OK. Thanks. I keep looking at the apple docs, rather than the
heads :-) (for error info, that is)
Make connections from the input/output unit's output scope, element
1 -- that's the device input.
Just took a look at the code, and unless I've misread how to make
connections, I thought I was already doing that....
// Connect the mixer to the output
OSStatus err = AUGraphConnectNodeInput(auGraph, mixerNode, 0,
inputNode, 0);
checkErr(err);
// Connect input to the mixer (same node, inputNode - using element
1 of that node)
err = AUGraphConnectNodeInput(auGraph, inputNode, 1, mixerNode, 0);
checkErr(err);
Karim mentioned a specific order for AU initialization, so I've gone
back and double checked that. I split out the 'getting references
to AU nodes' after I'd performed the AUGraphOpen(). Still, while
everything appears to initialize OK, I'm still getting inf as a value
for the levels.
I've assumed that no InputProc is required (no one's said that it is
yet :-).
Is it also possible that I DO have to setup volume levels on the
mixer? I've tried doing that (code is below), but to no effect. I
mention it because everything *seems* OK, but I have no readings.
---
Neil Clayton
I've included code again, because it has changed slightly (but I've
cut out meaningless stuff):
- (void) enableIO {
UInt32 enableIO;
//When using AudioUnitSetProperty the 4th parameter in the method
//refer to an AudioUnitElement. When using an AudioOutputUnit
//the input element will be '1' and the output element will be '0'.
enableIO = 1;
AudioUnitSetProperty(inputUnit,
kAudioOutputUnitProperty_EnableIO,
kAudioUnitScope_Input,
1, // input element
&enableIO,
sizeof(enableIO));
enableIO = 0;
AudioUnitSetProperty(inputUnit,
kAudioOutputUnitProperty_EnableIO,
kAudioUnitScope_Output,
0, //output element
&enableIO,
sizeof(enableIO));
}
- (void) connectAUs {
// Connect the mixer to the output
OSStatus err = AUGraphConnectNodeInput(auGraph, mixerNode, 0,
inputNode, 0);
checkErr(err);
// Connect input to the mixer (same node, inputNode - using element
1 of that node)
err = AUGraphConnectNodeInput(auGraph, inputNode, 1, mixerNode, 0);
checkErr(err);
}
- (void) setDevice:(AudioDeviceID)deviceId {
UInt32 size;
OSStatus err = noErr;
size = sizeof(AudioDeviceID);
err = AudioUnitSetProperty(inputUnit,
kAudioOutputUnitProperty_CurrentDevice,
kAudioUnitScope_Global,
0,
&deviceId,
sizeof(deviceId));
checkErr(err);
// Setup the StreamFormat for element 1 - the input element
CAStreamBasicDescription DeviceFormat;
CAStreamBasicDescription DesiredFormat;
size = sizeof(CAStreamBasicDescription);
//Get the input device format
err = AudioUnitGetProperty (inputUnit,
kAudioUnitProperty_StreamFormat,
kAudioUnitScope_Input,
1,
&DeviceFormat,
&size);
checkErr(err);
//set the desired format to the device's sample rate
DesiredFormat.mSampleRate = DeviceFormat.mSampleRate;
//set format to output scope
err = AudioUnitSetProperty(inputUnit,
kAudioUnitProperty_StreamFormat,
kAudioUnitScope_Output,
1,
&DesiredFormat,
sizeof(CAStreamBasicDescription));
checkErr(err);
}
- (void) setVolumes {
// Not sure if I need to do this or not. It's had no effect so far,
but did within ComplexPlayThru (when I modified it to have a mixer)
// Enable the mixer input's and output's
OSStatus err = AudioUnitSetParameter(mixerUnit,
kMatrixMixerParam_Enable, kAudioUnitScope_Input, 0, 1, 0);
checkErr(err);
err = AudioUnitSetParameter(mixerUnit, kMatrixMixerParam_Enable,
kAudioUnitScope_Output, 0, 1, 0);
checkErr(err);
// Set global volume
err = AudioUnitSetParameter(mixerUnit, kMatrixMixerParam_Volume,
kAudioUnitScope_Global, 0, 1, 0);
checkErr(err);
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Coreaudio-api mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/coreaudio-api/email@hidden