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

#73283
dnaldoog
Participant
    • Topics: 4
    • Replies: 480
    • Total: 484
    • β˜…β˜…

    Well I never looked at the reason for this function, just focusing on the errors you were dealing with and offering a way of fixing those (particular issues), but it seems that all you are trying to do is process the data coming in from the synth.

    I don’t think you need to do all that memoryblock converting or midi:getLuaData():getRange(), gsub() stuff. Needs to be as simple as possible or else all these compilation errors start seeping in as you are finding out.

    If you know a certain midi dump will be say 65 bytes long then:

    myMidiReceived = function(--[[ CtrlrMidiMessage --]] midi)
        local s = midi:getSize()
     if s == 65 then

    …now work out a way of writing into the values of a midi:getLuaData():getByte() to various modulator/components (uiSliders uiCombos etc); that magic moment when you see all the sliders change values on screen!

    You can do this by mapping the position of each byte in midi:getLuaData():getByte() to a table of modulator/Component names.

    This would be the foundation/core of your whole program!!! Everything else should be designed around this central function of Ctrlr πŸ™‚

    e.g.

    
    t={
    "WG_PITCH_COARSE", --  0x00 this would be the name of the Modulator/Component
    "WG_PITCH_FINE", -- 0x01
    "any_mod_name_I_choose", -- 0x10
    -- <em>54 more elements to be listed here</em>
    "TV_ENV_SUSTAIN_LEVEL”, -- 0x39 
    }
    --pseudo code follows untested!!
    j=1
    for i=5,65-2 do
    --  5 could be the offset from the sysex header F0 41 ?? ?? ??
    -- -2 = ignore checksum and F7 (in the case of Roland Synths)
    m=midi:getLuaData():getByte(i)
    panel:getModulatorByName(t[j]):getComponent():setValue(m,false)
    j=j+1
    end
    

    This is all untested, but hopefully it will help you understand the core idea of getting data out of the D-110 and into ctrlr. πŸ™‚

    Ctrlr