Commit Graph

518 Commits

Author SHA1 Message Date
Bryan Schumaker 8987dddade libsaria: Added a get_progress() function to the audio namespace
This function is used to access how far into the song the current audio
position is.  The value is returned as a percentage of the total length
for easy use by the UI.
2011-10-29 17:23:25 -04:00
Bryan Schumaker 0da84e8151 libsaria: Find tags for songs not in the library
I always want to find tags if it's possible.  Since I already have a way
to find the tags, it's fairly simple to tag a random file and pass the
result back to the UI.
2011-10-29 16:26:26 -04:00
Bryan Schumaker 049f91e514 libsaria: Return default track values in error case
If we can't find the inode, I return some default values to the UI to
keep it happy (and clear out the information from the previous song).
2011-10-29 16:18:15 -04:00
Bryan Schumaker 136f12bc7c libsaria: Created a SourceModel class
The source model class is used to more tightly control how songs are
inserted into the UI.  I provide an insert() function that the library's
for_each() function can take advantage of.  This allows me to directly
insert songs into the UI rather than having to use a static function as
the "middle man"
2011-10-29 15:19:45 -04:00
Bryan Schumaker 39f74eb6b4 libsaria: Various cleanups
- Pass inodes by reference
- Change some namespace code formatting to match later code
2011-10-28 17:02:46 -04:00
Bryan Schumaker a975fcc2cc libsaria: Added a current_track() function
This function will generate a Track object based on the current file
stored by the audio.  I then pass this object to to provided function so
the UI can be updated.
2011-10-28 15:33:17 -04:00
Bryan Schumaker 9997e6ffa6 libsaria: Added TRACK_LOADED callback
This is triggered whenever a new track is loaded.
2011-10-28 14:37:18 -04:00
Bryan Schumaker 707e7b3427 libsaria: Create an idle namespace
This cleans up the idle task code a lot, and reduces the size of
ocarina.bin to less than 1MB (with full debugging).  It probably won't
stay there long...
2011-10-27 15:18:03 -04:00
Bryan Schumaker c8dc6e1ee8 libsaria: Queue idle tasks from the task class
This is cleaner than calling an outside function since the task can
easily queue itself up.
2011-10-27 14:43:18 -04:00
Bryan Schumaker 90ac1ecfed libsaria: Massive audio cleanup
I removed libsaria/audio.cpp and did some namespace shuffling.  The new
code should be easier to follow and work with.
2011-10-27 14:31:30 -04:00
Bryan Schumaker 4f26d9ee2d libsaria: Update single paths
Updating a single LibraryPath may sometimes be faster than updating the
entire library.
2011-10-20 20:31:09 -04:00
Bryan Schumaker 245157c6b4 libsaria: Remove paths from library
If the user no longer wishes to track a certain path, they can remove it
from the library.  Note: it is unsafe to remove a path from the library
while that path is being scanned.  This could potentially lead to a
segmentation fault.
2011-10-20 20:18:35 -04:00
Bryan Schumaker c4cdfbe4b3 libsaria: Added library::update()
This will rescan every library path and add new files to the library.
Eventually it should probably remove files that no longer exist...
2011-10-20 13:24:11 -04:00
Bryan Schumaker 2a6d05ebee libsaria: Fill out a struct PathInfo
This struct is used by the gui to show how large a library path is
and eventually to remove it from the library.
2011-10-20 13:24:08 -04:00
Bryan Schumaker 8cf3caeb27 libsaria: Added function for getting the library size
I like to show this on the library tab so I know how many songs are
currently in the library.
2011-10-19 09:58:30 -04:00
Bryan Schumaker a508b7ff72 libsaria: Rip out old library
The code was a bit messy and didn't make use of namespaces very well.
By converting to a set of functions (instead of a class) I can use
each function as a function pointer if I want to.  I am also able to
remove libsaria/library.cpp since this was just a set of wrapper
functions to the old static class functions.
2011-10-18 10:02:55 -04:00
Bryan Schumaker c8daf92af4 libsaria: Save to XDG_CONFIG_HOME
I plan on storing all my preferences there rather than creating my own
save directory.  This will keep things consistent with other
applications the user may have.
2011-10-02 10:52:23 -04:00
Bryan Schumaker cea236a757 libsaria: Introduce libsaria namespace
Now I don't need to define everything as libsaria_some_func(), instead
these functions will exist in the libsaria namespace.
2011-10-01 13:27:31 -04:00
Bryan Schumaker 1a7b8a5ae9 libsaria: Load a saved library
No point in saving a library if I can't make use of the save file later.
2011-09-30 08:12:26 -04:00
Bryan Schumaker 1d1ecc8d8c libsaria: Save the library scan results
I write each track to a file that will be read in on startup (once those
changes are committed)
2011-09-27 08:23:49 -04:00
Bryan Schumaker 517faceb99 libsaria: Add tasks to the front and back of the queue
Queueing a task to run immediately can be useful, especially if it's
something like saving data as part of a "checkpoint"
2011-09-27 08:22:24 -04:00
Bryan Schumaker a97da1dd05 libsaria: Create the saria dir on startup
This is either ~/.saria or ~/.saria-debug, depending on if we're running
a debug build or not.
2011-09-22 08:21:57 -04:00
Bryan Schumaker 2017e8a2f1 libsaria: Play tracks based on inode number
This allows the UI to pass in an inode returned by the track list used
to set up the display.
2011-09-20 08:34:02 -04:00
Bryan Schumaker 0326b9c7e4 libsaria: Add accessor functions for Track and Tag classes
I need to get at these variables to add them to a list in the UI
2011-09-19 19:47:31 -04:00
Bryan Schumaker 6dfe4de57b libsaria: Create a list of all tracks in a library
This list will eventually be used to fill in a gtk listview, but for now
I gather all the information in one place.
2011-09-18 18:06:54 -04:00
Bryan Schumaker 69beb10d6b libsaria: Added LIBRARY_REFRESH callback
This callback is triggered during a library update to tell the UI that a
new version of the library is available.
2011-09-18 17:25:57 -04:00
Bryan Schumaker 7aff13f382 libsaria: Add tags to the library
I add each scanned track to the library for use later.
2011-09-18 12:20:59 -04:00
Bryan Schumaker a685023bcb libsaria: Convert length into a string
I format it into mm:ss format for UIs to display.
2011-09-18 11:39:18 -04:00
Bryan Schumaker 3255b045f0 libsaria: Find audio properties of each scanned song
This gives me the length, bitrate, sample rate and number of channels.
2011-09-18 11:23:44 -04:00
Bryan Schumaker 333a3a4b04 libsaria: Tag files to add to the library
I collect the artist / album / title / ... tags and add them to a class.
2011-09-17 14:16:06 -04:00
Bryan Schumaker 2c2e058b49 libsaria: Use new print functions
This mostly involved switching each print() to a println() to end the
line.
2011-09-17 13:50:13 -04:00
Bryan Schumaker ef5da936b4 libsaria: New print functions
I added a print(int) function to print out integer values.  I also
created println() functions for strings and ints.
2011-09-17 13:48:09 -04:00
Bryan Schumaker 1abdd945ae libsaria: Create scan tasks for each subdirectory
I want to recursively scan each directory for music files.
2011-09-17 12:56:39 -04:00
Bryan Schumaker 5167c6f012 libsaria: Read a directory into two vectors
I separate out directories and files so they can be processed
differenty.
2011-09-17 12:27:20 -04:00
Bryan Schumaker 59fbd0c696 libsaria: Notify UI when the idle queue size has changed
When the first task is queued, I trigger a callback so the UI can start
processing when idle.  I return the size of the queue from both
run_task() and queue_task() so the UI knows when to stop processing
callbacks.
2011-09-13 17:27:46 -04:00
Bryan Schumaker e94ca6b9d6 libsaria: Rename UpdateTask to ScanTask
I feel that ScanTask is a better name
2011-09-13 08:04:59 -04:00
Bryan Schumaker b84b7b415d libsaria: Remove .swo files
They shouldn't have been added in the first place...
2011-09-13 08:04:25 -04:00
Bryan Schumaker b43fcc4b05 libsaria: Queue an idle task to update the library
I don't actually perform a library update at this point, but I do create
a new task and add it to the update queue.  When the run_task() function
is called, the task is removed from the queue and deleted.
2011-09-12 14:18:23 -04:00
Bryan Schumaker 7840f491a1 libsaria: Move idle header files to idle directory 2011-09-12 11:27:58 -04:00
Bryan Schumaker 8a83b57010 libsaria: Create a new include/libsaria/audio.h
This file contains the audio init function.
2011-09-12 11:20:12 -04:00
Bryan Schumaker 679bf41cc1 libsaria: Move include/audio.h to the audio directory
The audio class can easily be defined in a file located in the audio/
directory.  This frees up the audio.h name for a UI-facing include file.
2011-09-12 11:14:23 -04:00
Bryan Schumaker d3b8020bbe libsaria: Remove libsaria class
I replaced the class functions with simple functions that exist in
multiple files.  I think things will be easier to work with now.
2011-09-12 11:08:56 -04:00
Bryan Schumaker dbce5c244a libsaria: Move idle trigger to new file
I think the idle code will be easier to manage if it is in its own file.
2011-09-12 10:38:27 -04:00
Bryan Schumaker c3eb748f44 libsaria: Move idle object out of libsaria class
This helps me prepare to remove the libsaria class.
2011-09-12 10:30:22 -04:00
Bryan Schumaker 33fe24fc64 Remove callbacks from libsaria class
These can easily exist as its own set of functions, and I want to remove
the libsaria class in the future.
2011-09-10 13:46:09 -04:00
Bryan Schumaker 84c0f7fe21 libsaria: Create an idle driver and idle task
Right now both classes are empty, but eventually I will add in support
for creating new idle tasks and for removing tasks from the idle queue.
2011-09-10 11:22:03 -04:00
Bryan Schumaker bd6aea830b libsaria: Fix finding audio duration
I needed to pass in a value for the format argument...
2011-09-03 23:09:31 -04:00
Bryan Schumaker ded2c559af libsaria: Fix up the audio seek() function
It now seeks forward or backward through a song by dt seconds.
2011-09-03 23:03:31 -04:00
Bryan Schumaker 77a7f84110 libsaria: Created a seek_to() function
This function will seek to an absolute percentage of a song, rather than
by some displaced amount.
2011-09-03 22:32:12 -04:00
Bryan Schumaker 4b3b1babbc libsaria: Add progress file
This will include code for seeking and getting the current position in
the song.  Right now I just have a function for resetting the position
to the beginning of the song.
2011-09-03 21:55:42 -04:00