Commit Graph

45 Commits

Author SHA1 Message Date
Anna Schumaker a8f94e9443 core/audio: Add a function to load tracks by filepath
If a matching track isn't found in the track database, then use the new
track_alloc_external() function to allocate an external track with the
correct tags.

Signed-off-by: Anna Schumaker <Anna@NoWheyCreamery.com>
2017-09-05 14:59:43 -04:00
Anna Schumaker e6f34d34f0 core/audio: Rework audio message handling
Let's just do everything inline and cut out the extra function calls to
make the code simpler.  I also created functions to help tests send EOS
or error messages.

Signed-off-by: Anna Schumaker <Anna@NoWheyCreamery.com>
2017-09-05 14:59:43 -04:00
Anna Schumaker fc6e3ff464 core/audio: Listen for GstStateChanged messages
And use these to trigger the state changed callback.  Additionally, this
callback can now be used by tests to determine when we're done seeking.

Signed-off-by: Anna Schumaker <Anna@NoWheyCreamery.com>
2017-09-05 14:59:43 -04:00
Anna Schumaker c03530f318 core/audio: Remove playbin-based player
Signed-off-by: Anna Schumaker <Anna@NoWheyCreamery.com>
2017-09-05 14:59:43 -04:00
Anna Schumaker 9c6a9f7759 core/audio: Add gstreamer elements for decoding files
We only play local music, so we know that we're using a file and we
don't need a uridecodebin to figure it out for us.

Signed-off-by: Anna Schumaker <Anna@NoWheyCreamery.com>
2017-09-05 14:12:13 -04:00
Anna Schumaker b558a9043c core/audio: Rearrange global variables
Add some whitespace to make it easier to follow what everything is.  I
also rename audio_bus to audio_old_id to make it easier to add in a new
audio bus.  Additionally, I changed test_audio_player() to
test_old_player() to make room for the new pipeline.

Signed-off-by: Anna Schumaker <Anna@NoWheyCreamery.com>
2017-09-05 14:12:13 -04:00
Anna Schumaker 5247bf2de0 core/audio: Rename audio_ops -> audio_callbacks
And make them optional, that way tests don't need to keep creating fake
callbacks if they don't need anything from the audio layer.

Signed-off-by: Anna Schumaker <Anna@NoWheyCreamery.com>
2017-08-22 09:12:33 -04:00
Anna Schumaker d8c3fb9ace core/audio: Add support for changing audio volume
Signed-off-by: Anna Schumaker <Anna@NoWheyCreamery.com>
2016-09-26 08:07:35 -04:00
Anna Schumaker 939ebeac13 core/audio: Expose the audio_save() function
This will be used to re-save the current track after defragmenting the
track database.

Signed-off-by: Anna Schumaker <Anna@NoWheyCreamery.com>
2016-09-26 08:07:35 -04:00
Anna Schumaker 13dadd25ef core/audio: Remove audio_stop() function
It has no users now that the stop button has been removed.

Signed-off-by: Anna Schumaker <Anna@OcarinaProject.net>
2016-05-10 11:15:35 -04:00
Anna Schumaker 50a7c83d61 gui/audio: Convert gst.cpp to audio.c
Signed-off-by: Anna Schumaker <Anna@OcarinaProject.net>
2016-04-08 13:16:10 -04:00
Anna Schumaker 0cf5187867 core/audio: Add on_state_change() audio operation
Called to notify when playback state has changed.

Signed-off-by: Anna Schumaker <Anna@OcarinaProject.net>
2016-03-28 08:01:30 -04:00
Anna Schumaker ed5f035855 core/audio: Rename audio_get_player() to test_audio_player()
Also, let's only have this function when CONFIG_TESTING is enabled.

Signed-off-by: Anna Schumaker <Anna@OcarinaProject.net>
2016-03-28 08:01:30 -04:00
Anna Schumaker 2586348921 core/audio: Convert file to C
I also convert core/core.c so the audio test can be converted at the
same time.

