damien

Forum Replies Created

Viewing 20 posts - 1 through 20 (of 62 total)
  • Author
    Posts
  • in reply to: website maintnance #121150
    damien
    Participant
      • Topics: 15
      • Replies: 62
      • Total: 77
      • β˜…

      Hi Atom, Glad you’re back on your Forum.
      The login process is fixed and working, that’s good news.
      You should also take a look at something else: when you edit posts several times, the post disappears totally and breaks the pagination. The edit of existing post is bugged, it’s probably coming from the wordpress caching system, that may be disabled for the forum.
      Maybe you should grant access to other members to help with moderation, updates, backups etc of the whole websites.
      I wish you all the best for your detox and wanted to thank you for all the incredible work you’ve done for this project, Ctrlr is an awesome tool for the musician community.
      All the best πŸ˜‰

      • This reply was modified 3 years, 3 months ago by damien.
      in reply to: Radio button in a modulator group needs a default setting #119383
      damien
      Participant
        • Topics: 15
        • Replies: 62
        • Total: 77
        • β˜…

        Hi Dnaldoog,
        Hope everything is alright on your side.
        I’ll check the new script you fixed during the next weekend and yes it makes more sense.
        I’m stuck with my DP4 panel since I’m still waiting for a DSP to be delivered. One got fried and it’s more than a month I’m waiting it to arrive. COVID20 makes parcels very slow to be delivered.
        Once I install and set up my unit I’ll get back to work and finish the panel once and for all πŸ™‚
        I go a Yamaha SPX990 and a Quadraverb2 this summer for a good price. I’ll program panels for them as well in september, the sysex implementation for alesis and yamaha are way more easier than ensoniq’s.
        take care
        Damien

        in reply to: Get “label” from popup submenu item #119119
        damien
        Participant
          • Topics: 15
          • Replies: 62
          • Total: 77
          • β˜…

          Hi JG,
          Your post is absolutely on point, I’ll study this chapter this weekend I am really looking forward to working on that.
          Thanks a lot
          Damien

          in reply to: Get “label” from popup submenu item #119109
          damien
          Participant
            • Topics: 15
            • Replies: 62
            • Total: 77
            • β˜…

            You could probably do this if everything was contained in a single lookup matrix table; kind of like a database, but you would have to do a full re-write re-design and if it’s already working there’s no need.

            I thought about that last weekend, but it’s too late. I’ll do it for my next project from the early design. A big table and a loop like in php with while.

            So this topic is officially “solved” but I won’t edit the title, I’m too scared about losing all.
            My next step for this project is to manage sysex dumps in and out for loading/saving presets and banks as .syx files.
            Thank you once again for your precious help. This is priceless.

            • This reply was modified 3 years, 8 months ago by damien. Reason: typo
            in reply to: Get “label” from popup submenu item #119107
            damien
            Participant
              • Topics: 15
              • Replies: 62
              • Total: 77
              • β˜…

              That would have been easier if we could get the popupitem “itemText” directly.

              And the +100, +150, +200 …added up to the index “i” of the preset number was a neat trick to distinguish one bank to call to another.

              in reply to: Get “label” from popup submenu item #119106
              damien
              Participant
                • Topics: 15
                • Replies: 62
                • Total: 77
                • β˜…

                Everything is fine this is because what I paste in my previous post was not the whole script:

                I have other statements beforehand :

                first I defined the presets name in tables according if they use 1DSP 2DSP and so on and if they are in ROM or RAM

                
                
                Preset2UnitRamName={"00 ....
                Preset2UnitRomName={"50 ....
                Preset4UnitRamName={"00 ....
                Preset4UnitRamName={"50 ....
                ...
                

                I created the different submenu for the popup and Then I populate the popup :

                
                ...
                --	SUB MENU - 2U
                --	RAM
                	for i,v in ipairs(Preset2UnitRamName) do
                		Algo2UnitRamPreset:addItem(i+299, v, true, false, Image())
                	end -- for
                
                --	ROM
                	for i,v in ipairs(Preset2UnitRomName) do
                		Algo2UnitRomPreset:addItem(i+449, v, true, false, Image())
                	end -- for
                
                --	SUB MENU - 4U
                --	RAM
                	for i,v in ipairs(Preset4UnitRamName) do
                		Algo4UnitRamPreset:addItem(i+499, v, true, false, Image())
                	end -- for
                
                --	ROM
                	for i,v in ipairs(Preset4UnitRomName) do
                		Algo4UnitRomPreset:addItem(i+649, v, true, false, Image())
                	end -- for
                
                --	CONFIG
                --	RAM
                	for i,v in ipairs(PresetConfigRamName) do
                		ConfigRamPreset:addItem(i+699, v, true, false, Image())
                	end -- for
                
                --	ROM
                	for i,v in ipairs(PresetConfigRomName) do
                		ConfigRomPreset:addItem(i+849, v, true, false, Image())
                	end -- for
                

                Then I decode the “itemReselultID” returned by the popup with show()
                bank is 1st number
                preset is 2&3 number

                --  FUNCTIONS REQUIRED FOR PRG CHANGE
                	local PstBank = tonumber(string.sub(itemResultID, 1,1))   -- Get bank number from #1 digit of the Popup Item selected
                	console("PstBank : "..(PstBank))
                
                	local PstID = tonumber(string.sub(itemResultID, 2,3))  -- Get bank number from #2 to #3 digit of the Popup Item selected
                	console("PstID : "..tostring(PstID))
                
                

                Then I created the different messages to select the right banks on the machine before sending the midi program change for the selected preset. It’s required because the same prgr chg can send 5 different presets change. We need to tell the machine wich bank to change (1U, 2U, 4U, the config routing etc) beforhand:

                
                --	PREPEND TO PRG CHANGE MESSAGE
                	local Src1ConfigChange = function()
                		SelectButton() -- Call Select Button Press/Release
                		ConfigButton() -- Call Select Config Press/Release
                		panel:sendMidiMessageNow(CtrlrMidiMessage({0x04, 0x34})) -- Config Program 52 (34h) Select 1U Psets
                	end
                
                	local Src2ConfigChange = function()
                		SelectButton() -- Call Select Button Press/Release
                		ConfigButton() -- Call Select Config Press/Release
                		panel:sendMidiMessageNow(CtrlrMidiMessage({0x04, 0x33})) -- Config Program 51 (33h) Select 2U Psets
                	end
                
                	local Src4ConfigChange = function()
                		SelectButton() -- Call Select Button Press/Release
                		ConfigButton() -- Call Select Config Press/Release
                		panel:sendMidiMessageNow(CtrlrMidiMessage({0x04, 0x32})) -- Config Program 50 (32h) Select 4U Psets
                	end
                
                	local ConfigChange = function()
                		SelectButton() -- Call Select Button Press/Release
                		ConfigButton() -- Call Select Config Press/Release
                	end
                
                

                This is what you asked about, depending on the 1 number of the popup item, it changes the table containing the number of the preset and the preset name :

                
                
                --  STATEMENTS RELATED TO BANK OF ITEM SELECTED
                	if PstBank == 1 then
                		PresetName = Preset1UnitRamName
                		SrcConfigChange = Src1ConfigChange
                	elseif PstBank == 2 then
                		PresetName = Preset1UnitRomName
                		SrcConfigChange = Src1ConfigChange
                	elseif PstBank == 3 then
                		PresetName = Preset2UnitRamName
                		SrcConfigChange = Src2ConfigChange
                	elseif PstBank == 4 then
                		PresetName = Preset2UnitRomName
                		SrcConfigChange = Src2ConfigChange
                	elseif PstBank == 5 then
                		PresetName = Preset4UnitRamName
                		SrcConfigChange = Src4ConfigChange
                	elseif PstBank == 6 then
                		PresetName = Preset4UnitRomName
                		SrcConfigChange = Src4ConfigChange
                	elseif PstBank == 7 then
                		PresetName = PresetConfigRamName
                		SrcConfigChange = ConfigChange
                	elseif PstBank == 8 then
                		PresetName = PresetConfigRomName
                		SrcConfigChange = ConfigChange
                	end
                
                

                and after all that we send the right prgrm change message to the machine and update the different labels on ctrlr:

                --	MIDI MESSAGE
                --  PRESET CHANGE FULL MESSAGE SEND
                
                if PstID~=nil then -- check if PstId in not nil for click outside the popup
                	for k,v in pairs(ChannelSend) do
                		if k==n then
                			console("Label Clicked : "..(n))
                			console ("Program Change Value : "..(PstID))
                			console ("Preset Bank : "..(PstBank))
                			SrcConfigChange() -- Config Change Sysex message prepend to Program Change
                			PstProgramChange = CtrlrMidiMessage({v, PstID})
                			panel:sendMidiMessageNow(PstProgramChange)
                		end -- if
                	end -- for
                
                	for i,v in ipairs(PresetName) do
                		local index = tonumber(i-1)
                		if index==PstID or index == PstID-50 then
                			local PstSpecID = tostring(string.sub(v, 1,2))   -- Get bank number from 2 first characters of the Popup Item selected
                			local PstSpecName = tostring(string.sub(v, 4,19))   -- Get bank number from #4 characters to #16 of the Popup Item selected
                			console("Preset Number : "..tostring(PstSpecID))
                			console("Preset Name : "..tostring(PstSpecName))
                			panel:getLabel(n):setText(PstSpecName)
                			panel:getLabel("lblAdditionalInfo"):setText(string.format("%02d", PstSpecID))
                			panel:getLabel("lblProgramChanges"):setText(PstSpecName)
                		end -- if
                	end -- for
                
                	os.execute(sleep(200))
                

                Once the whole instruction is sent to the machine we need to receive the settings of the differents new parameters for the requested preset:

                
                panel:sendMidiMessageNow(CtrlrMidiMessage({0xf0, 0x0f, 0x40, 0x00, 0x00, 0x15, 0xf7}))
                

                The message is received by ctrlr and the parameters are then updated.

                in reply to: Get “label” from popup submenu item #119104
                damien
                Participant
                  • Topics: 15
                  • Replies: 62
                  • Total: 77
                  • β˜…

                  Thanks for your reply, I tried LUA “while …” function and “sort” without the success I wanted.
                  I decided to reformat all my tables without keys.

                  from

                  
                  local Preset1UnitRamName={[00] = "Vocal Plate 1",...}
                  local Preset1UnitRomName={[50] = "Small Room Rev",...}
                  

                  to

                  
                  local Preset1UnitRamName={"00 Vocal Plate 1",...}
                  local Preset1UnitRomName={"50 Small Room Rev",...}
                  

                  and used string.sub to reformat in two parts the value from the selected table(PresetName) [required statements relative to the popup item selected ID where defined beforehand], as the number, and the Preset name.

                  And there you go:

                  	for i,v in ipairs(PresetName) do
                  		local index = tonumber(i-1)
                  		if index==PstID or index == PstID-50 then -- convert the Preset Number in its Table Index value
                  			local PstSpecID = tostring(string.sub(v, 1,2))   -- Get bank number from 2 first characters of the Popup Item selected
                  			local PstSpecName = tostring(string.sub(v, 4,19))   -- Get bank number from #4 characters to #16 of the Popup Item selected
                  			panel:getLabel(n):setText(PstSpecName)
                  			panel:getLabel("lblAdditionalInfo"):setText(string.format("%02d", PstSpecID))
                  			panel:getLabel("lblProgramChanges"):setText(PstSpecName)
                  		end -- if
                  	end -- for
                  

                  This sub.string reformat is very convenient.

                  Thanks for your help once again

                  in reply to: Get “label” from popup submenu item #119098
                  damien
                  Participant
                    • Topics: 15
                    • Replies: 62
                    • Total: 77
                    • β˜…

                    Hi,
                    All the ROM presets and default RAM are in tables and everything is called perfectly.
                    The only issue is that since I am using for k,v in pairs(t) and not ipairs, when the script iterates the table, they values are sorted for k in an random/arbitrary order. i.e :
                    01 = plate reverb, 02 = room reverb, 03 = Hall reverb…
                    returns 02,01,03 …
                    Is there a way to “index” a keyed table so that “for k,v in pair(t)” I get value in the right ascending order ?

                    Thanks a lot!

                    • This reply was modified 3 years, 8 months ago by damien. Reason: typo
                    damien
                    Participant
                      • Topics: 15
                      • Replies: 62
                      • Total: 77
                      • β˜…

                      if n=="lblPrstUA" or n=="lblPrstUB" or n=="lblPrstUC" or n=="lblPrstUD" then

                      Thank you very much, it makes sense. I changed it and it worked right away, like magic!
                      take care

                      Damien

                      damien
                      Participant
                        • Topics: 15
                        • Replies: 62
                        • Total: 77
                        • β˜…
                        
                        myRadio = function(--[[ CtrlrComponent --]] comp, --[[ MouseEvent --]] event)
                        local modName=L(comp:getOwner():getName())
                        dontBlock=true
                        if dontBlock then
                        local t={ButtonA=75,ButtonB=76,ButtonC=77}
                        for k,v in pairs(t)do
                        	panel:getModulatorByName(k):getComponent():setValue(0,false)--set all other modulators to false
                        	if k==modName then
                        	if myGlobal==tostring(k) and globalValue==127 then
                        	globalValue=0
                        else
                        	globalValue=127
                        	end
                        		-- do something
                        		panel:sendMidiMessageNow(CtrlrMidiMessage(string.format("B6 %.2x %.2x",v,globalValue)))
                        		panel:getLabel("debug"):setText(k.."\nsending "..string.format("%.2X",globalValue))
                        	myGlobal=tostring(k)
                        
                        	end
                        end
                        end -- dontBlock
                        end --f
                        

                        Hi JG,
                        I am working on a preset popup populated with tables containing the preset names.
                        Everything is working perfectly but I have some issues with a statement between label names and what it should equals for the statement to be true.

                        It’s a method fired when some labels are clicked :

                        
                        --  GET THE LABEL CLICKED SOURCE
                        	local n = L(comp:getOwner():getName())
                        	console ("name of the display label"..(n))
                        
                        --	MAIN MENU
                        		--PstSelectMain:addSectionHeader ("Select Unit Type")
                        		if n==lblPrstUA or n==lblPrstUB or n==lblPrstUC or n==lblPrstUD then
                        			PstSelectMain:addSubMenu("1 Unit RAM", Algo1UnitRamPreset, true, Image(), false, 0)
                        			PstSelectMain:addSubMenu("1 Unit ROM", Algo1UnitRomPreset, true, Image(), false, 0)
                        		end
                        		if n==lblPrstUA or n==lblPrstUC then
                        			console("U2 submenu")
                        			PstSelectMain:addSubMenu("2 Unit RAM", Algo2UnitRamPreset, true, Image(), false, 0)
                        			PstSelectMain:addSubMenu("2 Unit ROM", Algo2UnitRomPreset, true, Image(), false, 0)
                        		end
                        		if n==lblPrstUA then
                        			console("U4 submenu")
                        			PstSelectMain:addSubMenu("4 Unit RAM", Algo4UnitRamPreset, true, Image(), false, 0)
                        			PstSelectMain:addSubMenu("4 Unit ROM", Algo4UnitRomPreset, true, Image(), false, 0)
                        		end
                        		if n==lblProgramName or lblAdditionalInfo then
                        			console("Config submenu")
                        			PstSelectMain:addSubMenu("Config RAM", ConfigRamPreset, true, Image(), false, 0)
                        			PstSelectMain:addSubMenu("Config ROM", ConfigRomPreset, true, Image(), false, 0)
                        		end
                        
                        

                        I don’t know why but even if n returns lblPrstUA i.e the statement if n==lblPrstUA is never true.

                        My script is alright if I remove all the above statements.

                        Thanks for your help, have a nice weekend

                        Damien

                        in reply to: Get “label” from popup submenu item #119027
                        damien
                        Participant
                          • Topics: 15
                          • Replies: 62
                          • Total: 77
                          • β˜…

                          Hi dnaldoog,

                          I implemented a LUT like you suggested.
                          It’s working well with a table like this.

                          Thanks a lot! Have a good night

                          Damien

                          damien
                          Participant
                            • Topics: 15
                            • Replies: 62
                            • Total: 77
                            • β˜…

                            Hello,

                            I tried both method they all are working well, this BigInter Function from Juce is really nice.

                            I went with Possemo’s way it was more straight forward in my case.

                            Here is the final script wich is 1% smaller than the one before with all the different possibilities : 4x3x2, that was lot of statements…

                            function BypassStatusDecodeBin(EditBufferMessage, value, source)
                            
                            	local BypassStatusBin = BigInteger(EditBufferMessage:getByte(160))
                            	
                            	BypassStatusBit1=BypassStatusBin:getBitRangeAsInt(0,1)
                            	panel:getModulator("ViButComByPassA"):setModulatorValue(BypassStatusBit1, false, false, false)
                            	console ("UA Bypass Status: "..tostring(BypassStatusBit1))
                            
                            	BypassStatusBit2=BypassStatusBin:getBitRangeAsInt(1,1)
                            --	panel:getModulator("ViButComByPassAMode"):setModulatorValue(Byte55bit2, false, false, false)
                            	
                            	BypassStatusBit3=BypassStatusBin:getBitRangeAsInt(2,1)
                            	panel:getModulator("ViButComByPassB"):setModulatorValue(BypassStatusBit2, false, false, false)
                            	console ("UB Bypass Status: "..tostring(BypassStatusBit3))
                            
                            	BypassStatusBit4=BypassStatusBin:getBitRangeAsInt(3,1)
                            --	panel:getModulator("ViButComByPassBMode"):setModulatorValue(BypassStatusBit4, false, false, false)
                            	
                            	BypassStatusBit5=BypassStatusBin:getBitRangeAsInt(4,1)
                            	panel:getModulator("ViButComByPassC"):setModulatorValue(BypassStatusBit5, false, false, false)
                            	console ("UC Bypass Status: "..tostring(BypassStatusBit5))
                            
                            	BypassStatusBit6=BypassStatusBin:getBitRangeAsInt(5,1)
                            --	panel:getModulator("ViButComByPassCMode"):setModulatorValue(BypassStatusBit6, false, false, false)
                            
                            	BypassStatusBit7=BypassStatusBin:getBitRangeAsInt(6,1)
                            	panel:getModulator("ViButComByPassD"):setModulatorValue(BypassStatusBit7, false, false, false)
                            	console ("UD Bypass Status: "..tostring(BypassStatusBit7))
                            
                            	BypassStatusBit8=BypassStatusBin:getBitRangeAsInt(7,1)
                            --	panel:getModulator("ViButComByPassDMode"):setModulatorValue(BypassStatusBit8, false, false, false)
                            
                            end

                            Thanks guys for your precious help!

                            Damien

                            damien
                            Participant
                              • Topics: 15
                              • Replies: 62
                              • Total: 77
                              • β˜…

                              Edit:

                              for bits “stuvwxyz”

                              s = Unit D Kill mode status (1 = Kill, 0Bypass);
                              t = UnitD Bypass Status (1=Bypass; 0=Un-Bypassed);
                              u = Unit C kill mode,
                              v = Unit C Bypass Status;

                              and so on…

                              damien
                              Participant
                                • Topics: 15
                                • Replies: 62
                                • Total: 77
                                • β˜…

                                Buttons are updated via midi since LUA method do the work. On midiIn update, the source = 5 but still fires the buttons sysex.
                                But I don’t wan’t my buttons to send values again on their update via MidiIn so I added a kind of callback value inside my midiReceived script :

                                ReceivingBufferEdit = 1 — Block Active Unit Update
                                script to update all the parameters on dump reception
                                ReceivingBufferEdit = 0 — Allow Active Unit Update

                                and on the radio type script I have :

                                UnitSelect = function(--[[ CtrlrModulator --]] mod, --[[ number --]] value, --[[ number --]] source)
                                if source==4 then  -- should stop this code running on start
                                
                                console("Source for UnitSelect : "..(source))
                                
                                if ReceivingBufferEdit==0 then -- Send button values only if they are not updated via Midi dump
                                
                                	local n=L(mod:getName())
                                	local UnitModValue = panel:getModulatorByName(n):getModulatorValue()
                                	local t={ViButComA=0,ViButComB=1,ViButComC=2,ViButComD=3}
                                	
                                	console("Unit Selected Value : "..tostring(UnitModValue))
                                
                                	for k,v in pairs(t)do
                                		if k==n and UnitModValue == 0 then
                                			console("Unit Selected : "..tostring(k))
                                			panel:getModulatorByName(k):setValue(1, true)
                                		elseif k==n and UnitModValue == 1 then
                                			panel:sendMidiMessageNow(CtrlrMidiMessage({0xf0, 0x0f, 0x40, 0x00, 0x00, 0x01, 0x00, 0x02, 0x00, v, 0xf7})) -- press button
                                			panel:sendMidiMessageNow(CtrlrMidiMessage({0xf0, 0x0f, 0x40, 0x00, 0x00, 0x01, 0x00, 0x02, 0x08, v, 0xf7})) -- release button
                                		elseif k~=n then
                                			panel:getModulatorByName(k):setValue(0, true)
                                
                                		end -- fi
                                	end -- for
                                
                                end
                                	
                                end -- source ==4 (user clicked on a button - not lua generated
                                
                                end
                                

                                And it’s all good. Thank you for your help

                                • This reply was modified 3 years, 9 months ago by damien. Reason: typo
                                damien
                                Participant
                                  • Topics: 15
                                  • Replies: 62
                                  • Total: 77
                                  • β˜…

                                  Alright, I fixed the issue with a statement based on the current value of the clicked modulator

                                  It sends the message only if the button was not ON before clicking on it.
                                  And it locks the position to ON if clicked a second time without sending the sysex message twice.

                                  
                                  UnitSelect = function(--[[ CtrlrModulator --]] mod, --[[ number --]] value, --[[ number --]] source)
                                  if source==4 then -- should stop this code running on start
                                  	
                                  	local n=L(mod:getName())
                                  	local UnitModValue = panel:getModulatorByName(n):getModulatorValue()
                                  	local t={ViButComA=0,ViButComB=1,ViButComC=2,ViButComD=3}
                                  	
                                  	console("Unit Selected Value : "..tostring(UnitModValue))
                                  
                                  	for k,v in pairs(t)do
                                  		if k==n and UnitModValue == 0 then
                                  			console("Unit Selected : "..tostring(k))
                                  			panel:getModulatorByName(k):setValue(1, true)
                                  		elseif k==n and UnitModValue == 1 then
                                  			panel:sendMidiMessageNow(CtrlrMidiMessage({0xf0, 0x0f, 0x40, 0x00, 0x00, 0x01, 0x00, 0x02, 0x00, v, 0xf7})) -- press button
                                  			panel:sendMidiMessageNow(CtrlrMidiMessage({0xf0, 0x0f, 0x40, 0x00, 0x00, 0x01, 0x00, 0x02, 0x08, v, 0xf7})) -- release button
                                  		elseif k~=n then
                                  			panel:getModulatorByName(k):setValue(0, true)
                                  
                                  		end -- fi
                                  	end -- for
                                  	
                                  end -- source ==4 (user clicked on a button - not lua generated
                                  end
                                  

                                  Hope it will help people having trouble with radio buttons like me πŸ˜‰

                                  • This reply was modified 3 years, 9 months ago by damien.
                                  • This reply was modified 3 years, 9 months ago by damien. Reason: addons
                                  damien
                                  Participant
                                    • Topics: 15
                                    • Replies: 62
                                    • Total: 77
                                    • β˜…

                                    I am sorry I’ve been to fast, I thought this was working… but in fact it wasn’t.

                                    The radio switching operates properly and the message is sent as well but if the image is clicked twice, the button position can be reset to OFF.
                                    If the button is ON and clicked a second time it has to stay on and it’s not.

                                    Check on your demo if you click a button twice, all set to OFF.

                                    thanks

                                    damien
                                    Participant
                                      • Topics: 15
                                      • Replies: 62
                                      • Total: 77
                                      • β˜…

                                      Hi Dnaldoog,

                                      This is awesome! it’s working perfectly.
                                      In my case pressing buttons requires 2 messages : pressing (00) and releasing (08), because there is combo with 2 or 3 button pressing at the same time. In the latter case, you have 2 “press” button registered then a 3rd one that defines the task to do like saving banks or switching FX from Unit A or B etc… the implementation of sysex in this DP4 is very complex.

                                      So the script is :

                                      UnitSelect = function(--[[ CtrlrModulator --]] mod, --[[ number --]] value, --[[ number --]] source)
                                      if source==4 then -- should stop this code running on start
                                      	
                                      	local n=L(mod:getName())
                                      	local t={ViButComA=0,ViButComB=1,ViButComC=2,ViButComD=3}
                                      	
                                      	for k,v in pairs(t)do
                                      		if k==n then
                                      			panel:sendMidiMessageNow(CtrlrMidiMessage({0xf0, 0x0f, 0x40, 0x00, 0x00, 0x01, 0x00, 0x02, 0, v, 0xf7})) -- press button
                                      			panel:sendMidiMessageNow(CtrlrMidiMessage({0xf0, 0x0f, 0x40, 0x00, 0x00, 0x01, 0x00, 0x02, value*8, t[n], 0xf7})) -- release button
                                      		else
                                      			panel:getModulatorByName(k):setValue(0,false) -- true can create an infinite loop			
                                      		end -- fi
                                      	end -- for
                                      	
                                      end -- source ==4 (user clicked on a button - not lua generated
                                      end

                                      I wonder were did you get this “source” tag from and since manually is value = 4 I really want to know what other values represent. This is secret weapon.

                                      I blocked/allowed sending param value on refresh for all the knobs with a statement in my “send message” script :

                                      -- BLOCK UPDATE IF THE VALUE CHANGE IS FROM AN EDIT BUFFER REQUEST
                                      if AllowStatusUpdate == 0 then
                                      	console("Param BLOCKED Because AllowStatusUpdate is OFF")
                                      else
                                      	panel:sendMidiMessageNow(CtrlrMidiMessage(m:toHexString(1)))
                                      end
                                      

                                      So the parameter value message bond to the modulators is only sent by hand command.

                                      And added a mousedown method on every knobs

                                      
                                      ParamAllowStatusUpdate = function(--[[ CtrlrComponent --]] comp, --[[ MouseEvent --]] event)
                                      
                                      -------------------------------------------------------------------------
                                      --	BLOCK CTRLR TO SEND PARAM CHANGE AFTER RECEIVING EDIT BUFFER MESSAGE
                                      --	ONLY PARAM CHANGE FROM MOUSEDOWN ARE ALLOWED
                                      -------------------------------------------------------------------------
                                      
                                      AllowStatusUpdate = 1
                                      console("AllowStatusUpdare ON via MouseDown on Param Knob")
                                      end
                                      
                                      

                                      This source == 4 condition will help me a lot cleaning up my script at the final stage.

                                      Thank you so much for your help and sharing your knowledge, I really improved my logic skills with this project.

                                      • This reply was modified 3 years, 9 months ago by damien. Reason: typo, missing part
                                      damien
                                      Participant
                                        • Topics: 15
                                        • Replies: 62
                                        • Total: 77
                                        • β˜…

                                        DnaldDoog,
                                        Don’t worry my friend. I know your post vanished in the abyss but I received it via mail. I’ll check your method tomorrow. My main concern is that “on mouse down” feature doesn’t work properly with images as button, it’s something wrong with the Ctrlr app itself.
                                        I’ll check and try what you posted.

                                        thanks a lot!

                                        dnaldoog wrote:

                                        Well it becomes difficult when you need to use these buttons as toggle buttons sending MIDI 0/1 or 0/127.

                                        Here is a more developed version:

                                        First I have an some initialising code in a function that runs when the panel loads.


                                        — Called when the panel has finished loading

                                        — @type the type of instance beeing started, types available in the CtrlrPanel
                                        — class as enum

                                        — InstanceSingle
                                        — InstanceMulti
                                        — InstanceSingleRestriced
                                        — InstanceSingleEngine
                                        — InstanceMultiEngine
                                        — InstanceSingleRestrictedEngine

                                        init = function(–[[ CtrlrInstance –]] type)
                                        dontBlock=false
                                        panel:getModulatorByName(“ButtonA”):setValue(1,false)
                                        panel:getModulatorByName(“ButtonB”):setValue(0,false)
                                        panel:getModulatorByName(“ButtonC”):setValue(0,false)
                                        myGlobal=”ButtonA”
                                        globalValue=127
                                        end

                                        then a common mouse down function attached to each button:


                                        — Called when a mouse is down on this component

                                        myRadio = function(–[[ CtrlrComponent –]] comp, –[[ MouseEvent –]] event)
                                        local modName=L(comp:getOwner():getName())
                                        dontBlock=true
                                        if dontBlock then
                                        local t={ButtonA=75,ButtonB=76,ButtonC=77}
                                        for k,v in pairs(t)do
                                        panel:getModulatorByName(k):getComponent():setValue(0,false)–set all other modulators to false
                                        if k==modName then
                                        if myGlobal==tostring(k) and globalValue==127 then
                                        globalValue=0
                                        else
                                        globalValue=127
                                        end
                                        — do something
                                        panel:sendMidiMessageNow(CtrlrMidiMessage(string.format(“B6 %.2x %.2x”,v,globalValue)))
                                        panel:getLabel(“debug”):setText(k..”\nsending “..string.format(“%.2X”,globalValue))
                                        myGlobal=tostring(k)

                                        end
                                        end
                                        end — dontBlock
                                        end –f

                                        Note the change in the t{} table to a hash table:

                                        Regards,

                                        JG

                                        damien
                                        Participant
                                          • Topics: 15
                                          • Replies: 62
                                          • Total: 77
                                          • β˜…

                                          Edit:
                                          Attached a demo script where button launch the script on mouse down, and the same with imageButton does not. (console)

                                          Attachments:
                                          You must be logged in to view attached files.
                                          damien
                                          Participant
                                            • Topics: 15
                                            • Replies: 62
                                            • Total: 77
                                            • β˜…

                                            Hi Dnaldoog,
                                            Thanks for the reply, I checked your exemple panel and it’s exactly what I want, same for the one you put on your JD990.
                                            I saw that on your tone selector in the JD990 you used the method on valueChange and in the exemple panel you assigned the method to onClick

                                            Can you explain me the difference and the benefits?

                                            I also cannot manage to make this script work on mine since it’s uiImageButton and not uiButton maybe it’s a bug from ctrlr for mac or my script is wrong, even with a striped down version to check onclick I don’t get anything in the console :

                                            UnitSelect = function(--[[ CtrlrComponent --]] comp, --[[ MouseEvent --]] event)
                                            console("Test Script UnitSelect")
                                            end
                                            
                                            

                                            Here’s my “intended” script:

                                            --
                                            -- Called when a mouse is down on this component
                                            --
                                            
                                            UnitSelect = function(--[[ CtrlrComponent --]] comp, --[[ MouseEvent --]] event)
                                            
                                            console("UnitSelect is fired")
                                            
                                            local modName=L(comp:getOwner():getName())
                                            console(modName)
                                            
                                            local t={"ViButComA","ViButComB","ViButComC","ViButComD"}
                                            
                                            for _,v in ipairs(t)do
                                            
                                            	panel:getModulatorByName(v):setModulatorValue(false, false, false, false)	-- Set all other modulators to false
                                            	
                                            	if v==ViButComA then
                                            		panel:sendMidiMessageNow(CtrlrMidiMessage({0xf0, 0x0f, 0x40, 0x00, 0x00, 0x01, 0x00, 0x02, 0x00, 0x00, 0xf7})) -- Press Button
                                            		panel:sendMidiMessageNow(CtrlrMidiMessage({0xf0, 0x0f, 0x40, 0x00, 0x00, 0x01, 0x00, 0x02, 0x08, 0x00, 0xf7})) -- Release Button
                                            		console("Unit Button Pressed"..toString(v))
                                            	elseif v==ViButComB then
                                            		panel:sendMidiMessageNow(CtrlrMidiMessage({0xf0, 0x0f, 0x40, 0x00, 0x00, 0x01, 0x00, 0x02, 0x00, 0x01, 0xf7})) -- Press Button
                                            		panel:sendMidiMessageNow(CtrlrMidiMessage({0xf0, 0x0f, 0x40, 0x00, 0x00, 0x01, 0x00, 0x02, 0x08, 0x01, 0xf7})) -- Release Button
                                            		console("Unit Button Pressed"..toString(v))
                                            	elseif v==ViButComC then
                                            		panel:sendMidiMessageNow(CtrlrMidiMessage({0xf0, 0x0f, 0x40, 0x00, 0x00, 0x01, 0x00, 0x02, 0x00, 0x02, 0xf7})) -- Press Button
                                            		panel:sendMidiMessageNow(CtrlrMidiMessage({0xf0, 0x0f, 0x40, 0x00, 0x00, 0x01, 0x00, 0x02, 0x08, 0x02, 0xf7})) -- Release Button
                                            		console("Unit Button Pressed"..toString(v))
                                            	elseif v==ViButComD then
                                            		panel:sendMidiMessageNow(CtrlrMidiMessage({0xf0, 0x0f, 0x40, 0x00, 0x00, 0x01, 0x00, 0x02, 0x00, 0x03, 0xf7})) -- Press Button
                                            		panel:sendMidiMessageNow(CtrlrMidiMessage({0xf0, 0x0f, 0x40, 0x00, 0x00, 0x01, 0x00, 0x02, 0x08, 0x03, 0xf7})) -- Release Button
                                            		console("Unit Button Pressed"..toString(v))
                                            	end
                                            end
                                            
                                            end

                                            When I assign this script in the value change method it loops like crazy πŸ™‚

                                            Any clue about what could be possibly wrong?

                                            I just need 1 shared script by 4 buttons with 4 different messages sent according to the button pressed and the radiobutton feature like in you demo. I am struggling to get this done.

                                            Thanks a lot

                                            Damien

                                          Viewing 20 posts - 1 through 20 (of 62 total)
                                          Ctrlr