Re: Respecting Audio MIDI channel setup
Re: Respecting Audio MIDI channel setup
- Subject: Re: Respecting Audio MIDI channel setup
- From: Jeff Moore <email@hidden>
- Date: Wed, 16 Jun 2010 09:59:19 -0700
Given that you are setting the client format of the output unit to be equal to the output format, I suspect that the problem here is that you aren't respecting the channel layout of the device as specified by kAudioDevicePropertyPreferredChannelLayout. This property returns to you an AudioChannelLayout structure that has a description of the speaker arrangement and the job for each channel in the surround context.
--
Jeff Moore
Core Audio
Apple
On Jun 16, 2010, at 12:55 AM, Stevo Brock wrote:
> Hello,
>
> We have a customer issue where the audio is going out the wrong outputs in the customer's hardware (configuration image http://www.sunsetmagicwerks.com/images/AudioMidi.tiff). The customer says that other apps like iTunes and Quicktime Player play stereo audio out the hardware channels 5 & 6 whereas our applications play stereo audio out the hardware channels 1 & 2. Also attached below is our code to initialize Core Audio Playback which seems pretty basic and straightforward to me.
>
> What are we doing or not doing that is affecting the system in this way?
>
> -Stevo Brock
> Head of Development
> Monkey Tools, LLC
> www.monkey-tools.com
>
>
>
> if (sOutputUnitComponent == nil) {
> // Open Default Output Unit
> ComponentDescription desc;
> desc.componentType = kAudioUnitType_Output;
> desc.componentSubType = kAudioUnitSubType_DefaultOutput;
> desc.componentManufacturer = kAudioUnitManufacturer_Apple;
> desc.componentFlags = 0;
> desc.componentFlagsMask = 0;
> sOutputUnitComponent = ::FindNextComponent(nil, &desc);
>
> // We find it?
> if (sOutputUnitComponent == nil) {
> // No
> // Open AUHAL
> desc.componentType = kAudioUnitType_Output;
> desc.componentSubType = kAudioUnitSubType_HALOutput;
> desc.componentManufacturer = kAudioUnitManufacturer_Apple;
> desc.componentFlags = 0;
> desc.componentFlagsMask = 0;
> sOutputUnitComponent = ::FindNextComponent(nil, &desc);
> }
> }
>
> // We need one of them!
> ThrowIfNil(sOutputUnitComponent);
>
> // Open Output Unit
> error = MAKE_OSUError(::OpenAComponent(sOutputUnitComponent, &mPrivateData->mOutputUnit));
> ReportErrorAndReturnError(error, "opening component");
> mPrivateData->mComponentOpened = true;
>
> // Initialize
> error = MAKE_OSUError(::AudioUnitInitialize(mPrivateData->mOutputUnit));
> ReportErrorAndReturnError(error, "initializing output unit");
> mPrivateData->mOutputUnitInitialized = true;
>
> // Get output format
> Boolean writable;
> UInt32 size;
> ::AudioUnitGetPropertyInfo(mPrivateData->mOutputUnit,
> kAudioUnitProperty_StreamFormat, kAudioUnitScope_Output, 0, &size,
> &writable);
>
> error = MAKE_OSUError(::AudioUnitGetProperty(mPrivateData->mOutputUnit,
> kAudioUnitProperty_StreamFormat, kAudioUnitScope_Output, 0,
> &mPrivateData->mOutputFormat, &size));
> ReportErrorAndReturnError(error, "getting output unit output format");
>
> // Set input format to match
> error = MAKE_OSUError(::AudioUnitSetProperty(mPrivateData->mOutputUnit,
> kAudioUnitProperty_StreamFormat, kAudioUnitScope_Input, 0,
> &mPrivateData->mOutputFormat, size));
> ReportErrorAndReturnError(error, "setting output unit input format");
>
> // Set render callback
> AURenderCallbackStruct callback;
> callback.inputProc = sOutputUnitFillBuffer;
> callback.inputProcRefCon = mPrivateData;
> error = MAKE_OSUError(::AudioUnitSetProperty(mPrivateData->mOutputUnit,
> kAudioUnitProperty_SetRenderCallback, kAudioUnitScope_Input, 0, &callback,
> sizeof(AURenderCallbackStruct)));
> ReportErrorAndReturnError(error, "setting render callback for output unit");
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Coreaudio-api mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden