LAU midiMassageReceived cause crash

Home Forums General Programming LAU midiMassageReceived cause crash

Viewing 20 posts - 1 through 20 (of 26 total)
  • Author
    Posts
  • #565
    DMM
    Participant
      • Topics: 6
      • Replies: 46
      • Total: 52

      Trying to get a modulator to update on patchdump.
      As soon as i enable the lua code in the panel ctrlr crashes.[code:33cey2ja]–
      — Called when a panel receives a midi message (does not need to match any modulator mask)

      midiMessageReceived = function(midiMessage)
      s = midiMessage:getSize()
      if s == 67 then
      out = panel:getModulatorByName("outputLabel")
      out:getComponent():setPropertyString ("uiLabelText", midiMessage:toString())
      console("received program data")

      assignValues(midiMessage)
      end
      end

      function assignValues(midiMessage)
      console ("assignValues")
      lastSavedProgram = midiMessage:getLuaData()
      programData = midiMessage:getLuaData():getByte(8)
      — unpackedData = utils.unpackDsiData(programData)

      console ("RAW DATA: ")
      console (programData:toHexString(1))
      — console ("UNPACKED DATA: ")
      — console (unpackedData:toHexString(1))

      panel:getModulatorByName("modulator-1"):setModulatorValue(programData:getByte(8), false, true, true)

      end
      [/code:33cey2ja]

      Can anyone tel me why?
      It’s a simple panel with just one modulator

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

        can you also paste the output from the console here ? have you tried removing more lines to see witch one causes the crash ?

        #3950
        DMM
        Participant
          • Topics: 6
          • Replies: 46
          • Total: 52

          Yes i’ve taken out some lines.
          It’s a test panel with one modulator only (trying to get the code working for the JX-8P)
          Ctrlr crashes with all midi input

          The sysex when i press the preset button on the JX-8P:
          [list:2l8igms2]
          [f0 41 36 00 21 30 01 08 02 f7][19216.431]
          [c0 40][19216.432]
          [f0 41 36 00 21 30 01 07 00 f7][19216.435]
          f0 41 35 00 21 20 01 20 50 49 41 4e 4f 20 31 20 20 20 00 60 42 00 00 60 20 00 68 46 00 00 7f 7f 7f 00 60 5a 55 7f 20 60 20 2d 1c 00 11 5f 40 20 7f 20 20 40 54 67 00 2f 00 21 20 00 4d 00 25 20 7f 40 f7][19216.49]
          [/list:u:2l8igms2]

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

            that won’t work

            [code:1rev88nr]
            programData = midiMessage:getLuaData():getByte(8)
            panel:getModulatorByName("modulator-1"):setModulatorValue(programData:getByte(8), false, true, true)
            [/code:1rev88nr]

            programData is a byte (a number) you can’t call method on it.

            #3952
            DMM
            Participant
              • Topics: 6
              • Replies: 46
              • Total: 52

              Getrange does the same. Also gives a crash

              #3953
              DMM
              Participant
                • Topics: 6
                • Replies: 46
                • Total: 52

                Even with this little lua code ctrlr crashes[code:33riel45]–
                — Panel executes when when a midi message is received

                midiMessageReceived = function(midiMessage)

                s = midiMessage:getSize()
                — console(string.format ("I got the size of the message, here it is : %d",s))
                end
                [/code:33riel45]
                I think console should show me the sysex byte lengt

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

                  Can you tell me what revision of Ctrlr are u using. I’ll check and see if there is something wrong, but even if there is it will take some time to fix cause i dismantled Ctrlr and need to put it back together in a better way and that might take a while.

                  #3955
                  DMM
                  Participant
                    • Topics: 6
                    • Replies: 46
                    • Total: 52

                    I’ve the latest build and tryed the stable one.
                    Both with the same behavior.

                    #3956
                    DMM
                    Participant
                      • Topics: 6
                      • Replies: 46
                      • Total: 52

                      Windows version 32bit

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

                        Can you try this piece of code as part of your method, and see what the console will tell you
                        [code:2r828jir]
                        data = midiMessage:getLuaData()
                        console (string.format ("midiIncomming size: %d", data:getSize()))
                        console ("HEX: "..data:toHexString(1))
                        for i=0,data:getSize()-1 do
                        console (string.format("BYTE[%d]: %d/%x", i, data:getByte(i), data:getByte(i)))
                        end
                        [/code:2r828jir]

                        #3958
                        DMM
                        Participant
                          • Topics: 6
                          • Replies: 46
                          • Total: 52

                          if i input this in the console i’m getting an error.
                          ERROR: [string "data = midiMessage:getLuaData()…"]:1: attempt to index global ‘midiMessage’ (a nil value)

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

                            No no, edit the method, and replace it with:
                            [code:asyo8m0r]
                            midiMessageReceived = function(midiMessage)
                            data = midiMessage:getLuaData()
                            console (string.format ("midiIncomming size: %d", data:getSize()))
                            console ("HEX: "..data:toHexString(1))
                            for i=0,data:getSize()-1 do
                            console (string.format("BYTE[%d]: %d/%x", i, data:getByte(i), data:getByte(i)))
                            end
                            end
                            [/code:asyo8m0r]

                            then try to generate some midi data to the panel and watch the LUA console for any events.

                            #3960
                            DMM
                            Participant
                              • Topics: 6
                              • Replies: 46
                              • Total: 52

                              Haha you must be thinking <img decoding=” title=”Wink” />

                              But there is no output in the console an ctrlr crashes.

                              #3961
                              DMM
                              Participant
                                • Topics: 6
                                • Replies: 46
                                • Total: 52

                                What i’m finding strange is when i fire a random sysex string at other pannels
                                like the Virus or Blofeld, ctrlr doesn’t crash.

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

                                  That’s why i’m trying to figure out what is happening, have you tried my piece of code ?

                                  #3963
                                  DMM
                                  Participant
                                    • Topics: 6
                                    • Replies: 46
                                    • Total: 52

                                    Yes and also ctrlr crashes.

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

                                      Allright can you send the panel to me or attach it here so i can debug it ?

                                      #3965
                                      DMM
                                      Participant
                                        • Topics: 6
                                        • Replies: 46
                                        • Total: 52

                                        In the vst version ctrlr doesn’t crash but there is no byte length shown in the console

                                        #3966
                                        DMM
                                        Participant
                                          • Topics: 6
                                          • Replies: 46
                                          • Total: 52

                                          Here is the paneltext

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

                                            It’s weird, i think there is something weird happening with the naming scheme here. Try to create a new panel, add a method call it myMethod and paste the code from the old method, so that it look like this:
                                            [code:6dx2hvce]


                                            — Called when a panel receives a midi message (does not need to match any modulator mask)

                                            myMethod = function(midiMessage)

                                            data = midiMessage:getLuaData()

                                            console (string.format ("midiIncomming size: %d", data:getSize()))
                                            console ("HEX: "..data:toHexString(1))

                                            for i=0,data:getSize()-1 do
                                            console (string.format("BYTE[%d]: %d/%x", i, data:getByte(i), data:getByte(i)))
                                            end

                                            end
                                            [/code:6dx2hvce]

                                            but try it on a new panel and see if that keeps crashing.

                                          Viewing 20 posts - 1 through 20 (of 26 total)
                                          • The forum ‘Programming’ is closed to new topics and replies.
                                          There is currently 0 users and 87 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