Signed-off-by: Anna Schumaker <Anna@OcarinaProject.net>
2016-03-28 08:01:30 -04:00
Anna Schumaker 1d76990fd1 core/audio: Add audio_error() to handle error messages
Signed-off-by: Anna Schumaker <Anna@OcarinaProject.net>
2016-03-28 08:01:30 -04:00
Anna Schumaker a5556ac10a core/audio: Move audio_eos() out of the AudioDriver
This change lets me remove the AudioDriver, too.

Signed-off-by: Anna Schumaker <Anna@OcarinaProject.net>
2016-03-28 08:01:30 -04:00
Anna Schumaker 276c56406a core/audio: Move audio_pause_after() out of the audio namespace
Signed-off-by: Anna Schumaker <Anna@OcarinaProject.net>
2016-03-28 08:01:30 -04:00
Anna Schumaker d18d3dd214 core/audio: Move audio_prev() out of the audio namespace
Signed-off-by: Anna Schumaker <Anna@OcarinaProject.net>
2016-03-28 08:01:30 -04:00
Anna Schumaker 3f25369444 core/audio: Move audio_next() out of the audio namespace
Signed-off-by: Anna Schumaker <Anna@OcarinaProject.net>
2016-03-28 08:01:30 -04:00
Anna Schumaker 7765c2bf57 core/audio: Remove unused on_error() AudioDriver function
Signed-off-by: Anna Schumaker <Anna@OcarinaProject.net>
2016-03-28 08:01:30 -04:00
Anna Schumaker 2511db3a08 core/audio: Add audio_cur_state() function
This replaces the is_playing() function of the AudioDriver class.  I can
also make the GUIs GstDriver static.

Signed-off-by: Anna Schumaker <Anna@OcarinaProject.net>
2016-03-28 08:01:30 -04:00
Anna Schumaker 0a1a9f1394 core/audio: Move audio_cur_track() out of the audio namespace
Signed-off-by: Anna Schumaker <Anna@OcarinaProject.net>
2016-03-28 08:01:30 -04:00
Anna Schumaker d1d722a163 core/audio: Move audio_stop() out of the audio namespace
Signed-off-by: Anna Schumaker <Anna@OcarinaProject.net>
2016-03-28 08:01:30 -04:00
Anna Schumaker e1abe94b28 core/audio: Move audio_duration() out of the audio namespace
Signed-off-by: Anna Schumaker <Anna@OcarinaProject.net>
2016-03-28 08:01:30 -04:00
Anna Schumaker 20bb01ef4e core/audio: Move audio_position() out of the audio namespace
Signed-off-by: Anna Schumaker <Anna@OcarinaProject.net>
2016-03-28 08:01:30 -04:00
Anna Schumaker 566ef3bb50 core/audio: Move audio_seek() out of the audio namespace 2016-03-28 08:01:30 -04:00
Anna Schumaker 9097bd0ffc core/audio: Move audio_pause() out of the audio namespace
Signed-off-by: Anna Schumaker <Anna@OcarinaProject.net>
2016-03-28 08:01:29 -04:00
Anna Schumaker 16c4c23a42 core/audio: Move audio_play() out of the audio namespace
Signed-off-by: Anna Schumaker <Anna@OcarinaProject.net>
2016-03-28 08:01:29 -04:00
Anna Schumaker e5c3d8f02e core/audio: Move audio_load() out of the audio namespace
And add the on_load() audio operation.

Signed-off-by: Anna Schumaker <Anna@OcarinaProject.net>
2016-03-28 08:01:29 -04:00
Anna Schumaker e0c89556ed core/audio: Add audio_deinit() function
Signed-off-by: Anna Schumaker <Anna@OcarinaProject.net>
2016-03-28 08:01:29 -04:00
Anna Schumaker d9540b29d6 core/audio: Move audio_init() out of the audio namespace
I also move the gstreamer playbin back into core/

