change midiMessageType of a modulator in LUA

Home Forums General Programming change midiMessageType of a modulator in LUA

Viewing 10 posts - 21 through 30 (of 30 total)
  • Author
    Posts
  • #7201
    atom
    Keymaster
      • Topics: 159
      • Replies: 2945
      • Total: 3104
      • ★★★★★

      Can you give me a scenario where i can reproduce this ? It looks like MIDI device settings are saved for me.

      #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

        #13691
        Hecticcc
        Participant
          • Topics: 25
          • Replies: 160
          • Total: 185
          • ★★

          Read up here for info on this:
          ctrlr.org/forums/topic/preventing-script-from-running-at-panel-load/

          • This reply was modified 10 years, 7 months ago by Hecticcc.
          #13726
          lfo2vco
          Participant
            • Topics: 26
            • Replies: 162
            • Total: 188
            • ★★

            Read up here for info on this:
            ctrlr.org/forums/topic/preventing-script-from-running-at-panel-load/

            Hi Hecticcc, I have this variable in a Method I am using (written by Atom).

            if panel:getRestoreState() == true or panel:getProgramState() == true then
            	return
            end

            This looks very similar to what Msepsis mentioned in the thread you referenced above. It does the job, many thanks for your assistance.

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

            #13752
            Hecticcc
            Participant
              • Topics: 25
              • Replies: 160
              • Total: 185
              • ★★

              Yeah that should work, but for some reason sometimes it fails for me. That’s why i use a custom variable just to be sure.

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

                Yeah that should work, but for some reason sometimes it fails for me. That’s why i use a custom variable just to be sure.

                Cheers again for pointing me towards this. If I encounter any further problems I may press you for more info on the custom variable : )

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

                #13953
                macrodx
                Participant
                  • Topics: 3
                  • Replies: 28
                  • Total: 31

                  Hi all,

                  just thought I should add this because it fits the topic:

                  modulator:getMidiMessage() will return nil when the modulatorIsStatic (“Modulator does not react to value changes”) property is set to 1 (“Static”).

                  #14390
                  zeoka
                  Participant
                    • Topics: 73
                    • Replies: 466
                    • Total: 539
                    • ★★★

                    Hi
                    I still don’t know how to set midi property of a modulator via LUA
                    i want to change midiMessageCtrlrNumber of a button by another modulator
                    setProperty is not working
                    Any idea ?

                    #14391
                    atom
                    Keymaster
                      • Topics: 159
                      • Replies: 2945
                      • Total: 3104
                      • ★★★★★

                      Can you show the line of code you use to change the property ?

                      #14392
                      zeoka
                      Participant
                        • Topics: 73
                        • Replies: 466
                        • Total: 539
                        • ★★★

                        Hello Atom ! how are you ?

                        i just saw in old post here how to do
                        getMidiMessage() replace getComponent()
                        sorry

                      Viewing 10 posts - 21 through 30 (of 30 total)
                      • The forum ‘Programming’ is closed to new topics and replies.
                      There is currently 0 users and 75 guests online
                      No users are currently active
                      Forum Statistics
                      Threads: 2,495, Posts: 17,374, Members: 77,605
                      Most users ever online was 12 on January 22, 2019 3:47 pm
                      Ctrlr