comparison src/audio/macosx/SDL_coreaudio.c @ 3637:8a46b3eab813

Since we're not using the CoreAudio HAL now, we don't need to use EnableIO. I think that's how it works. Fixes failure to open audio device on Mac OS X.
author Ryan C. Gordon <icculus@icculus.org>
date Mon, 11 Jan 2010 07:45:34 +0000
parents e474a820daeb
children f7b03b6838cb
comparison
equal deleted inserted replaced
3636:e474a820daeb 3637:8a46b3eab813
418 { 418 {
419 OSStatus result = noErr; 419 OSStatus result = noErr;
420 AURenderCallbackStruct callback; 420 AURenderCallbackStruct callback;
421 ComponentDescription desc; 421 ComponentDescription desc;
422 Component comp = NULL; 422 Component comp = NULL;
423 UInt32 enableIO = 0;
424 const AudioUnitElement output_bus = 0; 423 const AudioUnitElement output_bus = 0;
425 const AudioUnitElement input_bus = 1; 424 const AudioUnitElement input_bus = 1;
426 const AudioUnitElement bus = ((iscapture) ? input_bus : output_bus); 425 const AudioUnitElement bus = ((iscapture) ? input_bus : output_bus);
427 const AudioUnitScope scope = ((iscapture) ? kAudioUnitScope_Output : 426 const AudioUnitScope scope = ((iscapture) ? kAudioUnitScope_Output :
428 kAudioUnitScope_Input); 427 kAudioUnitScope_Input);
446 /* Open & initialize the audio unit */ 445 /* Open & initialize the audio unit */
447 result = OpenAComponent(comp, &this->hidden->audioUnit); 446 result = OpenAComponent(comp, &this->hidden->audioUnit);
448 CHECK_RESULT("OpenAComponent"); 447 CHECK_RESULT("OpenAComponent");
449 448
450 this->hidden->audioUnitOpened = 1; 449 this->hidden->audioUnitOpened = 1;
451
452 // !!! FIXME: this is wrong?
453 enableIO = ((iscapture) ? 1 : 0);
454 result = AudioUnitSetProperty(this->hidden->audioUnit,
455 kAudioOutputUnitProperty_EnableIO,
456 kAudioUnitScope_Input, input_bus,
457 &enableIO, sizeof(enableIO));
458 CHECK_RESULT("AudioUnitSetProperty (kAudioUnitProperty_EnableIO input)");
459
460 // !!! FIXME: this is wrong?
461 enableIO = ((iscapture) ? 0 : 1);
462 result = AudioUnitSetProperty(this->hidden->audioUnit,
463 kAudioOutputUnitProperty_EnableIO,
464 kAudioUnitScope_Output, output_bus,
465 &enableIO, sizeof(enableIO));
466 CHECK_RESULT("AudioUnitSetProperty (kAudioUnitProperty_EnableIO output)");
467 450
468 result = AudioUnitSetProperty(this->hidden->audioUnit, 451 result = AudioUnitSetProperty(this->hidden->audioUnit,
469 kAudioOutputUnitProperty_CurrentDevice, 452 kAudioOutputUnitProperty_CurrentDevice,
470 kAudioUnitScope_Global, 0, 453 kAudioUnitScope_Global, 0,
471 &this->hidden->deviceID, 454 &this->hidden->deviceID,