Mercurial > sdl-ios-xcode
comparison src/audio/dsp/SDL_dspaudio.c @ 3816:9d070c1a45fa SDL-ryan-multiple-audio-device
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.
author | Ryan C. Gordon <icculus@icculus.org> |
---|---|
date | Fri, 06 Oct 2006 04:46:58 +0000 |
parents | 2c5387c0a642 |
children | 103bbe13f5eb |
comparison
equal
deleted
inserted
replaced
3815:3234d6eee011 | 3816:9d070c1a45fa |
---|---|
56 | 56 |
57 /* Open the audio device for playback, and don't block if busy */ | 57 /* Open the audio device for playback, and don't block if busy */ |
58 #define OPEN_FLAGS_OUTPUT (O_WRONLY|O_NONBLOCK) | 58 #define OPEN_FLAGS_OUTPUT (O_WRONLY|O_NONBLOCK) |
59 #define OPEN_FLAGS_INPUT (O_RDONLY|O_NONBLOCK) | 59 #define OPEN_FLAGS_INPUT (O_RDONLY|O_NONBLOCK) |
60 | 60 |
61 /* Audio driver functions */ | |
62 static int DSP_DetectDevices(int iscapture); | |
63 static const char *DSP_GetDeviceName(int index, int iscapture); | |
64 static int DSP_OpenDevice(_THIS, const char *devname, int iscapture); | |
65 static void DSP_WaitDevice(_THIS); | |
66 static void DSP_PlayDevice(_THIS); | |
67 static Uint8 *DSP_GetDeviceBuf(_THIS); | |
68 static void DSP_CloseDevice(_THIS); | |
69 static void DSP_Deinitialize(void); | |
70 | |
71 /* Audio driver bootstrap functions */ | 61 /* Audio driver bootstrap functions */ |
72 | 62 |
73 static char **outputDevices = NULL; | 63 static char **outputDevices = NULL; |
74 static int outputDeviceCount = 0; | 64 static int outputDeviceCount = 0; |
75 static char **inputDevices = NULL; | 65 static char **inputDevices = NULL; |
112 build_device_lists(); | 102 build_device_lists(); |
113 available = ((outputDeviceCount > 0) || (inputDeviceCount > 0)); | 103 available = ((outputDeviceCount > 0) || (inputDeviceCount > 0)); |
114 free_device_lists(); | 104 free_device_lists(); |
115 return available; | 105 return available; |
116 } | 106 } |
117 | |
118 | |
119 static int | |
120 DSP_Init(SDL_AudioDriverImpl *impl) | |
121 { | |
122 /* Set the function pointers */ | |
123 impl->DetectDevices = DSP_DetectDevices; | |
124 impl->GetDeviceName = DSP_GetDeviceName; | |
125 impl->OpenDevice = DSP_OpenDevice; | |
126 impl->PlayDevice = DSP_PlayDevice; | |
127 impl->GetDeviceBuf = DSP_GetDeviceBuf; | |
128 impl->CloseDevice = DSP_CloseDevice; | |
129 impl->Deinitialize = DSP_Deinitialize; | |
130 | |
131 build_device_lists(); | |
132 return 1; | |
133 } | |
134 | |
135 | |
136 AudioBootStrap DSP_bootstrap = { | |
137 DSP_DRIVER_NAME, "OSS /dev/dsp standard audio", | |
138 DSP_Available, DSP_Init, 0 | |
139 }; | |
140 | 107 |
141 | 108 |
142 static void DSP_Deinitialize(void) | 109 static void DSP_Deinitialize(void) |
143 { | 110 { |
144 free_device_lists(); | 111 free_device_lists(); |
400 SDL_free(this->hidden); | 367 SDL_free(this->hidden); |
401 this->hidden = NULL; | 368 this->hidden = NULL; |
402 } | 369 } |
403 } | 370 } |
404 | 371 |
372 static int | |
373 DSP_Init(SDL_AudioDriverImpl *impl) | |
374 { | |
375 /* Set the function pointers */ | |
376 impl->DetectDevices = DSP_DetectDevices; | |
377 impl->GetDeviceName = DSP_GetDeviceName; | |
378 impl->OpenDevice = DSP_OpenDevice; | |
379 impl->PlayDevice = DSP_PlayDevice; | |
380 impl->GetDeviceBuf = DSP_GetDeviceBuf; | |
381 impl->CloseDevice = DSP_CloseDevice; | |
382 impl->Deinitialize = DSP_Deinitialize; | |
383 | |
384 build_device_lists(); | |
385 return 1; | |
386 } | |
387 | |
388 | |
389 AudioBootStrap DSP_bootstrap = { | |
390 DSP_DRIVER_NAME, "OSS /dev/dsp standard audio", | |
391 DSP_Available, DSP_Init, 0 | |
392 }; | |
393 | |
405 /* vi: set ts=4 sw=4 expandtab: */ | 394 /* vi: set ts=4 sw=4 expandtab: */ |