# HG changeset patch # User Ryan C. Gordon # Date 1160110018 0 # Node ID 9d070c1a45fa17e5c756abf98ff6e76a5d85f6d3 # Parent 3234d6eee0116a5110b1d8bc537a84c704528e94 Moved AudioBootstrap section in converted drivers to bottom of source, so I could delete the predeclarations (one more thing to forget to update when changing the API, otherwise). There're a few other cleanups that snuck into this commit, too. diff -r 3234d6eee011 -r 9d070c1a45fa src/audio/arts/SDL_artsaudio.c --- a/src/audio/arts/SDL_artsaudio.c Fri Oct 06 04:16:11 2006 +0000 +++ b/src/audio/arts/SDL_artsaudio.c Fri Oct 06 04:46:58 2006 +0000 @@ -39,14 +39,6 @@ /* The tag name used by artsc audio */ #define ARTS_DRIVER_NAME "arts" -/* Audio driver functions */ -static int ARTS_OpenDevice(_THIS, const char *devname, int iscapture); -static void ARTS_WaitDevice(_THIS); -static void ARTS_PlayDevice(_THIS); -static Uint8 *ARTS_GetDeviceBuf(_THIS); -static void ARTS_CloseDevice(_THIS); -static void ARTS_WaitDone(_THIS); - #ifdef SDL_AUDIO_DRIVER_ARTS_DYNAMIC static const char *arts_library = SDL_AUDIO_DRIVER_ARTS_DYNAMIC; @@ -160,28 +152,6 @@ } -static int -ARTS_Init(SDL_AudioDriverImpl *impl) -{ - /* Set the function pointers */ - impl->OpenDevice = ARTS_OpenDevice; - impl->PlayDevice = ARTS_PlayDevice; - impl->WaitDevice = ARTS_WaitDevice; - impl->GetDeviceBuf = ARTS_GetDeviceBuf; - impl->CloseDevice = ARTS_CloseDevice; - impl->WaitDone = ARTS_WaitDone; - impl->OnlyHasDefaultOutputDevice = 1; - - return 1; -} - - -AudioBootStrap ARTS_bootstrap = { - ARTS_DRIVER_NAME, "Analog RealTime Synthesizer", - ARTS_Available, ARTS_Init, 0 -}; - - /* This function waits until it is possible to write a full sound buffer */ static void ARTS_WaitDevice(_THIS) @@ -370,4 +340,26 @@ return 1; } + +static int +ARTS_Init(SDL_AudioDriverImpl *impl) +{ + /* Set the function pointers */ + impl->OpenDevice = ARTS_OpenDevice; + impl->PlayDevice = ARTS_PlayDevice; + impl->WaitDevice = ARTS_WaitDevice; + impl->GetDeviceBuf = ARTS_GetDeviceBuf; + impl->CloseDevice = ARTS_CloseDevice; + impl->WaitDone = ARTS_WaitDone; + impl->OnlyHasDefaultOutputDevice = 1; + + return 1; +} + + +AudioBootStrap ARTS_bootstrap = { + ARTS_DRIVER_NAME, "Analog RealTime Synthesizer", + ARTS_Available, ARTS_Init, 0 +}; + /* vi: set ts=4 sw=4 expandtab: */ diff -r 3234d6eee011 -r 9d070c1a45fa src/audio/bsd/SDL_bsdaudio.c --- a/src/audio/bsd/SDL_bsdaudio.c Fri Oct 06 04:16:11 2006 +0000 +++ b/src/audio/bsd/SDL_bsdaudio.c Fri Oct 06 04:46:58 2006 +0000 @@ -269,46 +269,18 @@ "waiting : %s\n" "active : %s\n" "", - info. - play. - buffer_size, - info. - play. - sample_rate, - info. - play. - channels, - info. - play. - precision, - info. - play. - encoding, - info. - play. - seek, - info. - play. - samples, - info. - play. - eof, - info. - play. - pause - ? - "yes" - : - "no", - info. - play. - error - ? - "yes" - : - "no", - info. - play.waiting ? "yes" : "no", info.play.active ? "yes" : "no"); + info.play.buffer_size, + info.play.sample_rate, + info.play.channels, + info.play.precision, + info.play.encoding, + info.play.seek, + info.play.samples, + info.play.eof, + info.play.pause ? "yes" : "no", + info.play.error ? "yes" : "no", + info.play.waiting ? "yes" : "no", + info.play.active ? "yes" : "no"); fprintf(stderr, "\n" "[audio info]\n" diff -r 3234d6eee011 -r 9d070c1a45fa src/audio/dc/SDL_dcaudio.c --- a/src/audio/dc/SDL_dcaudio.c Fri Oct 06 04:16:11 2006 +0000 +++ b/src/audio/dc/SDL_dcaudio.c Fri Oct 06 04:46:58 2006 +0000 @@ -28,7 +28,6 @@ #include "SDL_audio.h" #include "../SDL_audiomem.h" #include "../SDL_audio_c.h" -#include "../SDL_audiodev_c.h" #include "SDL_dcaudio.h" #include "aica.h" diff -r 3234d6eee011 -r 9d070c1a45fa src/audio/disk/SDL_diskaudio.c --- a/src/audio/disk/SDL_diskaudio.c Fri Oct 06 04:16:11 2006 +0000 +++ b/src/audio/disk/SDL_diskaudio.c Fri Oct 06 04:46:58 2006 +0000 @@ -45,13 +45,6 @@ #define DISKENVR_WRITEDELAY "SDL_DISKAUDIODELAY" #define DISKDEFAULT_WRITEDELAY 150 -/* Audio driver functions */ -static int DISKAUD_OpenDevice(_THIS, const char *devname, int iscapture); -static void DISKAUD_WaitDevice(_THIS); -static void DISKAUD_PlayDevice(_THIS); -static Uint8 *DISKAUD_GetDeviceBuf(_THIS); -static void DISKAUD_CloseDevice(_THIS); - static const char * DISKAUD_GetOutputFilename(const char *devname) { @@ -71,27 +64,6 @@ return 1; /* always available. */ } -static int -DISKAUD_Init(SDL_AudioDriverImpl *impl) -{ - /* Initialize all variables that we clean on shutdown */ - SDL_memset(impl, '\0', sizeof (SDL_AudioDriverImpl)); - - /* Set the function pointers */ - impl->OpenDevice = DISKAUD_OpenDevice; - impl->WaitDevice = DISKAUD_WaitDevice; - impl->PlayDevice = DISKAUD_PlayDevice; - impl->GetDeviceBuf = DISKAUD_GetDeviceBuf; - impl->CloseDevice = DISKAUD_CloseDevice; - - return 1; -} - -AudioBootStrap DISKAUD_bootstrap = { - DISKAUD_DRIVER_NAME, "direct-to-disk audio", - DISKAUD_Available, DISKAUD_Init, 1 -}; - /* This function waits until it is possible to write a full sound buffer */ static void DISKAUD_WaitDevice(_THIS) @@ -183,4 +155,25 @@ return 1; } +static int +DISKAUD_Init(SDL_AudioDriverImpl *impl) +{ + /* Initialize all variables that we clean on shutdown */ + SDL_memset(impl, '\0', sizeof (SDL_AudioDriverImpl)); + + /* Set the function pointers */ + impl->OpenDevice = DISKAUD_OpenDevice; + impl->WaitDevice = DISKAUD_WaitDevice; + impl->PlayDevice = DISKAUD_PlayDevice; + impl->GetDeviceBuf = DISKAUD_GetDeviceBuf; + impl->CloseDevice = DISKAUD_CloseDevice; + + return 1; +} + +AudioBootStrap DISKAUD_bootstrap = { + DISKAUD_DRIVER_NAME, "direct-to-disk audio", + DISKAUD_Available, DISKAUD_Init, 1 +}; + /* vi: set ts=4 sw=4 expandtab: */ diff -r 3234d6eee011 -r 9d070c1a45fa src/audio/dma/SDL_dmaaudio.c --- a/src/audio/dma/SDL_dmaaudio.c Fri Oct 06 04:16:11 2006 +0000 +++ b/src/audio/dma/SDL_dmaaudio.c Fri Oct 06 04:46:58 2006 +0000 @@ -62,18 +62,6 @@ #define OPEN_FLAGS_INPUT (O_RDWR|O_NONBLOCK) #define OPEN_FLAGS_OUTPUT (O_RDWR|O_NONBLOCK) -/* Audio driver functions */ -static int DMA_DetectDevices(int iscapture); -static const char *DMA_GetDeviceName(int index, int iscapture); -static int DMA_OpenDevice(_THIS, const char *devname, int iscapture); -static void DMA_WaitDevice(_THIS); -static void DMA_PlayDevice(_THIS); -static Uint8 *DMA_GetDeviceBuf(_THIS); -static void DMA_CloseDevice(_THIS); -static void DMA_Deinitialize(void); - -/* Audio driver bootstrap functions */ - static char **outputDevices = NULL; static int outputDeviceCount = 0; static char **inputDevices = NULL; @@ -138,29 +126,6 @@ return available; } - -static int -DMA_Init(SDL_AudioDriverImpl *impl) -{ - /* Set the function pointers */ - impl->DetectDevices = DMA_DetectDevices; - impl->GetDeviceName = DMA_GetDeviceName; - impl->OpenDevice = DMA_OpenDevice; - impl->WaitDevice = DMA_WaitDevice; - impl->PlayDevice = DMA_PlayDevice; - impl->GetDeviceBuf = DMA_GetDeviceBuf; - impl->CloseDevice = DMA_CloseDevice; - impl->Deinitialize = DMA_Deinitialize; - - build_device_lists(); - return 1; -} - -AudioBootStrap DMA_bootstrap = { - DMA_DRIVER_NAME, "OSS /dev/dsp DMA audio", - DMA_Available, DMA_Init, 0 -}; - static void DMA_Deinitialize(void) { free_device_lists(); @@ -557,4 +522,26 @@ } } +static int +DMA_Init(SDL_AudioDriverImpl *impl) +{ + /* Set the function pointers */ + impl->DetectDevices = DMA_DetectDevices; + impl->GetDeviceName = DMA_GetDeviceName; + impl->OpenDevice = DMA_OpenDevice; + impl->WaitDevice = DMA_WaitDevice; + impl->PlayDevice = DMA_PlayDevice; + impl->GetDeviceBuf = DMA_GetDeviceBuf; + impl->CloseDevice = DMA_CloseDevice; + impl->Deinitialize = DMA_Deinitialize; + + build_device_lists(); + return 1; +} + +AudioBootStrap DMA_bootstrap = { + DMA_DRIVER_NAME, "OSS /dev/dsp DMA audio", + DMA_Available, DMA_Init, 0 +}; + /* vi: set ts=4 sw=4 expandtab: */ diff -r 3234d6eee011 -r 9d070c1a45fa src/audio/dsp/SDL_dspaudio.c --- a/src/audio/dsp/SDL_dspaudio.c Fri Oct 06 04:16:11 2006 +0000 +++ b/src/audio/dsp/SDL_dspaudio.c Fri Oct 06 04:46:58 2006 +0000 @@ -58,16 +58,6 @@ #define OPEN_FLAGS_OUTPUT (O_WRONLY|O_NONBLOCK) #define OPEN_FLAGS_INPUT (O_RDONLY|O_NONBLOCK) -/* Audio driver functions */ -static int DSP_DetectDevices(int iscapture); -static const char *DSP_GetDeviceName(int index, int iscapture); -static int DSP_OpenDevice(_THIS, const char *devname, int iscapture); -static void DSP_WaitDevice(_THIS); -static void DSP_PlayDevice(_THIS); -static Uint8 *DSP_GetDeviceBuf(_THIS); -static void DSP_CloseDevice(_THIS); -static void DSP_Deinitialize(void); - /* Audio driver bootstrap functions */ static char **outputDevices = NULL; @@ -116,29 +106,6 @@ } -static int -DSP_Init(SDL_AudioDriverImpl *impl) -{ - /* Set the function pointers */ - impl->DetectDevices = DSP_DetectDevices; - impl->GetDeviceName = DSP_GetDeviceName; - impl->OpenDevice = DSP_OpenDevice; - impl->PlayDevice = DSP_PlayDevice; - impl->GetDeviceBuf = DSP_GetDeviceBuf; - impl->CloseDevice = DSP_CloseDevice; - impl->Deinitialize = DSP_Deinitialize; - - build_device_lists(); - return 1; -} - - -AudioBootStrap DSP_bootstrap = { - DSP_DRIVER_NAME, "OSS /dev/dsp standard audio", - DSP_Available, DSP_Init, 0 -}; - - static void DSP_Deinitialize(void) { free_device_lists(); @@ -402,4 +369,26 @@ } } +static int +DSP_Init(SDL_AudioDriverImpl *impl) +{ + /* Set the function pointers */ + impl->DetectDevices = DSP_DetectDevices; + impl->GetDeviceName = DSP_GetDeviceName; + impl->OpenDevice = DSP_OpenDevice; + impl->PlayDevice = DSP_PlayDevice; + impl->GetDeviceBuf = DSP_GetDeviceBuf; + impl->CloseDevice = DSP_CloseDevice; + impl->Deinitialize = DSP_Deinitialize; + + build_device_lists(); + return 1; +} + + +AudioBootStrap DSP_bootstrap = { + DSP_DRIVER_NAME, "OSS /dev/dsp standard audio", + DSP_Available, DSP_Init, 0 +}; + /* vi: set ts=4 sw=4 expandtab: */ diff -r 3234d6eee011 -r 9d070c1a45fa src/audio/dummy/SDL_dummyaudio.c --- a/src/audio/dummy/SDL_dummyaudio.c Fri Oct 06 04:16:11 2006 +0000 +++ b/src/audio/dummy/SDL_dummyaudio.c Fri Oct 06 04:46:58 2006 +0000 @@ -35,10 +35,6 @@ /* The tag name used by DUMMY audio */ #define DUMMYAUD_DRIVER_NAME "dummy" -/* Audio driver functions */ -static int DUMMYAUD_OpenDevice(_THIS, const char *devname, int iscapture); - -/* Audio driver bootstrap functions */ static int DUMMYAUD_Available(void) { @@ -46,6 +42,13 @@ } static int +DUMMYAUD_OpenDevice(_THIS, const char *devname, int iscapture) +{ + return 1; /* always succeeds. */ +} + + +static int DUMMYAUD_Init(SDL_AudioDriverImpl *impl) { /* Set the function pointers */ @@ -60,10 +63,4 @@ DUMMYAUD_Available, DUMMYAUD_Init, 1 }; -static int -DUMMYAUD_OpenDevice(_THIS, const char *devname, int iscapture) -{ - return 1; /* always succeeds. */ -} - /* vi: set ts=4 sw=4 expandtab: */ diff -r 3234d6eee011 -r 9d070c1a45fa src/audio/esd/SDL_esdaudio.c --- a/src/audio/esd/SDL_esdaudio.c Fri Oct 06 04:16:11 2006 +0000 +++ b/src/audio/esd/SDL_esdaudio.c Fri Oct 06 04:46:58 2006 +0000 @@ -45,13 +45,6 @@ /* The tag name used by ESD audio */ #define ESD_DRIVER_NAME "esd" -/* Audio driver functions */ -static int ESD_OpenDevice(_THIS, const char *devname, int iscapture); -static void ESD_WaitDevice(_THIS); -static void ESD_PlayDevice(_THIS); -static Uint8 *ESD_GetDeviceBuf(_THIS); -static void ESD_CloseDevice(_THIS); - #ifdef SDL_AUDIO_DRIVER_ESD_DYNAMIC static const char *esd_library = SDL_AUDIO_DRIVER_ESD_DYNAMIC; @@ -122,8 +115,6 @@ #endif /* SDL_AUDIO_DRIVER_ESD_DYNAMIC */ -/* Audio driver bootstrap functions */ - static int ESD_Available(void) { @@ -144,26 +135,6 @@ } -static int -ESD_Init(SDL_AudioDriverImpl *impl) -{ - /* Set the function pointers */ - impl->OpenDevice = ESD_OpenDevice; - impl->PlayDevice = ESD_PlayDevice; - impl->WaitDevice = ESD_WaitDevice; - impl->GetDeviceBuf = ESD_GetDeviceBuf; - impl->CloseDevice = ESD_CloseDevice; - impl->OnlyHasDefaultOutputDevice = 1; - - return 1; -} - - -AudioBootStrap ESD_bootstrap = { - ESD_DRIVER_NAME, "Enlightened Sound Daemon", - ESD_Available, ESD_Init, 0 -}; - /* This function waits until it is possible to write a full sound buffer */ static void ESD_WaitDevice(_THIS) @@ -360,4 +331,25 @@ return 1; } + +static int +ESD_Init(SDL_AudioDriverImpl *impl) +{ + /* Set the function pointers */ + impl->OpenDevice = ESD_OpenDevice; + impl->PlayDevice = ESD_PlayDevice; + impl->WaitDevice = ESD_WaitDevice; + impl->GetDeviceBuf = ESD_GetDeviceBuf; + impl->CloseDevice = ESD_CloseDevice; + impl->OnlyHasDefaultOutputDevice = 1; + + return 1; +} + + +AudioBootStrap ESD_bootstrap = { + ESD_DRIVER_NAME, "Enlightened Sound Daemon", + ESD_Available, ESD_Init, 0 +}; + /* vi: set ts=4 sw=4 expandtab: */ diff -r 3234d6eee011 -r 9d070c1a45fa src/audio/macosx/SDL_coreaudio.c --- a/src/audio/macosx/SDL_coreaudio.c Fri Oct 06 04:16:11 2006 +0000 +++ b/src/audio/macosx/SDL_coreaudio.c Fri Oct 06 04:46:58 2006 +0000 @@ -201,20 +201,6 @@ return 0; } - -/* Audio driver functions */ - -static int COREAUDIO_DetectDevices(int iscapture); -static const char *COREAUDIO_GetDeviceName(int index, int iscapture); -static int COREAUDIO_OpenDevice(_THIS, const char *devname, int iscapture); -static void COREAUDIO_WaitDevice(_THIS); -static void COREAUDIO_PlayDevice(_THIS); -static Uint8 *COREAUDIO_GetDeviceBuf(_THIS); -static void COREAUDIO_CloseDevice(_THIS); -static void COREAUDIO_Deinitialize(void); - -/* Audio driver bootstrap functions */ - static int COREAUDIO_Available(void) { @@ -222,28 +208,6 @@ } static int -COREAUDIO_Init(SDL_AudioDriverImpl *impl) -{ - /* Set the function pointers */ - impl->DetectDevices = COREAUDIO_DetectDevices; - impl->GetDeviceName = COREAUDIO_GetDeviceName; - impl->OpenDevice = COREAUDIO_OpenDevice; - impl->CloseDevice = COREAUDIO_CloseDevice; - impl->Deinitialize = COREAUDIO_Deinitialize; - impl->ProvidesOwnCallbackThread = 1; - - build_device_lists(); /* do an initial check for devices... */ - - return 1; -} - -AudioBootStrap COREAUDIO_bootstrap = { - "coreaudio", "Mac OS X CoreAudio", - COREAUDIO_Available, COREAUDIO_Init, 0 -}; - - -static int COREAUDIO_DetectDevices(int iscapture) { if (iscapture) { @@ -601,4 +565,25 @@ return 1; /* good to go. */ } +static int +COREAUDIO_Init(SDL_AudioDriverImpl *impl) +{ + /* Set the function pointers */ + impl->DetectDevices = COREAUDIO_DetectDevices; + impl->GetDeviceName = COREAUDIO_GetDeviceName; + impl->OpenDevice = COREAUDIO_OpenDevice; + impl->CloseDevice = COREAUDIO_CloseDevice; + impl->Deinitialize = COREAUDIO_Deinitialize; + impl->ProvidesOwnCallbackThread = 1; + + build_device_lists(); /* do an initial check for devices... */ + + return 1; +} + +AudioBootStrap COREAUDIO_bootstrap = { + "coreaudio", "Mac OS X CoreAudio", + COREAUDIO_Available, COREAUDIO_Init, 0 +}; + /* vi: set ts=4 sw=4 expandtab: */ diff -r 3234d6eee011 -r 9d070c1a45fa src/audio/macrom/SDL_romaudio.c --- a/src/audio/macrom/SDL_romaudio.c Fri Oct 06 04:16:11 2006 +0000 +++ b/src/audio/macrom/SDL_romaudio.c Fri Oct 06 04:46:58 2006 +0000 @@ -50,15 +50,6 @@ #include "../SDL_sysaudio.h" #include "SDL_romaudio.h" -/* Audio driver functions */ - -static void SNDMGR_CloseDevice(_THIS); -static int SNDMGR_OpenDevice(_THIS, const char *devname, int iscapture); -static void SNDMGR_LockDevice(_THIS); -static void SNDMGR_UnlockDevice(_THIS); - -/* Audio driver bootstrap functions */ - static int SNDMGR_Available(void) { @@ -66,28 +57,6 @@ } -static int -SNDMGR_Init(SDL_AudioDriverImpl *impl) -{ - /* Set the function pointers */ - impl->OpenDevice = SNDMGR_OpenDevice; - impl->CloseDevice = SNDMGR_CloseDevice; - impl->ProvidesOwnCallbackThread = 1; - impl->OnlyHasDefaultOutputDevice = 1; - -#ifndef __MACOSX__ /* Mac OS X uses threaded audio, so normal thread code is okay */ - impl->LockDevice = SNDMGR_LockDevice; - impl->UnlockDevice = SNDMGR_UnlockDevice; -#endif - - return 1; -} - -AudioBootStrap SNDMGR_bootstrap = { - "sndmgr", SDL_MACOS_NAME " SoundManager", - SNDMGR_Available, SNDMGR_Init, 0 -}; - #pragma options align=power static volatile SInt32 audio_is_locked = 0; @@ -331,4 +300,26 @@ this->hidden = NULL; } +static int +SNDMGR_Init(SDL_AudioDriverImpl *impl) +{ + /* Set the function pointers */ + impl->OpenDevice = SNDMGR_OpenDevice; + impl->CloseDevice = SNDMGR_CloseDevice; + impl->ProvidesOwnCallbackThread = 1; + impl->OnlyHasDefaultOutputDevice = 1; + +#ifndef __MACOSX__ /* Mac OS X uses threaded audio, so normal thread code is okay */ + impl->LockDevice = SNDMGR_LockDevice; + impl->UnlockDevice = SNDMGR_UnlockDevice; +#endif + + return 1; +} + +AudioBootStrap SNDMGR_bootstrap = { + "sndmgr", SDL_MACOS_NAME " SoundManager", + SNDMGR_Available, SNDMGR_Init, 0 +}; + /* vi: set ts=4 sw=4 expandtab: */