setting modulator MIDI channel via Lua

Home Forums General Programming setting modulator MIDI channel via Lua

Viewing 7 posts - 1 through 7 (of 7 total)
  • Author
    Posts
  • #669
    msepsis
    Participant
      • Topics: 219
      • Replies: 732
      • Total: 951
      • ★★★

      I have a combo box that contains values 1-16. I want the selection of this combo box to set the MIDI channel of a component.

      Following the API I see there is a setChannel function for the CtrlrMidiMessage class, but I don’t think that’s what I want.

      Could we get a "setChannel" function under the "ctrlrModulator" class, or maybe there’s some other way to set this up so users can specify the MIDI ch a modulator or group of modulators speak over? Maybe add all the modulators to a group and drive the group’s midi channel from the combobox?

      edit: arg. nope.. groups don’t get MIDI channels. . .

      Monstrum Media | Music, Sound & Software Design, Chicago / San Francisco listen

      #4649
      msepsis
      Participant
        • Topics: 219
        • Replies: 732
        • Total: 951
        • ★★★

        *bump*

        Monstrum Media | Music, Sound & Software Design, Chicago / San Francisco listen

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

          Well i can set up a setMidiChannel() method for a modulator but it will just change the midi channel on the midi message it owns (same as if you’d do it yourself from LUA).

          If you have an idea how to solve it in the GUI (set midi channel to multiple modulators at once) i’d love to implement something. I can consider groups and tabs for that, but maybe there are some better ideas for that ?

          #4651
          msepsis
          Participant
            • Topics: 219
            • Replies: 732
            • Total: 951
            • ★★★

            thanks for the reply. How do you change the midi channel the midi message owns from Lua, if you don’t mind explaining? Might be exactly what I’m looking for.

            As for your implementation question I’m not sure what the best way to go about this would be but I think adding modulators to groups (or tabs) and assigning a midi channel to the group (or tab) would be a logical place to organize things.

            My desire here is to be able to use a combobox w/ values 1-16 to set the MIDI out channel of a group of modulators to this selected MIDI channel.

            I’ve tried something like, but there is no setChannel function for the ctrlr modulator class so obviously this doesn’t work.
            [code:32d9ljvg]
            s1ch= panel:getModulatorByName("MIDI Channel s1"):getModulatorValue()

            if s1ch==1 then
            panel:getModulatorByName("modulator1"):setChannel(1)
            panel:getModulatorByName("modulator2"):setChannel(1)
            panel:getModulatorByName("modulator3"):setChannel(1)

            elseif s1ch==2 then
            panel:getModulatorByName("modulator1"):setChannel(2)
            panel:getModulatorByName("modulator2"):setChannel(2)
            panel:getModulatorByName("modulator3"):setChannel(2)

            etc...
            [/code:32d9ljvg]

            Monstrum Media | Music, Sound & Software Design, Chicago / San Francisco listen

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

              Try with this:

              panel:getModulatorByName("modulator1"):setPropertyInt("midiMessageChannel",3)

              #4653
              msepsis
              Participant
                • Topics: 219
                • Replies: 732
                • Total: 951
                • ★★★
                "dasfaker":3ux2lbu8 wrote:
                Try with this:

                panel:getModulatorByName("modulator1"):setPropertyInt("midiMessageChannel",3)[/quote:3ux2lbu8]

                I tried this, however it did not change the MIDI Channel property of the modulator as I expected. Maybe it’s not visually reflected in the modulator’s property?? Only gave it a tertiary try.. I’ll look more at it this weekend probably.

                Monstrum Media | Music, Sound & Software Design, Chicago / San Francisco listen

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

                  That’s wrong the MIDI channel is not the property of the modulator, it’s the property of the MidiMessage object that belongs to the modulator, so
                  to set the midi channel of modulator-1 with the variable newMidiChannel:

                  [code:17vwi94w]
                  panel:getModulatorByName("modulator-1"):getMidiMessage():setPropertyInt("midiMessageChannel", newMidiChannel)
                  [/code:17vwi94w]

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