[SDL] SDL useful for sound synthesis?
darkmatter at freeuk.com
Thu Sep 21 13:11:09 PDT 2006
Thursday, September 21, 2006, 7:23:47 PM, you wrote:
> I guess when browsing through the SDL examples I was under the impression
> that most SDL users who use its sound capability already have their wav
> files (or whatever the format their audio is in) and just play this back and
> maybe add some effects or something. This is why I wasn't sure if I could
> use SDL to feed in my very own synthesized sound (i.e. simply a binary array
> of short int's or something) and have it play on-the-fly (i.e. soon after
> each sound chunk is processed) and in real-time.
SDL itself handles audio with a callback that requests for a buffer of
some size (usually a small one) be filled with audio data
concurrently. Extra stuff such as playing wav, streaming etc is
handled by SDL_mixer which sits on top of this.
> Since I'm not doing game programming, but rather I am making a simulation
> program, I was considering OpenAL - which is a library just for audio. Does
> anyone know if OpenAL might be more advantageous/disadvantageous for what
> I'm trying to do?
I'm not sure about this. OpenAL's streaming allows you to calculate
buffers and queue them for playback, but if what you want is
realtime, this is totally inappropriate as it has no settings to
control how large the mix buffer is, or any notification of where
playback is (other than when it's done with a set of queued buffers).
If latency is of the utmost importance, you might want to consider
looking at PortAudio... especially as on platforms that support it
(such as Windows and Mac), this supports ASIO.
Peter mailto:darkmatter at freeuk.com
More information about the SDL