I want to generate a sample withAudioFilePlayerUnit to play 6 channel audio file. The issue here is that, the AudioFilePlayerUnit callback shows stereo channel in buffer, but the file loaded to the fileUnit was of 6 channels. I have tried setting the input and output format for the fileUnit to that of file's stream format(6 channels), but still the callback shows stereo channels in buffer. I have added my code snippet below.
OSStatus error = AudioFileOpenURL(audioFileURL, kAudioFileReadPermission, 0, &_audioInputFileId);
UInt32 dataSize = sizeof(AudioStreamBasicDescription); AudioFileGetProperty(_audioInputFileId, kAudioFilePropertyDataFormat, &dataSize, &_fileStreamDescription);
setting the input and outputFormat for the unit : UInt32 propertySize = sizeof(_fileStreamDescription);
AudioUnitScope scope = kAudioUnitScope_Input; OSStatus err = AudioUnitSetProperty(filePlayerUnit, kAudioUnitProperty_StreamFormat, scope, 0, &_fileStreamDescription, propertySize);
OSStatus err = AudioUnitSetProperty(filePlayerUnit, kAudioUnitProperty_StreamFormat, kAudioUnitScope_Output, 0, &_fileStreamDescription, propertySize);
here setting the input and output format also throws error.
I have added the callback using AudioUnitRenderNotify method to the fileUnit but when check the buffer in the callback I can see it returning as stereo channels.