core/audio: Move audio_stop() out of the audio namespace
Signed-off-by: Anna Schumaker <Anna@OcarinaProject.net>
This commit is contained in:
parent
e1abe94b28
commit
d1d722a163
|
@ -162,6 +162,12 @@ bool audio_pause()
|
|||
return __audio_change_state(GST_STATE_PAUSED);
|
||||
}
|
||||
|
||||
bool audio_stop()
|
||||
{
|
||||
audio_pause();
|
||||
return audio_seek(0);
|
||||
}
|
||||
|
||||
bool audio_seek(gint64 offset)
|
||||
{
|
||||
if (!audio_track)
|
||||
|
@ -172,12 +178,6 @@ bool audio_seek(gint64 offset)
|
|||
offset);
|
||||
}
|
||||
|
||||
void audio :: stop()
|
||||
{
|
||||
audio_pause();
|
||||
audio_seek(0);
|
||||
}
|
||||
|
||||
gint64 audio_position()
|
||||
{
|
||||
gint64 position;
|
||||
|
|
|
@ -178,6 +178,11 @@ void gst :: pause()
|
|||
}
|
||||
}
|
||||
|
||||
void gst :: stop() {
|
||||
if (audio_stop())
|
||||
on_pause();
|
||||
}
|
||||
|
||||
void gst :: next()
|
||||
{
|
||||
audio :: next();
|
||||
|
@ -218,7 +223,7 @@ void gst :: init_pre()
|
|||
o_play->signal_clicked().connect(sigc::ptr_fun(gst :: play));
|
||||
o_prev->signal_clicked().connect(sigc::ptr_fun(audio :: prev));
|
||||
o_seek->signal_change_value().connect(sigc::ptr_fun(on_seek));
|
||||
o_stop->signal_clicked().connect(sigc::ptr_fun(audio :: stop));
|
||||
o_stop->signal_clicked().connect(sigc::ptr_fun(gst :: stop));
|
||||
|
||||
o_count->signal_changed().connect(sigc::ptr_fun(on_pause_count));
|
||||
o_enabled->signal_toggled().connect(sigc::ptr_fun(on_pause_enabled));
|
||||
|
|
|
@ -52,11 +52,6 @@ public:
|
|||
namespace audio
|
||||
{
|
||||
|
||||
/**
|
||||
* Stop playback and seek to the beginning of the track.
|
||||
*/
|
||||
void stop();
|
||||
|
||||
void next(); /**< Find and load the next track that should be played. */
|
||||
void prev(); /**< Call the deck :: previous() function and load the result. */
|
||||
|
||||
|
@ -112,6 +107,9 @@ bool audio_play();
|
|||
/* Called to pause playback. */
|
||||
bool audio_pause();
|
||||
|
||||
/* Called to stop playback. */
|
||||
bool audio_stop();
|
||||
|
||||
/* Called to seek playback to a specific offset, in nanoseconds. */
|
||||
bool audio_seek(gint64);
|
||||
|
||||
|
|
|
@ -45,6 +45,7 @@ namespace gst
|
|||
{
|
||||
void play();
|
||||
void pause();
|
||||
void stop();
|
||||
void next();
|
||||
void toggle();
|
||||
void init_pre();
|
||||
|
|
|
@ -68,6 +68,7 @@ static void test_init()
|
|||
test_equal(audio_load(NULL), false);
|
||||
test_equal(audio_play(), false);
|
||||
test_equal(audio_pause(), false);
|
||||
test_equal(audio_stop(), false);
|
||||
test_equal(audio_seek(7), false);
|
||||
test_equal(audio_position(), 0);
|
||||
test_equal(audio_duration(), 0);
|
||||
|
@ -107,7 +108,15 @@ static void test_playback()
|
|||
test_equal(test_audio_seek(5 * GST_SECOND), true);
|
||||
test_equal(audio_position(), 5 * GST_SECOND);
|
||||
|
||||
test_equal(test_audio_seek(0), true);
|
||||
test_equal(audio_stop(), true);
|
||||
test_equal(audio_position(), 0);
|
||||
|
||||
test_equal(test_audio_seek(42 * GST_SECOND), true);
|
||||
test_equal(audio_position(), 42 * GST_SECOND);
|
||||
|
||||
test_equal(audio_play(), true);
|
||||
test_equal(audio_stop(), true);
|
||||
test_equal(audio_pause(), false);
|
||||
test_equal(audio_position(), 0);
|
||||
|
||||
/* Check duration again now that track is fully loaded. */
|
||||
|
@ -135,7 +144,7 @@ void test_pre_init()
|
|||
driver->playing = true;
|
||||
audio_pause();
|
||||
test_equal(driver->playing, true);
|
||||
audio :: stop();
|
||||
audio_stop();
|
||||
test_equal(driver->playing, true);
|
||||
driver->playing = false;
|
||||
|
||||
|
@ -166,28 +175,6 @@ void test_init2()
|
|||
test_not_equal(track, TRACK_NULL);
|
||||
}
|
||||
|
||||
void test_playback_controls()
|
||||
{
|
||||
TestDriver *driver = (TestDriver *)audio :: get_driver();
|
||||
|
||||
driver->playing = audio_play();
|
||||
test_equal(driver->playing, true);
|
||||
|
||||
driver->playing = audio_pause();
|
||||
test_equal(driver->playing, false);
|
||||
|
||||
audio_seek(4242);
|
||||
test_equal(audio_position(), (long)4242);
|
||||
|
||||
audio_play();
|
||||
audio :: stop();
|
||||
test_equal(driver->playing, false);
|
||||
|
||||
audio_seek(4242);
|
||||
test_equal(audio_position(), (long)4242);
|
||||
test_equal(audio_duration(), (long)424242);
|
||||
}
|
||||
|
||||
void test_track_controls()
|
||||
{
|
||||
struct track *track = NULL;
|
||||
|
@ -262,6 +249,5 @@ DECLARE_UNIT_TESTS(
|
|||
UNIT_TEST("Audio Deinitialization", test_deinit),
|
||||
UNIT_TEST("Test Audio Pre-Init", test_pre_init),
|
||||
UNIT_TEST("Test Audio Init 2", test_init2),
|
||||
UNIT_TEST("Test Audio Playback Controls", test_playback_controls),
|
||||
UNIT_TEST("Test Audio Automatic Pausing", test_autopause),
|
||||
);
|
||||
|
|
Loading…
Reference in New Issue