Re: implementing an AudioIOFunction
Re: implementing an AudioIOFunction
- Subject: Re: implementing an AudioIOFunction
- From: "Herb Petschauer" <email@hidden>
- Date: Sun, 24 Dec 2006 17:34:55 -0800
This may not help you at all (I'm just killing time waiting for my turn at the oven on Xmas Eve :-) ). Have you looked at /Developer/Examples/Kernel/IOKit/Audio/PhantomAudioDriver/PhantomAudioEngine.cpp? Search on AudioIOFunction and you will get a hit. This is probably old news but thought I'd chime in...
Cheers,
-H.
On 23/12/06, Josh Rodatus <email@hidden> wrote:
Greetings,
I am writing a KEXT that taps system audio output by first locating the
output IOAudioStream object in the registry, and then calling its
setIOFunction() method to install a custom AudioIOFunction in the
pipeline.
The typedef for an AudioIOFunction as declared in IOAudioStream.h is:
typedef IOReturn (*AudioIOFunction)(const void *mixBuf, void
*sampleBuf, UInt32 firstSampleFrame, UInt32 numSampleFrames, const
IOAudioStreamFormat *streamFormat, IOAudioStream *audioStream);
The problem is that installing my IO function prevents any output audio
from reaching the device. All I can figure is that an AudioIOFunction
is expected to copy a section of mixBuf into sampleBuf, or vice versa.
Unfortunately my attempts copying the samples from one buffer to the
other only result in distorted output audio.
Here's how I'm copying it:
IOReturn AudioIOProc(const void *mixBuf, void *sampleBuf, UInt32
firstSampleFrame, UInt32 numSampleFrames, const IOAudioStreamFormat
*streamFormat, IOAudioStream *audioStream) {
{
void *samples = (float *)mixBuf + (firstSampleFrame *
streamFormat->fNumChannels);
size_t size = numSampleFrames * sizeof(float) *
streamFormat->fNumChannels;
bcopy(samples, sampleBuf, size);
return kIOReturnSuccess;
}
I tried Googling for source code and documentation, to no avail. If
anyone could give some advice or instruction on how to properly
implement an AudioIOFunction, I would be most grateful.
Thanks,
Josh
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Darwin-kernel mailing list (email@hidden
This email sent to email@hidden
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Darwin-kernel mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden