Is SendMidiMessageNow() stopping sedning after first F7?

Home Forums General Programming Is SendMidiMessageNow() stopping sedning after first F7?

Viewing 10 posts - 1 through 10 (of 10 total)
  • Author
    Posts
  • #69182
    goodweather
    Participant
      • Topics: 45
      • Replies: 550
      • Total: 595
      • ★★★

      Hi,
      can someone confirm that when using SendMidiMessageNow it sends everything till the first F7 is encountered?

      On the Pro2, bank dumps are in fact just a series of 99 program dumps. Each of them starts with F0 and ends with F7. So, to send a bank dump to my Pro2, I just assembled this big file and send it to the synth. Until now, I didn’t notice anything but felt it was going quite fast.

      By doing an empty bank dump (99 x Basic program) send, I realized that only the first program was sent.

      When sending the same file with MidiOX, the synth gets indeed the 99 programs without any problem even if it takes some time. Factory bank dumps are handled that way.

      Therefore my question: even if you have a message containing several F0…F7 blocks, is SendMidiMessageNow only sending the first F0…F7 block?

      Thx!

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

        It’s possible that the first F7 finish the message at this point.

        You have to send each program individually, leave a time between messages and let the synth’s buffer breath.

        Use a timer, init a variable when you trigger the timer for the first time, and change the variable’s value on every pass. Knowing the variable’s value you can send a different message with the same timer. On the last pass, stop the timer.

        #69184
        m.tarenskeen
        Participant
          • Topics: 30
          • Replies: 113
          • Total: 143
          • ★★

          Yesterday I noticed this too working on my current RefaceDX panel project.
          A dump with one single patch already contains 7 little sysex blocks with lengths of respectively 13, 51, 41, 41, 41, 41, 13 bytes = 241 bytes in total.
          I first tried to use SendMidiMessageNow() on the complete dump but soon discovered that only the first 13 bytes were sent.
          So I now call SendMidiMessageNow() seven times in row. In this case with such a small dump no extra intervaltime was needed. Just extra lines of code and extra work for me.

          I think this is a strange limitation of SendMidiMessageNow. Why not let me decide if I want to send my dump as a whole, or in separate packets?

          • This reply was modified 7 years, 11 months ago by m.tarenskeen.
          #69186
          dasfaker
          Keymaster
            • Topics: 80
            • Replies: 793
            • Total: 873
            • ★★★

            Because the function of sendMidiMessageNow is to send a single message, that starts with f0 and ends with f7. I don’t see any problem with it.

            If you need to send many individual messages together use a loop, or a timer if the data is big enough. The Reface has a modern and fast processor and accepts those messages without pause, but an old synth will need time between them.

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

              For my Pro2, a bank is 116622 and there is no problem sending that with MidiOX. Anyway I can also send the 99 programs one by one.
              Anyway, tried to do this without success (only the 3 programs got sent).
              Also tried with a timer but it didn’t help.
              Can you please explain the principle?

              where to have the loop? in the BankSend button method?
              where to prepare memory block with the program? in the BankSend button method?
              Where to put the timer? within the loop?
              If starting a timer, shall I stop it for each program or stop it at the end?
              In the timer, I put
              mbProgram = MemoryBlock()
              mbProgram = mbUser1:getRange(iCounter*1178,1178)
              msgBank = CtrlrMidiMessage(mbProgram)
              panel:sendMidiMessageNow(msgBank)

              Thx to point me to some example. I already tried different things without any success.

              #69188
              m.tarenskeen
              Participant
                • Topics: 30
                • Replies: 113
                • Total: 143
                • ★★

                MidiOX puts a configurable amount of waiting time after each 0xF7. Sending 116622 bytes without breaks might be a problem for some instruments.

                Because the function of sendMidiMessageNow is to send a single message, that starts with f0 and ends with f7. I don’t see any problem with it.

                I don’t have any problem with it, I just don’t understand what problem sendMidiMessageNow could have if it was not restricted to one single SysEx block, and if would let me decide what to put in the data to be sent.

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

                  Fire the timer from anywhere

                  timer:setCallback (1, timer1)
                  timer:startTimer(1,50) -- 50 ms timer
                  iCounter = 0
                  
                  function timer1(timerId)
                  mbProgram = MemoryBlock()
                  mbProgram = mbUser1:getRange(iCounter*1178,1178)
                  msgBank = CtrlrMidiMessage(mbProgram)
                  panel:sendMidiMessageNow(msgBank)
                  iCounter = iCounter + 1
                  if iCounter == 128 then
                  timer:stopTimer(1)
                  end

                  Not tested, but it should work. While the timer is not stopped, it will send a message every 50 ms until iCounter == 128. The timer is like a loop.

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

                    Thx dasfaker. Saw the same procedure in Carl’s P08 panel.
                    Can you explain a bit more (it is about the same as I did but I used a loop doing the 2 first lines above (starting timer)?
                    So, the main method starts the timer only once.
                    Then the timer is looping by itself 128 times??? No need for any classical loop (sorry I’m a classical programmer)?

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

                      Yes. When you start a timer, it’s running until it is stopped, so it cyclically perform it’s code when it reach it’s timing, and in this case, when you reach the desired cycle (define3d by a variable), stop it.

                      With a normal loop you don’t control the timing of each cycle.

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

                        Got you! Tried it just now and it works fine (I set the timer to 150ms to be safe)!
                        One learns every day 🙂

                      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 120 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