core/audio: Move audio_cur_track() out of the audio namespace
Signed-off-by: Anna Schumaker <Anna@OcarinaProject.net>
This commit is contained in:
parent
d1d722a163
commit
0a1a9f1394
|
@ -148,6 +148,11 @@ bool audio_load(struct track *track)
|
|||
return false;
|
||||
}
|
||||
|
||||
struct track *audio_cur_track()
|
||||
{
|
||||
return audio_track;
|
||||
}
|
||||
|
||||
bool audio_play()
|
||||
{
|
||||
if (!audio_track)
|
||||
|
@ -216,11 +221,6 @@ void audio :: prev()
|
|||
GST_STATE_PLAYING : GST_STATE_PAUSED);
|
||||
}
|
||||
|
||||
struct track *audio :: current_track()
|
||||
{
|
||||
return audio_track;
|
||||
}
|
||||
|
||||
void audio :: pause_after(bool enabled, unsigned int n)
|
||||
{
|
||||
if (n > _pause_count)
|
||||
|
|
|
@ -94,7 +94,7 @@ struct audio_ops audio_ops = {
|
|||
static int parse_gst_error(GstMessage *error)
|
||||
{
|
||||
GError *err;
|
||||
struct track *track = audio :: current_track();
|
||||
struct track *track = audio_cur_track();
|
||||
gchar *path;
|
||||
int ret = 0;
|
||||
|
||||
|
|
|
@ -137,7 +137,7 @@ public:
|
|||
|
||||
static void on_ban()
|
||||
{
|
||||
struct track *track = audio :: current_track();
|
||||
struct track *track = audio_cur_track();
|
||||
if (o_ban->get_active()) {
|
||||
if (collection_ban(track))
|
||||
audio :: next();
|
||||
|
@ -147,7 +147,7 @@ static void on_ban()
|
|||
|
||||
static void on_favorite()
|
||||
{
|
||||
struct track *track = audio :: current_track();
|
||||
struct track *track = audio_cur_track();
|
||||
if (o_fav->get_active())
|
||||
playlist_add(PL_FAVORITED, track);
|
||||
else
|
||||
|
@ -198,7 +198,7 @@ void plist :: init()
|
|||
o_ban = gui :: get_widget<Gtk::ToggleButton>("o_ban");
|
||||
o_fav = gui :: get_widget<Gtk::ToggleButton>("o_favorite");
|
||||
|
||||
track_loaded(audio :: current_track());
|
||||
track_loaded(audio_cur_track());
|
||||
|
||||
o_ban->signal_toggled().connect(sigc::ptr_fun(on_ban));
|
||||
o_fav->signal_toggled().connect(sigc::ptr_fun(on_favorite));
|
||||
|
|
|
@ -55,11 +55,6 @@ namespace audio
|
|||
void next(); /**< Find and load the next track that should be played. */
|
||||
void prev(); /**< Call the deck :: previous() function and load the result. */
|
||||
|
||||
/**
|
||||
* @return A pointer to the currently playing track object.
|
||||
*/
|
||||
struct track *current_track();
|
||||
|
||||
/**
|
||||
* Configure the automatic pausing feature.
|
||||
*
|
||||
|
@ -101,6 +96,10 @@ void audio_deinit();
|
|||
/* Called to load a track for playback. */
|
||||
bool audio_load(struct track *);
|
||||
|
||||
/* Called to get the current track. */
|
||||
struct track *audio_cur_track();
|
||||
|
||||
|
||||
/* Called to begin playback. */
|
||||
bool audio_play();
|
||||
|
||||
|
|
|
@ -60,7 +60,7 @@ static struct core_init_data test_init_data = {
|
|||
static void test_init()
|
||||
{
|
||||
test_equal(audio_get_player(), NULL);
|
||||
test_equal(audio :: current_track(), NULL);
|
||||
test_equal(audio_cur_track(), NULL);
|
||||
test_equal(audio_get_player(), NULL);
|
||||
|
||||
core :: init(NULL, NULL, &test_init_data);
|
||||
|
@ -72,13 +72,13 @@ static void test_init()
|
|||
test_equal(audio_seek(7), false);
|
||||
test_equal(audio_position(), 0);
|
||||
test_equal(audio_duration(), 0);
|
||||
test_equal(audio :: current_track(), NULL);
|
||||
test_equal(audio_cur_track(), NULL);
|
||||
test_equal(load_count, 0);
|
||||
|
||||
collection_add("tests/Music/Hyrule Symphony");
|
||||
while (idle_run_task()) {};
|
||||
|
||||
test_equal(audio :: current_track(), NULL);
|
||||
test_equal(audio_cur_track(), NULL);
|
||||
test_not_equal(audio_get_player(), NULL);
|
||||
}
|
||||
|
||||
|
@ -86,13 +86,13 @@ static void test_playback()
|
|||
{
|
||||
test_equal(audio_load(track_get(0)), true);
|
||||
test_equal(load_count, 1);
|
||||
test_equal(audio :: current_track(), track_get(0));
|
||||
test_equal(audio_cur_track(), track_get(0));
|
||||
test_equal(queue_size(history_get_queue()), 1);
|
||||
test_equal(audio_duration(), track_get(0)->tr_length * GST_SECOND);
|
||||
|
||||
test_equal(audio_load(NULL), false);
|
||||
test_equal(load_count, 1);
|
||||
test_equal(audio :: current_track(), track_get(0));
|
||||
test_equal(audio_cur_track(), track_get(0));
|
||||
test_equal(queue_size(history_get_queue()), 1);
|
||||
|
||||
test_equal(audio_load(track_get(0)), false);
|
||||
|
@ -127,7 +127,7 @@ static void test_deinit()
|
|||
{
|
||||
core :: deinit();
|
||||
|
||||
test_equal(audio :: current_track(), NULL);
|
||||
test_equal(audio_cur_track(), NULL);
|
||||
test_equal(audio_get_player(), NULL);
|
||||
}
|
||||
|
||||
|
@ -136,7 +136,7 @@ void test_pre_init()
|
|||
{
|
||||
TestDriver *driver = (TestDriver *)audio :: get_driver();
|
||||
|
||||
test_equal(audio :: current_track(), TRACK_NULL);
|
||||
test_equal(audio_cur_track(), TRACK_NULL);
|
||||
|
||||
audio_play();
|
||||
test_equal(driver->playing, false);
|
||||
|
@ -154,10 +154,10 @@ void test_pre_init()
|
|||
test_equal(audio_duration(), (long)0);
|
||||
|
||||
audio :: next();
|
||||
test_equal(audio :: current_track(), TRACK_NULL);
|
||||
test_equal(audio_cur_track(), TRACK_NULL);
|
||||
|
||||
audio :: prev();
|
||||
test_equal(audio :: current_track(), TRACK_NULL);
|
||||
test_equal(audio_cur_track(), TRACK_NULL);
|
||||
}
|
||||
|
||||
void test_init2()
|
||||
|
@ -167,11 +167,11 @@ void test_init2()
|
|||
test_cp_data_dir();
|
||||
audio_init(NULL, NULL, &test_audio_ops);
|
||||
|
||||
track = audio :: current_track();
|
||||
track = audio_cur_track();
|
||||
test_equal(track, TRACK_NULL);
|
||||
|
||||
core :: init(NULL, NULL, &test_init_data);
|
||||
track = audio :: current_track();
|
||||
track = audio_cur_track();
|
||||
test_not_equal(track, TRACK_NULL);
|
||||
}
|
||||
|
||||
|
@ -184,7 +184,7 @@ void test_track_controls()
|
|||
|
||||
driver->playing = audio_pause();
|
||||
audio :: next();
|
||||
test_not_equal(audio :: current_track()->tr_dbe.dbe_index, (unsigned)2);
|
||||
test_not_equal(audio_cur_track()->tr_dbe.dbe_index, (unsigned)2);
|
||||
test_equal(driver->is_playing(), false);
|
||||
|
||||
audio_play();
|
||||
|
@ -192,7 +192,7 @@ void test_track_controls()
|
|||
test_equal(driver->is_playing(), true);
|
||||
|
||||
audio_load(track);
|
||||
test_not_equal(audio :: current_track(), track);
|
||||
test_not_equal(audio_cur_track(), track);
|
||||
|
||||
track = track_get(0);
|
||||
audio_seek(4242);
|
||||
|
@ -205,9 +205,9 @@ void test_track_controls()
|
|||
test_equal(driver->is_playing(), true);
|
||||
test_equal(audio_position(), (long)4242);
|
||||
|
||||
track = audio :: current_track();
|
||||
track = audio_cur_track();
|
||||
driver->eos();
|
||||
test_not_equal(audio :: current_track(), track);
|
||||
test_not_equal(audio_cur_track(), track);
|
||||
}
|
||||
|
||||
void test_autopause()
|
||||
|
|
Loading…
Reference in New Issue