Reply To: change midiMessageType of a modulator in LUA

Home Forums General Programming change midiMessageType of a modulator in LUA Reply To: change midiMessageType of a modulator in LUA

#13687
lfo2vco
Participant
    • Topics: 26
    • Replies: 162
    • Total: 188
    • ★★

    Also try to avoid calling panel:getModulatorByName() at runtime, this is the biggest mistake people make, in situation where you have hundreds or thousands of modulators in the panel (those static ones count too) Ctrlr needs to go through the table to find the one you want.

    If you are done with designing your panel you can type somewhere in the init method for a panel

    OK, this seems like really good advice, so I have given it a go. But now I am getting “Callback errors” on panel launch. Seems that the other methods are not aware of the ‘init method’ and are giving “nil values”.

    Init is in the ‘Called when the panel has finished loading’ panel field and goes like this (shortened for this example):

    function init()
    	AftertouchEnv1toDCO = panel:getCombo("Aftertouch Env 1 to DCO")
    	AftertouchLFO1toDCO = panel:getCombo("Aftertouch LFO 1 to DCO")
    	AllSoundOff = panel:getButton("All Sound Off")
    	BankDisplay = panel:getLCDLabel("Bank Display")
    	Env1Attack = panel:getSlider("Env 1 Attack")
    	PitchBendtoDCOPitch = panel:getCombo("Pitch Bend to DCO Pitch")
    end

    One of the methods that fails is this:

    benderDCOpitchMessage = function(mod, value)
    
    	comboValue = PitchBendtoDCOPitch:getModulatorValue()
    
    	if comboValue == 00 then
    		mySysex = CtrlrMidiMessage({0xF0, 0x7F, 0x7F, 0x7F, 0x60, 0x01, 0x00, 0xb0, 0x23, 0x00, 0xF7})
    		panel:sendMidiMessageNow(mySysex)
    
    	elseif comboValue == 01 then
    		mySysex = CtrlrMidiMessage({0xF0, 0x7F, 0x7F, 0x7F, 0x60, 0x01, 0x00, 0xb0, 0x23, 0x20, 0xF7})
    		panel:sendMidiMessageNow(mySysex)
    
    	elseif comboValue == 02 then
    		mySysex = CtrlrMidiMessage({0xF0, 0x7F, 0x7F, 0x7F, 0x60, 0x01, 0x00, 0xb0, 0x23, 0x40, 0xF7})
    		panel:sendMidiMessageNow(mySysex)
    
    	elseif comboValue == 03 then
    		mySysex = CtrlrMidiMessage({0xF0, 0x7F, 0x7F, 0x7F, 0x60, 0x01, 0x00, 0xb0, 0x23, 0x60, 0xF7})
    		panel:sendMidiMessageNow(mySysex)
    
    	end
    
    end

    I also tried:
    comboValue = PitchBendtoDCOPitch:getProperty()

    Attachments:
    You must be logged in to view attached files.

    Here is some noise I organised into an acceptable format:
    https://soundcloud.com/lfo2vco/a-dark-crystal

    Ctrlr