Re: kAudioStreamPropertyPhysicalFormats (repost)
Re: kAudioStreamPropertyPhysicalFormats (repost)
- Subject: Re: kAudioStreamPropertyPhysicalFormats (repost)
- From: "Mikael Hakman" <email@hidden>
- Date: Tue, 5 Aug 2008 15:57:25 +0200
- Organization: Datakonsulten AB
Thanks Jeff, of course both calls work correctly if calling code is correct
which mine wasn't. Selector used in ObjectGetPropertyData was
kAudioStreamPropertyPhysicalFormats, it should be
kAudioStreamPropertyAvailablePhysicalFormats. I apologize for taking up your
time with such a trivial matter.
Regards/Mikael
On Monday, August 04, 2008 8:16 PM, Jeff Moore wrote:
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