Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Patch for SDL audio recording #53

SDLBugzilla opened this issue Feb 10, 2021 · 0 comments

Patch for SDL audio recording #53

SDLBugzilla opened this issue Feb 10, 2021 · 0 comments
duplicate enhancement


Copy link

@SDLBugzilla SDLBugzilla commented Feb 10, 2021

This bug report was migrated from our old Bugzilla tracker.

These attachments are available in the static archive:

Reported in version: 2.0.0
Reported for operating system, platform: All, All

Comments on the original bug report:

On 2006-05-04 00:39:56 +0000, Sam Lantinga wrote:

Date: 09 Apr 2002 18:09:25 -0700
From: Dan Helfman
Subject: [SDL] Patch for SDL audio recording

Attached is a patch for audio recording in SDL. The patch is for SDL
1.2.3 but should apply against CVS too (last I checked, anyway). It
retains source compatibility with the SDL 1.2 audio playback API, so all
your old programs should still compile against and work with this
patched SDL (let me know if they don't). It most definitely does not
retain binary compatibility, so I don't expect this patch to make it
into SDL 1.2. I'm hoping that some sort of recording ability will make
it into 1.3.

Because I tried to retain source compatibility with the current API, I
could not make the most elegant modifications possible, and indeed the
patch is rather hackish and currently only works for DSP audio.

Here's how you use it in your programs. With standard SDL audio playing,
you setup a callback in your audio spec that is called whenever SDL
needs a chunk of audio to fill its playback buffer. What I did was add a
second callback (callback_record) that SDL calls whenever it has a chunk
of recorded data (such as from a microphone) available for you. If you
don't set the recording callback to anything, then SDL will behave
exactly as the unpatched SDL with playback-only capabilities. But if
there is a callback_record function, then /dev/dsp will be opened for
read-write and recording should work. Note that if you don't want to do
any playback at all, you can choose not to set an audio play callback,
but still set a recording callback.

Feedback is definitely welcome. I'm particularly interested in people
just trying out the patch and reporting whether it works. I'm currently
working on adding wav file writing support so that you can actually do
something with all of the nice recorded audio data you get from this
patched SDL. I'll post new versions here and possibly put up a web page
for the patch if anyone's interested.

For what it's worth, this patch is Copyright (C) 2002 Jim Henson's
Creature Shop, and it is of course LGPL.

Dan Helfman
Jim Henson's Creature Shop

On 2006-05-04 00:42:17 +0000, Sam Lantinga wrote:

Created attachment 110

On 2006-05-04 00:47:25 +0000, Sam Lantinga wrote:

Whoops, didn't see bug # 10

*** This bug has been marked as a duplicate of 10 ***

@SDLBugzilla SDLBugzilla added duplicate enhancement labels Feb 10, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
duplicate enhancement
None yet

No branches or pull requests

1 participant