Why have my buttons stopped working?

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
	}
}

DOH!

Fixed it. No sooner have I posted than I noticed the problem - nothing in the send in the configuration:

image

image

Writing that in sendwill only route osc message from open stage control to itself, there absolutely no reason to do so.

That’s what I thought, from a post you put up the other day so I removed it but if I remove it then nothing works?!

I guess you rely on the custom module's to route the messages from the widgets, which are sent only if their target is defined or if a default target is set using the server's send option.

  • it's okay to define a "fake" target in the send option if you don't want to define the widgets' targets individually, just avoid using the same port as the one o-s-c listens on
  • make sure you're using oscOutFilter() to process the widgets' outgoing messages (in case you were using oscInFilter() before, which should instead be used for messages coming from outside o-s-c)
  • when processing outgoing messages in oscOutFilter(), bypass the original messages (since you don't need them to reach that "fake" target) with an empty return statement. You might need to do that bypass depending on the target (data.host and data.port) in case some widgets directly send to the proper target.

Awesome - I''ve done this - not sure how to define which port OSC listens on but have set the config as 127.0.0.99:8080 and that seems to have done the trick.