From 026589c77ea733ae92c38b78fbd633bfbd0b8e94 Mon Sep 17 00:00:00 2001 From: Miller Puckette Date: Fri, 8 Sep 2006 23:45:31 +0000 Subject: Many bug fixes svn path=/trunk/; revision=5906 --- pd/src/s_audio_alsa.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) (limited to 'pd/src/s_audio_alsa.c') diff --git a/pd/src/s_audio_alsa.c b/pd/src/s_audio_alsa.c index eb9bdc10..83530de9 100644 --- a/pd/src/s_audio_alsa.c +++ b/pd/src/s_audio_alsa.c @@ -37,6 +37,8 @@ static void alsa_checkiosync( void); static void alsa_numbertoname(int iodev, char *devname, int nchar); +static int alsa_jittermax; +#define ALSA_DEFJITTERMAX 3 /* don't assume we can turn all 31 bits when doing float-to-fix; otherwise some audio drivers (e.g. Midiman/ALSA) wrap around. */ @@ -240,6 +242,7 @@ int alsa_open_audio(int naudioindev, int *audioindev, int nchindev, /* save our belief as to ALSA's buffer size for later */ alsa_buf_samps = nfrags * frag_size; alsa_nindev = alsa_noutdev = 0; + alsa_jittermax = ALSA_DEFJITTERMAX; if (sys_verbose) post("audio buffer set to %d", (int)(0.001 * sys_schedadvance)); @@ -655,6 +658,7 @@ static void alsa_checkiosync( void) if (giveup-- <= 0) { post("tried but couldn't sync A/D/A"); + alsa_jittermax += 1; return; } minphase = 0x7fffffff; @@ -712,7 +716,7 @@ static void alsa_checkiosync( void) equal; but since we only make corrections DEFDACBLKSIZE samples at a time, we just ask that the spread be not more than 3/4 of a block. */ - if (maxphase <= minphase + (3 * DEFDACBLKSIZE / 4)) + if (maxphase <= minphase + (alsa_jittermax * (DEFDACBLKSIZE / 4))) break; if (!alreadylogged) -- cgit v1.2.1