Convert an in-memory mp3 file to PCM
Convert an in-memory mp3 file to PCM
- Subject: Convert an in-memory mp3 file to PCM
- From: claudio santoro <email@hidden>
- Date: Tue, 30 Sep 2014 10:50:38 +0200
Hi all,
I have a c++ mediaplayer that playes mp3 files and in its callback function I'd like to get the pcm flow of the buffer that is being playing.
This is my playback callback:
static void HandleOutputBuffer (
void *aqData,
AudioQueueRef inAQ,
AudioQueueBufferRef inBuffer
)
{
OSStatus status;
AQPlayerState *pAqData = (AQPlayerState *) aqData;
if (pAqData->mIsRunning == 0) return;
UInt32 numBytesReadFromFile;
UInt32 numPackets = pAqData->mNumPacketsToRead;
status = AudioFileReadPackets (
pAqData->mAudioFile,
false,
&numBytesReadFromFile,
pAqData->mPacketDescs,
pAqData->mCurrentPacket,
&numPackets,
inBuffer->mAudioData
);
// checkStatus(status);
if (numPackets > 0) {
inBuffer->mAudioDataByteSize = numBytesReadFromFile;
status = AudioQueueEnqueueBuffer (
pAqData->mQueue,
inBuffer,
(pAqData->mPacketDescs ? numPackets : 0),
pAqData->mPacketDescs
);
// checkStatus(status);
pAqData->mCurrentPacket += numPackets;
// Here: how to retreve the PCM from the buffer???
}
Can you tell me how to get the PCM of the buffer? I'd need it because I need to make a merge/mix with the line in microphone.
Thanx in advance.
Dodo
_______________________________________________
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