Is this the correct forum?

If yes I have several questions:

I need to convert formatted audio(mp3, etc) files to continuous, linear pcm data in a memory buffer--i.e., a basic process of reading from disc, converting, and transferring to buffer.

Using Core Audio, I infer that I can to do the following:

1. Read formatted audio data into an input buffer--NSHandle methods do this just fine.

2. Create a file stream parser-- i.e.,
AudioFileStreamOpen( self, propertyCallback, packetCallback, hint, &fileParserID )

3. Parse the buffered input--
AudioFileStreamParseBytes( fileParserID, inBufSize, inBuffer, 0 );

4. (in propertyCallback function) -- when inPropertyID is "..._ReadyToProducePackets":
    a.  Get AudioStreamBasicDescription--
            AudioFileStreamGetProperty( inAudioFileStream,
                                kAudioFileStreamProperty_DataFormat, &asbdSize, 
&asbd );
         -All seems ok to here.-
    b.  Establish an audio queue--.
            AudioQueueNewOutput( &asbd, queueCallback, inBuffer,
                                                                                
NULL, NULL, 0, &queue);
?? What does the callback process need to do, or is it needed,
                  given offline rendering??
    c.  Allocate an audio queue buffer
            AudioQueueAllocateBuffer( queue, nbytes, &queueBuffer );
    d.  Set queue to render offline
AudioQueueSetOfflineRenderFormat( queue, &asbd, &chLayout ); ?? What setting for channel layout & why is it needed for offline??

5. (in packetCallback) -- at each step of looping through the parsed packets:
    a.  Copy packet data to queue buffer
memcpy( queueBuffer->mAudioData +bytesFilled, inInputData +pcktOffset, pcktSize)
    b.  Update bytesFilled and pcktOffset
    -- then after loop completion (or perhaps within the loop):
    c.    Render the packet data to pcm
AudioQueueOfflineRender( queue, timeStamp, outputBuffer, mFramesPerPacket) ?? Why timestamp for offline? And can timeStamp be set as NULL?? ?? I assume that the output pcm is SInt16 for each channel of each frame. If so, this means that for an mp3 case, 1152 frames/pckt & 2 chan/ftm, the pcm output for every packet should be 4608 bytes. However, for that case, the variable queueBuffer->mAudioDataBytesCapacity = 4640. Why the extra 32 bytes (or am I misunderstanding DataBytesCapacity variable)??
        ?? At this point, with a 0 time stamp I get an error code = -66626.
              I cannot find any reference to this error--what doe it mean??

I'll appreciate any and all help and advice.  Thanks, Don Thompson
_______________________________________________

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com

Reply via email to