// ----------------------------------------------------------
void ofxAudioUnitInput::connectTo(ofxAudioUnit &otherUnit, int destinationBus, int sourceBus)
// ----------------------------------------------------------
{
	AURenderCallbackStruct callback;
	callback.inputProc = pullCallback;
	callback.inputProcRefCon = &_renderContext;
	
	AudioStreamBasicDescription ASBD;
	UInt32 ASBDSize = sizeof(ASBD);
	
	OFXAU_RETURN(AudioUnitGetProperty(*otherUnit.getUnit(),
									  kAudioUnitProperty_StreamFormat,
									  kAudioUnitScope_Input,
									  destinationBus,
									  &ASBD,
									  &ASBDSize),
				 "getting hardware input destination's format");
	
	OFXAU_RETURN(AudioUnitSetProperty(*_unit,
									  kAudioUnitProperty_StreamFormat,
									  kAudioUnitScope_Output,
									  1,
									  &ASBD,
									  sizeof(ASBD)),
				 "setting hardware input's output format");
	
	otherUnit.setRenderCallback(callback, destinationBus);
}
Example #2
0
// ----------------------------------------------------------
void ofxAudioUnitMidiReceiver::routeMidiTo(ofxAudioUnit &unitToRouteTo)
// ----------------------------------------------------------
{
	if((unitToRouteTo.getUnitRef()))
	{
		_unit = unitToRouteTo.getUnit();
	}
}