AudioSuite and convolution engine

Hi,

I encountered an issue when using Juce’s convolution engine in an AudioSuite plugin.
What happens is that the process call starts immediately when the user presses ‘render’ with the impulse response being loaded in the background thread, so the start of the clip doesn’t get the IR applied to it.

One way around this would be to detect that we’re running offline / AudioSuite in the process call,
and call Convolution::loadImpulseResponse() synchronously, or wait for it to have completed all its tasks, but currently there is no way to do this.
I could modify the Juce sources for this purpose but I’d rather avoid that if possible.

Alternatively a possible hack might be to detect when an IR selection has changed in AudioProcessor::parameterChanged() and load the IR immediately there when running as AS only,
hoping the IR had time to load before the user pressed ‘render’, although that’s less than ideal.

Has anyone encountered the same problem and found an elegant way to deal with this ?

Thanks !

Sounds like an issue we solved recently. You should update JUCE and see if everything is fine now. And very importantly, you need to call prepare after loadImpulseResponse, so the internal pre-processing is done before the call to process and not in a thread.

1 Like

Thanks @IvanC , you’re the man !
I was indeed using the latest version from master, but wasn’t calling prepare in the offline scenario.

The docs for Convolution::prepare() don’t mention this behavior:

Must be called before loading any impulse response. This provides the
maximumBufferSize and the sample rate required for any resampling.

could you update them to state this explicitely ?

Also I noticed AudioProcessor::setNonRealtime() is not called by the Pro Tools in JuceAAX_Processor::NotificationReceived().

Avid added AAX_eNotificationEvent_ASProcessingState and AAX_eNotificationEvent_ASPreviewState in PT 11 (but not Media Composer :unamused: ), so I modified the AAX wrapper to handle those as so:

 case AAX_eNotificationEvent_ASProcessingState:
 {
      const int32_t state = *static_cast<const int32_t*>(data);

      if (AAX_eProcessingState_StartPass == state)
      {
         pluginInstance->setNonRealtime(true);
      }
      else if (AAX_eProcessingState_StopPass == state)
      {
         pluginInstance->setNonRealtime(false);
      }

  break;
 }

Can something like this be incorporated in the main branch, I’m sure it would be useful to others ?

Thanks,
Lorcan

1 Like

Thanks for the suggestions, I’ve added the AAX notifications here:

And updated the convolution docs here:

2 Likes