Commit Graph

51 Commits

Author SHA1 Message Date
Anna Schumaker 77616aa8d2 Merge branch 'master' into Ocarina-next
Conflicts:
	Sconstruct
	tests/Sconscript
2014-06-26 17:04:58 -04:00
Anna Schumaker a74eaaffa6 tags: Check that a Track was tagged correctly
Without this check we could end up creating a Track for a .ini file or
some other non-audio file.

Signed-off-by: Anna Schumaker <Anna@OcarinaProject.net>
2014-06-22 12:35:08 -04:00
Anna Schumaker 64354cec26 Let's start Ocarina 6.2!
Signed-off-by: Anna Schumaker <Anna@OcarinaProject.net>
2014-06-14 19:32:23 -04:00
Anna Schumaker 70254e7aa1 Remove error.h
It's not used by anything anymore.

Signed-off-by: Anna Schumaker <Anna@OcarinaProject.net>
2014-06-06 09:40:14 -04:00
Anna Schumaker 9e3399b619 deck: Reintroduce deck :: get()
This function turned out to be really useful for the gui.

Signed-off-by: Anna Schumaker <Anna@OcarinaProject.net>
2014-06-05 11:05:19 -04:00
Anna Schumaker 1bfa299e08 audio: Update the code to match the design
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>
2014-06-01 17:53:41 -04:00
Anna Schumaker 6f3fcaae6e audio: Update audio design
This patch updates the design to something that makes a bit more sense,
and works with the new audio drivers.

Signed-off-by: Anna Schumaker <Anna@OcarinaProject.net>
2014-05-31 21:11:59 -04:00
Anna Schumaker 1cacbf51e7 driver: Move Gst code into the GstDriver
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>
2014-05-31 21:11:57 -04:00
Anna Schumaker edc4a2f4ee driver: Create an audio driver class
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>
2014-05-31 13:27:20 -04:00
Anna Schumaker f8f389c7ed deck: Create TempQueues
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>
2014-05-31 09:11:04 -04:00
Anna Schumaker 211d240484 deck: Rework the deck code
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>
2014-05-26 22:20:55 -04:00
Anna Schumaker b6156bab11 deck: Update the deck design for a new implementation
Signed-off-by: Anna Schumaker <Anna@OcarinaProject.net>
2014-05-26 20:27:47 -04:00
Anna Schumaker a96e6f6f2d file: Set version number on a per-file basis
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>
2014-05-26 12:14:28 -04:00
Anna Schumaker e4db93b8e2 playlist: Remove banned songs from the library queue
And put them back when they are unbanned.

Signed-off-by: Anna Schumaker <Anna@OcarinaProject.net>
2014-05-24 13:32:03 -04:00
Anna Schumaker 208e53c7e9 library: Update the code and unit test
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>
2014-05-24 12:48:47 -04:00
Anna Schumaker f995538a8c library: Initial design edits
More to come as I work on this bit of code!

Signed-off-by: Anna Schumaker <Anna@OcarinaProject.net>
2014-05-23 22:10:03 -04:00
Anna Schumaker 59220cc2ce tags: Add Track->played()
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>
2014-05-23 21:53:36 -04:00
Anna Schumaker 11df56139d playlist: Update the design and unit test
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>
2014-05-18 21:34:14 -04:00
Anna Schumaker f6306faac8 queue: Remove old unit test
Also take a few moments to update the DESIGN.

Signed-off-by: Anna Schumaker <Anna@OcarinaProject.net>
2014-05-18 14:46:14 -04:00
Anna Schumaker 6dc8bf7329 random: Use a different RNG for testing
This RNG is more predictable, which makes it great for testing.

Signed-off-by: Anna Schumaker <Anna@OcarinaProject.net>
2014-05-18 11:10:29 -04:00
Anna Schumaker 55f3f06ded file: More cleanups after removing legacy file support
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>
2014-04-26 14:07:06 -04:00
Anna Schumaker d939dcab20 queue: Begin code updates
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>
2014-04-13 12:27:15 -04:00
Anna Schumaker 44f62028c3 database: Return NULL when inserting a duplicate item
This provides us a more straightforward way to determine if the database
changed.

Signed-off-by: Anna Schumaker <Anna@OcarinaProject.net>
2014-04-13 11:14:11 -04:00
Anna Schumaker 5ff68140b5 Rip out import stuff
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>
2014-04-10 08:42:53 -04:00
Anna Schumaker 57fa16d289 queue: Update design for queues
Signed-off-by: Anna Schumaker <anna@ocarinaproject.net>
2014-04-09 21:10:08 -04:00
Anna Schumaker 2a01ce5159 tagdb: Import track information
This allows upgrading from a previous Ocarina version.

