Audio API changes

These are the changes in the new CVS snapshot for SDL 0.8c:

  * SDL_OpenAudio() now automatically converts to the requested
    audio format if the calling application doesn't ask for the
    hardware audio format.  It also now returns 0 on success and
    -1 on failure.
  * The audio callback is no longer passed a 'lookahead' argument
  * The following functions have been removed for simplicity:
        SDL_LockAudio();
        SDL_UnlockAudio();
        SDL_QueueAudio()
        SDL_WaitAudio()
        SDL_FlushAudio()
  * New functions allow easy audio format conversion:
        SDL_BuildAudioCVT()
        SDL_ConvertAudio()

Plus there is a new demo:
Plasma demo by Bini Michele , Aug 1998. Public domain.

I would like comments on the new audio API, if people have time to
play with it. The major change is:
if ( SDL_OpenAudio(&spec) == NULL ) … error
becomes
if ( SDL_OpenAudio(&spec, NULL) < 0 ) … error

Also, the SDL_QueueAudio() API was removed – it seemed like cruft.
I may replace it with something similar that blocks until audio is played.

See ya!
-Sam Lantinga (slouken at devolution.com)–
Author of Simple DirectMedia Layer -
http://www.devolution.com/~slouken/SDL/

  * New functions allow easy audio format conversion:
        SDL_BuildAudioCVT()
        SDL_ConvertAudio()

Sam, would it be feasable to add an audio-in recording facility? I want
to write a distortion pedal program… (I’ll be getting a new Guitar as
soon as I get the money :slight_smile:

If you can convert audio->native dsp, I would assume it wouldn’t be much
code to do native dsp->audio… (I really don’t know much about sound
files yet)

Then again, if it’s too much bloat, I suppose I should find a more
suitable cross-platform library.

– Michael Samuel On Tue, 25 Aug 1998, Sam Lantinga wrote:

I built up the last current release about 8 hours ago
on a BeOS Intel 3.2 running laptop. I built all the demos, and
pretty much every one of them crashed upon exit. (The Debug requester)
saying that the app had quit pops up…I’ll check out the new release,
but I figured I’d let you know.

Best Regards,
David Sowsy

Sam, would it be feasable to add an audio-in recording facility? I want
to write a distortion pedal program… (I’ll be getting a new Guitar as
soon as I get the money :slight_smile:

It’s possible, though I hadn’t thought about it.

Then again, if it’s too much bloat, I suppose I should find a more
suitable cross-platform library.

Cheap shot. :slight_smile:

See ya!
-Sam Lantinga (slouken at devolution.com)–
Author of Simple DirectMedia Layer -
http://www.devolution.com/~slouken/SDL/

Sam, would it be feasable to add an audio-in recording facility? I want
to write a distortion pedal program… (I’ll be getting a new Guitar as
soon as I get the money :slight_smile:

It’s possible, though I hadn’t thought about it.

The biggest problem you are going to have is latency. unless you are
quite careful about how to get and process the data they could easily be a
1/4 second delay between input and output. This would make for a really
crap guitar pedal… It may be a better idea to write that sort of thing
as a kernel module(Real-time linux).

njhOn Tue, 25 Aug 1998, Sam Lantinga wrote:

Sam, would it be feasable to add an audio-in recording facility? I want
to write a distortion pedal program… (I’ll be getting a new Guitar as
soon as I get the money :slight_smile:

It’s possible, though I hadn’t thought about it.

The biggest problem you are going to have is latency. unless you are
quite careful about how to get and process the data they could easily be a
1/4 second delay between input and output.
That delay can be reduced by forcing the sound driver to use smaller
buffers, or by handling the sound buffers directly.

-MicheleOn Wed, 26 Aug 1998, Nathan Hurst wrote:

On Tue, 25 Aug 1998, Sam Lantinga wrote:

It’s possible, though I hadn’t thought about it.

The biggest problem you are going to have is latency. unless you are
quite careful about how to get and process the data they could easily be a
1/4 second delay between input and output. This would make for a really
crap guitar pedal… It may be a better idea to write that sort of thing
as a kernel module(Real-time linux).

Cool… so if I write a crappy enough program, I can get a chorus pedal
happenning :slight_smile:

Seriously, considering it’s a mono input, and it’s whole purpose is to
distort, I couldn’t picture me processing at more than 8 bit 11.25khz
mono. I usually do a fairly good job piping and manipulating data on the
fly, but admittedly, they were only parsers, not audio modifying… I
suppose it couldn’t be too different :wink:

– Michael Samuel On Wed, 26 Aug 1998, Nathan Hurst wrote:

Cool… so if I write a crappy enough program, I can get a chorus pedal
happenning :slight_smile:

Seriously, considering it’s a mono input, and it’s whole purpose is to
distort, I couldn’t picture me processing at more than 8 bit 11.25khz
mono. I usually do a fairly good job piping and manipulating data on the
fly, but admittedly, they were only parsers, not audio modifying… I
suppose it couldn’t be too different :wink:

Arghgh, it’s the "; seriously, " construct again!!!
grrrr… :-);

Seriously, Long latency in a guitar pedal is prolly the worst place for
it. When you apply filters to CD and the like you rarely notice the
delay(even 10 second ones), but if you are playing an instrument you need
the feed back loop to be as tight as possible.

njhOn Wed, 26 Aug 1998, Michael Samuel wrote: