[SDL] Audio Output

Paul Newton Paul.Newton at sli-institute.ac.uk
Tue Aug 27 07:31:00 PDT 2002


-----Original Message-----
From: David Olofson [mailto:david.olofson at reologica.se]
Sent: 27 August 2002 15:12
To: sdl at libsdl.org
Subject: RE: [SDL] Audio Output


On Tue, 27/08/2002 12:01:05 , Paul Newton <Paul.Newton at sli-institute.ac.uk>
wrote:
>Further to my last post.  I have changed the code and now get a reasonable
>output.  However there is a regular clicking noise present.

Haven't followed this thread closely, but here are some ideas:

 * Is the clicking frequency affected if you change the size
   of the SDL audio buffer, the intermediate buffer or other
   buffers, if any?

If I change the buffer then the audio plays back at the wrong speed.  If I
increase the buffer it plays too fast.  The clicking isn't too bad then.  If
I reduce the buffer the sound plays back too slow and the clcicking is
really bad.

 * Is the size of the intermediate buffer (the one that the
   callback reads from) guaranteed to be a multiple of the
   buffer size argument of the callback? (Hint: You probably
   shouldn't assume anything about that argument - not even
   that it will be constant between calls! If nothing else,
   not making such assumptions gives your code a much better
   chance to work with other callback designs, such as VST,
   LADSPA or JACK plugins.)

No

 * Is there some processing going on that loses it's state
   regularly? (Like once per intermediate buffer wrap, or
   something...)

No

 * What happens in the callback/streaming sync when buffers
   wrap, are swapped, or whatever you do?


The way that I set up the bufffer was as a ring buffer.  However I set a
flag when the buffer is full so no more processing takes place.  The audio
then runs.  I think that after this empties the buffer as it does the
clicking is the time that it takes to refill the buffer before more audio
can be output.  I am currently working on getting the buffer to wrap
properly but without a lot of success at the moment.

Paul





//David


.---------------------------------------
| David Olofson
| Programmer
| david.olofson at reologica.se
|---------------------------------------
| Address:
| REOLOGICA Instruments AB
| Scheelevägen 30
| 223 63 LUND
| Sweden
|---------------------------------------
| Phone: 046-12 77 60
| Fax: 046-12 50 57
| Mobil: 
| E-mail: david.olofson at reologica.se
| WWW: http://www.reologica.se
| 
`-----> We Make Rheology Real


_______________________________________________
SDL mailing list
SDL at libsdl.org
http://www.libsdl.org/mailman/listinfo/sdl




More information about the SDL mailing list