Esempio n. 1
0
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;
}
Esempio n. 2
0
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;
}