Hi Anthony,
my software already plays mp3 files by using
CFRunLoopRunInMode (kCFRunLoopDefaultMode, AUDIO_TRUNK_SIZE, false);
So, I already create a queue buffer with
status = AudioQueueNewOutput ( // 1
&aqData.mDataFormat, // 2
HandleOutputBuffer, // 3
&aqData, // 4
CFRunLoopGetCurrent (), // 5
kCFRunLoopCommonModes, // 6
0, // 7
&aqData.mQueue // 8
);
and I have the callback function:
static void HandleOutputBuffer (
void *aqData,
AudioQueueRef inAQ,
AudioQueueBufferRef inBuffer
)
{
// std::cout << "cb" << std::endl;
OSStatus status;
AQPlayerState *pAqData = (AQPlayerState *) aqData; // 1
if (pAqData->mIsRunning == 0) return; // 2
UInt32 numBytesReadFromFile; // 3
UInt32 numPackets = pAqData->mNumPacketsToRead; // 4
status = AudioFileReadPackets (
pAqData->mAudioFile,
false,
&numBytesReadFromFile,
pAqData->mPacketDescs,
pAqData->mCurrentPacket,
&numPackets,
inBuffer->mAudioData
);
// checkStatus(status);
if (numPackets > 0) { // 5
inBuffer->mAudioDataByteSize = numBytesReadFromFile; // 6
status = AudioQueueEnqueueBuffer (
pAqData->mQueue,
inBuffer,
(pAqData->mPacketDescs ? numPackets : 0),
pAqData->mPacketDescs
);
// checkStatus(status);
pAqData->mCurrentPacket += numPackets; // 7
} else {
status = AudioQueueStop (
pAqData->mQueue,
false
);
// checkStatus(status);
pAqData->mIsRunning = false;
}
}
Am I on the right pathway?
Thanx in advance.
Dodo
Il giorno 03/set/2014, alle ore 07:25, Anthony Myatt <
email@hidden> ha scritto:
Hi Dodo,
In order to stream the audio of an output device, you will first need to tap into the output device stream to get the audio data.
Unfortunately this can’t be done easily, but has been achieved by others.
A program called "WireTap Studio” does this using a kernel extension and helper daemon.
More specifically, the kernel extension (kext) uses IOAudioEngine.
Basically, this won’t be an easy task.
Maybe someone else on the CoreAudio-API mailing list can help.
Regards,
Anthony
On 3 Sep 2014, at 12:21 am, claudio santoro <
email@hidden> wrote:
I thing I messed up with the email addresses.
I apolagize.
Cheers
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