Set kAudioUnitProperty_StreamFormat seems to be broken
Set kAudioUnitProperty_StreamFormat seems to be broken
- Subject: Set kAudioUnitProperty_StreamFormat seems to be broken
- From: Brian Barnes <email@hidden>
- Date: Fri, 28 Sep 2001 01:19:36 -0400
Alright. I've got it to play AIFFs. I'll post my code as soon as
somebody tells me what this problem is (and answers any of my other
outstanding questions!)
I queried the AU "kAudioUnitProperty_StreamFormat" and got this:
austream.mSampleRate=44100;
austream.mFormatID=kAudioFormatLinearPCM;
austream.mFormatFlags=kLinearPCMFormatFlagIsFloat|kLinearPCMFormatFlagIsBigEndian|
kLinearPCMFormatFlagIsPacked;
austream.mBytesPerPacket=8;
austream.mFramesPerPacket=1;
austream.mBytesPerFrame=8;
austream.mChannelsPerFrame=2;
austream.mBitsPerChannel=32;
So, I make an AIFF just like that, 44.1, 16-bit, stereo. Works like a
charm!
Then, I redo the AIFF to make it mono, and run this code:
austream.mSampleRate=44100;
austream.mFormatID=kAudioFormatLinearPCM;
austream.mFormatFlags=kLinearPCMFormatFlagIsFloat|kLinearPCMFormatFlagIsBigEndian|
kLinearPCMFormatFlagIsPacked;
austream.mBytesPerPacket=4;
austream.mFramesPerPacket=1;
austream.mBytesPerFrame=4;
austream.mChannelsPerFrame=1;
austream.mBitsPerChannel=32;
err=AudioUnitSetProperty(audiounit,kAudioUnitProperty_StreamFormat,kAudioUnitScope_Input,
0,(void*)&austream,sizeof(AudioStreamBasicDescription));
AudioUnitSetProperty returns WITHOUT an error, but the sound AIFF plays
twice as fast (the default settings are still in effect.) I moved
around the places I call this, to no effect. I can give my sample code
if somebody at Apple wants to check this out.
[>] Brian