comparison src/audio/macosx/SDL_coreaudio.c @ 3792:866c310e2cb5 SDL-ryan-multiple-audio-device

Changed some 1.3 audio symbol names.
author Ryan C. Gordon <icculus@icculus.org>
date Tue, 03 Oct 2006 22:17:59 +0000
parents 8f8209f8da6d
children 589bc3d060cd
comparison
equal deleted inserted replaced
3791:be33495e4d97 3792:866c310e2cb5
203 203
204 204
205 /* Audio driver functions */ 205 /* Audio driver functions */
206 206
207 static int COREAUDIO_DetectDevices(int iscapture); 207 static int COREAUDIO_DetectDevices(int iscapture);
208 static const char *COREAUDIO_GetAudioDevice(int index, int iscapture); 208 static const char *COREAUDIO_GetDeviceName(int index, int iscapture);
209 static int COREAUDIO_OpenAudio(_THIS, const char *devname, int iscapture); 209 static int COREAUDIO_OpenDevice(_THIS, const char *devname, int iscapture);
210 static void COREAUDIO_WaitAudio(_THIS); 210 static void COREAUDIO_WaitDevice(_THIS);
211 static void COREAUDIO_PlayAudio(_THIS); 211 static void COREAUDIO_PlayDevice(_THIS);
212 static Uint8 *COREAUDIO_GetAudioBuf(_THIS); 212 static Uint8 *COREAUDIO_GetDeviceBuf(_THIS);
213 static void COREAUDIO_CloseAudio(_THIS); 213 static void COREAUDIO_CloseDevice(_THIS);
214 static void COREAUDIO_Deinitialize(void); 214 static void COREAUDIO_Deinitialize(void);
215 215
216 /* Audio driver bootstrap functions */ 216 /* Audio driver bootstrap functions */
217 217
218 static int 218 static int
224 static int 224 static int
225 COREAUDIO_Init(SDL_AudioDriverImpl *impl) 225 COREAUDIO_Init(SDL_AudioDriverImpl *impl)
226 { 226 {
227 /* Set the function pointers */ 227 /* Set the function pointers */
228 impl->DetectDevices = COREAUDIO_DetectDevices; 228 impl->DetectDevices = COREAUDIO_DetectDevices;
229 impl->GetAudioDevice = COREAUDIO_GetAudioDevice; 229 impl->GetDeviceName = COREAUDIO_GetDeviceName;
230 impl->OpenAudio = COREAUDIO_OpenAudio; 230 impl->OpenDevice = COREAUDIO_OpenDevice;
231 impl->WaitAudio = COREAUDIO_WaitAudio; 231 impl->WaitDevice = COREAUDIO_WaitDevice;
232 impl->PlayAudio = COREAUDIO_PlayAudio; 232 impl->PlayDevice = COREAUDIO_PlayDevice;
233 impl->GetAudioBuf = COREAUDIO_GetAudioBuf; 233 impl->GetDeviceBuf = COREAUDIO_GetDeviceBuf;
234 impl->CloseAudio = COREAUDIO_CloseAudio; 234 impl->CloseDevice = COREAUDIO_CloseDevice;
235 impl->Deinitialize = COREAUDIO_Deinitialize; 235 impl->Deinitialize = COREAUDIO_Deinitialize;
236 236
237 return 1; 237 return 1;
238 } 238 }
239 239
257 return 0; /* shouldn't ever hit this. */ 257 return 0; /* shouldn't ever hit this. */
258 } 258 }
259 259
260 260
261 static const char * 261 static const char *
262 COREAUDIO_GetAudioDevice(int index, int iscapture) 262 COREAUDIO_GetDeviceName(int index, int iscapture)
263 { 263 {
264 if ((iscapture) && (index < inputDeviceCount)) { 264 if ((iscapture) && (index < inputDeviceCount)) {
265 return inputDevices[index].name; 265 return inputDevices[index].name;
266 } else if ((!iscapture) && (index < outputDeviceCount)) { 266 } else if ((!iscapture) && (index < outputDeviceCount)) {
267 return outputDevices[index].name; 267 return outputDevices[index].name;
355 } 355 }
356 356
357 357
358 /* Dummy functions -- we don't use thread-based audio */ 358 /* Dummy functions -- we don't use thread-based audio */
359 void 359 void
360 COREAUDIO_WaitAudio(_THIS) 360 COREAUDIO_WaitDevice(_THIS)
361 { 361 {
362 return; 362 return;
363 } 363 }
364 364
365 void 365 void
366 COREAUDIO_PlayAudio(_THIS) 366 COREAUDIO_PlayDevice(_THIS)
367 { 367 {
368 return; 368 return;
369 } 369 }
370 370
371 Uint8 * 371 Uint8 *
372 COREAUDIO_GetAudioBuf(_THIS) 372 COREAUDIO_GetDeviceBuf(_THIS)
373 { 373 {
374 return (NULL); 374 return (NULL);
375 } 375 }
376 376
377 void 377 void
378 COREAUDIO_CloseAudio(_THIS) 378 COREAUDIO_CloseDevice(_THIS)
379 { 379 {
380 if (this->hidden != NULL) { 380 if (this->hidden != NULL) {
381 OSStatus result = noErr; 381 OSStatus result = noErr;
382 AURenderCallbackStruct callback; 382 AURenderCallbackStruct callback;
383 const AudioUnitElement output_bus = 0; 383 const AudioUnitElement output_bus = 0;
405 } 405 }
406 406
407 407
408 #define CHECK_RESULT(msg) \ 408 #define CHECK_RESULT(msg) \
409 if (result != noErr) { \ 409 if (result != noErr) { \
410 COREAUDIO_CloseAudio(this); \ 410 COREAUDIO_CloseDevice(this); \
411 SDL_SetError("CoreAudio error (%s): %d", msg, (int) result); \ 411 SDL_SetError("CoreAudio error (%s): %d", msg, (int) result); \
412 return 0; \ 412 return 0; \
413 } 413 }
414 414
415 static int 415 static int
554 return 1; 554 return 1;
555 } 555 }
556 556
557 557
558 int 558 int
559 COREAUDIO_OpenAudio(_THIS, const char *devname, int iscapture) 559 COREAUDIO_OpenDevice(_THIS, const char *devname, int iscapture)
560 { 560 {
561 AudioStreamBasicDescription strdesc; 561 AudioStreamBasicDescription strdesc;
562 SDL_AudioFormat test_format = SDL_FirstAudioFormat(this->spec.format); 562 SDL_AudioFormat test_format = SDL_FirstAudioFormat(this->spec.format);
563 int valid_datatype = 0; 563 int valid_datatype = 0;
564 564