# Bypass callback/notification

**URL:** <https://forum.juce.com/t/bypass-callback-notification/14963>\
**Category:** Audio Plugins\
**Created:** [June 12, 2015, 5:09am UTC](https://forum.juce.com/t/bypass-callback-notification/14963 "2015-06-12T05:09:21Z")\
**Posts on this page:** 10\
**Page:** 1

<div class="post-metadata">

**Author:** ![sundhage](https://sea2.discourse-cdn.com/flex026/user_avatar/forum.juce.com/sundhage/32/162_2.png) [@sundhage](https://forum.juce.com/u/sundhage)\
**Post date:** [June 12, 2015, 5:09am UTC](https://forum.juce.com/t/bypass-callback-notification/14963/1 "2015-06-12T05:09:21Z")

</div>

I have a synth out for sale and found a small bug that I really don't know how to solve properly:

When the instrument is up and running in a DAW, I send a NoteOn midi message (holding a note on the keyboard). Before sending the NoteOff (releasing the note on the keyboard), I bypass the plug-in. When the plug-in is bypassed I&nbsp;release the keyboard (sending NoteOff). When I enable the plug-in again the note obviously continues playing since the NoteOff wasn't parsed in processBlock() because the instrument was&nbsp;bypassed at the time.

My current (seem-to-be-working) approach is to have a check the current time in processBlock() and if there's a gap greater than some value based on blockSize and samplerate I turn off all playing notes. This method is a really ugly hack and will most certainly turn back at me at some point/in some DAW/in some special-case that I cannot think of right now.

So, to the question: Is there any other way do get a notification/read some flag whether the instrument is bypassed by host so I instead could check for actual changes instead of assuming stuff based on gaps in the audio stream.

---

<div class="post-metadata">

**Author:** ![timur](https://sea2.discourse-cdn.com/flex026/user_avatar/forum.juce.com/timur/32/541_2.png) [@timur](https://forum.juce.com/u/timur)\
**Post date:** [June 12, 2015, 9:35am UTC](https://forum.juce.com/t/bypass-callback-notification/14963/2 "2015-06-12T09:35:19Z")

</div>

Interesting. What plugin format are you using? Is that AudioUnit, VST2, ...?

---

<div class="post-metadata">

**Author:** ![railjonrogut](https://sea2.discourse-cdn.com/flex026/user_avatar/forum.juce.com/railjonrogut/32/505_2.png) [@railjonrogut](https://forum.juce.com/u/railjonrogut)\
**Post date:** [June 12, 2015, 9:49am UTC](https://forum.juce.com/t/bypass-callback-notification/14963/3 "2015-06-12T09:49:00Z")

</div>

How about AudioProcessor::processBlockBypassed() – all the wrappers call that when the plugin is bypassed.

Rail

---

<div class="post-metadata">

**Author:** ![timur](https://sea2.discourse-cdn.com/flex026/user_avatar/forum.juce.com/timur/32/541_2.png) [@timur](https://forum.juce.com/u/timur)\
**Post date:** [June 12, 2015, 10:19am UTC](https://forum.juce.com/t/bypass-callback-notification/14963/4 "2015-06-12T10:19:00Z")

</div>

Yes, I was about to post that as well, but then I checked and found out that at least for AudioUnit, this AudioProcessor::processBlockBypassed is only called for effects, not for synths. But this is a synth.

---

<div class="post-metadata">

**Author:** ![railjonrogut](https://sea2.discourse-cdn.com/flex026/user_avatar/forum.juce.com/railjonrogut/32/505_2.png) [@railjonrogut](https://forum.juce.com/u/railjonrogut)\
**Post date:** [June 12, 2015, 10:27am UTC](https://forum.juce.com/t/bypass-callback-notification/14963/5 "2015-06-12T10:27:01Z")

</div>

Hmm… that’s only in the AU wrapper… The host really should disable the bypass button for a synth anyway.

Rail

---

<div class="post-metadata">

**Author:** ![timur](https://sea2.discourse-cdn.com/flex026/user_avatar/forum.juce.com/timur/32/541_2.png) [@timur](https://forum.juce.com/u/timur)\
**Post date:** [June 12, 2015, 10:29am UTC](https://forum.juce.com/t/bypass-callback-notification/14963/6 "2015-06-12T10:29:00Z")

</div>

Well, Logic does offer you a bypass button for a synth. I believe other hosts do, too. Clicking that button is exactly what this post is about, isn't it?

Apparently, right now a JUCE synth plugin has no way of knowing when this button was clicked.

---

<div class="post-metadata">

**Author:** ![railjonrogut](https://sea2.discourse-cdn.com/flex026/user_avatar/forum.juce.com/railjonrogut/32/505_2.png) [@railjonrogut](https://forum.juce.com/u/railjonrogut)\
**Post date:** [June 12, 2015, 10:37am UTC](https://forum.juce.com/t/bypass-callback-notification/14963/7 "2015-06-12T10:37:00Z")

</div>

In RTAS and AAX we have the ability to disable the host’s bypass button. It looks like the VST wrapper will call processBlockBypassed() for a Synth… the only issue is AU… is there a reason why Jules didn’t call processBlockBypassed() for an AU synth? The default processBlockBypassed() is an empty function and the developer could check if it’s a synth in the method.

Rail

---

<div class="post-metadata">

**Author:** ![sundhage](https://sea2.discourse-cdn.com/flex026/user_avatar/forum.juce.com/sundhage/32/162_2.png) [@sundhage](https://forum.juce.com/u/sundhage)\
**Post date:** [June 12, 2015, 10:50am UTC](https://forum.juce.com/t/bypass-callback-notification/14963/8 "2015-06-12T10:50:53Z")

</div>

It's AU and VST2.

I've only tested the processBlockBypassed() with the AU version (and since it didn't got called I assumed it wouldn't in the VST either). Anyhow, there's still an issue on how to solve this when creating AU's&nbsp;then...&nbsp;

&nbsp;

When peeking into juce\_AU\_Wapper.mm I found this:

&nbsp;

```
#if ! JucePlugin\_IsSynth else if (ShouldBypassEffect()) { juceFilter-\>processBlockBypassed (buffer, midiEvents); } #endif
```

I'll remove those precompiler conditionals and see what happens first thing monday...

&nbsp;

&nbsp;

---

<div class="post-metadata">

**Author:** ![timur](https://sea2.discourse-cdn.com/flex026/user_avatar/forum.juce.com/timur/32/541_2.png) [@timur](https://forum.juce.com/u/timur)\
**Post date:** [June 12, 2015, 11:00am UTC](https://forum.juce.com/t/bypass-callback-notification/14963/9 "2015-06-12T11:00:00Z")

</div>

Hi sundhage,

Removing the precompiler conditionals won't help you, because the code still would only be called if it is an effect and not a synth:

```
else if (ShouldBypassEffect()) ...
```

That ShouldBypassEffect() is AudioUnit code, not JUCE code, so we can't change anything there. Unfortunately there seems to be no equivalent of that function for a synth in the AudioUnit SDK...

&nbsp;

---

<div class="post-metadata">

**Author:** ![sundhage](https://sea2.discourse-cdn.com/flex026/user_avatar/forum.juce.com/sundhage/32/162_2.png) [@sundhage](https://forum.juce.com/u/sundhage)\
**Post date:** [June 12, 2015, 11:32am UTC](https://forum.juce.com/t/bypass-callback-notification/14963/10 "2015-06-12T11:32:44Z")

</div>

Ah! Saw that too now...
