From 5da0bd955eda23abd803b6873901779fe582a398 Mon Sep 17 00:00:00 2001 From: Takashi Iwai Date: Wed, 5 Nov 2003 18:35:42 +0000 Subject: [PATCH] Fixed bogus calculation of GETSAMPLES. --- ChangeLog | 4 ++++ timidity/alsa_a.c | 11 +++++------ 2 files changed, 9 insertions(+), 6 deletions(-) diff --git a/ChangeLog b/ChangeLog index d909b5ec..731dac87 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,7 @@ +2003-11-05 Takashi Iwai + + * timidity/alsa_a.c: Fixed bogus calculation of GETSAMPLES. + 2003-11-05 mput * timidity/readmidi.c: reindent. diff --git a/timidity/alsa_a.c b/timidity/alsa_a.c index 1b41095a..fdc5ad8d 100644 --- a/timidity/alsa_a.c +++ b/timidity/alsa_a.c @@ -569,6 +569,7 @@ static int acntl(int request, void *arg) { int i; snd_pcm_status_t *status; + snd_pcm_sframes_t delay; if (handle == NULL) return -1; @@ -598,19 +599,17 @@ static int acntl(int request, void *arg) case PM_REQ_GETFILLED: if (total_bytes == -1) return -1; - snd_pcm_status_alloca(&status); - if (snd_pcm_status(handle, status) < 0) + if (snd_pcm_delay(handle, &delay) < 0) return -1; - *((int *)arg) = snd_pcm_status_get_delay(status); + *((int *)arg) = delay; return 0; case PM_REQ_GETSAMPLES: if (total_bytes == -1) return -1; - snd_pcm_status_alloca(&status); - if (snd_pcm_status(handle, status) < 0) + if (snd_pcm_delay(handle, &delay) < 0) return -1; - *((int *)arg) = snd_pcm_status_get_delay(status) + output_counter; + *((int *)arg) = output_counter - delay; return 0; case PM_REQ_DISCARD: -- 2.11.0