core/audio: Add audio_deinit() function
Signed-off-by: Anna Schumaker <Anna@OcarinaProject.net>
This commit is contained in:
parent
d9540b29d6
commit
e0c89556ed
|
@ -100,6 +100,15 @@ void audio_init(int *argc, char ***argv)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void audio_deinit()
|
||||||
|
{
|
||||||
|
gst_element_set_state(audio_player, GST_STATE_NULL);
|
||||||
|
gst_object_unref(audio_player);
|
||||||
|
audio_player = NULL;
|
||||||
|
|
||||||
|
gst_deinit();
|
||||||
|
}
|
||||||
|
|
||||||
void audio :: play()
|
void audio :: play()
|
||||||
{
|
{
|
||||||
if (cur_track)
|
if (cur_track)
|
||||||
|
|
|
@ -26,6 +26,7 @@ void core :: init(int *argc, char ***argv, struct core_init_data *init)
|
||||||
|
|
||||||
void core :: deinit()
|
void core :: deinit()
|
||||||
{
|
{
|
||||||
|
audio_deinit();
|
||||||
tempq_deinit();
|
tempq_deinit();
|
||||||
history_deinit();
|
history_deinit();
|
||||||
collection_deinit();
|
collection_deinit();
|
||||||
|
|
|
@ -271,6 +271,4 @@ void gst :: init()
|
||||||
void gst :: quit()
|
void gst :: quit()
|
||||||
{
|
{
|
||||||
delete gst_driver;
|
delete gst_driver;
|
||||||
gst_change_state(GST_STATE_NULL);
|
|
||||||
gst_deinit();
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -158,6 +158,9 @@ namespace audio
|
||||||
/* Called to initialize the audio manager. */
|
/* Called to initialize the audio manager. */
|
||||||
void audio_init(int *, char ***);
|
void audio_init(int *, char ***);
|
||||||
|
|
||||||
|
/* Called to deinitialize the audio manager. */
|
||||||
|
void audio_deinit();
|
||||||
|
|
||||||
|
|
||||||
GstElement *audio_get_player();
|
GstElement *audio_get_player();
|
||||||
#endif /* OCARINA_CORE_AUDIO_H */
|
#endif /* OCARINA_CORE_AUDIO_H */
|
||||||
|
|
|
@ -57,8 +57,14 @@ static void test_init()
|
||||||
|
|
||||||
test_equal(audio :: current_track(), NULL);
|
test_equal(audio :: current_track(), NULL);
|
||||||
test_not_equal(audio_get_player(), NULL);
|
test_not_equal(audio_get_player(), NULL);
|
||||||
|
}
|
||||||
|
|
||||||
|
static void test_deinit()
|
||||||
|
{
|
||||||
core :: deinit();
|
core :: deinit();
|
||||||
|
|
||||||
|
test_equal(audio :: current_track(), NULL);
|
||||||
|
test_equal(audio_get_player(), NULL);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -206,6 +212,7 @@ void test_autopause()
|
||||||
|
|
||||||
DECLARE_UNIT_TESTS(
|
DECLARE_UNIT_TESTS(
|
||||||
UNIT_TEST("Audio Initialization", test_init),
|
UNIT_TEST("Audio Initialization", test_init),
|
||||||
|
UNIT_TEST("Audio Deinitialization", test_deinit),
|
||||||
UNIT_TEST("Test Audio Pre-Init", test_pre_init),
|
UNIT_TEST("Test Audio Pre-Init", test_pre_init),
|
||||||
UNIT_TEST("Test Audio Init 2", test_init2),
|
UNIT_TEST("Test Audio Init 2", test_init2),
|
||||||
UNIT_TEST("Test Audio Playback Controls", test_playback_controls),
|
UNIT_TEST("Test Audio Playback Controls", test_playback_controls),
|
||||||
|
|
Loading…
Reference in New Issue