ocarina/design/audio.txt

73 lines
2.1 KiB
Plaintext

== Files ==
ocarina/include/
audio.h
ocarina/lib/
audio.cpp
== Depends ==
deck library
Audio: (lib/audio.cpp)
This file will introduce an "audio" namespace containing all of the
functions interacting with gstreamer. This will create a wrapper
namespace that will be easier to work with than using raw gstreamer
functions.
The audio layer will also control the "pause after N tracks" feature
so songs can be loaded without neeting to pass in a "begin playback"
flag every time. The remaining tracks counter will only be decremented
when a song finishes through the end-of-stream message passed by the
gst pipeline.
- Internal:
Set up a message bus to look for end-of-stream and error messages so
the next song can be played. This function should call the play
function after loading a track and after checking the "pause after N"
count.
- API:
void audio :: init(argc, argv)
Initialize the gstreamer layer and reload the track that was
last loaded before shutdown. Please only pass --gst-* options
for argv.
void audio :: play()
Begin or resume playback.
void audio :: pause()
Pause playback.
void audio :: seek_to(int)
Seek to a position X seconds into the track
void audio :: stop()
pause()
seek_to(0)
void audio :: next()
Call the playlist :: next() function to get the next trackid,
and load that file into the gstreamer pipeline. Do not change
the state of the pipeline (if nothing is playing yet, don't
call play()).
void audio :: previous()
Call the playlist :: previous() function to iterate backwards
through the recently played playlist. Load the returned trackid
without changing the pipeline state.
trackid audio :: current_trackid()
Return the trackid of the currently playing song.
unsigned int audio :: position()
Return the number of seconds that the song has played.
unsigned int audio :: duration()
Return the duration of the current song in seconds.
void audio :: pause_after(unsigned int)
Pause after N tracks, pass a negative number to disable.
unsigned int audio :: pause_count()
Return the number of tracks that will be played before
playback pauses.