Signed-off-by: Anna Schumaker <anna@ocarinaproject.net>
2014-04-09 21:10:08 -04:00
Anna Schumaker ac338c5704 track: Implement comparison function
Used later for sorting queues.

Signed-off-by: Anna Schumaker <anna@ocarinaproject.net>
2014-04-09 21:10:08 -04:00
Anna Schumaker cac0aee2e6 database: Insert through a const reference
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>
2014-04-09 21:10:08 -04:00
Anna Schumaker a9dae134d0 database: Store pointers in the database
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>
2014-04-09 21:10:08 -04:00
Anna Schumaker 38990748bb database: Return pointers for insert() at() and find()
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>
2014-04-09 21:10:08 -04:00
Anna Schumaker e2560f3134 tagdb: Add most functions
I implemented:

- add_track()
- remove_track()
- add_library()
- remove_library()
- lookup()
- get_track_db()
- get_library_db()

Signed-off-by: Anna Schumaker <schumaker.anna@gmail.com>
2014-04-09 21:10:08 -04:00
Anna Schumaker 5d97c84d10 tagdb: Begin the Track class
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>
2014-04-09 21:10:07 -04:00
Anna Schumaker 134348f253 tags: Begin creating the tag database
This patch adds classes for Artist, Album, Genre and Library.

Signed-off-by: Anna Schumaker <anna@ocarinaproject.net>
2014-04-09 21:10:07 -04:00
Anna Schumaker d61dbae47f Add more to the Track tag design
Signed-off-by: Anna Schumaker <anna@ocarinaproject.net>
2014-04-09 21:10:07 -04:00
Anna Schumaker 0fee94f76a tagdb: Add information about tag database layer
This layer will be separate from the library updating code.  This will
give me a place to manage the various databases without extra code to
scan and update paths.

Signed-off-by: Anna Schumaker <anna@ocarinaproject.net>
2014-04-09 21:10:07 -04:00
Anna Schumaker 89fd79e079 Database: Improve on the insert() return value
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>
2014-04-09 21:10:07 -04:00
Anna Schumaker bfefd1761a Think out the design for each tag class
This gives me a chance to write out more information about each class,
so I'll have an easier time knowing what is going on if I ever need to
revisit the design.

Signed-off-by: Anna Schumaker <schumaker.anna@gmail.com>
2014-04-09 21:10:07 -04:00
Anna Schumaker 81f3ef458f database: Each DatabaseEntry should know its id
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>
2014-04-06 19:57:06 -04:00
Anna Schumaker 14879b03fd idle: Update design and unit test
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>
2014-04-06 19:57:06 -04:00
Anna Schumaker 58ed47b37c filter: Update design and rewrite the unit test
- 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>
2014-04-06 19:57:06 -04:00
Anna Schumaker 7eddaac14e Remove some text from DESIGN
Because it is all in TODO already.

Signed-off-by: Anna Schumaker <schumaker.anna@gmail.com>
2014-04-06 19:57:06 -04:00
Anna Schumaker 1b34a9a8a0 index: Update the index design
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>
2014-04-06 19:57:05 -04:00
Anna Schumaker fc8dc9d55e database: Design and test updates
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>
2014-04-06 19:57:05 -04:00
Anna Schumaker b251f27bb5 file: Don't use throw / catch to report errors
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>
2014-04-06 19:57:05 -04:00
Anna Schumaker 959cac0fe1 Database: Update design for database entries
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>
2014-04-06 19:57:05 -04:00
Anna Schumaker f7d08724a3 design: Cleanups to each section
Signed-off-by: Anna Schumaker <schumaker.anna@gmail.com>
2014-04-06 19:57:05 -04:00
Anna Schumaker 336024bae9 file: Update design and create a new unit test
Signed-off-by: Anna Schumaker <schumaker.anna@gmail.com>
2014-04-06 19:57:05 -04:00
Anna Schumaker e2fd4773da Update design info for versions
Signed-off-by: Anna Schumaker <schumaker.anna@gmail.com>
2014-04-06 19:57:05 -04:00
Anna Schumaker 73d3c68e9f error: Update design
To make sure all the info is up to date.

Signed-off-by: Anna Schumaker <schumaker.anna@gmail.com>
2014-04-06 19:57:05 -04:00
Anna Schumaker 0cf38aaf56 Introduce README
README has basic commands for building / cleaning
I also update the DESIGN file a bit.

Signed-off-by: Anna Schumaker <schumaker.anna@gmail.com>
2014-04-06 19:57:04 -04:00