# Audio API changes

**URL:** <https://discourse.libsdl.org/t/audio-api-changes/549>\
**Category:** SDL Development\
**Created:** [August 25, 1998, 12:17pm UTC](https://discourse.libsdl.org/t/audio-api-changes/549 "1998-08-25T12:17:25Z")\
**Posts on this page:** 8\
**Page:** 1

<div class="post-metadata">

**Author:** ![slouken](https://discourse.libsdl.org/letter_avatar_proxy/v4/letter/s/ec9cab/32.png) [@slouken](https://discourse.libsdl.org/u/slouken)\
**Post date:** [August 25, 1998, 12:17pm UTC](https://discourse.libsdl.org/t/audio-api-changes/549/1 "1998-08-25T12:17:25Z")

</div>

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](http://devolution.com))– Author of Simple DirectMedia Layer - [http://www.devolution.com/~slouken/SDL/](http://www.devolution.com/~slouken/SDL/)

---

<div class="post-metadata">

**Author:** ![Michael\_Samuel](https://discourse.libsdl.org/letter_avatar_proxy/v4/letter/m/bc8723/32.png) [@Michael\_Samuel](https://discourse.libsdl.org/u/Michael_Samuel)\
**Post date:** [August 25, 1998, 1:21pm UTC](https://discourse.libsdl.org/t/audio-api-changes/549/2 "1998-08-25T13:21:34Z")

</div>

> ```
> * 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 🙂

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:

---

<div class="post-metadata">

**Author:** ![David\_Sowsy](https://discourse.libsdl.org/letter_avatar_proxy/v4/letter/d/c68b51/32.png) [@David\_Sowsy](https://discourse.libsdl.org/u/David_Sowsy)\
**Post date:** [August 25, 1998, 3:36pm UTC](https://discourse.libsdl.org/t/audio-api-changes/549/3 "1998-08-25T15:36:58Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![slouken](https://discourse.libsdl.org/letter_avatar_proxy/v4/letter/s/ec9cab/32.png) [@slouken](https://discourse.libsdl.org/u/slouken)\
**Post date:** [August 25, 1998, 6:02pm UTC](https://discourse.libsdl.org/t/audio-api-changes/549/4 "1998-08-25T18:02:28Z")

</div>

> 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 🙂

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. 🙂

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

---

<div class="post-metadata">

**Author:** ![Nathan\_J\_Hurst](https://discourse.libsdl.org/letter_avatar_proxy/v4/letter/n/ac91a4/32.png) [@Nathan\_J\_Hurst](https://discourse.libsdl.org/u/Nathan_J_Hurst)\
**Post date:** [August 25, 1998, 9:45pm UTC](https://discourse.libsdl.org/t/audio-api-changes/549/5 "1998-08-25T21:45:43Z")

</div>

> > 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 🙂
> 
> 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:

---

<div class="post-metadata">

**Author:** ![Michele\_Bini](https://discourse.libsdl.org/letter_avatar_proxy/v4/letter/m/ecd19e/32.png) [@Michele\_Bini](https://discourse.libsdl.org/u/Michele_Bini)\
**Post date:** [August 26, 1998, 2:50am UTC](https://discourse.libsdl.org/t/audio-api-changes/549/6 "1998-08-26T02:50:16Z")

</div>

> > > 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 🙂
> > 
> > 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:

---

<div class="post-metadata">

**Author:** ![Michael\_Samuel](https://discourse.libsdl.org/letter_avatar_proxy/v4/letter/m/bc8723/32.png) [@Michael\_Samuel](https://discourse.libsdl.org/u/Michael_Samuel)\
**Post date:** [August 26, 1998, 1:55pm UTC](https://discourse.libsdl.org/t/audio-api-changes/549/7 "1998-08-26T13:55:50Z")

</div>

> > 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 🙂

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 😉

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

---

<div class="post-metadata">

**Author:** ![Nathan\_J\_Hurst](https://discourse.libsdl.org/letter_avatar_proxy/v4/letter/n/ac91a4/32.png) [@Nathan\_J\_Hurst](https://discourse.libsdl.org/u/Nathan_J_Hurst)\
**Post date:** [August 26, 1998, 10:00pm UTC](https://discourse.libsdl.org/t/audio-api-changes/549/8 "1998-08-26T22:00:56Z")

</div>

> Cool… so if I write a crappy enough program, I can get a chorus pedal  
> happenning 🙂
> 
> 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 😉

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:
