global variable question

Home Forums General Using Ctrlr global variable question

Viewing 5 posts - 1 through 5 (of 5 total)
  • Author
    Posts
  • #526
    Layzer2
    Participant
      • Topics: 21
      • Replies: 55
      • Total: 76

      can global variables be used in the button values boxes? for example

      Off = 0
      on = 1 + k0

      i hope so!

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

        That would be weird, globals are for SysEx processing.

        #3704
        Layzer2
        Participant
          • Topics: 21
          • Replies: 55
          • Total: 76

          I’m trying to figure out a way to do the following….

          2 buttons… ON, OFF

          when button 1 is on, it sends the value 1 to f0 06 06 10 xx F7

          when button 1 is off it sends 0

          easy enough…

          when button 2 is on, it sends the value of 2 to f0 06 06 10 xx F7

          when button 2 is off it sends 0

          no problems….

          heres where im going in circles….

          how can i make both buttons send the value of 3 when both are on….
          and have button 1 send the values 2 and 3 if toggled when button 2 is on, 0 and 1 if button 2 is off

          and have button 2 send values 1 and 3 when toggled if button 1 is on, 0 and 2 if button 1 is off?????

          i can easily accomplish this selecting using one button…but this is all in the name of making the controller
          function like it’s hardware counterpart…

          any ideas?……

          #3705
          dasfaker
          Keymaster
            • Topics: 80
            • Replies: 793
            • Total: 873
            • ★★★

            Try this for each button (not tested) with their correspondent values.

            b = panel:getModulatorByName("Button 2")
            b_value = b:getModulatorValue()

            if b_value == 1 then [i:2lrfih7j]– if button B is on[/i:2lrfih7j]
            if newValue == 0 then [i:2lrfih7j]– if button A is off[/i:2lrfih7j]
            m = CtrlrMidiMessage({0xF0, 0x06, 0x06, 0x10, 2, 0xF7})
            panel:sendMidiMessageNow(m)
            else [i:2lrfih7j]– if button A is on[/i:2lrfih7j]
            m = CtrlrMidiMessage({0xF0, 0x06, 0x06, 0x10, 3, 0xF7})
            panel:sendMidiMessageNow(m)
            end
            else [i:2lrfih7j]– if button B is off[/i:2lrfih7j]
            if newValue == 0 then [i:2lrfih7j]– if button A is off[/i:2lrfih7j]
            m = CtrlrMidiMessage({0xF0, 0x06, 0x06, 0x10, 0, 0xF7})
            panel:sendMidiMessageNow(m)
            else –[i:2lrfih7j] if button A is on[/i:2lrfih7j]
            m = CtrlrMidiMessage({0xF0, 0x06, 0x06, 0x10, 1, 0xF7})
            panel:sendMidiMessageNow(m)
            end

            #3706
            Layzer2
            Participant
              • Topics: 21
              • Replies: 55
              • Total: 76

              Thanks for the response Das, plugged in the code u supplied, changed the variables and it would crash….
              BUT the good news is…you showed me how to send midi data out directly using sendmidimessagenow….

              enabling me to cook up this code, which worked perfectly!!

              function buttons ()
              p = panel:getModulatorByName("Osc1 Pulse")
              pv = p:getModulatorValue()
              w = panel:getModulatorByName("Osc1 Wave")
              wv = w:getModulatorValue()
              send = pv + wv
              m = CtrlrMidiMessage({0xF0, 0x06, 0x06, 0x10, send, 0xF7})
              panel:sendMidiMessageNow(m)
              end

              i swear i worked on this one puzzle all day yesterday…
              moving on finally!

            Viewing 5 posts - 1 through 5 (of 5 total)
            • The forum ‘Using Ctrlr’ is closed to new topics and replies.
            There is currently 0 users and 115 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