I'm using Superpowered Reverb effect with Audio Graph on OS X.
I'm doing that by calling reverb->process
in the render callback of an output audio unit (tested on kAudioUnitSubType_SystemOutput
and kAudioUnitSubType_DefaultOutput
).
The reverb effect worked but the resulted audio is very noisy. I've tried different things (adjust the samplerate, use extra and zeroed buffers, etc) but it doesn't seems to help. Are there any ways to solve this? Thx.
Simplified code:
SuperpoweredReverb* reverb;
OSStatus callback(void * inComponentStorage,
AudioUnitRenderActionFlags * __nullable flags,
const AudioTimeStamp * inTimeStamp,
UInt32 busNumber,
UInt32 framesCount,
AudioBufferList * ioData)
{
for (int i = 0; i < ioData->mNumberBuffers; ++i)
{
if (ioData->mBuffers[i].mData)
reverb->process(static_cast<float*>(ioData->mBuffers[i].mData),
static_cast<float*>(ioData->mBuffers[i].mData),
framesCount);
}
return noErr;
}
void setupReverb(unsigned int sampleRate, AudioUnit unit)
{
reverb = new SuperpoweredReverb(sampleRate);
reverb->enable(true);
reverb->setMix(0.5);
AudioUnitAddRenderNotify(unit, callback, nullptr);
}