Best practices for using te::TransportControl::ReallocationInhibitor

Hey everyone, hope you’re all doing well!

I’m currently trying to work out the best practices when it comes to using the te::TransportControl::ReallocationInhibitor. \

I’m currently trying to tackle crashes which are occuring on the audio thread when the message thread is tearing down the plugin graph during playback. The crash will typically occur in some kind of Node::process type function, and the message thread will have just destoyed the Node that was playing.

The most common place this happens is when calling AudioClip::rescale, during playback, but can also happen when adjusting the master bus volume.

I’m currently using these functions in our engine play() and stop() respectively:

   * This function should be called whenever we want to declare that the audio engine is currently playing, and we want
   * to prevent tearing down and rebuilding the audio graph. This will prevent the `Node::process` flavour crashes.
  void disableTransportAllocation() {
    if (!reallocationInhibitor) {
      reallocationInhibitor = std::make_unique<te::TransportControl::ReallocationInhibitor>(edit->getTransport());

   * This function should be called whenever the engine is stopping playback, and it is now safe to rebuild the plugin
   * graph.
  void enableTransportAllocation() {
    // delete the reallocation inhibitor

  std::unique_ptr<te::TransportControl::ReallocationInhibitor> reallocationInhibitor;

TLDR; how do you use te::TransportControl::ReallocationInhibitor ?


Apologies for the delayed reply, I’ve been on holiday for the last two weeks.

This shouldn’t happen. You should effectively be able to make any edits and the audio graph should just work so it sounds like another bug that needs fixing.
If you can post a stack trace that would help me narrow down what it is.

Regarding the actual question, we tend to use ReallocationInhibitor when lots of changes are about to happen and we don’t want the effects to be audible until the end of the operation. The classic example of this is whilst dragging an audio/MIDI clip. You don’t really want to hear the audio skip around during the drag, only updating once you’ve lifted up the mouse.