libsaria: Create convenience functions for libsaria

Now I won't have to keep using libsaria_get() to access parts of
libsaria.  This should also cut down on the number of things that need
to be recompiled when libsaria is changed...
This commit is contained in:
Bryan Schumaker 2011-09-03 21:07:52 -04:00
parent 7cdd6b1664
commit e10a8e97f4
4 changed files with 59 additions and 1 deletions

View File

@ -0,0 +1,12 @@
#include <string>
using namespace std;
void libsaria_play();
void libsaria_pause();
void libsaria_stop();
void libsaria_load(string);
void libsaria_set_volume(double);
double libsaria_get_volume();

View File

@ -1,6 +1,6 @@
#include <libsaria/audio.h>
#include <libsaria/libsaria.h>
#include <libsaria/print.h>
static bool initialized = false;
static void init_gstreamer(int argc, char **argv)

View File

@ -2,6 +2,10 @@
#include <libsaria/libsaria.h>
#include <libsaria/audio.h>
/*
* Implementations of functions defined in the libsaria class
*/
void Libsaria::play()
{
if(audio.play())
@ -24,3 +28,22 @@ void Libsaria::seek()
{
audio.seek();
}
/*
* Convenience functions for accessing libsaria class functions
*/
void libsaria_play()
{
libsaria_get()->play();
}
void libsaria_pause()
{
libsaria_get()->pause();
}
void libsaria_stop()
{
libsaria_get()->stop();
}

View File

@ -1,6 +1,10 @@
#include <libsaria/libsaria.h>
/*
* Implementations of functions defined in the libsaria class
*/
Libsaria::Libsaria(int argc, char **argv)
{
audio.init(argc, argv);
@ -26,3 +30,22 @@ double Libsaria::get_volume()
{
return audio.get_volume();
}
/*
* Convenience functions for accessing libsaria class functions
*/
void libsaria_load(string filepath)
{
libsaria_get()->load(filepath);
}
void libsaria_set_volume(double volume)
{
libsaria_get()->set_volume(volume);
}
double libsaria_get_volume()
{
return libsaria_get()->get_volume();
}