Re: Getting data from microphone
Re: Getting data from microphone
- Subject: Re: Getting data from microphone
- From: Michael Thornburgh <email@hidden>
- Date: Sat, 13 Mar 2004 18:52:46 -0800
when you do AudioDeviceAddIOProc() and then AudioDeviceStart(), the HAL
will begin calling your IOProc periodically. the period is determined
by the kAudioDevicePropertyBufferFrameSize property.
when the HAL calls your IOProc, inInputData will be filled in with
samples from the input side of the device (like the microphone).
outOutputData will have buffer(s) initialized with 0s. to send samples
to the output side, you copy them into the provided buffer(s) in the
outOutputData AudioBufferList.
the above statement assumes that the device in question has both an
input side and an output side. if a device doesn't have one side or
the other, then the associated timestamp for that side will be NULL and
the corresponding inInputData or outOutputData pointer will be invalid.
for more information on the IO cycles, see the comments in
AudioHardware.h in the "IO Management" section for AudioDeviceIOProc
and AudioDeviceStart.
-mike
On Mar 13, 2004, at 5:08 PM, kante easley wrote:
Hi,
I have read through AudioHardware.h many times, and I still can't
figure out how to get data from my input AudioDevice. I have the
correct AudioDeviceID, and have all the corresponding information in an
AudioStreamBasicDescription filled in, but I'm lost as to what to do
next.
Which function do I call to get an AudioDataBuffer (with data in it)
from the device. The only function I can find that actually returns a
populated AudioBufferList is AudioDeviceRead, and I read in the
archives that this isn't the best way to do things.
Perhaps my problem is that I don't understand how IOProc's work. In
them I always see examples of code like
memcpy(outOutputData->mBuffers[0].mData,
inInputData->mBuffers[0].mData, size)
but where do the AudioBufferLists outOutputData, and inInputData come
from??? StartAudioDevice only passes a reference to an IOProc, but no
bufferlist. What is calling the IOProc? How do I give it the
outOutputData List?
Thank you for your patience!
Kante Easley
_______________________________________________
coreaudio-api mailing list | email@hidden
Help/Unsubscribe/Archives:
http://www.lists.apple.com/mailman/listinfo/coreaudio-api
Do not post admin requests to the list. They will be ignored.
_______________________________________________
coreaudio-api mailing list | email@hidden
Help/Unsubscribe/Archives:
http://www.lists.apple.com/mailman/listinfo/coreaudio-api
Do not post admin requests to the list. They will be ignored.