Here's my breath controller script - https://raw.githubusercontent.com/davidhealey/HISE-Scripting-Framework/master/modules/breathControl.js
Rather than using a specific CC it has a Level knob that you can control from your main interface whichever way you like. This also avoids the issue of putting loops inside the MIDI callbacks.
Unfortunately I haven't been able to make it work with the hardcoded legato script or my own legato script.