FortySevenEffects / arduino_midi_library

MIDI for Arduino
MIT License
1.58k stars 254 forks source link

small enhancement on MTC #107

Open mink99 opened 5 years ago

mink99 commented 5 years ago

I am currently working on some mtc stuff. Maybe a
void sendMTCFullFrameMessage(fps,hh,mm,ss,ff) could be added ? I know it is basically a normal sysex message, but it would be a nice simplification...

same for sendMTCQuarterMessage()

a parameter as in sendMTCQuarterMessage(int msgCount, int Value) would simplify this. This message is called from an interrupt and this could speed things up:

void sendMTCQuarterMessage (int msgCount,int v) { byte toSend; switch (msgCount) { case 0: toSend = 0x00 | lo_nibble(v); break; case 1: toSend = 0x10 | hi_nibble(v); break; case 2: toSend = 0x20 | lo_nibble(v); break; case 3: toSend = 0x30 | hi_nibble(v); break; case 4: toSend = 0x40 | lo_nibble(v); break; case 5: toSend = 0x50 | hi_nibble(v); break; case 6: toSend = 0x60 | lo_nibble(v); break; case 7: toSend = 0x72 | hi_nibble(v); //defaults to 25 .... //toSend = 0x70 | hi_nybble(hh) | 0b00100000; //would be 24 break; } MidiPort.write(0xF1); MidiPort.write(toSend); }

maybe even the counter could be handled internally...¨

mink99 commented 5 years ago

I see that reading the mtc full frame message is somehow in the fr “sysex construction helpers”, however this message is not a universal sysex, it is a dedicated message with well defined parameters