ocarina/libsaria/controls.cpp
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

62 lines
851 B
C++

#include <libsaria/audio.h>
#include <libsaria/controls.h>
#include <libsaria/library.h>
#include <libsaria/queue.h>
static bool pause_after_current = false;
namespace libsaria
{
void next()
{
if (queue::size() > 0)
queue::next();
else
library::next();
if (pause_after_current == true) {
audio::pause();
pause_after_current = false;
} else
audio::play();
}
string next_file()
{
if (queue::size() > 0)
return queue::next_file();
else
return library::next_file();
}
void set_pause_after(bool state)
{
pause_after_current = state;
}
bool get_pause_after()
{
return pause_after_current;
}
void toggle_play()
{
if (audio::is_playing())
audio::pause();
else
audio::play();
}
void rewind()
{
audio::seek(-5);
}
void forward()
{
audio::seek(5);
}
}; /* Namespace: libsaria */