Re: [hatari-devel] Default SdlAudioBufferSize

[ Thread Index | Date Index | More lists.tuxfamily.org/hatari-devel Archives ]


On 19/04/2012 01:32, David Savinkoff wrote:
Hi,

I was looking into key-click latency and found that the default
desiredAudioSpec.samples is set to 1024 for all sampling frequencies.

Work-around: --sound-buffer-size 20

*** 20 ms is a good automatic default for desiredAudioSpec.samples.
(= 1024 at sampling rates 32000 through 50066. = 512 for 16000 ->  25033).

Please look at the code in audio.c for improving, the
solution is easy and can be done in various ways:

- Initialize SdlAudioBufferSize = 20 instead of 0 (and/or)
- Change code a wee bit to make 20 milliseconds the default.


Hello

I'm away for 2 weeks starting today, I'll have a look at this when I'm back.

Nicolas


******* Test Patch ********
--- hatari/src/audio.c	2012-04-09 14:55:45.000000000 -0700
+++ hatari/src/audio.c	2012-04-18 14:42:49.000000000 -0700
@@ -118,8 +118,8 @@
  	/* In that case we use SdlAudioBufferSize (in ms) to compute a value */
  	/* of samples that matches the corresponding freq and buffer size. */
  	if ( SdlAudioBufferSize == 0 )			/* don't compute "samples", use default value */
-		desiredAudioSpec.samples = 1024;	/* buffer size in samples */
-	else
+		SdlAudioBufferSize = 20;		/* Use 20ms buffer */
+
  	{
  		int samples = (desiredAudioSpec.freq / 1000) * SdlAudioBufferSize;
  		int power2 = 1;
***************************
David

PS: I can make a proper patch for this, but I don't know
whether to remove as much code as possible or the least.






Mail converted by MHonArc 2.6.19+ http://listengine.tuxfamily.org/