This commit is contained in:
2026-02-25 13:47:51 +01:00
parent ae432628f6
commit 58793f3a14
6 changed files with 37 additions and 4 deletions

View File

@@ -67,6 +67,7 @@ typedef struct {
double music_duration;
ao_play_func_t ao_play_f;
int buf_size;
int paused;
} AO_Handle;
//static int(*ao_play)(void *device, char *samples, uint32_t n) = NULL;
@@ -158,7 +159,7 @@ static DWORD run(LPVOID arg)
while(go_on) {
MUTEX_LOCK(handle->mutex);
int has_frames = (handle->play_queue != NULL);
int has_frames = (!handle->paused) && (handle->play_queue != NULL);
if (has_frames) {
Queue_t *q = get(handle);
@@ -201,6 +202,7 @@ void *ao_create_async(void *ao_device_yeah, void *ao_play_f)
handle->ao_play_f = ao_play_f;
handle->buf_size = 0;
handle->paused = (1 == 0);
#ifdef USE_PTHREADS
pthread_mutex_t m = PTHREAD_MUTEX_INITIALIZER;
@@ -266,7 +268,6 @@ double ao_is_at_second_async(void *ao_handle)
return s;
}
double ao_music_duration_async(void *ao_handle)
{
AO_Handle *h = (AO_Handle *) ao_handle;
@@ -285,4 +286,12 @@ int ao_bufsize_async(void *ao_handle)
return s;
}
void ao_pause_async(void *ao_handle, int paused)
{
AO_Handle *h = (AO_Handle *) ao_handle;
MUTEX_LOCK(h->mutex);
h->paused = paused;
MUTEX_UNLOCK(h->mutex);
}