Things that worked before rev. 1184

Home Forums General Programming Things that worked before rev. 1184

Viewing 10 posts - 21 through 30 (of 30 total)
  • Author
    Posts
  • #6139
    Stoner
    Participant
      • Topics: 2
      • Replies: 28
      • Total: 30

      I now am trying to do this also, and it appears even Atoms sample code is breaking.

      buf = MemoryBlock( 4, true ) gives an No matching overload found error.

      yet

      buf = MemoryBlock()

      l = buf:getSize() yields an error Trying to use unregistered class.

       

      As I can not ever use getSize() on a MemoryBlock I have no idea whether file.loadFileAsData( buf )  is working.  It returns a true but I am unable to use buf:getSize() to test the return size.

       

      Help.

      Stoner

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

        Ahhh a reminder, on it.

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

          Ok so it should work now (without the size parameter i just added that), here is an example (the MemoryBlock constructor from an array of bytes is also just added, but you can create it other ways)

          mb1 = MemoryBlock ({0x01, 0x02, 0x03, 0x04})
          mb2 = MemoryBlock ({0xa1, 0xa2, 0xa3, 0xa4}) -- The first two constructors take an array of bytes
          mb3 = MemoryBlock ("b1 b2 b3 b4") -- This is a constructor that takes a string
          
          mb1:insert(mb2,2) -- this should work now
          console ("mb1:"..mb1:toHexString(1))
          
          mb3:insert(mb2, 1, 1) -- this method is new, it will be available in the next nightly
          console ("mb3:"..mb3:toHexString(1))
          

          Output will be:

          mb1:01 02 a1 a2 a3 a4 03 04
          mb3:b1 a1 b2 b3 b4
          
          #6143
          atom
          Keymaster
            • Topics: 159
            • Replies: 2945
            • Total: 3104
            • ★★★★★
            mb1 = MemoryBlock() -- this is available now
            mb2 = MemoryBlock(4,true) -- this is available now
            mb3 = MemoryBlock(mb2) -- this is available now
            mb4 = MemoryBlock ("ab cd") -- this is new
            mb5 = MemoryBlock ({0xab, 0xac}) -- this is new
            

            A new nightly will have all the constructors.

            #6147
            Stoner
            Participant
              • Topics: 2
              • Replies: 28
              • Total: 30

              Okay, thanks, but still missed the Trying to use unregistered class error on MB:getSize() of a MemoryBlock.

              Stoner

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

                OK try 1267 now if you already downloaded it, please download it again.

                #6149
                Stoner
                Participant
                  • Topics: 2
                  • Replies: 28
                  • Total: 30

                  No still a problem Atom.  Here is what I am doing and I need to get from start to finish and actually send some data.  You will need to create a valid File(“ValidSysEx.syx”) called lastFile.

                   

                  data = MemoryBlock()
                  len = lastFile:getSize()
                  if lastFile:existsAsFile() and len > 2 then
                  if lastFile:loadFileAsData( data ) and len == data:getSize() then
                  if data:getByte(0) == 0xf0 and data:getByte( len-1 ) == 0xf7 then
                  midi = CtrlrMidiMessage( data )
                  panel:sendMidiMessageNow(midi)
                  utils.infoWindow(“Send SysEx File successful!”, “File sent: “..lastFile:getFullPathName())
                  else
                  utils.warnWindow(“Send SysEx File failed!”, “File was not SysEx file: “..lastFile:getFullPathName())
                  end
                  else
                  utils.warnWindow(“Send SysEx File failed!”, “File did not load correctly: “..lastFile:getFullPathName())
                  end
                  else
                  utils.warnWindow(“Send SysEx File failed!”, “File was too small: “..lastFile:getFullPathName())
                  end

                  Stoner

                  #6150
                  Stoner
                  Participant
                    • Topics: 2
                    • Replies: 28
                    • Total: 30

                    I can confirm that if I remove the compare on the length above I will get a midi message and it’s type will return as 5, which is correct but midi:getSize will return 0 (zero) which should be 7 in my case and no midi data will be sent.

                    Stoner

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

                      I’m posting a fix right now.

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

                        Hi atom,
                        found this old post…

                        Retested mb2 = MemoryBlock(4,true) from above
                        and I get errors (5.3.201)

                        ERROR: No matching overload found, candidates:
                        void __init(luabind::argument const&,String const&)
                        void __init(luabind::argument const&,luabind::object const&)
                        void __init(luabind::argument const&,JMemoryBlock const&)
                        void __init(luabind::argument const&,custom [unsigned __int64] const,bool)
                        void __init(luabind::argument const&)

                        Thx to have a look!

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