So I'm really stuck suddenly. I have a stack of buttons which used to work and now they don't. I think I've changed somethng along the way when working on some other aspect of my panel and now they have all stopped functioning. They seem to be totally inactive and I can't work out why. I've tried debugging but when I press a button I get nothing on the console at all. Just note sure what I've done!
Here's a typical button (it's contained within a panel that is in a modal) :
Here is my configuration
When the button is pressed my custom module should filter and action based on the address: Here is extracted code from the custom module - I've left the MCU function bit in there in case that is the problem but the MCU part of my panel still works:
Cusrom module code
//Variables for Instrument Filters
var instrFilterMidiPortAll = 'oscOUT_InstrFilter';//Specifc Instrument Filters for Groups of instruments
var instrFilterMidiPortSolo = 'oscOUT_SoloInstrFilter';//Specifc Instrument Filters for Solos of instruments
var instrFilterSwitchVal = 0;
var soloOnlySwitchVal = 1;
var soloOnlySwitch = 1;
var instrFilterInVal = 0;
var instrFilterccSendVal = 0;
var instrFilterMidiChanRoot = 0;
module.exports = {
oscInFilter:function(data){
// console.log('*******************Filter has fired*************')
var { address, args, host, port } = data
// MCU SYSEX NAMING FUNCTIONS
if (mcuToOsc(host, port, address, args)) return
return { address, args, host, port }
},
oscOutFilter: function (data) { // Filter incoming osc messages
var { address, args, host, port } = data
console.log('button pressed ' + ensFilterInVal); //THIS DOESN'T FIRE SO MAYBE NOT GETTING A MESSAGE FROM BUTTON
if (oscToMcu(host, port, address, args)) return
//FILTER THE INSTRUMENT TRACKS
//
if (address == '/InstrFilterModal'){ instrFilterSwitchVal = args[0].value; }; ///this resets the panel when the modal is pressed
if (address == '/LibraryFilterSwitch'){ instrFilterSwitchVal = args[0].value; }; //this collects from a switch in the modal
if (address == '/soloOnlyFilterSwitch'){soloOnlySwitchVal = args[0].value;} //this value is used in the switch code below
if(instrFilterSwitchVal == 1){showOnlySwitch = 1; } else {showOnlySwitch = 2;}
if(soloOnlySwitchVal == 1){soloOnlySwitch = 1; } else {soloOnlySwitch = 2;}
if (address == '/InstrFilterBtn'){ instrFilterInVal = args[0].value; //THIS IS WHERE THE BUTTON IS DEALT WITH
console.log ('/ensFilterBtn pressed. Value sent ' + ensFilterInVal); //THIS IS NOT FIRING
instrFilterccSendVal = instrFilterInVal;
instrFilterMidiChan = instrFilterMidiChanRoot + instrFilterSwitchVal;
switch(soloOnlySwitch){
case 1:
instrFilterMidiPortVal = instrFilterMidiPortAll;
break;
case 2:
instrFilterMidiPortVal = instrFilterMidiPortSolo;
break;
}
switch(showOnlySwitch){
case 1: //Show Only Remote
//Send a show all midi command
sendOsc({ address: '/control', args: [{ type: 'i', value: showAllMidiChan }, { type: 'i', value: showAllccVal }, { type: 'i', value: 127 }], host: 'midi', port: showAllMidiPort });
//now send the filter midi cc to filter the only tracks
sendOsc({ address: '/control', args: [{ type: 'i', value: instrFilterMidiChan }, { type: 'i', value: instrFilterccSendVal }, { type: 'i', value: 127 }], host: 'midi', port: instrFilterMidiPortVal });
break;
case 2: //all others
sendOsc({ address: '/control', args: [{ type: 'i', value: instrFilterMidiChan }, { type: 'i', value: instrFilterccSendVal }, { type: 'i', value: 127 }], host: 'midi', port: instrFilterMidiPortVal });
break;
}
};
//END FILTER THE INSTRUMENT TRACKS
return data //End of OSC out Filter here
}
}