Using HALOutputUnit as an Input AU redux
Using HALOutputUnit as an Input AU redux
- Subject: Using HALOutputUnit as an Input AU redux
- From: Robert Grant <email@hidden>
- Date: Sat, 17 Jan 2004 12:48:46 -0500
Hi Craig,
Yes it was disappointing and I'm sure it's achievable. Here's what I've
learnt so far and it sounds like if you don't have a USB audio IO
device then it should be plain sailing (unfortunately I think a lot of
users are in the USB audio spot though). Anyway here's the scoop as I
understand it:
First load up a HALOutputUnit.
Next EnableIO the Input and Output busses (assuming you're wanting the
easiest, bi-directional approach first). This will always succeed
because it can't know if it will fail.
Now point it at the AudioDevice you want to use using James's example
code.
Next find out whether you got an Input bus by calling HasIO on input
bus 1. If it returns 1 in the property value then you're golden - you
can wire the input bus into your graph and you're done.
If it returns 0 it means you can't do input with that device and you'll
have to enter my world of pain... :-)
Pull up another HALOutputUnit
Enable the input bus and disable the output bus
Set the AudioDevice to an input device - what's unclear to me is how to
find the input USB device that corresponds to the output USB device.
Check the HasIO is enabled for the input bus.
If yes - then you've got some work to do:
Register the SetInputCallback to capture the incoming audio.
Create an AudioBufferList and buffers to save the audio buffers you
can find out the size of the buffers to create with
kAudioDevicePropertyBufferFrameSize.
When the Callback is fired
Call AudioUnitRender with your own buffers but with the frames and
timeStamp parameters passed in.
Manually wire in your audio capture code to the graph using
SetRenderCallback.
In the callback copy the saved buffers in the callback AudioBufferList.
(Unfortunately for me doing this ends with a locked computer and a
forced reboot.)
If no give up or, if you want to write your own audio input and do all
the synchronization work yourself, take a look at the AudioThru or
PlayEffect examples. (I tried adapting the PlayEffect sample code but
still ended up with major latency issues and occasional freezes).
That's what I have so far,
Robert.
On Jan 16, 2004, at 9:17 AM, Craig Bakalian wrote:
Hi,
I was following this thread and learning from it. I was disappointed
when you gave up. Yet, I may find time to try this. Could you just
tell me one thing, how are you setting the device. I know how to get
an AudioDevice, yet, I don't know how to set it to the
kAudioUnitSubType_HALOutput. Do you use the AudioUnitSetProperty()
with kAudioOutputUnitProperty_CurrentDevice. If so, what does the call
look like or what are the other parameters?
Craig Bakalian
www.eThinkingCap.com
On Jan 15, 2004, at 4:03 PM, email@hidden
wrote:
Hi Jeff,
Sadly the ssh trick isn't working - the machine seems to be locked
tight (except for the mouse).
I mentioned to Brad that I'm giving up on this for now until there's
an
example project that I can study. I'm not getting a clear picture of
how it's supposed to work and I'm trashing my machine using the trial
and error approach...
Thanks for all the help so far,
Robert.
_______________________________________________
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.