Home › Forums › General › Programming › Is SendMidiMessageNow() stopping sedning after first F7?
- This topic has 9 replies, 3 voices, and was last updated 7 years, 11 months ago by goodweather.
-
AuthorPosts
-
May 6, 2016 at 5:30 pm #69182
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!
May 6, 2016 at 6:18 pm #69183It’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.
May 6, 2016 at 7:42 pm #69184Yesterday 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.
May 6, 2016 at 8:03 pm #69186Because 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.
May 6, 2016 at 9:25 pm #69187For 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.
May 6, 2016 at 9:44 pm #69188MidiOX 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.
May 6, 2016 at 10:00 pm #69190Fire 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.
May 7, 2016 at 7:32 pm #69195Thx 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)?May 7, 2016 at 8:20 pm #69196Yes. 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.
May 7, 2016 at 8:33 pm #69197Got you! Tried it just now and it works fine (I set the timer to 150ms to be safe)!
One learns every day 🙂 -
AuthorPosts
- The forum ‘Programming’ is closed to new topics and replies.