Re: Using HALOutputUnit as an Input AU redux
Re: Using HALOutputUnit as an Input AU redux
- Subject: Re: Using HALOutputUnit as an Input AU redux
- From: Robert Grant <email@hidden>
- Date: Sun, 18 Jan 2004 13:27:18 -0500
Hi Craig,
All you need to do is add a reverb unit (or whatever you want) to the
graph and wire output bus 1 of the micUnit into input bus 0 of the
reverb unit and output bus 0 of the reverb unit into input bus 0 of the
micUnit.
Hope that helps,
Robert.
On Jan 18, 2004, at 9:04 AM, Craig Bakalian wrote:
Hi,
Okay, I got a HasIO on input bus 1 showing 1. Yet, the actual input,
[me shouting in the default microphone] is not sending audio to my
headphones. This is my code so far -> What am I missing? Do I need
to do a inputReadProcess() of some sort, check the stream...what? I
thought the graph would just push and pull the data through. And, how
could I wire this output unit to a reverb unit and then another
output unit? I thought a graph could only have one output unit.
Shesh, I am working on Sunday...
-(void)buildGraph
{
ComponentResult result;
NewAUGraph(&mainGraph);
AUGraphOpen(mainGraph);
UInt32 size;
size = sizeof(AudioDeviceID);
AudioHardwareGetProperty(kAudioHardwarePropertyDefaultInputDevice,
&size, &deviceID);
ComponentDescription mic;
mic.componentType = kAudioUnitType_Output;
mic.componentSubType = kAudioUnitSubType_HALOutput;
mic.componentManufacturer = kAudioUnitManufacturer_Apple;
mic.componentFlags = 0;
mic.componentFlagsMask = 0;
AUGraphNewNode(mainGraph, &mic, 0, NULL, &micNode);
AUGraphGetNodeInfo(mainGraph, micNode, NULL, NULL,NULL, &micUnit);
UInt32 enableIO = 1;
result = AudioUnitSetProperty(micUnit,
kAudioOutputUnitProperty_EnableIO, kAudioUnitScope_Input, 1,
&enableIO, sizeof(UInt32));
NSLog(@"%d", result);
result = AudioUnitSetProperty(micUnit,
kAudioOutputUnitProperty_EnableIO, kAudioUnitScope_Output, 0,
&enableIO, sizeof(UInt32));
NSLog(@"%d", result);
result = AudioUnitSetProperty(micUnit,
kAudioOutputUnitProperty_CurrentDevice, kAudioUnitScope_Global, 0,
&deviceID, sizeof(UInt32));
NSLog(@"%d", result);
UInt32 hasIO=0;
UInt32 dataSize = sizeof(UInt32);
result = AudioUnitGetProperty(micUnit,
kAudioOutputUnitProperty_HasIO, kAudioUnitScope_Input, 1, &hasIO,
&dataSize );
NSLog(@"%d", hasIO);
AUGraphInitialize(mainGraph);
AUGraphStart(mainGraph);
}
On Jan 17, 2004, at 12:48 PM, Robert Grant wrote:
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.
_______________________________________________
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.