// Get the ASBD from the player unit, update with channels
UInt32 playerASBDsize;
checkError(AudioUnitGetProperty(_playerUnit,
kAudioUnitProperty_StreamFormat,
kAudioUnitScope_Output,
BUS_PLAYER_OUTPUT,
&_playerASBD,
&playerASBDsize),
"AudioUnitSetProperty failed: getting stream format from the player unit", false);
_playerASBD.mChannelsPerFrame = 2;
_playerASBD.mSampleRate = 44100.0;
checkError(AudioUnitSetProperty(_playerUnit,
kAudioUnitProperty_StreamFormat,
kAudioUnitScope_Output,
BUS_PLAYER_OUTPUT,
&_playerASBD,
sizeof(_playerASBD)),
"AudioUnitSetProperty failed: setting channels & sample rate to player output ASBD", false);
That's all I do with stream formats for a file player hooked to a multichannel mixer. (I do set mixer output, RIO input etc.)
Hope that helps.
On 24 Dec 2012, at 23:36, n ketter wrote:
I've specified and instantiated two Audio Units: a multichannel mixer unit and a generator of subtype AudioFilePlayer.
I would have thought I needed to set the ASBD of the filePlayer's output to match the ASBD I set for the mixer input. However when I attempt to set the filePlayer's output I get a kAudioUnitErr_FormatNotSupported (-10868) error.
Here's the stream format I set on the mixer input (successfully) and am also trying to set on the filePlayer (it's the monostream format copied from Apple's "mixerhost" sample project):
Sample Rate: 44100
Format ID: lpcm
Format Flags: C
Bytes per Packet: 2
Frames per Packet: 1
Bytes per Frame: 2
Channels per Frame: 1
Bits per Channel: 16
In the course of troubleshooting this I queried the filePlayer AU for the format it is 'natively' set to. This is what's returned:
Sample Rate: 44100
Format ID: lpcm
Format Flags: 29
Bytes per Packet: 4
Frames per Packet: 1
Bytes per Frame: 4
Channels per Frame: 2
Bits per Channel: 32
All the example code I've found sends the output of the filePlayer unit to an effect unit and set the filePlayer's output to match the ASBD set for the effect unit. Given I have no effect unit it seems like setting the filePlayer's output to the mixer input's ASBD would be the correct - and required - thing to do.
Clearly I'm missing something.
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