[resolved] uiLabel to display/edit program names

Home Forums General Panels, Components, Macros [resolved] uiLabel to display/edit program names

Viewing 19 posts - 1 through 19 (of 19 total)
  • Author
    Posts
  • #10080
    msepsis
    Participant
      • Topics: 219
      • Replies: 732
      • Total: 951
      • ★★★

      Is there any example you might be able to put together, atom that demonstrates how this is possible? I seem to recall you saying this was doable a while back but I wasn’t at a point where I was even thinking about implementing it.

      Many of my synths use value 32-127 in ASCII of the last 16 bytes of a program dump to transfer program/sound names. I’ve got comboboxes set up right now to display/edit program names but would love to implement user typable program names if this is now possible.

      If it’s within reason a demo panel would probably be the most helpful

      • This topic was modified 10 years, 8 months ago by msepsis.

      Monstrum Media | Music, Sound & Software Design, Chicago / San Francisco listen

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

        if you can put the data into a memory block that is exactly the data that holds the program name (no more, no less), the doing toString() on the memory block that holds it should give you the program name.

        #10120
        zeoka
        Participant
          • Topics: 73
          • Replies: 466
          • Total: 539
          • ★★★

          i think i will use a script that is “a table” i can call for dump or edit name knobs
          and send to the 16 uilabels or one label with variables.
          I will naming bytes or mods with the same name and call the script when it needed
          That seems to be a good plan…
          In the Dasfaker panel there is things he does with the Virus main params label , i see approximatively like tables {“aa,bb,cc,dd”} if i’m correct , an other way than “setProperty” for each value…

          • This reply was modified 10 years, 10 months ago by zeoka.
          #11042
          zeoka
          Participant
            • Topics: 73
            • Replies: 466
            • Total: 539
            • ★★★

            Hi

            I’ve found some thing in a forum that looks like a ASCII table
            Not really sure about what’s happ or about what Ipad41001 said (even with Google trad 🙂 ) but i see “it works”

            http://twolivesleft.com/Codea/Talk/discussion/46/ascii-supported-resolved/p1

            there is other code later
            string.byte (s [, i [, j]])

            may be to evitate to type special characters we can’t type in ctrlr or jknobman ?

            Something to do with that ?

            • This reply was modified 10 years, 9 months ago by zeoka.
            #11050
            zeoka
            Participant
              • Topics: 73
              • Replies: 466
              • Total: 539
              • ★★★

              tried this one :`myMethod = function(mod, value)

              m1 = panel:getModulatorByName(“modulator-1”):getModulatorValue()
              m2 = panel:getModulatorByName(“modulator-2”):getModulatorValue()
              m3 = panel:getModulatorByName(“modulator-3”):getModulatorValue()
              mylabel = panel:getComponent(“modulator-4”)
              char1 = string.char(m1 + 32)
              char2 = string.char(m2 + 32)
              char3 = string.char(m3 + 32)

              mylabel:setComponentText (string.format(“%s%s%s”,char1,char2,char3))

              end`

              This is working except
              for two last chars in my synth there is arrows and not in ctrlr
              it is applied to the 3 modulators
              EDIT
              1 ) How to have a label text with input text like modulators contents ?
              Then i could apply a revert script in the label ?

              2) Atom may be i will not use modulator at all . could you create a special label text (or an option) with an input text when click on ? could be a simple way…
              i could replace modulators by midi:getLuaData 😉

              • This reply was modified 10 years, 9 months ago by zeoka.
              • This reply was modified 10 years, 9 months ago by zeoka.
              • This reply was modified 10 years, 9 months ago by zeoka.
              • This reply was modified 10 years, 9 months ago by zeoka.
              • This reply was modified 10 years, 9 months ago by zeoka.
              • This reply was modified 10 years, 9 months ago by zeoka.
              #11058
              zeoka
              Participant
                • Topics: 73
                • Replies: 466
                • Total: 539
                • ★★★

                OOsp !! “editing on one click” , “editing on double click” properties

                coool !

                #11060
                zeoka
                Participant
                  • Topics: 73
                  • Replies: 466
                  • Total: 539
                  • ★★★

                  Got the reverse thing !!

                  i type with the kbd and i set the modulator name characters ! i ‘ve removed the scripts on mods and now i will remove mods 🙂 `
                  — Called when the contents of a Label are changed
                  — @label
                  — @newContent a string that the label now contains

                  myMethod2 = function(label, newContent)

                  sendlabel = panel:getComponent(“modulator-4”):getProperty(“uiLabelText”)

                  charval1 = (string.byte(sendlabel,1)) – 32
                  charval2 = (string.byte(sendlabel,2)) – 32
                  charval3 = (string.byte(sendlabel,3)) – 32

                  panel:getModulatorByName(“modulator-1”):setModulatorValue(charval1,false,true,false)
                  panel:getModulatorByName(“modulator-2”):setModulatorValue(charval2,false,true,false)
                  panel:getModulatorByName(“modulator-3”):setModulatorValue(charval3,false,true,false)

                  end`

                  cheers

                  • This reply was modified 10 years, 9 months ago by zeoka.
                  #11071
                  zeoka
                  Participant
                    • Topics: 73
                    • Replies: 466
                    • Total: 539
                    • ★★★

                    Heyho !
                    With this i can type number of characters i want without nil error :

                    -- Called when the contents of a Label are changed
                    -- @label
                    -- @newContent    a string that the label now contains
                    --
                    myMethod2 = function(label, newContent)
                    
                    sendlabel = panel:getComponent("modulator-4"):getProperty("uiLabelText")
                    
                    charval1 = string.byte(sendlabel,1)
                    charval2 = string.byte(sendlabel,2)
                    charval3 = string.byte(sendlabel,3)
                     
                    
                    if charval1 == nil then 
                    panel:getModulatorByName("modulator-1"):setModulatorValue(0,false,true,false)
                    else
                    panel:getModulatorByName("modulator-1"):setModulatorValue(charval1  - 32,false,true,false)
                    end
                    
                    if charval2 == nil then 
                    panel:getModulatorByName("modulator-2"):setModulatorValue(0,false,true,false)
                    else
                    panel:getModulatorByName("modulator-2"):setModulatorValue(charval2  - 32,false,true,false)
                    end
                    
                    if charval3 == nil then 
                    panel:getModulatorByName("modulator-3"):setModulatorValue(0,false,true,false)
                    else
                    panel:getModulatorByName("modulator-3"):setModulatorValue(charval3  - 32,false,true,false)
                    end
                    
                    end
                    #11072
                    zeoka
                    Participant
                      • Topics: 73
                      • Replies: 466
                      • Total: 539
                      • ★★★

                      Now my label sends directly sysex without modulators !
                      Ive replaced setmodultorvalue by sendmidimessage now
                      20*4 combos less in the xml file , replaced by 8 textlabels !
                      They receive the patch name and send sysex (16 quasi at once)when i type the kbd

                      Perfect
                      Hope that helps some users who want include and type patch names .

                      i just type the label with the keyboard

                      Big up to Atom & Ctrlr

                      • This reply was modified 10 years, 9 months ago by zeoka.
                      • This reply was modified 10 years, 9 months ago by zeoka.
                      #11219
                      msepsis
                      Participant
                        • Topics: 219
                        • Replies: 732
                        • Total: 951
                        • ★★★

                        I’m still not there yet. I’m attempting to get the program name from a sysex dump (from the synth to the panel)… i’ve tried a variety of alterations of the following code, here i’m getting each character’s value individually from a range within the program dump from the synth:

                        	pn01 = programData:getByte(240)
                        	pn02 = programData:getByte(241)
                        	pn03 = programData:getByte(242)
                        	pn04 = programData:getByte(243)
                        	pn05 = programData:getByte(244)
                        	pn06 = programData:getByte(245)
                        	pn07 = programData:getByte(246)
                        	pn08 = programData:getByte(247)
                        	pn09 = programData:getByte(248)
                        	pn10 = programData:getByte(249)
                        	pn11 = programData:getByte(250)
                        	pn12 = programData:getByte(251)
                        	pn13 = programData:getByte(252)
                        	pn14 = programData:getByte(253)
                        	pn15 = programData:getByte(254)
                        	pn16 = programData:getByte(255)
                        	programName_string = string.format("%s %s %s %s %s %s %s %s %s %s %s %s %s %s %s %s", pn01, pn02, pn03, pn04, pn05, pn06, pn07, pn08, pn09, pn10, pn11, pn12, pn13, pn14, pn15, pn16) 
                        
                        programNameField = panel:getLabelComponent("Program Name Field")
                        		if programNameField then
                        			programNameField:setText (" "..(programNameBlock):toString())
                        		end

                        This does update the label “Program Name Field” with characters, but the wrong characters.. do I need to offset the bytes by 32 since the ASCII characters start at 32??

                        I did try an alteration of the above that just grabbed the range of all 16 characters, assigned all bytes to one variable then got a string from it but it’s basically the same as what I’ve done above except above I assign each byte to its own variable…

                        any help appreciated!

                        Monstrum Media | Music, Sound & Software Design, Chicago / San Francisco listen

                        #11222
                        zeoka
                        Participant
                          • Topics: 73
                          • Replies: 466
                          • Total: 539
                          • ★★★

                          pn01 = string.char((programData:getByte(240)))

                          or pnall = string.char((programData:getRange(240,255)),1,16) ??

                          heu a range could be set in string.format method ?
                          if yes go ! i use setComponentText to receive and i don’t convert anything
                          At the step of my panel i use uiLabelText as memory block. You can even use
                          find.byte or find.char (??) it could be useful
                          With string.char and string.byte i basically all update nice i type nb chars i want , it receive nice the only thing is need set “uiLabelChangedCbk” in the label
                          because when it receives sound it sends to the device too but it’s not a big issue

                          You must know what is data and what is string….because lua errors like i had 😉

                          • This reply was modified 10 years, 9 months ago by zeoka.
                          • This reply was modified 10 years, 9 months ago by zeoka.
                          • This reply was modified 10 years, 9 months ago by zeoka.
                          • This reply was modified 10 years, 9 months ago by zeoka.
                          • This reply was modified 10 years, 9 months ago by zeoka.
                          • This reply was modified 10 years, 9 months ago by zeoka.
                          • This reply was modified 10 years, 9 months ago by zeoka.
                          • This reply was modified 10 years, 9 months ago by zeoka.
                          • This reply was modified 10 years, 9 months ago by zeoka.
                          #11233
                          msepsis
                          Participant
                            • Topics: 219
                            • Replies: 732
                            • Total: 951
                            • ★★★

                            I appreciate your follow up (and nine!! edits) but unfortunately I don’t understand your post, zeoka ):

                            PS you can turn off logging “this reply was modified…” when you edit a post by unchecking “keep a log of this edit” here on the forums if you want.

                            Monstrum Media | Music, Sound & Software Design, Chicago / San Francisco listen

                            #11234
                            msepsis
                            Participant
                              • Topics: 219
                              • Replies: 732
                              • Total: 951
                              • ★★★

                              pn01 = string.char((programData:getByte(240)))

                              or pnall = string.char((programData:getRange(240,255)),1,16) ??

                              ahh.. yeah before the part i copied/pasted I have this in my script:

                              programData = midiMessage:getData():getRange(7,256)

                              that might clear up confusion as to how i was actually getting the bytes. 7-239 contain all the parameters, 240-255 are the bytes that contain the 16 program name characters.

                              Monstrum Media | Music, Sound & Software Design, Chicago / San Francisco listen

                              #11235
                              zeoka
                              Participant
                                • Topics: 73
                                • Replies: 466
                                • Total: 539
                                • ★★★

                                No problem :d

                                So i don’t know if “to get a range of a range” is possible 🙂 but the first line works
                                pn01 = string.char((programData:getByte(240)))

                                string.char = receice hex gives character
                                string.byte = receice character gives hex

                                may be rescale the range ?
                                pnall = string.char((programData:getRange(233,248)),1,16)

                                • This reply was modified 10 years, 9 months ago by zeoka.
                                #11237
                                msepsis
                                Participant
                                  • Topics: 219
                                  • Replies: 732
                                  • Total: 951
                                  • ★★★

                                  Thanks for your follow up. I’ll try a few things this evening.
                                  thanks again zeoka, i’ve been intending to implement this for a LONG time on my panel but at least had comboboxes working for each character so at least i had a way to display/edit program names. Typing the names in is much more preferable tho than selecting each character via dropdown!!

                                  Monstrum Media | Music, Sound & Software Design, Chicago / San Francisco listen

                                  #11269
                                  zeoka
                                  Participant
                                    • Topics: 73
                                    • Replies: 466
                                    • Total: 539
                                    • ★★★

                                    here is the two workingmethod to get midi device patch names :

                                            idx363 = midi:getLuaData():getByte(370)
                                             idx364 = midi:getLuaData():getByte(371)
                                    
                                            name1 = string.format("%c%c",idx363,idx364)
                                            panel:getComponent("1-SoundLabel"):setText((name1))
                                    --or
                                            idx379 = midi:getLuaData():getByte(386)
                                            idx380 = midi:getLuaData():getByte(387)
                                            char17 = string.char(idx379)             
                                            char18 = string.char(idx380)  
                                            panel:getComponent("1-Category"):setComponentText(string.format("%s%s",char17,char18))

                                    Unfortunely i can’t get the thing by range because range is not a string or a number . But it is not essential , just to gain code lines

                                    • This reply was modified 10 years, 9 months ago by zeoka.
                                    • This reply was modified 10 years, 9 months ago by zeoka.
                                    • This reply was modified 10 years, 9 months ago by zeoka.
                                    • This reply was modified 10 years, 9 months ago by zeoka.
                                    • This reply was modified 10 years, 9 months ago by zeoka.
                                    #11275
                                    msepsis
                                    Participant
                                      • Topics: 219
                                      • Replies: 732
                                      • Total: 951
                                      • ★★★

                                      Thanks. I’ll have to wait until next week to continue with this.. taking a much much needed week long vacation! ! ! !

                                      Monstrum Media | Music, Sound & Software Design, Chicago / San Francisco listen

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

                                        I fetch program names in the MOPHO panel

                                        unpackedData:getRange(184,16):toString()
                                        

                                        the toString() method for the MemoryBlock tries to parse the memory part as an ASCII string so that might help.

                                        #11347
                                        zeoka
                                        Participant
                                          • Topics: 73
                                          • Replies: 466
                                          • Total: 539
                                          • ★★★

                                          idx363to378 = midi:getLuaData():getRange(370,16)
                                          panel:getComponent(“1-SoundLabel”):setText(idx363to378:toString())
                                          That’s working
                                          The second number was the range not the end byte ! Before I’ve tried string.char() by range with no success

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