goodweather

Forum Replies Created

Viewing 20 posts - 421 through 440 (of 550 total)
  • Author
    Posts
  • in reply to: How to transmit sysex message by changing a tab #69476
    goodweather
    Participant
      • Topics: 45
      • Replies: 550
      • Total: 595
      • ★★★

      I was going to answer that you can do as follows:

      • for your object you need to have some kind of button to trigger the read of the tab params. In that button, you set the OnChange property to a method you will call for example ReadTabParams()
      • In ReadTabParams() you need to test the value of your uiTabs modulator using if-elseif-elseif-else-end and you read each property within each else

      This should work fine…

      in reply to: How to transmit sysex message by changing a tab #69470
      goodweather
      Participant
        • Topics: 45
        • Replies: 550
        • Total: 595
        • ★★★

        Sorry, I don’t get you… What do you want to do?
        With Lua you can retrieve any property of any modulator, thus including tabs.
        Then you can store those in variables or set other modulators with the values or…

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

          Without knowing it was in another panel, I have also used that technique: rebuilding and replacing the full string of names.
          This is faster and easier than searching in the content string and replacing a piece (you need to store what is before and what is after) of it.

          I put this in a separate method that I can call for any listbox: RefreshListBoxContent(memoryblock). So, only one program but re-used several times 🙂
          It is based on a memory block in my case as I have sound banks as memory blocks and I extract the program names from the bank (20 char string).

          Here is the code you can get inspired from:

          RefreshBankListBox = function(mbBank)
          
          	FileSize = mbBank:getSize()
          
          	if FileSize == 116622 then
          		sListBoxContent = ""
          		for i=0, 98 do
          			UnpackedTempData = utils.unpackDsiData(mbBank:getRange (438+i*1178, 24))
          			sTemp = trim(UnpackedTempData:getRange (0, 20):toString())	-- Remove blanks
          			sTemp = sTemp:gsub("'", " ")	-- Replace ' by a space as it gives issues in the listbox
          			sTemp = sTemp:gsub("\"", " ")	-- Replace " by a space as it gives issues in the listbox
          			if i==0 then
          				sListBoxContent = sListBoxContent..string.format("%s", "P1 "..sTemp)
          			else
          				sListBoxContent = sListBoxContent..string.format("\n%s", "P"..tostring(i+1).." "..sTemp)
          				--sListBoxContent = sListBoxContent..", \""..sTemp.."\""
          			end
          		end
          		return sListBoxContent
          	else
          		utils.warnWindow("Refresh bank list box", "Error: bank data not of correct size. Should be 116622 and is "..FileSize.." bytes.")
          	end
          
          end

          To use it:
          lbUser1:setPropertyString ("uiListBoxContent", RefreshBankListBox(mbUser1))

          With lbUser1 being a uiListBox declared as:
          lbUser1 = panel:getListBox("User1")

          in reply to: strange behaviour of setVisible during startup #69468
          goodweather
          Participant
            • Topics: 45
            • Replies: 550
            • Total: 595
            • ★★★

            Hi, I got this working but I remember having had some issues though… not sure anymore…
            What I have done:

            • In my panel I set the modulators invisible by default (Component generic – Is component visible = OFF)
            • In PanelLoaded, I set them invisible as well with
              	lblProgress:getComponent():setVisible(false)
              	txtProgress:getComponent():setVisible(false)
              	modProgressBar:getComponent():setVisible(false)
            • when needed I set them visible with
              	lblProgress:getComponent():setVisible(true)
              	txtProgress:getComponent():setVisible(true)
              	modProgressBar:getComponent():setVisible(true)
            • the different modulators are declared as
              	lblProgress = panel:getModulatorByName("lblProgress")
              	txtProgress = panel:getModulatorByName("txtProgress")
              	modProgressBar = panel:getModulatorByName("ProgressBar")
              

            May be this will help you…

            in reply to: How to transmit sysex message by changing a tab #69463
            goodweather
            Participant
              • Topics: 45
              • Replies: 550
              • Total: 595
              • ★★★

              A tab is a modulator so you build a classical OnChange method related to it that you will connect to “Component – Called when current tab changes”
              The start of your method is like:

              --
              -- Called when a modulator value changes
              -- @mod   http://ctrlr.org/api/class_ctrlr_modulator.html
              -- @value    new numeric value of the modulator
              --
              Tab_OnChange = function(--[[ CtrlrModulator --]] mod, --[[ number --]] value, --[[ number --]] source)
              

              value is the tab number. So you can just do something like

              if value==0 then
              sendmessage0
              elseif value == 1 then
              sendmessage1
              elseif value ==2 then
              sendmessage2
              end
              in reply to: save file without window? #69456
              goodweather
              Participant
                • Topics: 45
                • Replies: 550
                • Total: 595
                • ★★★

                Hi Possemo, is the create() line really needed?
                Looking in Juce API doc, the File() function is doing the creation of the file object (fileToWrite) if what you have within () is a valid full path…
                https://www.juce.com/doc/classFile#ab803ce7daf2eb1194a562a7912d96967
                Did you try without?

                in reply to: saving/loading data to a file #69452
                goodweather
                Participant
                  • Topics: 45
                  • Replies: 550
                  • Total: 595
                  • ★★★

                  Hi guys, hope you are well 🙂
                  It was good you explained what you wanted to achieve, Puppeteer…
                  On my Pro 2 panel, I have same kind of stuff but I keep everything separated:

                  • Factory banks are just tables of names in the panel. THey are declared as
                    F5Bank = {"SquareBass", "Cascades", "Pro Soloist", ... }
                    When you turn the Bank and Program buttons, you can navigate in the Factory bank programs. When you decide to Load, it is taken from the synth.
                  • Disk banks are on the PC disk. They are fully loaded on user request in a MB. The corresponding listbox is ppopulated with names that are extracted with getRange
                  • user banks are on the synth with also a corresponding bank on the PC. Similar as Disk banks but interaction with the synth on Load/Save

                  As Ctrlr is meant to be used with a synth, I think it is important to keep things separated and try to avoid loading everything.
                  I came to that conclusion when I put all Factory bank data in memory blocks that I was loading on Panel init. Starting the panel took several minutes… and thus was not very user friendly. So, I keep separated and load on request.
                  I do all the interactions with memory blocks (easy to replace/append/read piece by piece then write on disk when needed).

                  in reply to: Multiple bytes dumping into 1 parameter help #69429
                  goodweather
                  Participant
                    • Topics: 45
                    • Replies: 550
                    • Total: 595
                    • ★★★

                    Well…
                    In the midiMessageReceived method described by dasfaker, you can see you are loading a memory block called PatchDataLoaded (or programData if your data is in some extract of it).
                    Just replace mbDump in what I have written by PatchDataLoaded

                    The byte extraction and wave_number calculation can be put within dasfaker’s AssignValues() method. Assign the wave_number to one of your modulator if this is what you want to do…

                    in reply to: Multiple bytes dumping into 1 parameter help #69427
                    goodweather
                    Participant
                      • Topics: 45
                      • Replies: 550
                      • Total: 595
                      • ★★★

                      Hi,
                      if you know the offset of your parameter, then you can use one getRange() or 4 getByte().
                      You have your sysex dump in a memoryblock, let’s say mbDump.
                      The first byte is at offset 0. If your parameter is for example at offset 30, you will do:

                      byte1 = mbDump:getByte(30) -- 0000aaaa
                      byte2 = mbDump:getByte(31) -- 0000bbbb
                      byte3 = mbDump:getByte(32) -- 0000cccc
                      byte4 = mbDump:getByte(33) -- 0000dddd

                      Then you need to assemble those 4 bytes to form the number:

                      • dddd= 0 to 8
                      • cccc= 16 to 128
                      • bbbb= 256 to 2048
                      • aaaa= 4096 to 16384 (the first a should always be 0 if 16384 is the max)

                      So, the following formula should work:
                      wave_number = byte4 + byte3*16 + byte2*256 + byte1*4096
                      Test: 16384 = 0100 0000 0000 0000 = 4*4096 Yes!

                      Note that you need to check the order of the bytes (is aaaa the first one or the last one) but the solution above gives you the general principle.

                      Good luck 🙂

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

                        Well, not sure I follow you…
                        Q1: to replace the content of one line, there are different approaches depending on other possibilities of your panel.
                        On the Pro 2, I implemented a librarian and I can manage full banks or single programs belonging to banks. I took a lazy but easy approach to replace one line: I rebuilt the whole listbox content based on the new content of the bank.
                        Each bank contains 99 programs having the same 1178 bytes structure. This is stored in a Memoryblock and I know precisely where to find the name of each program.
                        So it is simply a matter to have a loop reading the 99 names and putting them after each other separated by \n

                        lbDisk1:setPropertyString ("uiListBoxContent", RefreshBankListBox(mbDisk1))
                        
                        RefreshBankListBox = function(mbBank)
                        
                        	FileSize = mbBank:getSize()
                        
                        	if FileSize == 116622 then
                        		sListBoxContent = ""
                        		for i=0, 98 do
                        			UnpackedTempData = utils.unpackDsiData(mbBank:getRange (438+i*1178, 24))
                        			sTemp = trim(UnpackedTempData:getRange (0, 20):toString())	-- Remove blanks
                        			sTemp = sTemp:gsub("'", " ")	-- Replace ' by a space as it gives issues in the listbox
                        			sTemp = sTemp:gsub("\"", " ")	-- Replace " by a space as it gives issues in the listbox
                        			if i==0 then
                        				sListBoxContent = sListBoxContent..string.format("%s", "P1 "..sTemp)
                        			else
                        				sListBoxContent = sListBoxContent..string.format("\n%s", "P"..tostring(i+1).." "..sTemp)
                        				--sListBoxContent = sListBoxContent..", \""..sTemp.."\""
                        			end
                        		end
                        		return sListBoxContent
                        	else
                        		utils.warnWindow("Refresh bank list box", "Error: bank data not of correct size. Should be 116622 and is "..FileSize.." bytes.")
                        	end
                        
                        end

                        trim is not a standard function. DSI data is packed so before reading the name I must first unpack the data and hopefully Atom provided a function in Ctrlr to do it.

                        Another approach is to search for the n-1 and n “\n”, cut your string (string.sub()) and add your new string in between. I tested this and it works fine.
                        Look at http://www.lua.org/manual/5.1/manual.html#5.4 for string manipulation and use Google for searching for code examples. Don’t take complex code. Often not needed.

                        Q2: show only 8 names? Do you mean you have a bank of 100 names for example but for some reason you want only to show 8 of them? Well, you can either make a loop and search for the 8th “\n” then take the part of the string until that position or you can rebuild from 1 to 8.
                        Lua is strong in string manipulation.
                        I often test small piece of code at http://www.lua.org/demo.html.
                        Use “print(some_value)” to see some output.

                        You will learn a lot by reading (take a lot of time) the end of the .cpp files in https://sourceforge.net/p/ctrlrv4/code/HEAD/tree/nightly/Source/Lua/ and in the different folders including in the parent one.
                        Also by reading things in the Juce API at https://www.juce.com/doc/classes
                        and in the forum, the different panels made by users and the DEMO panels provided by Atom.
                        You can also open the Lua console and type in the bottom part what(some_object or variable) to see all functions it can have.
                        Try with your listbox! what(FactoryBank1)

                        I add also issues myself in many things but then left it for a few days then came back, read a bit everywhere and solved the issues or found some workaround.

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

                          Forgot to say: very nice panel! Congrats!
                          Keep the good work!
                          On my side, I’m now finishing the Pro 2 panel and will soon release it for testing (busy with the logic of the Load/Save on main panel and the librarian manipulations).
                          Best regards!

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

                            Good 🙂

                            BankItem_OnClick is a callback function this means that it will be called each time you click on an item if you assign that function to your uiListbox property “Called when Item is clicked”. Basically, this is what you want to do: refresh your LCD each time an item is clicked…

                            I see you are using panel.getComponent(“LCD10”). Did you initialize all your modulators somewhere? In fact you should create a method containing all your modulators initialization like xyz = panel.getModulatorByName(“Bank1”) and you assign that method to your panel property “Called when panel is loaded”.
                            Then in all your methods, you don’t need to refer to the actual name of the modulator and the performance will be better as Ctrlr doesn’t need to go through the list of modulators to search their names (explained by Atom somewhere in the forum).
                            So, in your methods you simply use: xyz.getComponent().setPropertyString… to reach the component part within the Bank1 modulator.
                            In my Pro 2 panel I define things like lblLCD10 = panel.getModulatorByName(“LCD10”) to indicate it is a label that the user cannot change. I have also modSomething for all buttons; the Something being the same as the actual name of the modulators. Advantage is that I always know what type of component I’m handling (as long as I respect my own rule…).

                            About the L() function, I got the tip from dasfaker who had a similar problem. It is a string conversion function that must be used sometimes when comparing string objects.
                            Quote from Atom:

                            I think this might be a Lua issue in it’s core you are comparing a object of type String() and a string, getLuaName() is an alias to getName() and they both return a String()

                            so in order to compare the actual String() content you should do something like

                            m = panel:getModulatorByName (“very fucked up modulator”)
                            console (m:getName())
                            if L(m:getName()) == “very fucked up modulator” then
                            console (“Yup i got that modulator i needed”)
                            else
                            console (“Nope couldn’t get it”)
                            end
                            That is put the modulator:getName() in a L() function, this changes the String() object to a std::string object that is known to Lua as an object that has a string inside it.

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

                              Well… different things

                              • Your method must be (type it exactly like this): BankItem_OnClick = function(–[[ CtrlrModulator –]] modulator, –[[ number –]] value)
                              • within the method code, “value” is the number of the item clicked. If you want to display it, use console(tostring(value)). tostring() is much easier than string.format
                              • if you need the text corresponding to the “value” then use L(lbBank1:getTextForValue(value))

                              Good luck!

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

                                Always easier when you know the goal 🙂

                                Create a method that you can call BankItem_OnClick with type uiListBoxItemClicked.
                                When using it, the variable “value” will contain the number of the selected item.
                                So, in that method you can update your LCD with the code:

                                panel:getComponent(“ComScreen”):setPropertyString (“uiLabelText”,string.format(“%s %s %s %s %s %s”,lors,ramrom,bnkscreen,bnr,value,ToneNbr))

                                Compile the method then select your listbox and set the property “Called when Item is clicked” (somewhere at the bottom of the properties list) to BankItem_OnClick

                                Should work fine…

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

                                  What do you want to do? I don’t follow you.
                                  The whole content of a uiListBox is already a string…
                                  You set it with setPropertyString (“uiListBoxContent”, “Your content”) and you get it with getPropertyString (“uiListBoxContent”).

                                  You can assemble the content of a uiListBox with a loop like:

                                  for i=0, 98 do
                                  	if i==0 then
                                  		sListBoxContent = sListBoxContent..string.format("%s", "P1 "..sTemp)
                                  	else
                                  		sListBoxContent = sListBoxContent..string.format("\n%s", "P"..tostring(i+1).." "..sTemp)
                                  	end
                                  end

                                  The first program should not have a return before all the other ones well.
                                  sTemp is the name of each program (I have removed here the way I’m getting it and you need to replace by your own stuff).

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

                                    Nice to read!
                                    Yes, iLastSelectedProgram is a variable containing the selected Item.
                                    In my Pro 2 implementation, I’m doing the complete management based on mouse clicks. You don’t need to select an actual value with a modulator but just clicking on the program you want to load.
                                    But that’s another story 🙂

                                    in reply to: Some important info #69385
                                    goodweather
                                    Participant
                                      • Topics: 45
                                      • Replies: 550
                                      • Total: 595
                                      • ★★★

                                      Thx Atom.
                                      Just downloaded 5.4.2 from web site (i was on 5.3.186 before) and tried the About to check.
                                      It still indicates 5.3.201 instead of 5.4.2.
                                      I’ll let you know if I find some not working stuff…
                                      Thx for continuing working and improving Ctrlr!!!

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

                                        Hi,
                                        I have implemented that in my Pro 2 librarian (soon to be published). I’m using Lua methods to copy the selected item of a uiListbox into a uiLabel.
                                        I’ll also describe it extensively in the Step by Step guide 2.0.

                                        If you know the item that has been clicked (I can also give you the code and logic for that), you can use the following statement:
                                        txtSource:getComponent():setPropertyString ("uiLabelText", L(lbDisk1:getTextForValue(iLastSelectedProgram)))

                                        where

                                        • txtSource is your label modulator. I defined txtSource = panel:getModulatorByName(“txtSource”) during panel initialization
                                        • lbDisk1 is your list box. I defined lbDisk1 = panel:getListBox(“Disk1”) during panel initialization
                                        • iLastSelectedProgram is your item number in the list box

                                        Let me know if you need more hints…

                                        in reply to: DSI Tempest librarian (editor) #69360
                                        goodweather
                                        Participant
                                          • Topics: 45
                                          • Replies: 550
                                          • Total: 595
                                          • ★★★

                                          FYI, I am now finishing the librarian for the Pro 2. It is including bank (load from disk, from Pro 2, Save to disk) and program management (load/save to disk, move, swap, copy, load to Pro 2).
                                          Now I need to do some testing and implement the main Load and Save buttons functionality (this is on top of the librarian).
                                          Then I’ll release the panel as 0.9 version.
                                          I will also document everything in the Step by Step guide 2.0.
                                          Here is a screenshot as appetizer…

                                          Attachments:
                                          You must be logged in to view attached files.
                                          in reply to: How to capture Cancel from utils.SaveFileWindow? #69359
                                          goodweather
                                          Participant
                                            • Topics: 45
                                            • Replies: 550
                                            • Total: 595
                                            • ★★★

                                            Thx Poss. Unfortunately by reading the code I can see it won’t help as I’m opening the dialog window with already an existing filename…
                                            So: the file is valid and existing and will be overwritten…

                                          Viewing 20 posts - 421 through 440 (of 550 total)
                                          Ctrlr