We are currently migrating Bugzilla to GitHub issues.
Any changes made to the bug tracker now will be lost, so please do not post new bugs or make changes to them.
When we're done, all bug URLs will redirect to their equivalent location on the new bug tracker.

Bug 1511

Summary: SDL_PushAudio
Product: SDL Reporter: Paul Cercueil <paul>
Component: audioAssignee: Ryan C. Gordon <icculus>
Status: RESOLVED WONTFIX QA Contact: Sam Lantinga <slouken>
Severity: enhancement    
Priority: P2    
Version: 2.0.0   
Hardware: All   
OS: All   
Attachments: Patch that implements SDL_PushAudio

Description Paul Cercueil 2012-06-03 11:11:36 UTC
Created attachment 869 [details]
Patch that implements SDL_PushAudio

I'm the co-author of a Linux distribution targetted at open-source handheld consoles, that embeds SDL, and supports a couple of SDL emulators like gnuboy or snes9x. Emulators are really the special case where SDL becomes unadapted when it comes to submitting sound, as they generally want to "push" sound and doesn't map well to the "pull" interface used by SDL.

So instead of patching every emulator I work on to cope with the callback, I added a push interface to SDL. See the attached patch.

As ALSA and OSS (and probably others) do already provide a push interface, the current implementation could be enhanced; SDL_PushAudio could write directly to the buffer of the audio device (provided no conversion is necessary).

Best regards,

Paul Cercueil
Comment 1 Ryan C. Gordon 2015-02-18 03:48:46 UTC
We ended up adding an SDL_QueueAudio() API, for 2.0.4, that does something like this.

    https://hg.libsdl.org/SDL/file/4528766f5d2c/include/SDL_audio.h#l482

--ryan.