How to make a Panic Button (Send All MIDI Off)?
-
Hello HISE community,
I am in the process of creating my first plugin in HISE and wanted to add a kind of panic button.
I have already tried it withEngine.allNotesOff()
in the onControl callback, but without success.
Do you have any examples of how I can realize such a button?Thanks
-
@WillDevelop All notes off is correct
Show your code
-
@d-healey Here is my code
HiseSnippet 4374.3ocwbszcaibkFzsYmlneel4GPMzmDAZKSSvGRjVcmDpGTslHYoXp1N43wGc.AJRhXP.d.JZY0N5jeFyhYwrYVMKlMylYe1N+Il+A4ePl6sJ.P7hTDRhIxcKQbq59c+pKt0iaAT7LWGcpmmiqTgRme0TpTgunX+qrYi2arloszQ6KU3qJ12VaJg4PdgCiJs6US077nFREJ7IGh0oPoGJw+4u7q1UyRyVmNWjjzqbL0oGaNwjMW5Y+5eiokUOMC54lShT6l+5izcr2ywxYFvmOoXMooZ5uSaD8EZX0dPQoBe5AFlLG29LMF0SpvC20w3p9ictzVT+WY5YNvhhWnJ0G.RHtmikAxXTpzdiMsLNKnc6IAnb1buvmH7B+iEOwzvLT9buw2vKfLWin9iBOHN89jXzSMJ8pEgdYPoBQnzCET5aK1W20bJadIHe97hGYyntC0zieqQTWoG7l5EAepGiL0Z1HS6WaZvFS9dRq501QNZA+.0bzXFTRylPIx64.nZypNQ6czdtvEgVQIBPaFS4J6HaZqaMyfpTdzLyKN1w4ccsM5QoVU+Cdkghke1yH8oLRO.P4CrAMoUsbzLvq65oT9im8xS+mOXuyun2oGu+Au7ZTt2ydoy.GlySeIczLKM2pL1vxaRJGWJhtOfdT1gVNCzrPsUxndxxuWyknYY4bI0.io8fl8ad6NyEyE1yRiwnFPY0DLeWHXbjqyLaCxYZ1TKe+Gp0fvh3k.5D3.0LDhTJmnNHSRHBo9YNdlLSGakZaRpsIYYN6LUGhSYuzYFC7DJCmYqywZTE4OJWBZB8f9cjKMgPfHMFrCmqLA9YT0gPE5ZYonixNSyhxpN2JfMwZw+E.19tZWRN2jYQkKMBMtvgC2bp2pZMnxBoh9yJh+3UEsdWqoi0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Ns97UawDbJUNfRJfcmnwkgqtfeRvjJ7nh3gLSNxALSN5gKS9zgCm2P9XrFxSxUC4yKFdrNkn1ZPBI3iu4XplqcdllZ9Jc3sj+qnstELDS934WWL1luthgCIVAEma+uR22b6qJFc6XiQsuf4+MlffZQOVqbB9EEme3GSrFHWvGNapAj7X2gfovb.wu6B7Wo249gZ6Myi4LoOkgv5IMXTv2PD7kI9Wk7CohIUJtz5QEyWP4C1pPwXGLV4XGJV4XGHV4TGFV4TGDV4jGBV4rN.rxoN7qxK6fuJm9PuJm4AdUN4gcUN4AcU994PtFIBpdzfqR3RhS+kVw2TD3zLKMV7uCMvu3P7K.ZCw9hq.+hlv1yjcUzbQt29h0XUo32V7L7wtlMGePFbDxPYcvQ+uNR9xhG.Af5r4D7gE686VOe2iHI95iXzIZLWSr+5KlMoOzGRmBV2FxSB2nGXXSTU900BxVpO01feweE9wuPU75B9EpFTHLcftqyE5hDDwuvS9LtDfS17waJU7D7ZhZPJgEKVqZMIbntKz0wl+SUkjxVm52BcZbKzo4sPmV2Bc15Vny12BcZuTcvAgvIrmH5N.BN6.9HoEJb.eRUdTnz+Oc1ClI
function onControl(number, value) { var id = number.getId(); switch(id) { // Panic Button case 'midiPanicBtn': if (value == 1) { Console.print("Panic"); Engine.allNotesOff(); } number.setValue(0); break; } }
-
@WillDevelop Oh wow! You're using the on control callback, I forgot that thing existed.
Ok so do it like this instead.
// Your button should be set to momentary with saveInPreset disabled // Replace myButton with the ID of your button const myButton = Content.getComponent("myButton"); myButton.setControlCallback(onmyButtonControl); inline function onmyButtonControl(component, value) { if (value) return; Engine.allNotesOff(); }
-
Unfortunately, it didn't work.
Does the
Engine.allNotesOff();
function only send the command within HISE or also to the next plugin?Because the plugin should not produce its own sound but only output MIDI data (pass it on to the next plugin in the DAW)
-
@WillDevelop It's internal to HISE's engine.
-
Ah Okay, do you happen to have an idea how I can make a panic button that sends data to the outside (to the next plugin)?
-
@WillDevelop I don't know if it's possible. You can forward incoming MIDI messages out but I don't know about all notes off.
-
@d-healey If I find a solution, I will post it here. Thank you
-
@WillDevelop just send 128 note off messages?
-
@Lindon can you give me an example code how I can send this via a button click?
-
do you know how to generate a midi note off message?
-
@Lindon Ah such a simple idea!
-
@d-healey said in How to make a Panic Button (Send All MIDI Off)?:
@Lindon Ah such a simple idea!
thats me - full of simple ideas.....
-
@Lindon Not really, only in conjunction with a Note On command
-
@WillDevelop said in How to make a Panic Button (Send All MIDI Off)?:
@Lindon Not really, only in conjunction with a Note On command
so look in the documentation for NoteOff
eventually` you will find:
Synth.noteOff(int noteNumber)
so ...
for(i=0; i<128;i++) { Synth.noteOff(i); }
-
@Lindon
But does it also send a Note Off command to another plugin?
Because the plugin does not generate its own sounds, but only outputs MIDI data. -
@WillDevelop really, just type it in and try it.. if not - then you have learned something.
-
@Lindon Okay, I tried it and it didn't work.
-
I have found a solution
Button Callback
if(isMidiPanicBtnActive == 0) { isMidiPanicBtnActive = button.getValue; button.setValue(0); }
onNoteOff Callback
if (isMidiPanicBtnActive == 1) { for(i=0; i<128; i++) { Message.setNoteNumber(i); Message.sendToMidiOut(); } isMidiPanicBtnActive = 0; }
The only downside of this solution is that you have to press the button and then press a midi key
Because I don't think it is possible to send a message command with a button click, at least not "Message.setNoteNumber()"