Signed-off-by: Anna Schumaker <Anna@OcarinaProject.net>
2016-03-28 08:01:29 -04:00
Anna Schumaker a5963a553e core/tags/track: Convert file to C
Signed-off-by: Anna Schumaker <Anna@OcarinaProject.net>
2016-01-11 09:35:59 -05:00
Anna Schumaker 765079df94 core/tags/track: Convert Track class into a struct
Signed-off-by: Anna Schumaker <Anna@OcarinaProject.net>
2015-12-10 16:41:33 -05:00
Anna Schumaker ead1397b31 Remove Doxygen tags
I wasn't actually using Doxygen for anything, so it's probably best just
to remove it.

Signed-off-by: Anna Schumaker <Anna@OcarinaProject.net>
2015-09-02 14:24:42 -04:00
Anna Schumaker ec4d3b945e audio: Fix seeking on ARM
The on_seek() function needs to take an int64_t to avoid truncating on
ARM.

Signed-off-by: Anna Schumaker <anna@ocarinaproject.net>
2015-04-14 09:05:09 -04:00
Anna Schumaker 657ce8f0f4 audio: Ensure position and duration results are 64 bits
A long int is shorter on ARM than x86, which could cause position and
duration values to get truncated.  Additionally, quering gstreamer with
a long int causes a compile error on ARM.  Let's just do the right thing
and make this value an int64_t.

Signed-off-by: Anna Schumaker <anna@ocarinaproject.net>
2015-04-14 09:05:05 -04:00
Anna Schumaker 12260a3de9 string: Add a function for converting seconds to string
This is used to get a string representation of the number of seconds
passed in.

Signed-off-by: Anna Schumaker <Anna@OcarinaProject.net>
2015-01-27 09:23:14 -05:00
Anna Schumaker 92d264d4ac audio: Move Driver into audio.h
I also rename from Driver -> AudioDriver.

Signed-off-by: Anna Schumaker <Anna@OcarinaProject.net>
2014-12-20 15:48:07 -05:00
Anna Schumaker fd2a251c14 audio: Initialize GST from the gui layer
This means I no longer need to pass argc and argv parameters to core/,
so I can eventually work towards removing the Driver :: init() function.

Signed-off-by: Anna Schumaker <Anna@OcarinaProject.net>
2014-12-20 10:16:44 -05:00
Anna Schumaker b9d4c6749d audio: Move the get_driver() function into the audio namespace
It's already in the audio.cpp file, so just reshuffle things a little
bit.

Signed-off-by: Anna Schumaker <Anna@OcarinaProject.net>
2014-12-19 14:54:12 -05:00
Anna Schumaker 4a57b170cd audio: Update doxygen documentation
And remove the Audio section of the DESIGN file.

Signed-off-by: Anna Schumaker <Anna@OcarinaProject.net>
2014-12-19 13:45:55 -05:00
Anna Schumaker c7fe5b18d5 tagdb: Rip out most tagdb functions
Most of this are a straight replacement with the new versions in
tags/track.cpp.

Signed-off-by: Anna Schumaker <Anna@OcarinaProject.net>
2014-12-04 08:31:52 -05:00
Anna Schumaker 0a9c6d296b Add doxygen documentation for audio.h, core.h, and version.h
I want to have all of Ocarina documented in the code, rather than in a
difficult-to-maintain DESIGN file.  Let's get going on that!

Signed-off-by: Anna Schumaker <Anna@OcarinaProject.net>
2014-09-12 16:36:46 -04:00
Anna Schumaker 9ea0fd4f29 core: Update include file #ifndef guards
Signed-off-by: Anna Schumaker <Anna@OcarinaProject.net>
2014-06-21 09:49:07 -04:00
Anna Schumaker 95064e4537 Rename lib/ -> core/
I plan to introduce a new lib/ that sits between the gui and the backend
files (similar to how glibc sits between the kernel and userspace).
This gets the rename out of the way before I change my mind again.

Signed-off-by: Anna Schumaker <Anna@OcarinaProject.net>
2014-06-05 10:21:32 -04:00