This patch reworks the unit test using the TestDriver audio driver. I
also recode the audio layer to match the design and drastically clean up
the code.
Signed-off-by: Anna Schumaker <Anna@OcarinaProject.net>
This can only be hit when the tagdb has no tracks in it, since you can't
add a NULL pointer to the recent queue.
Signed-off-by: Anna Schumaker <Anna@OcarinaProject.net>
This would have to happen eventually. Might as well do it now!
I also updated the TestDriver test to match the changes I had to make.
Signed-off-by: Anna Schumaker <Anna@OcarinaProject.net>
The driver is used to select between gstreamer playback and a fake
playback mode used only when testing.
Currently the GSTDriver has empty functions. It will be implemented as
the audio.cpp file is updated.
Signed-off-by: Anna Schumaker <Anna@OcarinaProject.net>
TempQueues create a way to trigger deck :: write() whenever a queue
changes. This means higher layers don't need to remember to save after
changes!
Signed-off-by: Anna Schumaker <Anna@OcarinaProject.net>
This patch actually breaks a bunch of things, but I just want to be done
with the deck changes for now. I'll go back and fix things before
releasing!
Signed-off-by: Anna Schumaker <Anna@OcarinaProject.net>
I update the unit test and redo much of the code to be cleaner and make
more sense. One big improvement is that the recently played queue will
now be managed by the deck.
Signed-off-by: Anna Schumaker <Anna@OcarinaProject.net>
Keeping separate directories for all of these files isn't the most
obvious way to do things. Instead, move everything into the same
directory.
Signed-off-by: Anna Schumaker <Anna@OcarinaProject.net>
I'm about to bump the version number for the deck layer, so it makes
senes that different files need different version numbers.
Signed-off-by: Anna Schumaker <Anna@OcarinaProject.net>
This fixes the gui, deck, and audio code due to the library changes I
just did.
NOTE: Library updating callbacks have been disabled in the gui.
Signed-off-by: Anna Schumaker <Anna@OcarinaProject.net>
Lots of changes here! I switched from using track and library ids to
passing pointers, renamed some functions, and made the code much
cleaner.
Signed-off-by: Anna Schumaker <Anna@OcarinaProject.net>
This function is called to increment play count and set "date last
played" variables. Moving this into the Track class lets me remove an
internal callback and a few other unnecessary functions.
Signed-off-by: Anna Schumaker <Anna@OcarinaProject.net>
I updated the code to better match how I use playlists and to make sure
that everything is tested.
Signed-off-by: Anna Schumaker <Anna@OcarinaProject.net>
I now have a single function rather than 4 individual functions. The
code is cleaner, and I've added it to the unit test.
Signed-off-by: Anna Schumaker <Anna@OcarinaProject.net>
Apparently it's not okay to return str.c_str() to caller functions,
because str will go out of scope...
Signed-off-by: Anna Schumaker <Anna@OcarinaProject.net>
This is best implemented in a derived class, since it's only used by the
recently played queue.
Signed-off-by: Anna Schumaker <Anna@OcarinaProject.net>
It should take a Track pointer, rather than a track_id. This makes the
code easier to work with.
Signed-off-by: Anna Schumaker <Anna@OcarinaProject.net>
Looks like I missed updating a few places in the File class. I do that
now, and I also began updating the unit test to the new system.
Signed-off-by: Anna Schumaker <Anna@OcarinaProject.net>
I remove the "on_queue_changed" callback in the flag handler functions,
so changes won't trigger a save until I can update later layers.
Signed-off-by: Anna Schumaker <Anna@OcarinaProject.net>
So far I have renamed variables, changed a few functions, and updated
all the code that was affected.
Oh, I also started a new unit test.
Signed-off-by: Anna Schumaker <Anna@OcarinaProject.net>
I only needed this to make the jump from Ocarina 5.10 -> Ocarina 6.0.
It's not needed anymore, now that 6.0 is out.
Signed-off-by: Anna Schumaker <anna@ocarinaproject.net>
This should offer a performance increase since the item to insert will
only be copied if it is not already in the database.
Signed-off-by: Anna Schumaker <anna@ocarinaproject.net>
Inserting into a vector can sometimes cause the entire vector to
reallocate itself. The insert() function returns a pointer to the
caller, so this reallocation could invalidate the returned pointer.
This is not what we want.
Instead, store pointers to the data in the vector. C++ provides a
default copy constructor that can be used to allocate a new item before
inserting. By doing it this way callers won't have to allocate memory
themselves. In addition, I will no longer need to keep a valid bit
since we can simply check for a NULL entry in the database.
Signed-off-by: Anna Schumaker <anna@ocarinaproject.net>
This gives me the item directly, which is usually what I want when I
call these functions. Save iterators for iterating.
Signed-off-by: Anna Schumaker <anna@ocarinaproject.net>
I properly initialize variables, and I created supporting databases that
will be used to look up artist, album, genre and library information.
Signed-off-by: Anna Schumaker <anna@ocarinaproject.net>
Rather than returning an index into the database, instead return an
iterator pointing at the item we just inserted.
Signed-off-by: Anna Schumaker <anna@ocarinaproject.net>
Calculating through the iterator may lead to unexpected problems. We
already know the id of every database entry, so we might as well use it
directly.
Signed-off-by: Anna Schumaker <anna@ocarinaproject.net>
If a title began with a number then the number would be read as part of
the length, adding extra time. So a track with length "100" and title
"42 abcde" would be read back as having length "10042" and title "abcde"
Signed-off-by: Anna Schumaker <anna@ocarinaproject.net>
- Double check that track->valid == true before notifying the UI that
there is a new track.
- Use primary_key() instead of manually calculating the full filepath.
Signed-off-by: Anna Schumaker <anna@ocarinaproject.net>
Recalculating this doesn't change the runtime significantly, so we might
as well save some disk space.
Signed-off-by: Anna Schumaker <anna@ocarinaproject.net>
This will let me set up a Track class that has pointers to the
corresponding artist, album and genre information without needing to
know their IDs directly. Having this information available means I
won't need to keep a "join struct" when doing lookups - instead I can
return a pointer to a Track class that already knows everything.
Signed-off-by: Anna Schumaker <schumaker.anna@gmail.com>
I didn't have any changes to make to the IdleQueue itself, but I did
need to update the unit test and reword a few things in the design.
Signed-off-by: Anna Schuamker <schumaker.anna@gmail.com>
- filter :: add() now returns the lowercased text
- Don't cache lowercased strings
- Remove functions depending on CONFIG_TEST
Signed-off-by: Anna Schumaker <schumaker.anna@gmail.com>
I updated the design and rewrote the unit tests. This creates something
more consistent with how I ended up using the index.
Signed-off-by: Anna Schumaker <schumaker.anna@gmail.com>
I add:
- Autosaving option
- Real iterators
- Better accessor functions
The new design and unit test also allows me to remove the 300,000+ line
"database.good" file that the old tests were based on.
Signed-off-by: Anna Schumaker <schumaker.anna@gmail.com>
Needing to use throw / catch was getting in the way. Instead, check for
a boolean return value.
Signed-off-by: Anna Schumaker <schumaker.anna@gmail.com>
I changed primary_key() into a function since it is only called once,
and there is no point in using more mmemory than I need to. I also
created a basic unit test for everything that database entries are
supposed to do.
Signed-off-by: Anna Schumaker <schumaker.anna@gmail.com>
I was double clicking tracks in the gui, and they were removed from the
playqueue! This patch fixes that.
Signed-off-by: Anna Schumaker <schumaker.anna@gmail.com>
I'm taking a break from gui code to clean up the build system and update
my unit tests. This patch updates how code is built, and reworks my
"print" test to test version number instead.
Signed-off-by: Anna Schumaker <schumaker.anna@gmail.com>
I need this in case the user deletes all tracks from a playqueue without
adding anything by the time next() is called.
Signed-off-by: Anna Schumaker <schumaker.anna@gmail.com>
This is called by the GUI to tell the playqueue that a track has been
selected. This gives the PQ a chance to (possibly) remove it.
Signed-off-by: Anna Schumaker <schumaker.anna@gmail.com>
When a track finishes, I tell the library to update playcount. Then,
the library triggers a callback to the playqueue deck telling it to
update.
This patch also finds and prints the track that causes a gstreamer
error.
Signed-off-by: Anna Schumaker <schumaker.anna@gmail.com>
- Reimplement binary search for neater code
- Flip sort order when resetting sort if the first field is the one we
are sorting by.
Signed-off-by: Anna Schumaker <schumaker.anna@gmail.com>
The history playqueue should never change sort order, so use this flag
to prevent user changes.
Signed-off-by: Anna Schumaker <schumaker.anna@gmail.com>
My test was done with a library size of 8040.
Before this patch, I make 21919628 calls to my "less_than" function.
With this patch, I now make 101205 calls to my "less than" function.
This comes out to a 216-X improvement. I should have done this sooner.
Signed-off-by: Anna Schumaker <schumaker.anna@gmail.com>