2012-02-11 13:58:26 -05:00
|
|
|
// Copyright (c) 2011 Bryan Schumaker.
|
2012-09-12 08:15:31 -04:00
|
|
|
#include <libsaria.h>
|
|
|
|
#include <library.h>
|
|
|
|
#include <notify.h>
|
|
|
|
#include <format.h>
|
|
|
|
#include <prefs.h>
|
|
|
|
#include <print.h>
|
|
|
|
#include <audio.h>
|
|
|
|
#include <track.h>
|
|
|
|
#include <deck.h>
|
|
|
|
#include <idle.h>
|
|
|
|
#include <fs.h>
|
2011-09-12 10:30:22 -04:00
|
|
|
|
2012-11-08 08:10:17 -05:00
|
|
|
#include <stdlib.h>
|
|
|
|
|
2012-03-24 18:34:56 -04:00
|
|
|
static libsaria::Track outside_track;
|
2012-08-20 08:23:47 -04:00
|
|
|
static libsaria::initdata *app_data;
|
2012-03-24 18:34:56 -04:00
|
|
|
|
2011-10-28 15:33:30 -04:00
|
|
|
namespace libsaria
|
2011-09-03 21:07:52 -04:00
|
|
|
{
|
|
|
|
|
2012-05-15 11:04:30 -04:00
|
|
|
void init(struct initdata *init)
|
2011-10-28 15:33:30 -04:00
|
|
|
{
|
2012-08-20 08:23:47 -04:00
|
|
|
app_data = init;
|
2011-11-07 18:33:15 -05:00
|
|
|
srand( time(NULL) );
|
2011-10-28 15:33:30 -04:00
|
|
|
println("Initializing libsaria");
|
2012-03-06 08:26:30 -05:00
|
|
|
|
2013-03-24 17:09:08 -04:00
|
|
|
app::init();
|
2012-03-10 18:29:16 -05:00
|
|
|
prefs::init();
|
2012-03-09 14:46:05 -05:00
|
|
|
|
2012-05-15 11:04:30 -04:00
|
|
|
audio::init(init->argc, init->argv);
|
2012-03-23 08:08:12 -04:00
|
|
|
libsaria::library::init();
|
2012-11-18 10:17:48 -05:00
|
|
|
libsaria::deck::init();
|
2012-05-15 11:23:47 -04:00
|
|
|
|
2012-07-29 14:26:43 -04:00
|
|
|
app::open_pipe();
|
2011-10-28 15:33:30 -04:00
|
|
|
}
|
|
|
|
|
|
|
|
void quit()
|
|
|
|
{
|
2012-03-22 08:32:26 -04:00
|
|
|
println("Quitting libsaria");
|
2012-05-15 11:23:47 -04:00
|
|
|
app::close_pipe();
|
2012-11-24 16:50:53 -05:00
|
|
|
library::quit();
|
2012-03-08 20:22:03 -05:00
|
|
|
audio::quit();
|
2011-12-27 18:59:58 -05:00
|
|
|
print_format_stats();
|
2011-10-28 15:33:30 -04:00
|
|
|
}
|
|
|
|
|
2012-03-24 18:34:56 -04:00
|
|
|
void play_outside_song(string &filepath)
|
|
|
|
{
|
|
|
|
try {
|
|
|
|
outside_track = Track(filepath);
|
|
|
|
} catch (string message) {
|
|
|
|
println(message);
|
|
|
|
return;
|
|
|
|
}
|
2012-05-13 11:07:00 -04:00
|
|
|
outside_track.load(true);
|
2012-03-24 18:34:56 -04:00
|
|
|
}
|
|
|
|
|
2012-08-21 07:56:45 -04:00
|
|
|
void notify(notify_t event, void *data)
|
2012-08-20 08:23:47 -04:00
|
|
|
{
|
|
|
|
if (app_data->on_notify)
|
2012-08-21 07:56:45 -04:00
|
|
|
app_data->on_notify(event, data);
|
2012-08-20 08:23:47 -04:00
|
|
|
}
|
|
|
|
|
2011-10-28 15:33:30 -04:00
|
|
|
};
|