core/audio: Add a function for getting the current pause count
This will be needed by the gui to find the current count at any time, without waiting for a callback. Signed-off-by: Anna Schumaker <Anna@NoWheyCreamery.com>
This commit is contained in:
parent
e6ab06cf2b
commit
8a2c631a9b
|
@ -316,6 +316,11 @@ bool audio_pause_after(int n)
|
|||
return false;
|
||||
}
|
||||
|
||||
int audio_get_pause_count(void)
|
||||
{
|
||||
return audio_pause_count;
|
||||
}
|
||||
|
||||
#ifdef CONFIG_TESTING
|
||||
void test_audio_eos()
|
||||
{
|
||||
|
|
|
@ -78,6 +78,7 @@ struct track *audio_prev();
|
|||
* Returns true if the value has been changed.
|
||||
*/
|
||||
bool audio_pause_after(int);
|
||||
int audio_get_pause_count(void);
|
||||
|
||||
#ifdef CONFIG_TESTING
|
||||
void test_audio_eos();
|
||||
|
|
|
@ -62,6 +62,7 @@ static void test_init()
|
|||
g_assert_cmpuint(audio_get_volume(), ==, 100);
|
||||
g_assert_null(audio_cur_track());
|
||||
g_assert_cmpuint(audio_cur_state(), ==, GST_STATE_NULL);
|
||||
g_assert_cmpint(audio_get_pause_count(), ==, -1);
|
||||
g_assert_cmpuint(load_count, ==, 0);
|
||||
g_assert_cmpuint(state_count, ==, 0);
|
||||
|
||||
|
@ -203,24 +204,30 @@ void test_autopause()
|
|||
|
||||
g_assert_true(audio_pause_after(3));
|
||||
g_assert_cmpint(pause_count, ==, 3);
|
||||
g_assert_cmpint(audio_get_pause_count(), ==, 3);
|
||||
|
||||
g_assert_false(audio_pause_after(-2));
|
||||
g_assert_cmpint(pause_count, ==, 3);
|
||||
g_assert_cmpint(audio_get_pause_count(), ==, 3);
|
||||
|
||||
pause_count = 0;
|
||||
g_assert_false(audio_pause_after(3));
|
||||
g_assert_cmpint(pause_count, ==, 0);
|
||||
g_assert_cmpint(audio_get_pause_count(), ==, 3);
|
||||
|
||||
g_assert_true(audio_pause_after(-1));
|
||||
g_assert_cmpint(pause_count, ==, -1);
|
||||
g_assert_cmpint(audio_get_pause_count(), ==, -1);
|
||||
|
||||
g_assert_true(audio_pause_after(5));
|
||||
g_assert_cmpint(pause_count, ==, 5);
|
||||
g_assert_cmpint(audio_get_pause_count(), ==, 5);
|
||||
|
||||
state_count = 0;
|
||||
for (i = 4; i > -1; i--) {
|
||||
test_audio_eos();
|
||||
g_assert_cmpint(pause_count, ==, i);
|
||||
g_assert_cmpint(audio_get_pause_count(), ==, i);
|
||||
g_assert_cmpuint(audio_cur_state(), ==, GST_STATE_PLAYING);
|
||||
g_assert(playlist_at(history, 0) == audio_cur_track());
|
||||
}
|
||||
|
@ -229,6 +236,7 @@ void test_autopause()
|
|||
test_audio_eos();
|
||||
while (idle_run_task()) {}
|
||||
g_assert_cmpint(pause_count, ==, -1);
|
||||
g_assert_cmpint(audio_get_pause_count(), ==, -1);
|
||||
g_assert_cmpuint(audio_cur_state(), ==, GST_STATE_PAUSED);
|
||||
g_assert_cmpuint(test_wait_state(), ==, 6);
|
||||
|
||||
|
|
Loading…
Reference in New Issue