OSStatus AUEffectBase::SetProperty( AudioUnitPropertyID inID, AudioUnitScope inScope, AudioUnitElement inElement, const void * inData, UInt32 inDataSize) { if (inScope == kAudioUnitScope_Global) { switch (inID) { case kAudioUnitProperty_BypassEffect: { if (inDataSize < sizeof(UInt32)) return kAudioUnitErr_InvalidPropertyValue; bool tempNewSetting = *((UInt32*)inData) != 0; // we're changing the state of bypass if (tempNewSetting != IsBypassEffect()) { if (!tempNewSetting && IsBypassEffect() && IsInitialized()) // turning bypass off and we're initialized Reset(0, 0); SetBypassEffect (tempNewSetting); } return noErr; } case kAudioUnitProperty_InPlaceProcessing: mProcessesInPlace = (*((UInt32*)inData) != 0); return noErr; } } return AUBase::SetProperty (inID, inScope, inElement, inData, inDataSize); }
/*! @method Render */ OSStatus AUPannerBase::Render(AudioUnitRenderActionFlags & ioActionFlags, const AudioTimeStamp & inTimeStamp, UInt32 inNumberFrames) { if (IsBypassEffect()) return BypassRender(ioActionFlags, inTimeStamp, inNumberFrames); else return PannerRender(ioActionFlags, inTimeStamp, inNumberFrames); }
/*! @method SetProperty */ ComponentResult AUPannerBase::SetProperty(AudioUnitPropertyID inID, AudioUnitScope inScope, AudioUnitElement inElement, const void * inData, UInt32 inDataSize) { switch (inID) { case kAudioUnitProperty_BypassEffect: if (inDataSize < sizeof(UInt32)) return kAudioUnitErr_InvalidPropertyValue; bool tempNewSetting = *((UInt32*)inData) != 0; // we're changing the state of bypass if (tempNewSetting != IsBypassEffect()) { if (!tempNewSetting && IsBypassEffect() && IsInitialized()) // turning bypass off and we're initialized Reset(0, 0); SetBypassEffect (tempNewSetting); } return noErr; } return AUBase::SetProperty(inID, inScope, inElement, inData, inDataSize); }
OSStatus AUEffectBase::GetProperty (AudioUnitPropertyID inID, AudioUnitScope inScope, AudioUnitElement inElement, void * outData) { if (inScope == kAudioUnitScope_Global) { switch (inID) { case kAudioUnitProperty_BypassEffect: *((UInt32*)outData) = (IsBypassEffect() ? 1 : 0); return noErr; case kAudioUnitProperty_InPlaceProcessing: *((UInt32*)outData) = (mProcessesInPlace ? 1 : 0); return noErr; } } return AUBase::GetProperty (inID, inScope, inElement, outData); }
/*! @method GetProperty */ OSStatus AUPannerBase::GetProperty (AudioUnitPropertyID inID, AudioUnitScope inScope, AudioUnitElement inElement, void * outData) { OSStatus err = noErr; switch (inID) { case kAudioUnitProperty_BypassEffect: if (inScope != kAudioUnitScope_Global) return kAudioUnitErr_InvalidScope; *((UInt32*)outData) = (IsBypassEffect() ? 1 : 0); break; default: err = AUBase::GetProperty(inID, inScope, inElement, outData); } return err; }
ComponentResult AUInlineEffectBase::RenderBus(AudioUnitRenderActionFlags & flags, const AudioTimeStamp & timestamp, UInt32 bus, UInt32 frames) { if ((bus != 0) || (! HasInput(0))) { return kAudioUnitErr_NoConnection; } ComponentResult result; AUInputElement *theInput = GetInput(0); result = theInput->PullInput(flags, timestamp, 0, frames); if (result == noErr) { AudioBufferList & inputbuffers = theInput->GetBufferList(); if (! IsBypassEffect()) { result = ProcessBufferLists(flags, inputbuffers, inputbuffers, frames); } GetOutput(0)->SetBufferList(inputbuffers); } return result; }