Things that worked before rev. 1184

Home Forums General Programming Things that worked before rev. 1184

Viewing 20 posts - 1 through 20 (of 30 total)
  • Author
    Posts
  • #5190
    dasfaker
    Keymaster
      • Topics: 80
      • Replies: 793
      • Total: 873
      • ★★★

      Hi Atom. I’m having several LUA errors with things that worked before the present revision (1184):

      · LoadFileAsData:

      Previously I had working fine:

      configFile = File.getSpecialLocation(File.userApplicationDataDirectory):getChildFile(String("XP30.ini"))
      if configFile:existsAsFile() then
      --    configFileData = configFile:loadFileAsData()
      configFileData = File:loadFileAsData(configFile)
      console (configFileData:toHexString(1))
      end

      Now I get “ERROR: no static ‘loadFileAsData’ in class ‘File'”

      · replaceFileContentWithData

      I get this error: “attempt to call method ‘replaceFileContentWithData’ (a nil value)”

      It seems that file handling has changed a lot. Could you provide us some example of how to deal with it now?

      There are several issues with components and midi messages.

      uiCustomComponent sends midi message “F8” 12 times when you call a method in any component’s Callback (if the method is for mouseDown, when you click the component the messages are sent. If the method is on MouseEnter, the messages are sent when the mouse enters the component…). (The Sysex Formula is empty).

      If a component has Midi Message = None and it has a sysex formula, the sysex message is sent. You have to select again Midi Message = None to fix it, but it happens again when you reopen the panel.
      Removing the sysex formula fix it too, but by default all modulators had “F0 00 F7” in previous revisions, so we should change all modulators from old panels.

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

        I’ll post an example asap. This changes cause i want the API to be as close to the JUCE api as possible, so the methods from the JUCE::File class will be working, and not my “wrappers”.

        The SysEx formula is a pain in the ass, it’s how the component is loading is the problem maybe i can find a fix for that.

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

          This should work with the latest nightly. I’m fixing the rest.

          fileTest = function(mod, value)
          	fileRead 	= File("c:\\data.txt")
          	buf  		= MemoryBlock(4,true)
          
          	fileRead:loadFileAsData(buf)
          
          	console ("read data: "..buf:getSize())
          
          	fileWrite	= File("c:\\newFile.txt")
          	fileWrite:replaceWithData(buf)
          
          	console ("data written: "..fileWrite:getSize())
          end
          
          • This reply was modified 11 years, 4 months ago by atom.
          #5200
          dasfaker
          Keymaster
            • Topics: 80
            • Replies: 793
            • Total: 873
            • ★★★

            Thx, I’ll try it later.

            #5204
            dasfaker
            Keymaster
              • Topics: 80
              • Replies: 793
              • Total: 873
              • ★★★

              In your example, buf is a MemoryBlock (correct me if I’m wrong). But I’m trying to use a = buf:getByte(0) and get “attempt to call method ‘getByte’ (a nil value)”

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

                This is a type mismatch on your side CtrlrLuaMemoryBlock is not MemoryBlock, CtrlrLuaMemoryBlock had some additional methods that are not in MemoryBlock, but i just added them and the newer nightly will have the new getByte() and getRange() methods, but also more LUA freindly, insertIntoTable (table) and createFromTable (table) methods that take a normal LUA table as a parameter.

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

                  Hey atom, what If I want to write the contents of a variable to a file? The variable is set in this line which is run when receiving a patch dump.

                  programData = midiMessage:getLuaData():getRange(7,263)

                  I have to be honest i’ve never been able to get writing data to a file from a variable to work. I don’t understand anything about CtrlrLuaMemoryBlock or MemoryBlock.

                  The variable above which I want to save to a file contains the bytes that set all modulator values.

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

                  #5239
                  dasfaker
                  Keymaster
                    • Topics: 80
                    • Replies: 793
                    • Total: 873
                    • ★★★

                    I’m trying to insert data in a MemoryBlock without luck. Can you pinpoint me the correct way? Thx.

                    config_data = MemoryBlock(2,true)
                    config_data:insert(expansionDValue,1,0)

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

                      Try 1193 it should work now, i had to re-implement insert/append/copyFrom/copyTo/replaceWith methods.

                      #5319
                      dasfaker
                      Keymaster
                        • Topics: 80
                        • Replies: 793
                        • Total: 873
                        • ★★★

                        Hi Atom
                        I want to append data to a MemoryBlock, but I don’t get it.

                        In rawmaterialsoftware it says void append (const void *data, size_t numBytes) but the error I get in Ctrlr is void append(LMemoryBlock&,MemoryBlock&).
                        How to use it?.

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

                          If the api docs say (void *, size_t) that means i changed it to a MemoryBlock as a parameter so to append

                          data1 = MemoryBlock({0xf0, 0xf1, 0xf2})
                          data2 = MemoryBlock({0x00, 0x01, 0x02})
                          data1:append(data2) -- instead of data1:append(data2:getData(), data2:getSize())
                          
                          #5321
                          dasfaker
                          Keymaster
                            • Topics: 80
                            • Replies: 793
                            • Total: 873
                            • ★★★

                            I get this with the first line of your example
                            data1 = MemoryBlock({0xf0, 0xf1, 0xf2})
                            ERROR: No matching overload found, candidates:
                            void __init(luabind::argument const&,MemoryBlock const&)
                            void __init(luabind::argument const&,unsigned int const,bool)
                            void __init(luabind::argument const&)

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

                              Well yeah i didn’t compile this i wrote it from my head. it should be something like

                              data1 = MemoryBlock()
                              data2 = MemoryBlock()
                              data1:createFromTable({0xf0, 0xf1, 0xf2})
                              data2:createFromTable({0x00, 0x01, 0x02})
                              data1:append(data2)
                              
                              #5328
                              dasfaker
                              Keymaster
                                • Topics: 80
                                • Replies: 793
                                • Total: 873
                                • ★★★

                                Can’t we use setByte with a MemoryBlock? I get ” attempt to call method ‘setByte’ (a nil value)”

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

                                  Yeah i haven’t added that, i’ll do that asap

                                  #5338
                                  dasfaker
                                  Keymaster
                                    • Topics: 80
                                    • Replies: 793
                                    • Total: 873
                                    • ★★★

                                    Thanks, working in 1195.

                                    I would like to be able to use Font() as well.

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

                                      I’ll have a look at Font(), what exactly would you like to do with it so i can prepare an example.

                                      #5345
                                      dasfaker
                                      Keymaster
                                        • Topics: 80
                                        • Replies: 793
                                        • Total: 873
                                        • ★★★

                                        I just want to write some stuff inside a CustomComponent with another font, nothing complicated. Right now I got the text displayed but with the default font.

                                        #5390
                                        dasfaker
                                        Keymaster
                                          • Topics: 80
                                          • Replies: 793
                                          • Total: 873
                                          • ★★★

                                          Hi Atom

                                          Previously we could insert in a MemoryBlock a block of data with a specified size (MemoryBlock:insert (MemoryBlock2, position, size)).
                                          How can we do it now?

                                          #5444
                                          dasfaker
                                          Keymaster
                                            • Topics: 80
                                            • Replies: 793
                                            • Total: 873
                                            • ★★★

                                            BUMP

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