1.3 proposals (was: Re: [SDL] LoadLibrary analogous function?)

winterlion winterlion at fsj.net
Thu Aug 30 00:41:00 PDT 2001

On Wed, 29 Aug 2001, Samuel Hart wrote:

> On Wednesday 29 August 2001 12:24pm, winterlion wrote:

[clip internationalization - taking this out of SDL list for now...]

> > I'd love to see audio recording capabilities
> Yeah, you're not alone ;-)
> Actually, we were talking about this very thing for 1.3 a while ago (good
> luck trying to find the original thread, cuz I can't ;-). Sam Lantinga said
> that he wanted to try to add this support.
> Hopefully, that's still the plan ;-)

All going well - as near as I can tell:
	windows : SDL audio and record/windows do -not- mix...  I think
		this may be the easiest platform to support
	BeOS: or maybe this will - I don't know Be programming though
	MacOS: from what I've seen fairly straightforeward too...
		OSS: workable, no prob
		ALSA: no idea
		ESD: doesn't do bidirectional... or it doesn't work...
		ARTSD: claims bidirectional, then halts on my machine ???
	Unix/non-linux:  usually as per OSS - straightforeward

If it weren't for linux it'd be easy on all platforms...  but linux is
probably going to require other features to be present at a guess.

My suggestion on API btw:  (should look familiar :)

to SDL_AudioSpec add:
	int recfreq;		/* DSP frequency -- samples per second */
	Uint16 recformat;	/* Audio data format */
	Uint8  recchannels;	/* Number of channels: 1 mono, 2 stereo */
	Uint8  recsilence;	/* Audio buffer silence value (calculated) */
	Uint16 recsamples;	/* Audio buffer size in samples */
	Uint16 recpadding;	/* Necessary for some compile environments */
	Uint32 recsize;		/* Audio buffer size in bytes (calculated) */
	void (*recordcallback)(void *userdata, Uint8 *stream, int len);
	/* where stream contains the recorded audio */

extern DECLSPEC SDL_audiostatus SDL_GetAudioStatusRecording(void);
extern DECLSPEC void SDL_PauseAudioRecording(int pause_on);
extern DECLSPEC void SDL_LockAudioRecording(void);
extern DECLSPEC void SDL_UnlockAudioRecording(void);
/* as per SDL_[..]() but for recording channel */

I'm not 100%... the problem is there's multiple devices to record -from-, and
that also implies volume control.  Now I'll admit you could simplify it down
to default-source such as windows uses...  at a guess linux would -definitely-
need preference support as it does -not- support "default audio record/play"
systems in the same way.  (and not all cards are bidirectional, and some people
(like me for instance) have multiple soundcards and use multiple sound drivers.

but be aware that in many instances using SDL_Audio -and- trying to record
audio won't work on most platforms.

G'day, eh? :)
	- Teunis

PS: I got stuck with this when working on AV streaming...  so it got put
on hold until I could figure a solution out.  I still don't have one.

More information about the SDL mailing list