Reply To: Demo panel for MIDI receive/transmit routines

Home Forums General Using Ctrlr Demo panel for MIDI receive/transmit routines Reply To: Demo panel for MIDI receive/transmit routines

#73347
dnaldoog
Participant
    • Topics: 4
    • Replies: 480
    • Total: 484
    • ★★

    Hi Human Fly,

    I just put that panel together quickly and maybe there’s a much better way of doing it, but *reverse_nameThemAll* if renamed to *nameThemAll* and *nameThemAll* given a temporary name (say *nameThemAll2*) will return the names back to the original modulator-1,.. modulator-56. If you change a name in the table/array like those typos you spotted, you then run the original *nameThemAll* function again. Bit clumsy I realise, but just cobbled together quickly.

    my earlier observation that some things
    that seemed to need to be ‘known’ earlier in a method, often
    come later

    When you define a function it can reside anywhere in your program (often in another file) and the great thing is you can use that function again anywhere in your program rather than have some code in-line when you need it in one function and repeat that same code in another function, which could lead to more confusion and errors. In other words, if you are going to use that gsub code more than once, then bundle it into a function that you can call anywhere.

    is that a 10 byte dummy header you’ve got?

    That sysex is completely made up from what I thought the D110 should look like, but not fully checked. Have you looked at my JD-990 panel which might function similarly to the D110?

    for i=offset,#t+(offset-1)
    ‘offset=10’ is minus the headers and address locations, but F0 is ignored. You would have to check the real offset in the D110, so from that point (‘offset=10’, which is really 11!!! (remembering we ignore the first byte F0)) we load data into the modulators on Ctrlr.

    #t means the size of table #t=56 – keep looping until you reach #t (56)+(offset-1) (or + 9) so loop through 56 times from position 10 to 65.

    The (offset-1) is unnecessary – it’s just to show you what’s happening. The last two numbers are ‘checksum’ and ‘F7 end sysex’ and so are ignored. Confusing! 🙁

    
    offset=10
    j=1
    for i=10,65 do
    m=midi:getLuaData():getByte(i)
    panel:getModulatorByName(t[j]):getComponent():setValue(m,true)
    j=j+1
    end

    because ‘i’ starts at 10, we can’t use it to reference t[1] through to t[56] so I use another counter ‘j’ instead. You can do this too:

    
    for i=10,65 do
    m=midi:getLuaData():getByte(i)
    panel:getModulatorByName(t[i-9]):getComponent():setValue(m,true)
    end
    
    Ctrlr