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 - SDL_PushAudio
Summary: SDL_PushAudio
Status: RESOLVED WONTFIX
Alias: None
Product: SDL
Classification: Unclassified
Component: audio (show other bugs)
Version: 2.0.0
Hardware: All All
: P2 enhancement
Assignee: Ryan C. Gordon
QA Contact: Sam Lantinga
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2012-06-03 11:11 UTC by Paul Cercueil
Modified: 2015-02-18 03:48 UTC (History)
0 users

See Also:


Attachments
Patch that implements SDL_PushAudio (2.97 KB, patch)
2012-06-03 11:11 UTC, Paul Cercueil
Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
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.