core audio , multi-channel output

Apple APIs and Mac audio software development
Post Reply
stephanschulz
Posts: 1
Joined: 06 May 2013, 06:15

core audio , multi-channel output

Post by stephanschulz » 06 May 2013, 06:27

hi

i have been looking every for examples on how to use multi channel output happen with core audio. but no luck so far.

i am used to writing my own software in c++ and objective-c, and i am able to put something together to get regular stereo outputs working. but nothing on how to talk to an audio device that has more then 2 channels

here is part of the code that works for stereo outputs:

UInt32 busCount = 3; //numberOfOutputBusses;
AudioStreamBasicDescription outputASBD2 = {
.mSampleRate = 44100,
.mFormatID = kAudioFormatLinearPCM,
.mFormatFlags = kAudioFormatFlagsAudioUnitCanonical,
.mChannelsPerFrame = busCount,
.mFramesPerPacket = 1,
.mBitsPerChannel = sizeof(Float32) * 8,
.mBytesPerPacket = sizeof(Float32) * busCount,
.mBytesPerFrame = sizeof(Float32) * busCount
};

AudioUnitSetProperty(*_unit,
kAudioUnitProperty_StreamFormat,
kAudioUnitScope_Output,
1,
&outputASBD2,
sizeof(AudioStreamBasicDescription);

any advice would be great.

thx.

Post Reply