Quick question re: methodName (modulator, newValue)

Home Forums General Programming Quick question re: methodName (modulator, newValue)

Viewing 10 posts - 1 through 10 (of 10 total)
  • Author
    Posts
  • #541
    LilCthulhu
    Participant
      • Topics: 9
      • Replies: 67
      • Total: 76

      Hi,

      I’ve started implementing a new device panels, I’m a professional software developer, I just don’t have all the exp re: Lua <img decoding=” title=”Wink” /> I will have few questions regarding the API and would like to hear from you guys <img decoding=” title=”Wink” /> I’m planning to release this pannel ASAP and the IDE is going well…

      The first question is : when you create a new method associated to a modulator, you get the following method definition:

      methodName (modulator, newValue)

      I’ve got no issue with newValue, however I tried "using" the modulator value as a modulator object (the same way you would get one by getting the modulator using it’s name, etc)… but I want that method to be associated with multiple modulator AND each time I access the modulator variable, I get an error… maybe I’m not doing it right… and console printing the type of the modulator returns a userdata and not a modulator object… Any ideas ?

      Chris

      #3812
      atom
      Keymaster
        • Topics: 159
        • Replies: 2945
        • Total: 3104
        • ★★★★★

        You can assign the same method for any number of modulators bu selecting it as a property for each modulator. The modulator variable is an object and you access it or modify it by its methods. Most of the stuff is done by getting or setting its properties. There are some examples in the dos directory of your ctrlr installation. What exactly are you trying to do in that method? Ill try to give you an example once I know what are you trying to achieve.

        #3813
        LilCthulhu
        Participant
          • Topics: 9
          • Replies: 67
          • Total: 76

          Basically, I want some lua method to be responsible for sending sysex message to my keyboard instead of using the modulator sysex block.

          The reason I prefer this approach is that by changing one method, I can alter the way sysex are sent and received from the keyboard and it’s far easier to edit <img decoding=” title=”Wink” /> I’m planing on using the custom modulator group value (or the modulator’s ui group custom index) (GV) + custom modulator index (MI) as an the address of the sysex msg and newValue (NV) the new value…

          GV+MI would be the address in two hex char… for example

          GV = h52, MI = h02, NV = h64 … then sysex would be " … 00 54 64 …"
          GV = h7F, MI = h05, NV = h62 … then sysex would be " … 01 05 62 …"

          Upon receiving sysex, I could use the same address scheme to assign value to my modulators since the unique index of each of my modulator would be the direct address of the sysex, for example… upon receiving address 01 05, I would direct the value to modulator index # 132… All other non-sysex object would be in higher indexes not affected…

          Then assigning received sysex would simply be a matter of looping through the array and sending the value of the dump to the modulators instead of referencing each modulators…

          Basically I’m trying to target both a famous synth from the 90s + it’s rack version (that had more parameters) with the same panel <img decoding=” title=”Wink” />

          I don’t know if it makes sense but I know it does for me <img decoding=” title=”Wink” />

          #3814
          LilCthulhu
          Participant
            • Topics: 9
            • Replies: 67
            • Total: 76

            So when I get the modulator variable in the method. I expect to write somehting like this ( I don’t know the real lui api yet so this is pseudo code)

            address = modulator.CustomModulatorGroupValue + modulator.CustumModulatorIndex

            sendSysex("F7 … … " + address + newValue + checksum + "F0")

            The actual sending of sysex could be another "hidden" modulator <img decoding=” title=”Wink” />

            Thanks

            #3815
            atom
            Keymaster
              • Topics: 159
              • Replies: 2945
              • Total: 3104
              • ★★★★★

              Your code should like this (inside the method)
              [code:2ozhzfvq]
              address = modulator:getPropertyInt("modulatorCustomIndex") + modulator:getPropertyInt("modulatorCustomIndexGroup")
              checksum = 2+2 — or whatever calculation you need to do
              midiMessage = CtrlrMidiMessage(string.format ("F7 %.2x %.2x %.2x F0", address, newValue, checksum))
              panel:sendLuaMidiMessageNow(midiMessage)
              [/code:2ozhzfvq]

              #3816
              LilCthulhu
              Participant
                • Topics: 9
                • Replies: 67
                • Total: 76

                THANKS !!! Wow <img decoding=” title=”Wink” /> Btw, does my thinking make sense ? doing it like that… the other reason I’m doing it like that is that I have around 50+ parameters per tone, and I have 4 tones + 1 other one I need to keep for modifying more than one tone at the same time… so that makes around 200 sysex code + some others… maybe a total of 300-400 possible parameters <img decoding=” title=”Wink” />.

                Of course, I could use only one set of visuals for all 4 tones, but I want the user to be able to see/update each tone independantly and be able to switch from one tone to the other… I could refresh from the keyboard each time a tone is displayed which is what I might do also… I’m not there yet <img decoding=” title=”Wink” />

                #3817
                atom
                Keymaster
                  • Topics: 159
                  • Replies: 2945
                  • Total: 3104
                  • ★★★★★

                  It makes sense though i’d urge you to avoid LUA if not needed, apart from the checksum all the sysex stuff can be done without LUA. If you can tell me how to do the checksum or provied a working code in c/c++ i’ll add that to my collection and everything will be done within Ctrlr without LUA (there is already a checksum sysex modifier for the Roland JP synths, it will be just another one there). Also without lua you will get automatic input matching, the only LUA code you’d need to write would be for the program dump/send for the synths.

                  #3818
                  LilCthulhu
                  Participant
                    • Topics: 9
                    • Replies: 67
                    • Total: 76

                    I’ve already tackled a lot of the issues in advance (because your IDE already provide MOST of what we need), was able to figure out the checksum calculation using your Roland checksum just by changing the Z value (don’t know if it suceeded randomly or if it makes sense, but it works so far)… my targets are also Rolands, so it kind of make sense. I suppose the Z value is a mean to determine the array size of hex parameters on which to calculate the checksum… I’ve also figure out the proper way to calculate values ranging from -50 to 50 in the gui but 0-100 in the sysex, etc. So far I’ve been able to figure out mostly everything.

                    I’ve even managed to modify the xml files directly for majors modifications.. I’ve also sorted the modulators/labels in the xml files by sections… I’ve created multiple panels and will be "merging" them when ready <img decoding=” title=”Wink” /> I started last sunday and spent a little bit of time on it…

                    #3819
                    atom
                    Keymaster
                      • Topics: 159
                      • Replies: 2945
                      • Total: 3104
                      • ★★★★★

                      Try not to change the XMLs manually if you are a developer there is a LUA console that you can use to automatic changes to all modulators with one simple loop. Apart from that do whatever you like <img decoding=” title=”Smile” /> thats what it’s for let me know if i can help with anything.

                      The checksum is for the JP series but i imagine roland uses the same algorithm for most of it’s sysex implementation so that might work for a lot of hardware.

                      #3820
                      LilCthulhu
                      Participant
                        • Topics: 9
                        • Replies: 67
                        • Total: 76

                        Well, as for the LUA console, I actually did quite a few things there by going through a loop on the modulators, quite handy… I’ve also seen that it can add properties to objects (if you make a mistakes, etc) which can be a good thing or not… n’way. I’ve found that adding 4 sets of modulators for 4 tones was easier by editing the xmls, once the first set was done, it was a matter of find and replace <img decoding=” title=”Wink” />… I still need to fix all those vstindex <img decoding=” title=”Wink” /> but it was quick <img decoding=” title=”Wink” /> Also, I’ve sorted the xmls files so it’s easier to locate an issue that way, I’ve got all my groups with all my labels and afterward my modulator s;)

                      Viewing 10 posts - 1 through 10 (of 10 total)
                      • The forum ‘Programming’ is closed to new topics and replies.
                      There is currently 0 users and 100 guests online
                      No users are currently active
                      Forum Statistics
                      Threads: 2,495, Posts: 17,374, Members: 77,605
                      Most users ever online was 12 on January 22, 2019 3:47 pm
                      Ctrlr