Re: HALOutputUnit (Pt 1)
Re: HALOutputUnit (Pt 1)
- Subject: Re: HALOutputUnit (Pt 1)
- From: Bob Stuller <email@hidden>
- Date: Tue, 3 Feb 2004 18:35:21 -0500
Doug, Greetings!
At 12:17 PM -0800 2/3/04, Doug Wyatt wrote:
On Feb 3, 2004, at 10:47, Bob Stuller wrote:
Okay, I'm stuck. I'm trying to use the HALOutputUnit to pull
16-bit audio at 16 kHz and,
when I get to the point of trying to set these settings, I get a
kAudioUnitErr_PropertyNotWritable error. Here is sketch of the
code that I am using.
AudioStreamBasicDescription format;
memset(&format, 0, sizeof(AudioStreamBasicDescription));
format.mSampleRate = 16000.0;
format.mBytesPerFrame = 2;
format.mFramesPerPacket = 1;
format.mBytesPerPacket = 2;
format.mChannelsPerFrame = 1;
format.mBitsPerChannel = 16;
format.mFormatID = kAudioFormatLinearPCM;
format.mFormatFlags = kLinearPCMFormatFlagIsBigEndian
// | kLinearPCMFormatFlagIsSignedInteger
| kLinearPCMFormatFlagIsPacked
| kLinearPCMFormatFlagIsNonInterleaved;
status = AudioUnitSetProperty(mHALOutInstance,
kAudioUnitProperty_StreamFormat,
kAudioUnitScope_Input,
1, &format, sizeof(format));
This is the AudioUnitSetProperty call that returns the NotWritable
error. Where did I go wrong here?
element 1's input scope is the hardware input format -- you want to
be changing its format in the output scope
Changing the code above to:
status = AudioUnitSetProperty(mHALOutInstance,
kAudioUnitProperty_StreamFormat,
kAudioUnitScope_Output,
1, &format, sizeof(format));
<<
... gets me a kAudioFormatUnsupportedDataFormatError. Adding the
kLinearPCMFormatFlagIsSignedInteger flag to the format makes that
error go away however. Going back to my requirements, I find that I
need signed integers but was left wondering: Can't the HALOutputUnit
make that particular conversion?
Peace,
Bob
--
Just because you do not take an interest in politics doesn't mean
politics won't take an interest in you.
-- Pericles (430 B.C.)
_______________________________________________
coreaudio-api mailing list | email@hidden
Help/Unsubscribe/Archives:
http://www.lists.apple.com/mailman/listinfo/coreaudio-api
Do not post admin requests to the list. They will be ignored.