boolean logic or lua?

Home Forums General Programming boolean logic or lua?

Viewing 1 post (of 1 total)
  • Author
    Posts
  • #71205
    human fly
    Participant
      • Topics: 124
      • Replies: 1070
      • Total: 1194
      • ★★★★

      lua of course – i’m trying to resolve a problem with 4 buttons
      selecting the value of a single MIDI sysex parameter. i’m
      looking at the D-50 panel now, which must be more or less the
      same thing – but it really is a terrible roland manual this time
      (other ones are not actually as bad as people say)

      the D-110 has a similar partial button array, selecting
      0-15 (0000-1111) on ONE parameter which controls the on/off state
      of the 4 partials. not easy to represent graphically unless it has
      some extra programming. it looks like this:
      —————————————————
      (sorry, this doesn’t show up right/spacing)
      0000 ALL OFF 0
      0001 1 1 partial1 solo
      0010 2 2 partial2 solo
      0011 1+2 3
      0100 3 4 partial3 solo
      0101 3+1 5
      0110 3+2 6
      0111 2+3+4 7
      1000 4 8 partial4 solo
      1001 4+1 9
      1010 4+2 10
      1011 4+21 11
      1100 4+3 12
      1101 4+3+1 13
      1110 4+3+2 14
      1111 4+3+2+1 15
      ————————————————–
      as you see, you cannot switch each one on/off
      as 0/1, 0/2, 0/4, 0/8 because 0 is always ALL OFF.

      so that looks like a boolean logic problem. don’t
      know if it would be OR gates or XOR, or any other
      combination of logic gates, and i’d have difficulty
      figuring it out. i have to, because any other option
      is going to look terrible represented graphically,
      can’t be done unless loads of buttons are used.

      so then i thought, have a look at the D-50 panel, and
      see what he did, because it has to be a Lua anyway.
      and this is what is there:
      ‘called when the modulator changes’:
      ————————————————————-

      — Called when a modulator value changes
      — @mod http://ctrlr.org/api/class_ctrlr_modulator.html
      — @value new numeric value of the modulator

      PartialsOnOff = function(value)

      LowerP1 = panel:getModulatorByName(“LowerPartial1_OnOff”):getModulatorValue()
      LowerP2 = panel:getModulatorByName(“LowerPartial2_OnOff”):getModulatorValue()
      UpperP1 = panel:getModulatorByName(“UpperPartial1_OnOff”):getModulatorValue()
      UpperP2 = panel:getModulatorByName(“UpperPartial2_OnOff”):getModulatorValue()

      LowerPartial = (LowerP1 + LowerP2)
      UpperPartial = (UpperP1 + UpperP2)

      if LowerP1 == 1 then
      panel:sendMidiMessageNow(CtrlrMidiMessage({0xf0, 0x41, 0x00, 0x14, 0x12, 0x00, 0x02, 0x6e, 0x01, 0x0f, 0xf7})) end
      if LowerP2 == 1 then
      panel:sendMidiMessageNow(CtrlrMidiMessage({0xf0, 0x41, 0x00, 0x14, 0x12, 0x00, 0x02, 0x6e, 0x02, 0x0e, 0xf7})) end
      if LowerPartial == 2 then
      panel:sendMidiMessageNow(CtrlrMidiMessage({0xf0, 0x41, 0x00, 0x14, 0x12, 0x00, 0x02, 0x6e, 0x03, 0x0d, 0xf7}))
      elseif LowerPartial == 0 then
      panel:sendMidiMessageNow(CtrlrMidiMessage({0xf0, 0x41, 0x00, 0x14, 0x12, 0x00, 0x02, 0x6e, 0x00, 0x10, 0xf7}))
      end

      if UpperP1 == 1 then
      panel:sendMidiMessageNow(CtrlrMidiMessage({0xf0, 0x41, 0x00, 0x14, 0x12, 0x00, 0x01, 0x2e, 0x01, 0x50, 0xf7})) end
      if UpperP2 == 1 then
      panel:sendMidiMessageNow(CtrlrMidiMessage({0xf0, 0x41, 0x00, 0x14, 0x12, 0x00, 0x01, 0x2e, 0x02, 0x4f, 0xf7})) end
      if UpperPartial == 2 then
      panel:sendMidiMessageNow(CtrlrMidiMessage({0xf0, 0x41, 0x00, 0x14, 0x12, 0x00, 0x01, 0x2e, 0x03, 0x4e, 0xf7}))
      elseif UpperPartial == 0 then
      panel:sendMidiMessageNow(CtrlrMidiMessage({0xf0, 0x41, 0x00, 0x14, 0x12, 0x00, 0x01, 0x2e, 0x00, 0x51, 0xf7}))
      end

      end
      ——————————————————————————-
      i can’t tell yet from the D-50 manual what the parameter number is.
      the D-110 manual is much better on this section. the parameter address
      part of the message is <00 0C>

      the thing is, the D-50 panel sends out FOUR sysex message, and i’m
      sure this isn’t right for the D-110. it only needs a single message,
      and single value, 0-15. the value range contains all possible combinations
      of partials. here is what the D-50 panel sends out:
      ——————————————————————-
      this is partial1 off, and 2,3,4 on:

      F0 41 00 14 12 00 02 6E 02 0E F7
      F0 41 00 14 12 00 01 2E 01 50 F7
      F0 41 00 14 12 00 01 2E 02 4F F7
      F0 41 00 14 12 00 01 2E 03 4E F7

      -which makes no sense to me at all. and i don’t think i can just
      copy this method. i can see 2 different adresses there, the main
      one looks like <01 2E>, i don’t know why it needs the <02 6E> address.
      (and the manual is real ****** to look at)

      this was Anders Eriksson 2015

      please help me solve this !
      >edit>looking at the expression, it looks like it would work,
      and makes sense, but it sends out 4 messages? i only want one.
      looking at it more closely;

      • This topic was modified 7 years, 2 months ago by human fly.
      • This topic was modified 7 years, 2 months ago by human fly.
      • This topic was modified 7 years, 2 months ago by human fly.
    Viewing 1 post (of 1 total)
    • The forum ‘Programming’ is closed to new topics and replies.
    There is currently 0 users and 68 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