Re: AudioConverterNew unknown error
Re: AudioConverterNew unknown error
- Subject: Re: AudioConverterNew unknown error
- From: kelly jacklin <email@hidden>
- Date: Mon, 27 Sep 2004 05:17:26 -0700
On Sep 26, 2004, at 2:54 PM, Malcolm Haylock wrote:
I'm receiving error no. 29759 when I try to create a new audio
converter
between two formats with identical fields apart from mFormatFlags. The
source and destination fields are:
Actually, I'll bet you're really receiving
kAudioConverterErr_FormatNotSupported ('fmt?'), and then casting it to
an OSErr (which is a 16-bit value), right? 29759 == 0x743f == 't?'...
Try getting the return code as an OSStatus, and print it as a long
value.
mSampleRate=44100.0
mFormatID=lpcm
mFormatFlags=
source:
kLinearPCMFormatFlagIsSignedInteger |
kLinearPCMFormatFlagIsBigEndian |
kLinearPCMFormatFlagIsPacked;
destination:
kAudioFormatFlagIsNonInterleaved |
kAudioFormatFlagIsPacked |
kAudioFormatFlagIsBigEndian |
kLinearPCMFormatFlagIsFloat
mBytesPerPacket=32
mFramesPerPacket=1
mBytesPerFrame=32
mChannelsPerFrame=8
mBitsPerChannel=32
mReserved=0
So, you're trying to convert 8-channels from a source that is 32-bit
signed integer, interleaved to non-interleaved 32-bit float format,
right?
If the destination is not interleaved, you need to set mBytesPerFrame
(and thus mBytesPerPacket) to 4 (i.e. bytes per channel sample), not
32. You only multiple out by mChannelsPerFrame if you are doing
interleaved.
Thus your destination format is not self-consistent, so the
AudioConverter is returning kAudioConverterErr_FormatNotSupported.
All works fine when I remove the kAudioFormatFlagIsNonInterleaved flag
from the destination.
And this would make perfect sense, since for interleaved it should be
32, whereas for non-interleaved it should be 4.
I still suggest you use the proper type for receiving your return
codes, though, as this will continue to be confusing for you in the
future if you use a short to receive an OSStatus.
Hope this helps...
kelly
_______________________________________________
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