goodweather

Forum Replies Created

Viewing 20 posts - 61 through 80 (of 550 total)
  • Author
    Posts
  • in reply to: setModulatorValue() and friends #118502
    goodweather
    Participant
      • Topics: 45
      • Replies: 550
      • Total: 595
      • ★★★

      @ lecleto
      You can find info about the arguments of functions in
      https://github.com/RomanKubiak/ctrlr/blob/master/Source/Core/CtrlrModulator/CtrlrModulator.h

      Need a bit searching and is missing explanations but helps a bit…

      in reply to: uiPanelCanvasRectangle – the funniest thing #118501
      goodweather
      Participant
        • Topics: 45
        • Replies: 550
        • Total: 595
        • ★★★

        This has been mentioned several times in some other threads.
        It is a bug and you need to indeed add 24 pixels to have your exported panels fine.

        Exporting a panel is not saving it…

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

          Different things to improve:
          – declare all your modulators in a separate AssignModulators() method instead of calling each time getModulatorByName(). Call that method from your PanelLoaded() method on panel init.
          Later on, you can directly use those mod variables.
          So:
          in AssignModulators you have declarations like modOPOnOff = panel:getModulatorByName(“OP_ON_OFF_BYTE”)
          then in your other methods you simply use modOPOnOff:setValue(byte93Int, true)
          – this is actually the second improvement, use setValue() io setModulatorValue(). The last 2 args of setModulatorValue() are not used (saw that in another post)
          – to get the value of a mod, simply do modOPOnOff:getModulatorValue(). You should not go through the component as indicated in dnaldoog code.

          For the rest, indeed dnaldoog code is the right answer. Just take each value and multiply it by 8,4,2,1 according to the bit position then add everything and you get your final value.

          in reply to: Editing exisitng Panel #118372
          goodweather
          Participant
            • Topics: 45
            • Replies: 550
            • Total: 595
            • ★★★

            Changes of properties are modulator by modulator.
            However, you can select several modulator at once (select first one then hold Ctrl while selecting the next ones). Try to select the same type of modulators. Edit the common property for all at once.
            Remark: multi-selection is sometimes (not often) crashing; always frequently save. Verify your property on several modulators just to be sure (you can also display the properties by doing Panel -> Modulator list and in the list menu, select the appropriate visible columns then sorting

            in reply to: Cleaning blank nibbles from hexstring #118371
            goodweather
            Participant
              • Topics: 45
              • Replies: 550
              • Total: 595
              • ★★★

              Oui, c’est celui que j’essaye d’avoir et pour lequel j’ai déjà envoyé 2 messages mais sans réponse. Le gars doit l’avoir déjà vendu et ne doit pas avoir envie de répondre. Il laisse aller l’annonce jusque expiration dans 2-3 jours je pense…

              ******

              To complete dnaldoog answer’s (which is not appearing here but that we got in mail), here is a few conversion functions that you can put in one single method (I’m calling that method Miscellaneous).
              As dnaldoog mentioned, not needed in most cases but sometimes well 😉

              --
              -- Returns HEX representation of a DECimal number
              --
              dec2hex = function(num)
              
                  local hexstr = '0123456789ABCDEF'
                  local s = ''
              
                  while num > 0 do
                      local mod = math.fmod(num, 16)
                      s = string.sub(hexstr, mod+1, mod+1) .. s
                      num = math.floor(num / 16)
                  end
                  if s == '' then s = '0' end
                  return s
              
              end
              
              --
              -- 	For the conversion of a DECimal number to anything else
              --	it is just needed to use the built-in Lua function tonumber(string, base)
              --
              --	print(tonumber("0100",2))
              --	4
              -- 	print(tonumber("3F",16))
              -- 	63
              
              --
              -- Returns HEX representation of a String
              --
              function str2hex(str)
                  local hex = ''
                  while #str > 0 do
                      local hb = dec2hex(string.byte(str, 1, 1))
                      if #hb < 2 then hb = '0' .. hb end
                      hex = hex .. hb
                      str = string.sub(str, 2)
                  end
                  return hex
              end
              
              --
              -- 	To display a memory block in ASCII
              --	it is just needed to use the built-in Lua function toString()
              --
              --	message is "f0 00 20 32 28 00 74 01 32 2e 30 2e 32 f7"
              --	console(MidiMessage:getData():getRange(8, 5):toString())
              --	2.0.2
              
              --
              -- Returns ASCII representation of a string of HEX numbers separated by blanks or not
              -- Example: console(hex2ascii("32 2E 30 2E 32")) gives 2.0.2
              -- Example: console(hex2ascii("322E302E32")) gives also 2.0.2
              --
              function hex2ascii(str)
                  local ascii = ''
                  while #str > 0 do
              		if string.sub(str, 1,1) ~= " " then
                      	ascii = ascii .. string.char(tonumber(string.sub(str, 1,2), 16))
                      	str = string.sub(str, 3)
              		else
                      	str = string.sub(str, 2)
              		end
                  end
                  return ascii
              end
              in reply to: Image – Invalid Resource when export #118349
              goodweather
              Participant
                • Topics: 45
                • Replies: 550
                • Total: 595
                • ★★★

                Only needed to clean the cache when there is a resource issue.

                .panel is a xml file yo can open in an editor as Notepad++
                .bpanelz is a binary (b) compressed (z) file of a panel including the resources. Use that for sharing your panel otherwise people will mis the images.

                Here is a summary I made in my Step by step guide (maybe it is only in my draft 2.x version):

                Ctrlr standalone reads and can export its data in different formats:
                ─ XML: creates a .panel file (XML file that is thus readable/editable in Notepad or any text editor).
                ─ Compressed XML: creates a compressed file with extension .panelz
                ─ Binary: creates a binary file with extension .bpanel
                ─ Compressed binary: creates a compressed binary file with extension .bpanelz
                ─ Compressed binary + resources: creates a file containing the panel, images and fonts used as resources with extension .bpanelz (the best way to share on the net, smallest and loads quick)
                ─ Instance: creates an .exe file that contains the panel, its resources but also the complete Ctrlr program. It can be used to distribute your panel without having people downloading something. Everything is editable, people can switch mode…
                ─ Restricted instance: same as Instance (an .exe file is also created) but not editable
                Use Compressed binary + resources when you want to share your panel with other people by providing them access to all images, the Lua code… so they can modify the panel or look how you built it.
                Use Restricted instance when you want to distribute the panel in such a way that people cannot modify the panel or look at the Lua code. In a restricted instance the Panel menu is removed and the File menu contains only Quit.

                in reply to: Editing exisitng Panel #118340
                goodweather
                Participant
                  • Topics: 45
                  • Replies: 550
                  • Total: 595
                  • ★★★

                  Which panel? Which colors?
                  You must download and install Ctrlr.
                  Download a .bpanelz file to get the .panel and its resources (images).
                  If the colors you want to change are in the images, you need to adapt those source images.
                  If the colors you want to change are the ones on standard Ctrlr buttons or panel background, then you need to open the panel in Ctrlr then select each modulator (button/rotary) and you will find color properties on the right side. Properties are depending on the type of modulator.

                  in reply to: Cleaning blank nibbles from hexstring #118339
                  goodweather
                  Participant
                    • Topics: 45
                    • Replies: 550
                    • Total: 595
                    • ★★★

                    Belge, mon nom c’est Bontemps 😉

                    in reply to: Playing WAV files with Ctrlr #118323
                    goodweather
                    Participant
                      • Topics: 45
                      • Replies: 550
                      • Total: 595
                      • ★★★

                      Well, in my Model D and Poly D panels I’m providing all patches from the Minimoog patch book but don’t have the wav files for them.
                      I’m also providing some other presets from the Minimoog User manual with associated wav files.
                      They don’t have to be stored in resources.
                      I have implemented a file browser giving the ability to automatically play (or not) the sound related to the patch. So, you can browse your sounds without doing the actual patching.

                      And indeed, people also like the VST/AU versions of the panels because they can store the settings for each of their track.

                      in reply to: Cleaning blank nibbles from hexstring #118322
                      goodweather
                      Participant
                        • Topics: 45
                        • Replies: 550
                        • Total: 595
                        • ★★★

                        OK! With your explanation I understand now the bit packing they are using and why you need to extract the 4 lowest bits then assemble them by 2 (msb+lsb).
                        Code from dnaldoog is perfect indeed (shift left x4 then add to next).
                        Didn’t want to criticize, just to understand 😉

                        in reply to: Cleaning blank nibbles from hexstring #118319
                        goodweather
                        Participant
                          • Topics: 45
                          • Replies: 550
                          • Total: 595
                          • ★★★

                          I’m still not sure to understand the need…
                          You get a 334 bytes message
                          In the documentation, you are saying (sorry i didn’t check) that they mention the offset with each byte (=8 bits) representing one data (your example CD_Routing is byte 155)
                          So, why not directly extracting the data byte by byte?
                          This is what I’m doing for all sysex dumps and there is no conversion needed except of course if they used bit packing.
                          Do not confuse the actual message and your way of seeing/displaying it on the screen/console!

                          Sent a reminder to the guy. Cross fingers but I guess he already sold it and it is the reason he is not answering.

                          in reply to: Global Persistent Variables? #118310
                          goodweather
                          Participant
                            • Topics: 45
                            • Replies: 550
                            • Total: 595
                            • ★★★

                            OK. which synth is it?
                            You didn’t tell me if it was factory or user patches.
                            Now that you gave me more info about what you want to do I can redirect you a bit.
                            Please look at my Pro 2 panel.

                            I would use Memoryblocks (look in Juce API doc and also in another post I answered recently.

                            MemoryBlock v CtrlrLuaMemoryBlock


                            One MB would be a bank of 64 patches. Each patch has a fixed length. Starts by F0 and finishes by F7.
                            When starting the panel, you load a MB of 64 patches (file on disk) and from there you can send each patch to the synth as you want.
                            You also treat each patch as a MB.

                            in reply to: Global Persistent Variables? #118307
                            goodweather
                            Participant
                              • Topics: 45
                              • Replies: 550
                              • Total: 595
                              • ★★★

                              I have never tried but I think you can store what you want in StateData.
                              Just make a test 😉
                              I suppose this is for user patches. For factory patches, just declare your table in some TablesInit() method then call that method at panel load to initialize it.
                              If you load user patchs in some component, then they stay there even if you close and re-open the panel because in the cache of the panel.
                              Therefore, I’m not sure you really need to keep that in state data.
                              You need to experiment different ways and choose the one you like the best. This is Ctrlr 😉

                              in reply to: getModulatorsWithProperty #118306
                              goodweather
                              Participant
                                • Topics: 45
                                • Replies: 550
                                • Total: 595
                                • ★★★

                                Thx to confirm, my friend!
                                I’m now doing the scanning of all modulators myself and it works fast

                                in reply to: MemoryBlock v CtrlrLuaMemoryBlock #118305
                                goodweather
                                Participant
                                  • Topics: 45
                                  • Replies: 550
                                  • Total: 595
                                  • ★★★

                                  For the correct syntax of functions, always look in Juce API
                                  Then realize that not everything has been ported to Ctrlr.
                                  Then also realize that some things are changing in Lua.
                                  For example, the bitwise operations have changed between Lua 5.1/5.2 and 5.3

                                  And indeed, I sometimes see strange characters in posts… Don’t know why…

                                  in reply to: Playing WAV files with Ctrlr #118303
                                  goodweather
                                  Participant
                                    • Topics: 45
                                    • Replies: 550
                                    • Total: 595
                                    • ★★★

                                    Héhé my friends, it is well indeed possible but via 2 tricks 😉

                                    The first trick is to run an external command from within Ctrlr.
                                    The second trick is to avoid the user to load some fancy wav player and thus the player must be native in the OS.
                                    After searching a bit, you find that rather easily.

                                    For Windows, the commands are:
                                    – powershell -c (New-Object Media.SoundPlayer ‘your_wav_filename’).PlaySync();
                                    – powershell -c (New-Object Media.SoundPlayer ‘your_wav_filename’).Play(); Start-Sleep -s 10; Exit;
                                    For MacOS, it is:
                                    – afplay \”your_wav_filename\”
                                    – afplay \”your_wav_filename\” -t 10

                                    To run the external command in Lua, it is os.execute(your_command)

                                    in reply to: Global Persistent Variables? #118302
                                    goodweather
                                    Participant
                                      • Topics: 45
                                      • Replies: 550
                                      • Total: 595
                                      • ★★★

                                      Glad I could help 🙂

                                      in reply to: Cleaning blank nibbles from hexstring #118294
                                      goodweather
                                      Participant
                                        • Topics: 45
                                        • Replies: 550
                                        • Total: 595
                                        • ★★★

                                        Why cleaning the message? Why not reading it as it comes from the DP4?
                                        Don’t get any answer from the seller of the DP4 I’m targetting 🙁

                                        in reply to: Global Persistent Variables? #118293
                                        goodweather
                                        Participant
                                          • Topics: 45
                                          • Replies: 550
                                          • Total: 595
                                          • ★★★

                                          You can achieve this with stateData. StateData is kept in the Ctrlr cache.

                                          Create a method SaveStateData to store the data you want to keep. Example:

                                          --
                                          -- Called when data needs saving
                                          -- StateData is saved when the user press Ctrl+Alt+S (Save Ctrlr StateData in the menu)
                                          -- or when quitting Ctrlr while leaving the panel open.
                                          -- At that time all modulators indicated as Dynamic are saved but by using this method 
                                          -- it is possible to also save values of variables that can then be read when loading the panel
                                          --
                                          SaveStateData = function(--[[ ValueTree --]]stateData)
                                          
                                          	-- Saving the last file loaded/saved so it can be reloaded at panel load
                                          	-- This is needed to have all uiLabels restored
                                          	-- If a uiLabel is set to Dynamic instead of Static then it is its value - 0 - and not its uiLabelText property that is saved
                                          	-- Therefore, obliged to keep all uiLabels as Static and to reload the last file
                                          	stateData:setProperty ("LastFileFullPath", sLastFileFullPath, nil)
                                          	stateData:setProperty ("LastFileName", sLastFileName, nil)
                                          	stateData:setProperty ("RootFolder", currentRootFolder, nil)
                                          
                                          end

                                          Create a method to read your stateData and put the values in variables. Example:

                                          --
                                          -- Called when data is restored
                                          --
                                          ReadStateData = function(--[[ ValueTree --]] stateData)
                                          
                                          	-- Variables to be read
                                          	sLastFileFullPath = stateData:getProperty("LastFileFullPath")
                                          	sLastFileName = stateData:getProperty("LastFileName")
                                          	currentRootFolder = stateData:getProperty("RootFolder")
                                          
                                          end

                                          In panel properties, set
                                          Called when Ctrlr state is saved: SaveStateData
                                          Called when Ctrlr is loaded: ReadStateDate

                                          In your PanelLoaded method, you need to check if the StateDate has been restored or not. Yep, it is sometimes failing… Example:

                                          -- Check restored statedata and, if found, inform timer to reload file to secure all uiLabels are correctly set
                                          if sLastFileFullPath == nil or sLastFileFullPath == "" then
                                          	sLastFileFullPath = ""
                                          	sLastFileName = ""
                                          	bLastFile = false
                                          else
                                          	-- if stateData is working then sLastFileFullPath, sLastFileName should have been restored correctly
                                          	-- Check if file has not been moved or been deleted
                                          	f = File(sLastFileFullPath)
                                          	if f:existsAsFile() then
                                          		bLastFile = true
                                          	else
                                          		sLastFileFullPath = ""
                                          		sLastFileName = ""
                                          		bLastFile = false
                                          	end
                                          end

                                          Last info: please be aware that StateData is only saved when the user quit Ctrlr by keeping the panel open. Thus not when simply closing a panel. A bit tricky and for sure not perfect.
                                          Good luck!

                                          in reply to: Change Modulator Display Values #118292
                                          goodweather
                                          Participant
                                            • Topics: 45
                                            • Replies: 550
                                            • Total: 595
                                            • ★★★

                                            It works as well with uiSlider but is a bit more tricky:
                                            – min Value = -3
                                            – max Value = 3
                                            – expression to evaluate when calculating the midi message: modulatorValue+3
                                            – expression to evaluate when calculating the modulator value: midiValue-3

                                            The advantage is that you don’t need to type all the single values
                                            You will understand the advantage when you will have a mod -128 to +128 😉

                                            From my part, I prefer using a separate display of the value label but then you need to code a Lua function that is triggered when the mod value changes.

                                          Viewing 20 posts - 61 through 80 (of 550 total)
                                          Ctrlr