Re: Error -66626
Re: Error -66626
- Subject: Re: Error -66626
- From: dct <email@hidden>
- Date: Fri, 22 May 2009 17:01:40 -0700
Thank you very much. But please excuse a (probably) dumb question:
If a parsed input packet represents 1152 * 2 (Frames/Packet * channels/
Frame) individual data samples, then shouldn't orf.mBytesPerPacket =
sizeof(SInt16) * ord.mChannelsPerFrame * ff.mFramesPerPacket?
On May 22, 2009, at 4:35 PM, Doug Wyatt wrote:
The file format is correct. Just construct a correct PCM
AudioStreamBasicDescription to pass to
AudioQueueSetOfflineRenderFormat, e.g.
AudioStreamBasicDescription orf; // "offline render format"
AudioStreamBasicDescription ff; // file sample rate, obtained earlier
orf.mSampleRate = ff.mSampleRate;
orf.mFormatID = kAudioFormatLinearPCM;
orf.mFormatFlags = kAudioFormatFlagIsSignedInteger |
kAudioFormatFlagsNativeEndian | kAudioFormatFlagIsPacked;
orf.mFramesPerPacket = 1;
orf.mChannelsPerFrame = ff.mChannelsPerFrame;
orf.mBitsPerChannel = 16;
orf.mBytesPerFrame = orf.mBytesPerPacket = sizeof(SInt16) *
ord.mChannelsPerFrame;
On May 22, 2009, at 16:30 , dct wrote:
Bill, thanks.
Apparently I didn't explain my intent -- I want to convert
formatted audio ( mp3, etc.) to linear pcm (SInt16 will do nicely).
I do notice that the AudioStreamBasicDescription, asbd, returned
with AudioFileStreamProperty has a number of zero values for a
given mp3 input , specifically:
mSampleRate = 44100 (as expected)
mFormatID = 778924083 (mp3 as expected)
mFormatFlags = 0
mBytesPerPacket = 0 (is this ok?)
mFramesPerPacket = 1152 (seems right, 9 blocks of 128 each, or 8
overlapping of 256 each)
mBytesPerFrame = 0 (is this ok?)
mChannelsPerFrame = 2 ( seems right, input is stereo)
mBitsPerChannel = 0 (is this ok?)
On May 22, 2009, at 3:55 PM, William Stewart wrote:
On May 22, 2009, at 3:00 PM, dct wrote:
OKThe call is:
err = AudioQueueSetOfflineRenderFormat( queue, asbd, &chLayout );
"asbd" is being set by:
err = AudioFileStreamProperty( inAudioFileStream,
kAudioFileStreamProperty_DataFormat, &asbdSize, &asbd);
where: asbd is an AudioStreamBasicDescription
structure, asbdSize = sizeof(asbd), and
inAudioFileStream is the
AudioFileStreamID passed to propertyCallback.
err= 0.
Depends what the format of the data is in the file, but this is
not the intention of using the audio queue. The reason that you
would use an audio queue here is to transform the data from the
file format to an uncompressed format (linear pcm).
If you set the output format of the queue to the same as the file
- why have a queue at all? Just read the raw packets straight from
the file and you are done.
So, the asbd you want to provide to RenderFormat is a linear pcm,
probably 16 bit, probably same number of channels as the file, and
the sample rate you want.
"chLayout" is set:
chLayout.mChannelLayoutTag = kAudioChannelLayoutTag =
kAudioChannelLayoutTag_Mono;
chLayout.mChannelBitmap = 0;
chLayout.mNumberChannelDescriptions = 1;
?? Would { 0,0,0 } be proper for offline?
You don't need to provide channel descriptions - just the tag is
sufficient (the Mono one)
Don
On May 22, 2009, at 2:28 PM, Doug Wyatt wrote:
1718449215 = 'fmt?'
So there's something wrong with the format being set...
Doug
On May 22, 2009, at 14:20 , dct wrote:
I hadn't set an "err = " at the
AudioQueueSetOfflineRenderFormat call.
Having done so, I now get an error equal to: 1718449215.
Don
On May 22, 2009, at 1:51 PM, Doug Wyatt wrote:
I hope to document that error in a future release.
But for now, it only comes from two places:
- trying to change kAudioQueueProperty_CurrentDevice when the
queue is in offline mode
- calling AudioQueueOfflineRender when the queue is not in
offline mode
"In offline mode" means that AudioQueueSetOfflineRenderFormat
has been called with a non-NULL stream format and succeeded.
Did you get an error result from
AudioQueueSetOfflineRenderFormat?
Doug
On May 22, 2009, at 11:47 , dct wrote:
Doug, thank for the reply.
I don't think that's it; I do call
AudioQueueSetOfflineRenderFormat.
My sequence of Core Audio function calls goes as follows:
- AudioFileStreamOpen(self, propertyCallback, packetCallback,
hint, &parserID);
- err = AudioFileStreamParseBytes(parserID, inBufSize,
inBuffer,
kAudioFileStreamParseFlag_Discontinuity );
(in propertyCallback)
- err = AudioFileStreamGetProperty( inAudioFileStream,
kAudioFileStreamProperty_DataFormat, &asbdSize, &asbd);
- err = AudioQueueNewOutput(&asbd, audioQueueCallback,
inBuffer,
NULL, NULL, 0, &queue);
- AudioQueueAllocateBuffer( queue, nn, &queueBuffer );
-AudioQueueSetOfflineRenderFormat( queue, &asbd, &chLayout );
(in propertyCallback)
- err = AudioQueueOfflineRender( dcdrData->queue, &ts,
outBuffer, asbd.mFramesPerPacket );
( ts is a time stamp with ts.mSampleTime=0 & ts.mHostTime
= sys clock time)
Here I get err = -66626 and outBuffer seems to contain only 0s.
On May 21, 2009, at 6:24 PM, Doug Wyatt wrote:
Maybe you didn't call AudioQueueSetOfflineRenderFormat first?
_______________________________________________
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
_______________________________________________
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