Send whole page at once

Home Forums General Panels, Components, Macros Send whole page at once

Viewing 8 posts - 1 through 8 (of 8 total)
  • Author
    Posts
  • #120510
    leopard86
    Participant
      • Topics: 1
      • Replies: 3
      • Total: 4

      Hello, I’m building my first panel in Ctrlr for a synth under development.
      I designed a page with lots of knobs and I would like to send all their values at once when I’m loading the synth. Do we have a way to do that? The ideal solution would be a button that sends the current values of all the knobs in the page. I couldn’t find this, or maybe I haven’t googled enough 🙂

      By the way, it would be useful too to have a way to create a dump file of all the knobs values.

      Best regards

      #120512
      Tedjuh
      Participant
        • Topics: 9
        • Replies: 97
        • Total: 106
        • ★★

        A little bit more information would help a lot. So if you could answer the following questions:

        1. Which synthesizer? Do you know the sysex to request a sysex dump or the sysex to send a dump to the synth?
        2 Does the synth already react if you turn knobs or move sliders in your “panel” and vice versa?

        But to answer your questions.. yes it is possible to send a dump or to receive one. And yes it is possible to save a dump. (See Dnaldoogs Universal Dump recorder in the panels sections of the ctrlr site.)

        #120524
        leopard86
        Participant
          • Topics: 1
          • Replies: 3
          • Total: 4

          Thank you Tedjuh.
          To clarify: the synthesizer is of my own design. At the moment it does receive and interpret only CC messages, so if I turn knobs on the Ctrl panel it works. I will implement sysex dump, but at the moment I only want to send to it multiple CC, one for each knob in the Ctrlr page, for debug reasons.

          Maybe I can create a button and write a Lua script that take all the knobs in the page and sends them? I’ve no experience with Lua but I am a developer, I can figure out how to do that if there is some code to read/copy/steal 😀

          Best

          • This reply was modified 3 years, 4 months ago by leopard86.
          #120527
          dnaldoog
          Participant
            • Topics: 4
            • Replies: 480
            • Total: 484
            • ★★

            Hi leopard86,

            Many ways to do this, but for simple debugging and no error checking, create a multidimensional lua table of all the modulator names and their CC numbers:

            
            t={ -- global table
            lfo={cc=23,val=0},
            vcf={cc=8,val=0},
            vca={cc=26,val=0},
            A={cc=13,val=0},
            D={cc=14,val=0},
            S={cc=18,val=0},
            R={cc=20,val=0},
            }
            

            Create a single callback function attached to each control in the table:
            This will record the value to the table t{}.

            
            saveValue = function(mod,value,source)
            local name=L(mod:getName())
            t[name].val=value
            end
            

            Next create a mouse down callback function for a button, which on click will loop through the table and send each message in the table as CC:

            
            sendAll = function(comp,event)
                for k, v in pairs(t) do
                    panel:sendMidiMessageNow(CtrlrMidiMessage({0xB0, v.cc, v.val})) -- just channel 1
                    console(string.format("sent value for %s - %d [hex %.2x] using cc#%d", k, v.val, v.val, v.cc))
                end
            end
            

            Let me know if you need code for testing on different channels or see here how to do that https://ctrlr.org/forums/topic/novation-bass-station-2-panel/page/2/#post-119592

            See example panel attached

            Attachments:
            You must be logged in to view attached files.
            #120642
            leopard86
            Participant
              • Topics: 1
              • Replies: 3
              • Total: 4

              Thank you very much, I managed to implement this correctly! 🙂

              #120644
              leopard86
              Participant
                • Topics: 1
                • Replies: 3
                • Total: 4

                One further question: instead of building the table with all the CC messages, couldn’t I just get the “MIDI Controller Number” property from each modulator and send the value? Is there a way to iterate for all modulators in the panel?

                This would be much more convenient to avoid issues when I need to modify some CC. I’m getting in troubles developing C code on a DSP (where all CC are in an enum) and having to keep track of every little change of this enum in both the panel (by editing the “MIDI Controller Number”) and the table in the LUA script.

                Best

                #120645
                goodweather
                Participant
                  • Topics: 45
                  • Replies: 550
                  • Total: 595
                  • ★★★

                  Yes, this is possible. If needed, I’m also advising you to mark the modulators you want to send with a specific Custom Modulator index Group.
                  Here is the code:

                  -- Loop on all modulators in custom group 2
                  n = panel:getNumModulators()
                  		
                  for i=0,n-1 do
                  	local mod = panel:getModulatorByIndex(i)
                  	-- local Name= L(mod:getName())
                  	if mod:getPropertyInt("modulatorCustomIndexGroup") == 2 then 
                  		-- console(tostring(i.." "..Name))
                  		do_something
                  	end
                  end

                  To get the Midi Controller Number use:
                  mod:getMidiMessage():getProperty(“midiMessageCtrlrNumber”)

                  Pay attention that not all modulators have a Midi Message (uiLabels…); therefore the trick is to only take the “Dynamic” modulators.

                  Good luck 😉

                  #120646
                  goodweather
                  Participant
                    • Topics: 45
                    • Replies: 550
                    • Total: 595
                    • ★★★

                    Something else… I’m personally using a different technique than a table:
                    – I assign all modulators to a variable at panel load
                    modPanelSubOnOff = panel:getModulatorByName(“PanelSubOnOff”)
                    – you get a nice list but then it is easy to manage afterwards
                    – for loading/saving/sending, rather than looping on a table, I’m working in a line by line way like
                    modProgramOctave:setValue(LoadedProgramData:getByte(16), true)
                    modPanelSubOnOff:setValue(LoadedProgramData:getByte(17), true)
                    modEditTimbre:setValue(LoadedProgramData:getByte(18), true)

                    In programming there are always different roads to reach the same goal. Up to you to feel which one is the best for you (readable, maintainable…) 😉

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