uint16_t MDSong::toSysex(ElektronDataToSysexEncoder &encoder) { encoder.stop7Bit(); encoder.pack8(0xF0); encoder.pack(machinedrum_sysex_hdr, sizeof(machinedrum_sysex_hdr)); encoder.pack8(MD_PATTERN_MESSAGE_ID); encoder.pack8(0x04); // version encoder.pack8(0x01); // revision encoder.startChecksum(); encoder.pack8(origPosition); encoder.pack((uint8_t *)name, 16); for (uint8_t i = 0; i < numRows; i++) { encoder.start7Bit(); encoder.pack((uint8_t *)&rows[i].pattern, 4); encoder.pack16(rows[i].mutes); encoder.pack16(rows[i].tempo); encoder.pack(&rows[i].startPosition, 2); encoder.stop7Bit(); } uint16_t enclen = encoder.finish(); encoder.finishChecksum(); return enclen + 5; }
uint16_t MDGlobal::toSysex(ElektronDataToSysexEncoder &encoder) { encoder.stop7Bit(); encoder.pack8(0xF0); encoder.pack(machinedrum_sysex_hdr, sizeof(machinedrum_sysex_hdr)); encoder.pack8(MD_GLOBAL_MESSAGE_ID); encoder.pack8(0x05); // version encoder.pack8(0x01); // revision encoder.startChecksum(); encoder.pack8(origPosition); encoder.pack(drumRouting, 16); encoder.start7Bit(); encoder.pack(keyMap, 128); encoder.stop7Bit(); encoder.pack8(baseChannel); encoder.pack8(unused); encoder.pack16(tempo); encoder.packb(extendedMode); uint8_t byte = 0; if (clockIn) SET_BIT(byte, 0); if (transportIn) SET_BIT(byte, 4); if (clockOut) SET_BIT(byte, 5); if (transportOut) SET_BIT(byte, 6); encoder.pack8(byte); encoder.packb(localOn); encoder.pack(&drumLeft, 12); uint16_t enclen = encoder.finish(); encoder.finishChecksum(); return enclen + 5; }
uint16_t MDKit::toSysex(ElektronDataToSysexEncoder &encoder) { encoder.stop7Bit(); encoder.pack8(0xF0); encoder.pack(machinedrum_sysex_hdr, sizeof(machinedrum_sysex_hdr)); encoder.pack8(MD_KIT_MESSAGE_ID); encoder.pack8(0x04); // version encoder.pack8(0x01); // revision encoder.startChecksum(); encoder.pack8(origPosition); encoder.pack((uint8_t *)name, 16); name[16] = '\0'; encoder.pack((uint8_t *)params, 16 * 24); encoder.pack(levels, 16); encoder.start7Bit(); encoder.pack32(models, 16); encoder.stop7Bit(); encoder.start7Bit(); for (uint8_t i = 0; i < 16; i++) { // encoder.pack((uint8_t *)&lfos[i], 36); encoder.pack((uint8_t *)&lfos[i], 5); encoder.pack((uint8_t *)&lfo_statestore[i], 31); } encoder.stop7Bit(); encoder.pack(reverb, 8); encoder.pack(delay, 8); encoder.pack(eq, 8); encoder.pack(dynamics, 8); encoder.start7Bit(); encoder.pack(trigGroups, 16); encoder.pack(muteGroups, 16); uint16_t enclen = encoder.finish(); encoder.finishChecksum(); return enclen + 5; }