ComponentResult AUInstrumentBase::Render( AudioUnitRenderActionFlags & ioActionFlags, const AudioTimeStamp & inTimeStamp, UInt32 inNumberFrames) { PerformEvents(inTimeStamp); UInt32 numOutputs = Outputs().GetNumberOfElements(); for (UInt32 j = 0; j < numOutputs; ++j) { AudioBufferList& bufferList = GetOutput(j)->GetBufferList(); for (UInt32 k = 0; k < bufferList.mNumberBuffers; ++k) { memset(bufferList.mBuffers[k].mData, 0, bufferList.mBuffers[k].mDataByteSize); } } UInt32 numGroups = Groups().GetNumberOfElements(); for (UInt32 j = 0; j < numGroups; ++j) { SynthGroupElement *group = (SynthGroupElement*)Groups().GetElement(j); OSStatus err = group->Render(inNumberFrames); if (err) return err; } mAbsoluteSampleFrame += inNumberFrames; return noErr; }
OSStatus AUInstrumentBase::Render( AudioUnitRenderActionFlags & ioActionFlags, const AudioTimeStamp & inTimeStamp, UInt32 inNumberFrames) { PerformEvents(inTimeStamp); AUScope &outputs = Outputs(); UInt32 numOutputs = outputs.GetNumberOfElements(); for (UInt32 j = 0; j < numOutputs; ++j) { GetOutput(j)->PrepareBuffer(inNumberFrames); // AUBase::DoRenderBus() only does this for the first output element AudioBufferList& bufferList = GetOutput(j)->GetBufferList(); for (UInt32 k = 0; k < bufferList.mNumberBuffers; ++k) { memset(bufferList.mBuffers[k].mData, 0, bufferList.mBuffers[k].mDataByteSize); } } UInt32 numGroups = Groups().GetNumberOfElements(); for (UInt32 j = 0; j < numGroups; ++j) { SynthGroupElement *group = (SynthGroupElement*)Groups().GetElement(j); OSStatus err = group->Render((SInt64)inTimeStamp.mSampleTime, inNumberFrames, outputs); if (err) return err; } mAbsoluteSampleFrame += inNumberFrames; return noErr; }