Bryan Schumaker
6b7c3f3d50
libsaria: Use dynamic memory for library tracks
...
This allows me to create only one Track() instance for each song in the
library. Before this, a Track() was being created and then copied when
adding new songs to the library. I thought this was wasteful, so now
each song is only created once.
2011-12-30 15:50:21 -05:00
Bryan Schumaker
ff4fcbf809
libsaria: Clean up path scanning code
...
I have an easier time figuring out what's going on now.
2011-12-30 15:03:45 -05:00
Bryan Schumaker
180707a6c2
libsaria: Remove redundant code
...
Nothing needs to call this function anymore. I also cleaned up the
header file a bit.
2011-12-29 22:08:53 -05:00
Bryan Schumaker
bdf359e008
libsaria: Remove path.cpp file
...
I moved these functions into the main library.cpp file
2011-12-29 21:54:51 -05:00
Bryan Schumaker
8e8eec3556
libsaria: Move update_path() function
...
Now it's in the library.cpp file.
2011-12-29 21:42:07 -05:00
Bryan Schumaker
dbeb2981d4
libsaria: Move update code to path subdir
...
This keeps it all together and makes editing the library less confusing.
2011-12-29 21:12:27 -05:00
Bryan Schumaker
ad989fdcd7
libsaria: Move more LibraryPath() code to the subdirectory
2011-12-29 21:02:24 -05:00
Bryan Schumaker
df7e677bf2
libsaria: Remove unused LibraryPath function
...
I don't need to get the list of tracks anymore, now that my for_each
function has been removed.
2011-12-29 20:46:01 -05:00
Bryan Schumaker
d74efc6022
libsaria: Remove barely used size function from LibraryPath
...
It was used internally once and externally once (to print out the
current size). It can easily be removed to clean things up.
2011-12-29 20:43:46 -05:00
Bryan Schumaker
995a372a6e
libsaria: Library code can access the path_list directly
...
This makes more sense than using an accessor function. Nothing outside
the library can use this variable, so there shouldn't be other problems.
2011-12-29 20:37:05 -05:00
Bryan Schumaker
fe8a293377
libsaria: Move library's LoadTask() to file.cpp
...
This is the only place it's used, so it makes sense to define it there.
2011-12-29 20:31:54 -05:00
Bryan Schumaker
9da577daa0
libsaria: Begin moving LibraryPath class to subdirectory
...
I think it'll be easier to work with if it is self-contained in a
subdirectory. Otherwise it's too mixed in with the library code to be
maintainable.
2011-12-29 20:27:04 -05:00
Bryan Schumaker
63140fb6a0
libsaria: Remove queue for_each
...
It's been replaced with iterator functions.
2011-12-29 16:25:34 -05:00
Bryan Schumaker
fe8c1cd580
libsaria: Create iterator functions for the queue
2011-12-29 16:24:33 -05:00
Bryan Schumaker
3749b56bfd
libsaria: Remove old list file
...
I've completely replaced it with my new list now.
2011-12-29 15:47:11 -05:00
Bryan Schumaker
ec2aadbc2d
libsaria: Move get_info() function to new list
2011-12-29 15:43:17 -05:00
Bryan Schumaker
fb0084c275
libsaria: Remove old play_id() function
...
Nothing uses it anymore
2011-12-29 15:35:06 -05:00
Bryan Schumaker
8049a7a9fd
libsaria: Select songid using libsaria controls.cpp
...
I do this in the upper level namespace, rather than doing it in the
library, to make use of the play_filepath() function that I already have
written.
2011-12-29 15:32:15 -05:00
Bryan Schumaker
c1cc33877c
libsaria: Find filepath from songid using new list
2011-12-29 15:30:30 -05:00
Bryan Schumaker
7b78f18e52
libsaria: Remove next() from the queue
...
I don't need it anymore.
2011-12-29 15:10:00 -05:00
Bryan Schumaker
bcc34ef4b0
libsaria: Choose next song from the new list
...
I removed the old list functions while I was at it. I also changed the
next() function in the controls.cpp file to work with filepaths so the
library and queue won't have to load the chosen file themselves.
2011-12-29 15:06:12 -05:00
Bryan Schumaker
942c518394
libsaria: Remove for_each() from library
...
I don't need it anymore.
2011-12-29 14:20:53 -05:00
Bryan Schumaker
fea84b90ac
libsaria: Move list size function
...
It now exists with my new playlist code, since I'm phasing out the old
code.
2011-12-29 12:28:00 -05:00
Bryan Schumaker
2fd41ff4d7
libsaria: Create iterator functions for the library
...
I use these to fill in the UI list for the library. I think this will
be easier to use (and cleaner) than passing a function pointer to a
for_each loop.
2011-12-29 12:08:32 -05:00
Bryan Schumaker
0fa608c90f
libsaria: Sort the new playlist after reading
...
Otherwise it won't be useful...
2011-12-28 23:04:41 -05:00
Bryan Schumaker
2effa26b32
libsaria: Began new playlist namespace
...
It'll exist in parallel to the current list for now. I'll remove the
old one once the new one has all the same features.
2011-12-28 22:25:55 -05:00
Bryan Schumaker
336f188686
libsaria: Sort list using comparison operator
...
It makes sense to define a function for sorting tracks as part of the
track class, rather than having to implement it externally.
2011-12-28 22:03:43 -05:00
Bryan Schumaker
1e5628d059
libsaria: Find lowercase tags when creating a track
...
This avoids several lookups during list sorting, so initial startup
should be a little bit faster now.
2011-12-28 17:40:11 -05:00
Bryan Schumaker
a3130a7da5
libsaria: Cache lowercase strings, too
...
This is useful for sorting the library when filling in the list, since I
do many comparisons with the same artists and albums. This beats having
to lowercase them every time!
2011-12-28 11:00:08 -05:00
Bryan Schumaker
8e4b3dfbfe
libsaria: Don't track cache misses
...
Each cache miss will add a new word to either the format cache or the
substring cache. I can look at the size of the caches to determine the
number of misses rather than keep track of this with a new variable.
2011-12-28 10:23:17 -05:00
Bryan Schumaker
147a212809
libsaria: Format to a set of words
...
I don't care about the order of words for indexing, and I don't need
duplicates either. Formatting to a unique set of words should make
things a little faster.
2011-12-28 10:15:08 -05:00
Bryan Schumaker
abfd67cc84
libsaria: Refresh index while scanning
...
This keeps the index up-to-date with the library. Tracks are indexed as
they are scanned, then the current filter string is run through the
index again to update it.
2011-12-27 23:02:09 -05:00
Bryan Schumaker
26a18f331e
libsaria: Remove old index code
...
It has been replaced with my new index.
2011-12-27 22:42:50 -05:00
Bryan Schumaker
1d3baa79d5
libsaria: Implement index::rand()
...
Needed to get a random song from the index when filtered.
2011-12-27 22:41:54 -05:00
Bryan Schumaker
83488dfa06
libsaria: Add filtering to the new index
...
Otherwise it's useless. I search all three indexes and use the union of
those results to determine what is visible.
2011-12-27 22:30:38 -05:00
Bryan Schumaker
9c749e4ade
libsaria: Began new index
...
Right now I just add songs to it and cache substrings for each word. I
also print out stats during libsaria shutdown.
2011-12-27 19:42:46 -05:00
Bryan Schumaker
52a3e73023
libsaria: Print format_cache stats
...
I wanted to know how often there were cache hits and misses, so I print
out these stats on shutdown.
2011-12-27 19:42:27 -05:00
Bryan Schumaker
664ad0dad2
libsaria: Cache words generated from strings
...
I now look up a list of words from a map (if it exists), rather than
having to iterate over the same string potentially many times.
2011-12-27 18:48:57 -05:00
Bryan Schumaker
a74cea2e71
libsaria: Remove old TrackTag() class
...
It was basically a layer of misdirection that made it harder to use
Tracks. The Track() class now does everything that the TrackTag() one
did.
2011-12-26 12:14:25 -05:00
Bryan Schumaker
5f20899b14
libsaria: Remove references to ino_t
...
I want to use sid_t instead. It's more obvious what it's used for.
2011-12-25 23:29:35 -05:00
Bryan Schumaker
e4f7fde197
Create a typedef for song ids
...
Passing around an inode number doesn't tell people what the inode is
used for. Typedefing it to a song id is more helpful.
2011-12-25 23:07:58 -05:00
Bryan Schumaker
da118b2281
libsaria: Switch to the new OutFile() class
...
The new class is more convenient to work with since it's the output
stream with my save protocol built in. I should have done this earlier!
2011-12-25 22:34:12 -05:00
Bryan Schumaker
5877d3ac4a
libsaria: Created a new OutFile() class
...
Similar to how I created a new InFile() class. The new one can be used
directly as a stream, only it has my save file protocol stuff built in.
2011-12-25 22:21:11 -05:00
Bryan Schumaker
6794ce15e5
libsaria: Return ifstream reference from operator>>
...
This allows me to chain calls to the same stream, cleaning up the code.
2011-12-25 22:20:04 -05:00
Bryan Schumaker
d39536d7d0
libsaria: Completely replace old InFile() class
...
My InFile2() class is clearer and simpler, so I've replaced InFile()
with it.
2011-12-25 21:24:02 -05:00
Bryan Schumaker
5e308202a0
libsaria: Create a new way to save files
...
I inherit from the ifstream class, so I can override the insertion
operator for string handling. I can then use templates to save
everything else.
2011-12-25 21:16:09 -05:00
Bryan Schumaker
603a76964b
libsaria: Store current audio volume
...
This allows me to restore the volume on startup.
2011-12-23 22:04:24 -05:00
Bryan Schumaker
f7d7d5e038
libsaria: Add floats as preferenc type
...
Now I can store floating point numbers in addition to booleans.
2011-12-23 22:03:31 -05:00
Bryan Schumaker
8dfbb8915b
libsaria: Check for current file before attempting state change
...
Without this, pressing "play" on an empty library will cause an error.
The recovery code will then try to pick a new song, and fail (since
there are no tracks to choose from). It will then try to play, cause an
error and repeat forever.
2011-12-23 21:18:45 -05:00
Bryan Schumaker
1dc9df80e1
libsaria: Cleanup audio progress code
2011-12-23 21:14:14 -05:00
Bryan Schumaker
0e983e4043
libsaria: Implement gapless playback
...
I need to get the next file out of the library or queue without changing
it immediately. I then queue it up in the gstreamer pipeline so it will
play automatically when the current track finishes.
2011-12-23 20:48:37 -05:00
Bryan Schumaker
2783b8d995
libsaria: Improved audio file loading
...
I look for an audio-changed signal and push this to the message bus. I
then use the message to send out the TRACK_LOADED callback to the UI.
This should be even more useful for gapless playback.
2011-12-23 20:46:02 -05:00
Bryan Schumaker
7711b354cb
libsaria: Create a durstr() function
...
Call this to get a string representation of the pipeline's current
duration.
2011-12-23 20:31:07 -05:00
Bryan Schumaker
e509d4e723
libsaria: Added comments
...
I'll be able to figure out these functions easier the next time I see
them.
2011-12-23 16:04:28 -05:00
Bryan Schumaker
04a64ca015
libsaria: Use a load_file() function
...
All this function does is load a file. Nothing else. I think this will
be useful for using about-to-finish.
2011-12-23 16:03:10 -05:00
Bryan Schumaker
f8f5f87e54
libsaria: Remove the get_player() function
...
I declared the variables in the local header file for use by the audio
layer. I think this will make things a bit more efficient.
2011-12-23 15:49:56 -05:00
Bryan Schumaker
3944e691a5
libsaria: New controls
...
I added functions for rewinding, fast forwarding, and toggling play /
pause. This should make it easier on the UI.
2011-12-23 15:48:08 -05:00
Bryan Schumaker
df1e1a0a9a
libsaria: Replace the old print() function
...
I now use a wrapper around printf() that can be disabled when debugging
is off.
2011-12-18 15:07:01 -05:00
Bryan Schumaker
81e7662c7e
libsaria: Track current gstreamer state
...
I use this to tell the GUI if music is currently playing or not.
2011-12-17 09:44:24 -05:00
Bryan Schumaker
a10fd2f5a0
libsaria: Print size of queue
...
I needed this for debugging, so I'll leave it there.
2011-12-17 09:44:11 -05:00
Bryan Schumaker
5c6d7903a8
libsaria: Pause after current song
...
What if you want to leave and a good song starts playing? This solves
the problem by loading the next song, but not playing it so the user can
go away and listen to it when they come back.
2011-12-11 21:03:09 -05:00
Bryan Schumaker
304b581274
libsaria: Check if $HOME is part of $XDG_CONFIG_HOME
...
On one machine it is, on another it isn't. This should be a solution
that works for everybody.
2011-12-11 20:26:39 -05:00
Bryan Schumaker
83867dba2c
libsaria: Reindex on library refresh
...
This should allow me to filter while the library is scanning.
2011-12-11 20:25:53 -05:00
Bryan Schumaker
e983d69322
libsaria: Chose next songs from the queue
...
If there are songs in the queue, I pick from there. Otherwise, I pick
from the library.
2011-12-11 16:25:24 -05:00
Bryan Schumaker
6ef54e07c5
libsaria: Add songs to the queue
...
It takes a list of song ids and adds them to a deque. The UI can then
iterate over each ID and query the size.
2011-12-11 16:16:02 -05:00
Bryan Schumaker
9739bdc76a
libsaria: Library get_info() returns TrackTag
...
I simplify the function by removing the function pointer call and
letting callers deal with the TrackTag pointer it now returns.
2011-12-11 16:14:53 -05:00
Bryan Schumaker
56eee0ae22
libsaria: Added queue
...
I do this as a double-ended queue so I can remove songs anywhere I want
(and hopefully re-order them later, too).
2011-12-11 15:46:58 -05:00
Bryan Schumaker
57bf72c4e5
libsaria: Get utf8 encoded strings from taglib
...
This should cut down on the number of pango errors that I see when
filing in lists.
2011-12-11 15:46:44 -05:00
Bryan Schumaker
0b4d9c25eb
libsaria: Use absolute paths for saria dirs
...
I noticed that new save files weren't being created. I now use the HOME
environment variable to construct an absolute path to write files to.
2011-12-11 15:46:40 -05:00
Bryan Schumaker
a14cedc942
libsaria: Choose songs after filtering
...
Songs are only picked from the set of visible songs after filtering.
2011-12-11 15:46:35 -05:00
Bryan Schumaker
f0decd07d6
libsaria: Load library through an idle task
...
This allows me to draw the UI first and load the library once that has
finished. This should make Ocarina feel more responsive.
2011-11-13 13:44:45 -05:00
Bryan Schumaker
ffbaff27ec
libsaria: Change the number of tracks indexed at once
...
I was doing 50, but I think I can handle 100. I also defined a constant
at the top of the file to make it easier to change this value again in
the future.
2011-11-13 12:43:02 -05:00
Bryan Schumaker
6e033513c0
libsaria: Refilter during indexing
...
I trigger a REFILTER callback after each IndexTask is processed to keep
the UI up to date with the current index.
2011-11-13 12:40:42 -05:00
Bryan Schumaker
b36def4c08
libsaria: Change library size when filtered
...
I return the number of visible songs, so if the user has entered a
filter string then I return the size of the results set. If we're not
filtered then I return the size of the playlist.
2011-11-13 12:21:00 -05:00
Bryan Schumaker
fa498f379c
libsaria: Added an is_visible() function
...
This will return true if the given inode is visible.
2011-11-13 12:05:03 -05:00
Bryan Schumaker
75cb804756
libsaria: Added a REFILTER callback
...
This will be called to inform the UI that the filter text has changed.
2011-11-13 11:33:12 -05:00
Bryan Schumaker
824f589ff2
libsaria: Perform filtering
...
I use an in-place set intersection to find a set of songs that match the
search terms.
2011-11-13 11:29:41 -05:00
Bryan Schumaker
1c0084b2e9
libsaria: Created a generic format_text() function
...
This is used by the track tags for creating word lists. I also use the
function to format filter search text.
2011-11-13 10:47:55 -05:00
Bryan Schumaker
d5df6e134b
libsaria: Build the substring index
...
This is an index of every substring in the (artist, album, title) tags
of the library. This should be easier to work with than regular
expression based filtering since I don't need to compare every key with
every search term.
2011-11-13 09:48:50 -05:00
Bryan Schumaker
7fc4e22795
libsaria: Call a dummy index function for each TrackTag
...
This function takes an inode and word list. Soon it will add each
substring to an index.
2011-11-12 19:31:42 -05:00
Bryan Schumaker
fc50ceb34f
libsaria: Format each tag as it is read in
...
I lowercase everything, strip out some characters, and create a linked
list of each word for each tag.
2011-11-12 19:21:41 -05:00
Bryan Schumaker
ef36c58e96
libsaria: Create an IdleTask for indexing the library
...
Right now this will only be triggered when the library is loaded from
disk. Once I get farther I can easily create a function to index a
track as it is added to the library (so I won't need to reindex
everything during this case)
2011-11-12 14:25:32 -05:00
Bryan Schumaker
958020f270
libsaria: Check stream status before reading
...
If we are unable to open the preferences file we shouldn't try to read
from it. This led to a segmentation fault when compiled in release
mode, but for some reason it worked when compiled in debug mode?
2011-11-09 17:28:19 -05:00
Bryan Schumaker
026bf0c010
libsaria: Only load song if string is not empty
...
It's stupid to try loading an empty string.
2011-11-09 08:33:40 -05:00
Bryan Schumaker
11d92eef89
libsaria: Add a debugging message
...
Helpful for knowing what path the audio subsystem is attempting to load.
2011-11-08 08:19:47 -05:00
Bryan Schumaker
258ebbc081
libsaria: Choose the next song based on the random setting
...
If random is enabled, I choose a random song from the list. If random
is disabled I choose the next song sequentially.
2011-11-07 18:33:15 -05:00
Bryan Schumaker
b6f21d5705
libsaria: Added preferences
...
Right now I only store boolean values, but I think I've coded this in a
way to make adding new values easy.
2011-11-07 08:30:53 -05:00
Bryan Schumaker
c1332133a9
libsaria: Change meaning of audio::seek_to()
...
It used to seek to a percentage of the pipeline, but now is seeks to an
absolute position in nanoseconds.
2011-11-06 20:25:13 -05:00
Bryan Schumaker
6b58311e9e
libsaria: Call next() at the end of the stream
...
It's nice to pick another song after the end of the current one.
2011-11-06 19:44:16 -05:00
Bryan Schumaker
e908f46c21
libsaria: Implement a next() function
...
This will pick the next song from the library to play.
2011-11-06 19:17:15 -05:00
Bryan Schumaker
9379a2cf33
libsaria: Better track comparision function
...
I sort by artist / album / track, so I need to check each of these
fields in order. It would be nice if I could expand numbers into words
for some tags (3 Doors Down, Matchbox 20 and so on), but I'm happy with
what I have right now.
2011-11-06 15:44:45 -05:00
Bryan Schumaker
858fa1821f
libsaria: Turn the play_list into a list of pointers
...
Pointers to a TrackTag structure are easier to pass around than the
TrackTag structure, so this should speed up sorting. Also it removes
duplicated memory between the LibraryPaths and the play_list.
2011-11-06 13:57:09 -05:00
Bryan Schumaker
095ade27ad
libsaria: Sort play_list by artist
...
Right now I do a basic string comparison. I should eventually format
the strings to remove punctuation and use the same case.
2011-11-06 13:49:20 -05:00
Bryan Schumaker
4f2c75499f
libsaria: Clean up LibraryPath class
...
I moved around some code and removed undefined functions
2011-11-06 13:39:14 -05:00
Bryan Schumaker
922c9e86ef
libsaria: Get info from play_list
...
It's easier with everything in one single list.
2011-11-06 13:36:11 -05:00
Bryan Schumaker
5ae5a349de
libsaria: Play tracks from the play_list
...
Rather than finding the id in the LibraryPath lists, I instead find it
in the play_list list and store an iterator to this track.
2011-11-06 13:15:48 -05:00
Bryan Schumaker
b3cb20dd5d
libsaria: Properly set the inode for each track tag
...
I was setting local variables rather than the TrackTag variable. No
wonder things didn't work
2011-11-06 13:09:59 -05:00
Bryan Schumaker
5b2e0c7b82
libsaria: Fill a SourceModel from the play_list
...
Looping over a single list is really easy and straightforward!
2011-11-06 12:44:14 -05:00
Bryan Schumaker
cdcaaeb8c8
libsaria: Report the library size as the play_list size
...
This is simpler than looping over all library paths and adding up their
individual sizes.
2011-11-06 12:39:13 -05:00
Bryan Schumaker
637ea47a60
libsaria: Insert all tracks into one giant list
...
This puts everything in one place for easy use (I hope)
2011-11-06 12:34:41 -05:00