0dfb02c612
This toggles between play and pause states. Signed-off-by: Bryan Schumaker <bjschuma@gmail.com>
41 lines
755 B
C++
41 lines
755 B
C++
// Copyright (c) Bryan Schumaker 2012.
|
|
#include <libsaria/libsaria.h>
|
|
#include <libsaria/audio.h>
|
|
#include <libsaria/print.h>
|
|
#include <libsaria/deck.h>
|
|
|
|
#include <fstream>
|
|
using namespace std;
|
|
|
|
static void run_cmd(ifstream &in, string &file)
|
|
{
|
|
string cmd;
|
|
in >> cmd;
|
|
|
|
if (cmd == "play")
|
|
libsaria::audio::play();
|
|
else if (cmd == "pause")
|
|
libsaria::audio::pause();
|
|
else if (cmd == "stop")
|
|
libsaria::audio::stop();
|
|
else if (cmd == "toggle")
|
|
libsaria::audio::toggle_play();
|
|
else if (cmd == "next")
|
|
libsaria::deck::next();
|
|
else if (cmd == "prev")
|
|
libsaria::deck::prev();
|
|
}
|
|
|
|
void libsaria::read_piped_file(string &file)
|
|
{
|
|
ifstream in;
|
|
string cmd;
|
|
|
|
if (!exists(file))
|
|
return;
|
|
|
|
in.open(file.c_str());
|
|
run_cmd(in, file);
|
|
in.close();
|
|
}
|