| |||
| [Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] |
SCAudio is a QuickTime thing (which happens to make heavy use of CoreAudio), so I'm posting this answer back to the qt-api list as well... On Sep 11, 2006, at 5:14 AM, Sandeep Chandna wrote: plz c inline If you have a buffer of data, you don't have to copy it, you can just point your AudioBufferList's mData at it. For example, if you've got, say, a 512 frame buffer 16-bit PCM big endian, interleaved, stereo audio: // do a quick sanity check on the buffer list passed to you) assert(ioData->mNumberBuffers == 1); assert(ioData->mBuffers[0].mNumberChannels == 2); // point the abl buffer at your data buffer: ioData->mBuffers[0].mData = myDataBuffer; ioData->mBuffers[0].mDataByteSize = 2048; (512 * 2 channels * 2 bytes) You may not free "myDataBuffer" until 1) your input proc gets called again, or 2) SCAudioFillBuffer() returns.
Please look at CoreAudioTypes.h, it gives very good instruction on how to fill out an audio buffer list. For example, an ASBD for the above mentioned 16-bit PCM big endian, interleaved, stereo audio, would look like this: asbd.mFormatID = kAudioFormatLinearPCM; asbd.mSampleRate = 44100.0; // or whatever the sample rate is asbd.mFormatFlags = kAudioFormatFlagIsBigEndian | kAudioFormatFlagIsSignedInteger | kAudioFormatFlagIsPacked; asbd.mBytesPerPacket = 4; // 16-bit * 2 channels asbd.mFramesPerPacket = 1; // For PCM, frames per packet is always 1 asbd.mBytesPerFrame = 4; // for PCM, frames per packet and bytes per packet are equivalent asbd.mChannelsPerFrame = 2; asbd.mBitsPerChannel = 16; If you're filling out an asbd for a compressed format (to pass to SCAudio), you aren't required to fill out every field, you may just fill in the fields you know, for instance, for AAC, you might only know format id, sample rate, and number of channels, and set the rest of the fields to 0: asbd.mFormatID = kAudioFormatMPEG4AAC; asbd.mSampleRate = 44100.0; // or whatever the sample rate is asbd.mFormatFlags = 0; asbd.mBytesPerPacket = 0; asbd.mFramesPerPacket = 0; asbd.mBytesPerFrame = 0; asbd.mChannelsPerFrame = 2; asbd.mBitsPerChannel = 0; SCAudio will fill in the rest of the fields with the specifics. After setting the format on the component instance, you can then get the property, and the asbd returned will be fully populated. Alternately, if you already have a SoundDescription, for some reason, you can use the QTSoundDescription accessor API's in Movies.h to get an asbd for the format described by the SoundDescription. See QTSoundDescriptionGetProperty(). -Brad Ford QuickTime Engineering |
_______________________________________________ Do not post admin requests to the list. They will be ignored. QuickTime-API mailing list (email@hidden) Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/quicktime-api/email@hidden This email sent to email@hidden
| Home | Archives | FAQ | Terms/Conditions | Contact | RSS | Lists | About |
Visit the Apple Store online or at retail locations.
1-800-MY-APPLE
Contact Apple | Terms of Use | Privacy Policy
Copyright © 2007 Apple Inc. All rights reserved.