Mercurial > sdl-ios-xcode
diff src/audio/SDL_sysaudio.h @ 3784:37c9c4590689 SDL-ryan-multiple-audio-device
First batch of heavy lifting on supporting multiple audio devices at once.
This has a long way to go yet, most of the drivers aren't updated for the
new interfaces, and it's still got some obvious bugs, FIXMEs, and wistlist
items.
Don't use yet.
author | Ryan C. Gordon <icculus@icculus.org> |
---|---|
date | Sun, 01 Oct 2006 05:24:03 +0000 |
parents | c121d94672cb |
children | 8d74a4721ca9 |
line wrap: on
line diff
--- a/src/audio/SDL_sysaudio.h Sun Oct 01 05:21:40 2006 +0000 +++ b/src/audio/SDL_sysaudio.h Sun Oct 01 05:24:03 2006 +0000 @@ -29,13 +29,23 @@ /* The SDL audio driver */ typedef struct SDL_AudioDevice SDL_AudioDevice; +#define _THIS SDL_AudioDevice *_this -/* Define the SDL audio driver structure */ -#define _THIS SDL_AudioDevice *_this -#ifndef _STATUS -#define _STATUS SDL_status *status -#endif -struct SDL_AudioDevice +/* !!! FIXME: rename these from "Audio" to "Device" ... */ +typedef struct SDL_AudioDriverImpl +{ + int (*OpenAudio) (_THIS, const char *devname, int iscapture); + void (*ThreadInit) (_THIS); /* Called by audio thread at start */ + void (*WaitAudio) (_THIS); + void (*PlayAudio) (_THIS); + Uint8 *(*GetAudioBuf) (_THIS); + void (*WaitDone) (_THIS); + void (*CloseAudio) (_THIS); + void (*LockAudio) (_THIS); + void (*UnlockAudio) (_THIS); +} SDL_AudioDriverImpl; + +typedef struct SDL_AudioDriver { /* * * */ /* The name of this audio driver */ @@ -45,20 +55,16 @@ /* The description of this audio driver */ const char *desc; + SDL_AudioDriverImpl impl; +} SDL_AudioDriver; + + +/* Define the SDL audio driver structure */ +struct SDL_AudioDevice +{ /* * * */ - /* Public driver functions */ - int (*OpenAudio) (_THIS, SDL_AudioSpec * spec); - void (*ThreadInit) (_THIS); /* Called by audio thread at start */ - void (*WaitAudio) (_THIS); - void (*PlayAudio) (_THIS); - Uint8 *(*GetAudioBuf) (_THIS); - void (*WaitDone) (_THIS); - void (*CloseAudio) (_THIS); - - /* * * */ - /* Lock / Unlock functions added for the Mac port */ - void (*LockAudio) (_THIS); - void (*UnlockAudio) (_THIS); + /* Lowlevel audio implementation */ + const SDL_AudioDriver *driver; /* * * */ /* Data common to all devices */ @@ -99,7 +105,7 @@ const char *name; const char *desc; int (*available) (void); - SDL_AudioDevice *(*create) (int devindex); + int (*init) (SDL_AudioDriverImpl *impl); } AudioBootStrap; #if SDL_AUDIO_DRIVER_BSD @@ -174,8 +180,5 @@ extern AudioBootStrap DART_bootstrap; #endif -/* This is the current audio device */ -extern SDL_AudioDevice *current_audio; - #endif /* _SDL_sysaudio_h */ /* vi: set ts=4 sw=4 expandtab: */