Re: kAudioStreamPropertyPhysicalFormats (repost)
Re: kAudioStreamPropertyPhysicalFormats (repost)
- Subject: Re: kAudioStreamPropertyPhysicalFormats (repost)
- From: Jeff Moore <email@hidden>
- Date: Mon, 04 Aug 2008 11:16:55 -0700
My test code seems to work OK. Plus, AudioStreamGetProperty is
implemented internally in terms of AudioObjectGetPropertyData. So
internally, it is all the same code path no matter which API call you
make.
There are other pieces of the puzzle missing here.
On Aug 3, 2008, at 5:54 AM, Mikael Hakman wrote:
I have an issue with using kAudioStreamPropertyPhysicalFormats to
get physical formats supported by a device. If I use the following
code it works ok.
OSStatus os = 0;
AudioObjectPropertyAddress inAddr;
inAddr.mSelector = kAudioStreamPropertyPhysicalFormats;
inAddr.mScope = kAudioObjectPropertyScopeGlobal;
inAddr.mElement = 0;
UInt32 ioSize;
// os = AudioObjectGetPropertyDataSize (this->streamID,&inAddr,
0,NULL,&ioSize);
Boolean writable;
os = AudioStreamGetPropertyInfo (this->streamID,
0,kAudioStreamPropertyAvailablePhysicalFormats,&ioSize,&writable);
assert (os == 0);
int fmtCnt = ioSize / sizeof (AudioStreamRangedDescription);
assert (fmtCnt > 0);
AudioStreamRangedDescription * asrds = (AudioStreamRangedDescription
*) malloc (ioSize);
assert (asrds != NULL);
// os = AudioObjectGetPropertyData (this->streamID,&inAddr,
0,NULL,&ioSize,asrds);
os = AudioStreamGetProperty (this->streamID,
0,kAudioStreamPropertyAvailablePhysicalFormats,&ioSize,asrds);
assert (os == 0);
However if I comment out the 2 AudioStreamGetProperty calls and
uncomment
corresponding 2 AudioObjectGetProperty calls instead (this is the new
recommended way), the returned array of AudioStreamRangedDescription
seems
to be garbled. First returned element appears to be ok but following
elements appear not to contain meaningful values.
It looks as if there were some struct/array element alignment
problems.
--
Jeff Moore
Core Audio
Apple
_______________________________________________
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