trouble setting combo box value through Lua

Home Forums General Programming trouble setting combo box value through Lua

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

      in a combobox who’s unique name is "Osc 1 BP Scale Select" I have two selections, their values are 120 and 121, so in "combo contents" I have:

      harmonic=120
      global=121

      however the "Maximum value the modulator can have, should be set from UI component" is reading as "1"..
      nowhere can i set the value range of this modulator besides the "combo contents" field. fine. the combo box works on it’s own so I’ll ignore that quirk for now..

      however

      To set the value of this combobox to "harmonic" through Lua do I want to:

      panel:getModulatorByName("Osc 1 BP Scale Select"):setModulatorValue((0), false, true, true)
      or
      panel:getModulatorByName("Osc 1 BP Scale Select"):setModulatorValue((120), false, true, true)

      ?
      neither seem to be working.

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

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

        if modulator-3 is a Combo and value is the new value of the Combo i want, then this works for me:

        [code:26mk4i04]
        m = panel:getModulatorByName("modulator-3")
        m:setValue(value,true)
        [/code:26mk4i04]

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

          I’ll try that.

          There’s still the part regarding the discrepancy w/ the max value if you’ve set values for the modulator in the "combo contents" field. Also experiencing this with a few rotary knobs. I can send values from the panel to the synth with no issue, it’s when I’m assigning values after getting a sysex dump from the synth that things are breaking for these knobs/combo boxes.

          Slightly different issue than my topic here, but it’s the discrepancy I describe that I believe is causing trouble…

          For instance,
          the [i:3m89ozcc]OSC 1 Octave[/i:3m89ozcc] parameter on the microwave xt has a range of 16-112, interval of 12, with values -4, -3, -2, -1, 0, +1, +2, +3, +4.
          I have the following in the slider contents field:
          "-4"=16
          "-3"=28
          "-2"=40
          "-1"=52
          "0"=64
          "+1"=76
          "+2"=88
          "+3"=100
          "+4"=112

          For this slider/knob, I have the Minimum Value set to "12", Maximum Value set to "122" and Interval set to "12"… however even still, the "Maximum value the modulator can have…" attribute is auto set to "8". Thus.. when I receive a sysex program dump from the synth this Octave knob is ALWAYS going to get set to value of -4 (16) , the lowest value closest to 8.

          Bug? or something I’m missing? Can you speak to why the "maximum value the modulator can have" ignores the min/max/interval settings? This is causing issues.

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

          #4557
          msepsis
          Participant
            • Topics: 219
            • Replies: 732
            • Total: 951
            • ★★★
            "atom":zz2mbhju wrote:
            if modulator-3 is a Combo and value is the new value of the Combo i want, then this works for me:

            [code:zz2mbhju]
            m = panel:getModulatorByName("modulator-3")
            m:setValue(value,true)
            [/code:zz2mbhju][/quote:zz2mbhju]

            So "value" will always start with 0, regardless if you’ve set that comboboxes values via combocontents as I did..

            I have set in the combo contents
            [code:zz2mbhju]harmonic=120
            global=121[/code:zz2mbhju]

            so I was anticipating that with using your example "value" would be either 120 or 121 however it only works when my values start with 0.. so
            0=harmonic and 1=global.

            Here’s a little more info.. puppetOSC1PBR is an off-canvas "puppet" knob that receives from my program dump sysex from the synth. I then use the following script to send the value from this puppet knob to either the on-panel combobox or uiSlider, depending on the value…

            [code:zz2mbhju]
            setOSC1PBR = function(modulator, newValue)

            OSC1PBR_V= panel:getModulatorByName("puppetOSC1PBR"):getModulatorValue()

            if OSC1PBR_V<=119 then
            panel:getModulatorByName("Osc 1 BP Scale"):setModulatorValue((OSC1PBR_V), false, true, true)
            end

            if OSC1PBR_V==120 then

            osc1bps = panel:getModulatorByName("Osc 1 BP Scale Select")
            osc1bps:setValue(0,true)
            end

            if OSC1PBR_V==121 then

            osc1bps = panel:getModulatorByName("Osc 1 BP Scale Select")
            osc1bps:setValue(1,true)

            end

            end
            [/code:zz2mbhju]

            Now, with this code if i spin "puppetOSC1PBR" it’s driving the Osc 1 BP Scale knob just fine, and [b:zz2mbhju][i:zz2mbhju]sometimes [/i:zz2mbhju][/b:zz2mbhju] will change "Osc 1 BP Scale Select". I’ll have to test this w/ an actual sysex dump from the synth when I get home as this knob isn’t meant to be spun manually anyway. seems to kind of work, not sure why the combo box doesn’t update reliably any time i go past 119 on "puppetOSC1PBR"

            thanks for the tips, hope you’re following me.

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

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

              you can do

              [code:34kxmwbp]
              m = panel:getModulatorByName("modulator-3")
              m:setValueMapped(newValue,true)
              [/code:34kxmwbp]

              where newValue is the assigned value after the = in the combo contents not the index. You need to understand that the MAX value is the non-mapped count of values in a component not the max value you assign to a certain position in the component. It needs to be linear, actual numeric values are spread from 0 to MAX.

              #4559
              msepsis
              Participant
                • Topics: 219
                • Replies: 732
                • Total: 951
                • ★★★
                "atom":2ybaskeg wrote:
                You need to understand that the MAX value is the non-mapped count of values in a component not the max value you assign to a certain position in the component. It needs to be linear, actual numeric values are spread from 0 to MAX.[/quote:2ybaskeg]

                ahhh!! Ich verstehe jetzt, es ist nicht gebrochen. Danke für die Erklärung!

                seriously. thanks Atom for explaining this. It turns out "setValueMapped" was the cornerstone of solving my hang up with getting my nightly rev version of this panel working with sysex dumps to update modulators.. I’ve been using "setModulatorValue" since ctrlr rev 666ish which works fine up until after the last stable 934.

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

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