libsaria: Pause after current song
What if you want to leave and a good song starts playing? This solves the problem by loading the next song, but not playing it so the user can go away and listen to it when they come back.
This commit is contained in:
parent
304b581274
commit
5c6d7903a8
|
@ -4,6 +4,8 @@
|
|||
namespace libsaria
|
||||
{
|
||||
void next();
|
||||
void set_pause_after(bool);
|
||||
bool get_pause_after();
|
||||
};
|
||||
|
||||
#endif /* LIBSARIA_CONTROLS_H */
|
||||
|
|
|
@ -60,7 +60,6 @@ namespace libsaria
|
|||
cur_file = file;
|
||||
g_object_set(G_OBJECT(get_player()), "uri", uri.c_str(), NULL);
|
||||
trigger_callback(TRACK_LOADED);
|
||||
play();
|
||||
}
|
||||
|
||||
string audio::get_current_file()
|
||||
|
|
|
@ -1,8 +1,11 @@
|
|||
|
||||
#include <libsaria/audio.h>
|
||||
#include <libsaria/controls.h>
|
||||
#include <libsaria/library.h>
|
||||
#include <libsaria/queue.h>
|
||||
|
||||
static bool pause_after_current = false;
|
||||
|
||||
namespace libsaria
|
||||
{
|
||||
|
||||
|
@ -12,6 +15,22 @@ namespace libsaria
|
|||
queue::next();
|
||||
else
|
||||
library::next();
|
||||
|
||||
if (pause_after_current == true) {
|
||||
audio::pause();
|
||||
pause_after_current = false;
|
||||
} else
|
||||
audio::play();
|
||||
}
|
||||
|
||||
void set_pause_after(bool state)
|
||||
{
|
||||
pause_after_current = state;
|
||||
}
|
||||
|
||||
bool get_pause_after()
|
||||
{
|
||||
return pause_after_current;
|
||||
}
|
||||
|
||||
}; /* Namespace: libsaria */
|
||||
|
|
|
@ -153,6 +153,7 @@ namespace libsaria
|
|||
if (find_id(id, it)) {
|
||||
cur_track = it;
|
||||
libsaria::audio::load((*it)->get_filepath());
|
||||
libsaria::audio::play();
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue