Reply To: MIDI Out LED

Home Forums General Programming MIDI Out LED Reply To: MIDI Out LED

#118742
computerchemist
Participant
  • Topics: 2
  • Replies: 31
  • Total: 33

c takes a time to initialise, but I get what it’s doing – like you said earlier, it’s not answering the original question but it is a really neat way of doing a progress bar.
But my problem isn’t sending lots of little packets, the Poly800 expects a giant floater of a packet in one go – depending upon which version it’s anywhere from 3273 bytes to 5383 bytes – in one single go. This actually takes over a second to upload, and during that time I’ve basically got to try and let the user know it’s happening. But becuase it could be big or small, it can’t be a fixed number.
But I just tried this and it worked:

    mysysexData=MemoryBlock();
     mysysexData=encodeSysex();
     s = mysysexData:getSize();

    totwait = tonumber( ( s * 0.32 ) + 5 );

    -- console("start timer40...");
    panel:getModulatorByName("sendDumpButton"):getComponent():setProperty ("uiButtonTextColourOff","FFFF4545",true); -- set to red
    timer:startTimer (40, totwait); 

    panel:sendMidiMessageNow(CtrlrMidiMessage(mysysexData:toHexString(1))); -- go send it

My callback basically stops the timer and sets the text back to black, but it’s bang on timing now. The trick was that “magic number’ and if you multiply the size of your sysex by 0.32 and add the current mididelay time onto it (in my case 5ms) it’s only bang on perfect 🙂

So hoping this might help someone else out – two ways actually, your very nice bar progress for split packets or a precise LED on time for very big packets.

Do NOT follow this link or you will be banned from the site!