Merge branch 'dev' of codeberg.org:dcoredump/MicroDexed into dev

dev
Holger Wirtz 9 months ago
commit 1fe784196e
  1. 2
      MicroDexed.ino
  2. 31
      midi_devices.hpp

@ -1251,7 +1251,7 @@ void handleAfterTouch(byte inChannel, byte inPressure) {
void handlePitchBend(byte inChannel, int inPitch) {
for (uint8_t instance_id = 0; instance_id < NUM_DEXED; instance_id++) {
if (checkMidiChannel(inChannel, instance_id)) {
MicroDexed[instance_id]->setPitchbend(inPitch);
MicroDexed[instance_id]->setPitchbend(inPitch - 0x2000);
}
}
}

@ -69,9 +69,12 @@ USBHub hub3(usb_host);
#elif NUM_HUBS_MIDI_DEVICE_USB_HOST_SERIAL < 5
USBHub hub4(usb_host);
#endif
USBSerial_BigBuffer userial(usb_host, 1);
MIDI_NAMESPACE::SerialMIDI<USBSerial_BigBuffer, CustomBaudRateSettings> serialMIDI(userial);
MIDI_NAMESPACE::MidiInterface<MIDI_NAMESPACE::SerialMIDI<USBSerial_BigBuffer, CustomBaudRateSettings>> usbhost_midi_serial((MIDI_NAMESPACE::SerialMIDI<USBSerial_BigBuffer, CustomBaudRateSettings> &)serialMIDI);
//USBSerial_BigBuffer userial(usb_host, 1);
//MIDI_NAMESPACE::SerialMIDI<USBSerial_BigBuffer, CustomBaudRateSettings> serialMIDI(userial);
//MIDI_NAMESPACE::MidiInterface<MIDI_NAMESPACE::SerialMIDI<USBSerial_BigBuffer, CustomBaudRateSettings>> usbhost_midi_serial((MIDI_NAMESPACE::SerialMIDI<USBSerial_BigBuffer, CustomBaudRateSettings> &)serialMIDI);
USBSerial userial(usb_host);
MIDI_NAMESPACE::SerialMIDI<USBSerial, CustomBaudRateSettings> serialMIDI(userial);
MIDI_NAMESPACE::MidiInterface<MIDI_NAMESPACE::SerialMIDI<USBSerial, CustomBaudRateSettings>> usbhost_midi_serial((MIDI_NAMESPACE::SerialMIDI<USBSerial, CustomBaudRateSettings> &)serialMIDI);
#endif
void handleNoteOn(byte inChannel, uint8_t inNumber, uint8_t inVelocity);
@ -122,7 +125,7 @@ void handle_generic(byte inChannel, uint8_t inData1, uint8_t inData2, const char
strlcpy(text, "Mono AT", sizeof(text));
break;
case midi::PitchBend:
handlePitchBend(inChannel, inData1);
handlePitchBend(inChannel, (inData2 << 7) | inData1);
strlcpy(text, "PB", sizeof(text));
break;
case midi::ProgramChange:
@ -158,7 +161,7 @@ void handle_generic(byte inChannel, uint8_t inData1, uint8_t inData2, const char
usbMIDI.sendAfterTouch(inData1, inChannel);
break;
case midi::PitchBend:
usbMIDI.sendPitchBend(inData1, inChannel);
usbMIDI.sendPitchBend((inData2 << 7) | inData1, inChannel);
break;
case midi::ProgramChange:
usbMIDI.sendProgramChange(inData1, inChannel);
@ -191,7 +194,7 @@ void handle_generic(byte inChannel, uint8_t inData1, uint8_t inData2, const char
midi_serial.sendAfterTouch(inData1, inChannel);
break;
case midi::PitchBend:
midi_serial.sendPitchBend(inData1, inChannel);
midi_serial.sendPitchBend((inData2 << 7) | inData1, inChannel);
break;
case midi::ProgramChange:
midi_serial.sendProgramChange(inData1, inChannel);
@ -224,7 +227,7 @@ void handle_generic(byte inChannel, uint8_t inData1, uint8_t inData2, const char
midi_usb.sendAfterTouch(inData1, inChannel);
break;
case midi::PitchBend:
midi_usb.sendPitchBend(inData1, inChannel);
midi_usb.sendPitchBend((inData2 << 7) | inData1, inChannel);
break;
case midi::ProgramChange:
midi_usb.sendProgramChange(inData1, inChannel);
@ -257,7 +260,7 @@ void handle_generic(byte inChannel, uint8_t inData1, uint8_t inData2, const char
usbhost_midi_serial.sendAfterTouch(inData1, inChannel);
break;
case midi::PitchBend:
usbhost_midi_serial.sendPitchBend(inData1, inChannel);
usbhost_midi_serial.sendPitchBend((inData2 << 7) | inData1, inChannel);
break;
case midi::ProgramChange:
usbhost_midi_serial.sendProgramChange(inData1, inChannel);
@ -599,7 +602,8 @@ void handleAfterTouch_MIDI_DEVICE_DIN(byte inChannel, uint8_t inPressure) {
}
void handlePitchBend_MIDI_DEVICE_DIN(byte inChannel, int inPitch) {
handle_generic(inChannel, inPitch, '\0', MIDI_BY_DIN, midi::PitchBend);
inPitch += 0x2000;
handle_generic(inChannel, (inPitch & 0x07), (inPitch >> 0x07), MIDI_BY_DIN, midi::PitchBend);
}
void handleProgramChange_MIDI_DEVICE_DIN(byte inChannel, uint8_t inProgram) {
@ -703,7 +707,8 @@ void handleAfterTouch_MIDI_DEVICE_USB_HOST(byte inChannel, uint8_t inPressure) {
}
void handlePitchBend_MIDI_DEVICE_USB_HOST(byte inChannel, int inPitch) {
handle_generic(inChannel, inPitch, '\0', MIDI_BY_USB_HOST, midi::PitchBend);
inPitch += 0x2000;
handle_generic(inChannel, (inPitch & 0x07), (inPitch >> 0x07), MIDI_BY_USB_HOST, midi::PitchBend);
}
void handleProgramChange_MIDI_DEVICE_USB_HOST(byte inChannel, uint8_t inProgram) {
@ -805,7 +810,8 @@ void handleAfterTouch_MIDI_DEVICE_USB_HOST_SERIAL(byte inChannel, uint8_t inPres
}
void handlePitchBend_MIDI_DEVICE_USB_HOST_SERIAL(byte inChannel, int inPitch) {
handle_generic(inChannel, inPitch, '\0', MIDI_BY_USB_HOST_SERIAL, midi::PitchBend);
inPitch += 0x2000;
handle_generic(inChannel, (inPitch & 0x07), (inPitch >> 0x07), MIDI_BY_USB_HOST_SERIAL, midi::PitchBend);
}
void handleProgramChange_MIDI_DEVICE_USB_HOST_SERIAL(byte inChannel, uint8_t inProgram) {
@ -909,7 +915,8 @@ void handleAfterTouch_MIDI_DEVICE_USB(byte inChannel, uint8_t inPressure) {
}
void handlePitchBend_MIDI_DEVICE_USB(byte inChannel, int inPitch) {
handle_generic(inChannel, inPitch, '\0', MIDI_BY_USB, midi::PitchBend);
inPitch += 0x2000;
handle_generic(inChannel, (inPitch & 0x07), (inPitch >> 0x07), MIDI_BY_USB, midi::PitchBend);
}
void handleProgramChange_MIDI_DEVICE_USB(byte inChannel, uint8_t inProgram) {

Loading…
Cancel
Save