libsaria: Use a load_file() function

All this function does is load a file.  Nothing else.  I think this will
be useful for using about-to-finish.
This commit is contained in:
Bryan Schumaker 2011-12-23 16:03:10 -05:00
parent f8f5f87e54
commit 04a64ca015
2 changed files with 11 additions and 3 deletions

View File

@ -16,6 +16,7 @@ namespace libsaria
string get_current_file(); string get_current_file();
/* Playback control functions */ /* Playback control functions */
void load_file(string);
void load(string); void load(string);
void play(); void play();
void pause(); void pause();

View File

@ -54,18 +54,25 @@ namespace libsaria
seek_to(0); seek_to(0);
} }
void audio::load(string file) void audio::load_file(string file)
{ {
if (file == "") if (file == "")
return; return;
string uri = "file://" + file; string uri = "file://" + file;
reset();
println("Loading uri: " + uri); println("Loading uri: " + uri);
cur_file = file;
g_object_set(G_OBJECT(player), "uri", uri.c_str(), NULL); g_object_set(G_OBJECT(player), "uri", uri.c_str(), NULL);
cur_file = file;
trigger_callback(TRACK_LOADED); trigger_callback(TRACK_LOADED);
} }
void audio::load(string file)
{
if (file == "")
return;
reset();
load_file(file);
}
string audio::get_current_file() string audio::get_current_file()
{ {
return cur_file; return cur_file;