-
Notifications
You must be signed in to change notification settings - Fork 3
midiBsToUMP
Class used for translating between a raw MIDI 1.0 Byte stream and UMP
This allows the application to set the group used when creating UMP messages.
By default midiBsToUMP will output MIDI 1.0 Channel voice message (Message Type 2). Set this to true to output MIDI 2 Channel Voice Messages (Message Type 4).
This uses the Translation methods described in Universal MIDI Packet (UMP) Format and MIDI 2.0 Protocol Version 1.0.
This means it attempts to convert RPN and NRPN Control Change messages into UMP RPN and NRPN messages. This may cause some issues with Some devices that do not sent LSB Data vale (CC #38).
Process incoming MIDI 1.0 Byte stream
Check if there are available UMP packets after processing the Byte Stream
Return a 32Bit word for a UMP Packet. A Bystream conversion may create several UMP packets.
midi2Processor output any Sysex it creates via the function declared by setRawSysEx handler. The SysEx is streamed as the raw SysEx data streams seen in MIDI 1.0 Byte Streams. It is possible to convert to UMP using midiBsToUMP.
void rawSysex(uint8_t group, uint8_t *sysex ,uint16_t length, uint8_t state){
Sysex2UMP.defaultGroup = group;
if (state < 2){
Sysex2UMP.midi1BytestreamParse((uint8_t)SYSEX_START);
}
for(int i=0; i < length; i++){
Sysex2UMP.midi1BytesteamParse(sysex[i]);
while(Sysex2UMP.availableUMP()){
uint32_t ump = Sysex2UMP.readUMP();
seedOutUMPWordToADevice(ump);
}
}
if (state == 0 || state==3){
Sysex2UMP.midi1BytesteamParse((uint8_t)SYSEX_STOP);
while(Sysex2UMP.availableMIDI1()){
uint32_t ump = Sysex2UMP.readMIDI1();
seedOutUMPWordToADevice(ump);
}
}
}
midi2Processor MIDI2 (0,2,2);
midiBsToUMP Sysex2UMP;
MIDI2.setRawSysEx(rawSysex);
MIDI2.sendDiscoveryRequest(0, 1);