Bryan Schumaker
26979eb6a9
libsaria: Track()s add themselves to the index and library
...
When one is created, it adds itself to the library and index. Up next:
removing themselves when they are destroyed.
2011-12-30 15:57:14 -05:00
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
02f8dbc6b8
ocarina: Fill queue using iterator functions
...
I don't need the old for_each method anymore, either. I remove it using
this patch.
2011-12-29 16:24:54 -05:00
Bryan Schumaker
fe8c1cd580
libsaria: Create iterator functions for the queue
2011-12-29 16:24:33 -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
7b78f18e52
libsaria: Remove next() from the queue
...
I don't need it anymore.
2011-12-29 15:10:00 -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
5dcfac8be2
ocarina: Use the iterators to fill the library list
...
I keep the old way around for the queue until I can change that, too.
2011-12-29 12:09:35 -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
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
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
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
6eaa8f944c
ocarina: Changes for the TrackTag() class removal
2011-12-26 12:14:35 -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
11e3d77dca
ocarina: Remove references to ino_t
...
sid_t is more obvious that it's a song id.
2011-12-25 23:30:28 -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
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
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
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
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
983ce59efb
ocarina: Added keyboard shortcuts
...
Now I don't need to click in the GUI to do things. I never realized how
much I missed these until now.
2011-12-17 09:44:24 -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
7f125061f6
ocarina: Don't filter the queue
...
It was only getting filtered when new songs were added to it and never
unfiltered. This was somewhat confusing for me, and not very useful
since the only visible songs were the last ones added. I fixed this by
creating an init option to enable filtering on songlists.
2011-12-17 09:44:16 -05:00
Bryan Schumaker
01b6df4f47
ocarina: Scroll treeview to current song
...
I do this whenever the current song changes.
2011-12-12 08:35: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
e987eaa3a4
ocarina: Hide queue when empty
...
This was something that I did in 4.x, and I like the feature. Who wants
to see an empty notebook page?
2011-12-11 17:56:24 -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
0f3e5d5963
ocarina: Fill in the queue
...
The library passes in its selected songs and then the queue responds to
the QUEUE_REFRESH callback to fill in the list.
2011-12-11 16:18:47 -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
9a9fc87f92
ocarina: Properly respond to a right click
...
I had a test function, but it wasn't being called. I connected the
widget to the activate signal and improved the function to list the rows
that are currently selected.
2011-12-11 15:46:54 -05:00
Bryan Schumaker
74ab92ea6f
ocarina: Get list of selected IDs from the songlist
2011-12-11 15:46:50 -05:00
Bryan Schumaker
781dedfe13
ocarina: Added a queue page
...
Eventually it will show the list of queued songs. For now I just add an
unused page.
2011-12-11 15:46:47 -05:00
Bryan Schumaker
5512d46e4e
ocarina: Filter the song list
...
Users enter text and non-matching songs are removed from the songlist
view (they do come back when the text is removed)
2011-11-13 12:05:52 -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
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
8ae21bfe58
ocarina: Added basic header
...
It's a label declaring itself to be a header. This allows me to make
sure that page switching functions work before I get too far.
2011-11-13 10:03:47 -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
66f70249ad
ocarina: Load images using the full path
...
relative paths can't be trusted once the program has been installed. To
get around this, I assume that the install directory has been configured
correctly and then point to images located in the subdirectory next to
the executable.
2011-11-08 08:20:21 -05:00
Bryan Schumaker
e409c2317f
ocarina: Added a random button
...
Random hasn't been implemented in libsaria yet, but I can still create
the button to test preferences. The random button should set itself to
the value store in the preferences file.
2011-11-07 08:32:01 -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
fffb9875ac
ocarina: Add a next() button
...
Users press this button to choose the next song.
2011-11-06 19:18:03 -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
6d7828b946
libsaria: Store library path as a linked list of track tags
...
Lookup by id will be slighly slower, but now I will have one list for
each path that can be merged together and sorted to represent the
library. This sounds like a good tradeoff to me, especially since I can
store an iterator to the current track when deciding what to play next.
This will give me much faster access to song for the current track.
2011-11-06 11:16:46 -05:00
Bryan Schumaker
9c0e61b42d
libsaria: Create track tags with an inode
...
I need to store the inode somewhere if I want to use a linked list to
store LibraryPath data. I currently have a map <ino_t, TrackTag>, so
the obvious choice is to store the inode in the TrackTag structure.
2011-11-06 10:54:45 -05:00
Bryan Schumaker
6930c1ccf3
Ocarina: Add a test menu item
...
The label for the menu reads "test", but it doesn't do anything yet.
2011-11-04 08:25:51 -04:00
Bryan Schumaker
481c2b4832
ocarina: Initialize songlist with a list of menu items
...
These items will be used to create a right click menu.
2011-11-03 08:32:32 -04:00
Bryan Schumaker
0a216c38ce
libsaria: Return the current audio position as a string
...
This returns it in mm:ss format for easy use by the UI
2011-11-02 08:20:26 -04:00
Bryan Schumaker
9236dcbb50
ocarina: Show length of song next to progress bar
...
This makes it easy to tell the total length of the current song.
2011-11-02 08:11:04 -04:00
Bryan Schumaker
c75d832934
libsaria: Give the audio separate position() and duration() functions
...
The UI can use these functions to set up an accurate progress bar based
on the number of nanoseconds each returns.
2011-11-01 22:47:04 -04:00
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
c894815dad
ocarina: Add the library list to the ocarina namespace
2011-10-29 15:55:48 -04:00
Bryan Schumaker
0b1684620d
ocarina: Add the chooser to the ocarina namespace
...
This removes some ocarina_*() functions
2011-10-29 15:52:03 -04:00
Bryan Schumaker
7c79aab787
ocarina: Create initial namespace
...
Namespaces make code easier to follow, and remove the need to mangle the
beginning of function names by using ocarina_*() or libsaria_*(). In
other words: "namespaces are one honking good idea. Let's have more of
them!"
2011-10-29 15:47:00 -04:00
Bryan Schumaker
c727aaa526
ocarina: Fill a songlist by inheriting from a SourceModel
...
The SourceModel declares an insert() function that is called when
filling the list. I have defined this function in a way that the list
will be filled in through repeated calls to insert()
2011-10-29 15:19:56 -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
9d22d6b278
ocarina: Split footer into multiple files
...
This should help keep things organized
2011-10-28 17:06:18 -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
6c5412a3d5
ocarina: Move songlist init code into a new file
...
Doing it all in one function was messy and hard to follow. I've broken
it into several smaller functions, so now I know what is going on.
2011-10-27 17:17:46 -04:00
Bryan Schumaker
236cf0fee5
ocarina: Move songlist.h
...
It really should go into the include directory. I don't want to use
relative paths to include header files in a subdirectory... I don't know
why I even did it in the first place!
2011-10-27 16:39:27 -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
d3c9301628
ocarina: Access footer through get_footer() and put_footer()
...
I combined reference counting with the get_footer() function to make
using it easier (no manual reference counting). put_footer() will
deallocate the widget if the reference count is 0 (this is already done
by the g_object_unref() function) so it should work in a sane way.
2011-10-27 12:08:21 -04:00
Bryan Schumaker
155e436259
ocarina: Set window title and icon during init()
...
I was setting these through other function calls, but it's easier (and
cleaner) to do it all in the initial init() call.
2011-10-22 08:55:32 -04:00
Bryan Schumaker
882f917c8f
ocarina: Add a reference to the footer before moving
...
Calling the remove() function will destroy the footer if it has no other
references. To prevent this, I need to call g_object_ref() add a
reference to the widget.
2011-10-21 14:51:22 -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
2c12cb80aa
ocarina: Move tab page content into a table
...
This should make it easier to add or remove headers and footers so that
I can share one widget between all pages.
2011-10-20 19:33:05 -04:00
Bryan Schumaker
83719838aa
ocarina: Refresh path list when library is updated
...
I respond to the LIBRARY_REFRESH callback by creating new path panels to
show the updated information.
2011-10-20 18:46:54 -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
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
170e700746
ocarina: Listen for LIBRARY_REFRESH callback
...
I eventually want to add songs to the songlist, but for now it is enough
to wait for this callback.
2011-09-18 17:27:12 -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
3a5a41f53f
ocarina: Added bare songlist and a library tab
...
Eventually the songlist class will list all songs in the library. For
now, I just create an empty window and add it to the main tabs.
2011-09-18 14:43:46 -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
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
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
dfdb38be27
ocarina: Don't always run the idle task
...
I register the idle task when there are events in the idle queue and I
remove the idle task once those events have been processed. This should
cut down on CPU usage when nothing is happening.
2011-09-13 17:35:21 -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
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
c0a80623f5
libsaria: Created new idle.h
...
This exposes the libsaria_idle_task() function to the UI.
2011-09-12 11:31:58 -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
705ca61e6a
ocarina: Select a directory to scan
...
This directory will eventually be scanned and added to the library.
Right now I just print it to the screen.
2011-09-10 10:45:52 -04:00
Bryan Schumaker
9df15e944c
ocarina: Add a text button for library scanning
...
A text button will use a slightly larger image to make it easier to see.
This also gives me an opportunity to add some help text to describe what
the button does.
2011-09-10 10:30:25 -04:00
Bryan Schumaker
62b86f5136
ocarina: Add a settings tab for library management
...
Right now I just add an empty vbox to the page. I eventually want to
show information about each library path.
2011-09-10 09:42:34 -04:00
Bryan Schumaker
b8f977cc35
ocarina: Add a switch for tab label expanding
...
Pass in true to cause the tab label to expand and fill up the entire
space, false if the label should not expand.
2011-09-09 08:27:58 -04:00
Bryan Schumaker
976637f88b
ocarina: Add settings tab
...
Eventually this tab will be used for configuring everything. Right now
it's an empty page.
2011-09-09 08:14:07 -04:00
Bryan Schumaker
c3b82c401f
ocarina: Created tabs for the main window
...
Most things are going to be displayed in a gtk notebook. This patch
creates that notebook.
2011-09-07 08:25:52 -04:00
Bryan Schumaker
7b48c3311d
ocarina: Rename gui/ to ocarina/
...
I think ocarina/ is a better name for this directory, and now that I've
named the executable "ocarina.bin" I can do this again. I also added
functions for creating a page footer with the basic controls.
2011-09-07 08:12:02 -04:00
Bryan Schumaker
a097e751b2
ocarina: Remove custom icon size from button constructor
...
All buttons are the same size, so there is no point in requesting the
size for each button.
2011-09-06 07:57:06 -04:00
Bryan Schumaker
39a8f861c7
ocarina: Added a fast-forward button
...
Clicking it advances the song by 5 seconds
2011-09-03 23:15:30 -04:00
Bryan Schumaker
c2c3a1eea9
ocarina: Added a rewind button
...
Pressing the rewind button rewinds the song by 5 seconds.
2011-09-03 23:06:13 -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
Bryan Schumaker
937fbc1111
Move volume helper functions
...
I moved these to a volume.h file to keep them separate from controls.
2011-09-03 21:31:21 -04:00
Bryan Schumaker
e10a8e97f4
libsaria: Create convenience functions for libsaria
...
Now I won't have to keep using libsaria_get() to access parts of
libsaria. This should also cut down on the number of things that need
to be recompiled when libsaria is changed...
2011-09-03 21:07:52 -04:00
Bryan Schumaker
ceddd240ca
libsaria: Added a get_volume() function
...
I use this function to get the current volume levels. I added and extra
variable to the Audio class to track what the current volume is.
2011-09-03 10:24:34 -04:00
Bryan Schumaker
5a8cafa4d8
libsaria: Add a VOLUME callback
...
This will be triggered whenever the volume changes through the libsaria
class.
2011-09-03 10:08:54 -04:00
Bryan Schumaker
f354a305ae
libsaria: Change volume function
...
I introduced a function for directly setting the new volume level. It
does not allow changing by some value.
2011-09-03 09:49:09 -04:00
Bryan Schumaker
cfc86bd891
Added callback.h
...
This should have been added a long time ago, but my include/ocarina
directory was being ignored by git...
2011-09-03 09:14:03 -04:00
Bryan Schumaker
6137ec8a83
ocarina: Added volume button
...
This button will eventually be used to control the libsaria volume. It
doesn't do anything useful yet.
2011-09-02 08:26:44 -04:00
Bryan Schumaker
f6ac48219e
ocarina: Move pause button code
...
I moved it from the generic button.cpp file to the controls.cpp file to
keep everything together. I also changed the button list to use the new
show / hide functions.
2011-08-31 08:26:40 -04:00
Bryan Schumaker
bd907ecfe0
ocarina: Remove show_play_buttons() and hide_play_buttons()
...
I replaced these functions with a generic show_button_list() and
hide_button_list() functions.
2011-08-31 08:20:45 -04:00
Bryan Schumaker
8234e4072b
ocarina: Move play button to new file
...
I moved all the button code into a new subdirectory. From there, I
moved the play button code into a file named controls.cpp. This should
help clean up button code.
2011-08-30 08:26:23 -04:00
Bryan Schumaker
7e9b2f9380
Switch from make to scons
...
Scons will track changes to my include/ directory better than make will.
I also have an easier time understanding the Sconstruct file than I did
with Makefiles.
2011-08-28 11:10:58 -04:00
Bryan Schumaker
ac03eed3f5
ocarina: Show and hide play and pause buttons
...
I hide the play button when music is playing and show it when music has
been stopped. I hide the pause button when music is not playing and
show it when music has been stopped. This can give the effect of one
button replacing the other.
2011-08-27 13:38:01 -04:00
Bryan Schumaker
31c777dc8a
libsaria: Remove old function declarations
...
I replaced these functions with a self-contained class. I don't need to
keep these around anymore.
2011-08-27 12:43:49 -04:00
Bryan Schumaker
feaa34b8db
libsaria: Remove audio check_state() function
...
It was empty because I decided to go along a different route.
2011-08-27 12:40:10 -04:00
Bryan Schumaker
2888e741e8
libsaria: Added callback framework
...
I have created generic functions for registering and triggering
callbacks. New callbacks can be added by creating a new constant in the
callback_t enum.
2011-08-27 12:34:19 -04:00
Bryan Schumaker
5dea1ae42a
libsaria: Audio return values when changing state
...
play() and pause() now return true or false base on if the state change
request succeeds or fails. This can be used later to determine if a
callback should be triggered.
2011-08-27 12:32:06 -04:00
Bryan Schumaker
1831046685
libsaria: Created a load() function
...
Calling this function will load a song.
2011-08-23 08:28:35 -04:00
Bryan Schumaker
20756aac14
Created an open button
...
Clicking the button will open a file chooser to select a file to play.
2011-08-23 08:26:23 -04:00
Bryan Schumaker
7d3769a1a2
ocarina: Clean up button code
...
I didn't like using macros...
2011-08-23 07:53:25 -04:00
Bryan Schumaker
b23d912f64
ocarina: Added a stop button
...
This calls the Libsaria stop function
2011-08-22 08:29:23 -04:00
Bryan Schumaker
6e47ec49df
libsaria: Added a stop function
...
I stop playback, and seek to the beginning. I do this as to different
function calls in the Libsaria class so callbacks will still trigger
(once they have been implemented).
2011-08-22 08:27:34 -04:00
Bryan Schumaker
3e2f374bf8
libsaria: created Audio() class
...
This class will be used to control gstreamer functions. So far, it can
load a song, play, and pause.
2011-08-21 19:24:33 -04:00
Bryan Schumaker
ec2c848a90
Libsaria class can play and pause music
...
Eventually the class will contain an audio instance, so there won't be a
global play or pause function anymore.
2011-08-21 18:10:18 -04:00
Bryan Schumaker
dd5ad9e87d
Began Libsaria() class
...
This class will act as an interface for the Ocarina front-end.
2011-08-21 15:45:15 -04:00
Bryan Schumaker
bf3d41f8d2
Set window icon
...
Just to my basic ocarina image for now.
2011-08-21 15:19:56 -04:00
Bryan Schumaker
b802b31d42
Set window title
...
I set the title based on the current version, but I do this through a
function to make it easier to change later.
2011-08-21 15:15:40 -04:00
Bryan Schumaker
ae5b3a358e
Play and pause buttons work
...
They play and pause music...
2011-08-20 12:12:53 -04:00
Bryan Schumaker
8c49544efd
Created helper for connecting signals
...
This should make connecting signals easier, since I don't need to use
any conversion macros.
2011-08-20 11:47:26 -04:00
Bryan Schumaker
1413a31aa7
Create wrapper function for gtk_container_add()
...
I don't want to have to keep typing out the conversion macros, so this
function puts them all in one place.
2011-08-20 11:36:29 -04:00
Bryan Schumaker
d75227b6af
Added a wrapper function for gtk_box_pack_start()
...
This will call the conversion macros for packing items into a box.
2011-08-20 11:32:20 -04:00
Bryan Schumaker
467cedf828
Added a pause button
...
I just put in next to the play button for now.
2011-08-20 11:17:01 -04:00
Bryan Schumaker
0f5303503c
Improve play button creation
...
I made a function to create a play button. I suspect that
pre-configured buttons will be easier to use than having to build them
up every time.
2011-08-20 11:08:42 -04:00
Bryan Schumaker
7efcfddcde
Add a button to the window
...
The button doesn't do anything yet, but I may eventually modify it for
playing and pausing music.
2011-08-18 08:20:56 -04:00
Bryan Schumaker
53d8718053
Open a window and play a song
...
I start ocarina with a file. I play the song right away, and open a
window so that gtk_main() can quit when closed.
2011-08-15 07:53:25 -04:00
Bryan Schumaker
c0ace6fed6
Basic initializiation code
...
I print some messages to the screen and I have a makefile to compile
libsaria and gui code.
2011-08-14 11:35:37 -04:00