comparison src/audio/macosx/SDL_coreaudio.c @ 3830:29e83f221c62 SDL-ryan-multiple-audio-device

Fixed some things to use SDL C runtime functions.
author Ryan C. Gordon <icculus@icculus.org>
date Sat, 07 Oct 2006 19:56:47 +0000
parents 9d070c1a45fa
children 66fb40445587
comparison
equal deleted inserted replaced
3829:d3171647e661 3830:29e83f221c62
331 331
332 /* stop processing the audio unit */ 332 /* stop processing the audio unit */
333 result = AudioOutputUnitStop(this->hidden->audioUnit); 333 result = AudioOutputUnitStop(this->hidden->audioUnit);
334 334
335 /* Remove the input callback */ 335 /* Remove the input callback */
336 memset(&callback, '\0', sizeof (AURenderCallbackStruct)); 336 SDL_memset(&callback, '\0', sizeof (AURenderCallbackStruct));
337 result = AudioUnitSetProperty(this->hidden->audioUnit, 337 result = AudioUnitSetProperty(this->hidden->audioUnit,
338 kAudioUnitProperty_SetRenderCallback, 338 kAudioUnitProperty_SetRenderCallback,
339 scope, bus, &callback, sizeof (callback)); 339 scope, bus, &callback, sizeof (callback));
340 340
341 CloseComponent(this->hidden->audioUnit); 341 CloseComponent(this->hidden->audioUnit);
423 if (!find_device_by_name(this, devname, iscapture)) { 423 if (!find_device_by_name(this, devname, iscapture)) {
424 SDL_SetError("Couldn't find requested CoreAudio device"); 424 SDL_SetError("Couldn't find requested CoreAudio device");
425 return 0; 425 return 0;
426 } 426 }
427 427
428 memset(&desc, '\0', sizeof(ComponentDescription)); 428 SDL_memset(&desc, '\0', sizeof(ComponentDescription));
429 desc.componentType = kAudioUnitType_Output; 429 desc.componentType = kAudioUnitType_Output;
430 desc.componentSubType = kAudioUnitSubType_HALOutput; 430 desc.componentSubType = kAudioUnitSubType_HALOutput;
431 desc.componentManufacturer = kAudioUnitManufacturer_Apple; 431 desc.componentManufacturer = kAudioUnitManufacturer_Apple;
432 432
433 comp = FindNextComponent(NULL, &desc); 433 comp = FindNextComponent(NULL, &desc);
468 kAudioUnitProperty_StreamFormat, 468 kAudioUnitProperty_StreamFormat,
469 scope, bus, strdesc, sizeof (*strdesc)); 469 scope, bus, strdesc, sizeof (*strdesc));
470 CHECK_RESULT("AudioUnitSetProperty (kAudioUnitProperty_StreamFormat)"); 470 CHECK_RESULT("AudioUnitSetProperty (kAudioUnitProperty_StreamFormat)");
471 471
472 /* Set the audio callback */ 472 /* Set the audio callback */
473 memset(&callback, '\0', sizeof (AURenderCallbackStruct)); 473 SDL_memset(&callback, '\0', sizeof (AURenderCallbackStruct));
474 callback.inputProc = ((iscapture) ? inputCallback : outputCallback); 474 callback.inputProc = ((iscapture) ? inputCallback : outputCallback);
475 callback.inputProcRefCon = this; 475 callback.inputProcRefCon = this;
476 result = AudioUnitSetProperty(this->hidden->audioUnit, 476 result = AudioUnitSetProperty(this->hidden->audioUnit,
477 kAudioUnitProperty_SetRenderCallback, 477 kAudioUnitProperty_SetRenderCallback,
478 scope, bus, &callback, sizeof (callback)); 478 scope, bus, &callback, sizeof (callback));
512 return (0); 512 return (0);
513 } 513 }
514 SDL_memset(this->hidden, 0, (sizeof *this->hidden)); 514 SDL_memset(this->hidden, 0, (sizeof *this->hidden));
515 515
516 /* Setup a AudioStreamBasicDescription with the requested format */ 516 /* Setup a AudioStreamBasicDescription with the requested format */
517 memset(&strdesc, '\0', sizeof(AudioStreamBasicDescription)); 517 SDL_memset(&strdesc, '\0', sizeof(AudioStreamBasicDescription));
518 strdesc.mFormatID = kAudioFormatLinearPCM; 518 strdesc.mFormatID = kAudioFormatLinearPCM;
519 strdesc.mFormatFlags = kLinearPCMFormatFlagIsPacked; 519 strdesc.mFormatFlags = kLinearPCMFormatFlagIsPacked;
520 strdesc.mChannelsPerFrame = this->spec.channels; 520 strdesc.mChannelsPerFrame = this->spec.channels;
521 strdesc.mSampleRate = this->spec.freq; 521 strdesc.mSampleRate = this->spec.freq;
522 strdesc.mFramesPerPacket = 1; 522 strdesc.mFramesPerPacket = 1;