
#include <libsaria/libsaria.h>
#include <libsaria/callback.h>

#include "audio/audio.h"

static Audio audio;

void audio_init(int argc, char **argv)
{
	audio.init(argc, argv);
}

void libsaria_seek_to(double prcnt)
{
	audio.seek_to(prcnt);
}

void libsaria_seek(int dt)
{
	audio.seek(dt);
}

void libsaria_play()
{
	if(audio.play())
		trigger_callback(PLAY);
}

void libsaria_pause()
{
	if(audio.pause())
		trigger_callback(PAUSE);
}

void libsaria_stop()
{
	libsaria_pause();
	libsaria_seek_to(0);
}

void libsaria_load(string filepath)
{
	audio.load(filepath);
	libsaria_play();
}

void libsaria_set_volume(double volume)
{
	audio.set_volume(volume);
	trigger_callback(VOLUME);
}

double libsaria_get_volume()
{
	return audio.get_volume();
}
