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.
62 lines
851 B
C++
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 */
|