mirror of
https://github.com/felis/USB_Host_Shield_2.0.git
synced 2024-03-22 11:31:26 +01:00
Merge pull request #596 from YuuichiAkagawa/pr_usbh_midi_fix#586
Fix for handling MIDI channels in the bidirectional converter example
This commit is contained in:
commit
e10f89da72
1 changed files with 7 additions and 1 deletions
|
@ -1,7 +1,7 @@
|
||||||
/*
|
/*
|
||||||
*******************************************************************************
|
*******************************************************************************
|
||||||
* Legacy Serial MIDI and USB Host bidirectional converter
|
* Legacy Serial MIDI and USB Host bidirectional converter
|
||||||
* Copyright (C) 2013-2020 Yuuichi Akagawa
|
* Copyright (C) 2013-2021 Yuuichi Akagawa
|
||||||
*
|
*
|
||||||
* for use with Arduino MIDI library
|
* for use with Arduino MIDI library
|
||||||
* https://github.com/FortySevenEffects/arduino_midi_library/
|
* https://github.com/FortySevenEffects/arduino_midi_library/
|
||||||
|
@ -44,6 +44,7 @@ MIDI_CREATE_DEFAULT_INSTANCE();
|
||||||
//////////////////////////
|
//////////////////////////
|
||||||
|
|
||||||
USB Usb;
|
USB Usb;
|
||||||
|
//USBHub Hub1(&Usb);
|
||||||
USBH_MIDI Midi(&Usb);
|
USBH_MIDI Midi(&Usb);
|
||||||
|
|
||||||
void MIDI_poll();
|
void MIDI_poll();
|
||||||
|
@ -87,6 +88,11 @@ void loop()
|
||||||
//SysEx is handled by event.
|
//SysEx is handled by event.
|
||||||
break;
|
break;
|
||||||
default :
|
default :
|
||||||
|
// If this is a channel messages, set the channel number.
|
||||||
|
if( msg[0] < 0xf0 ){
|
||||||
|
// The getchannel() returns 1-16, but the MIDI status byte starts at 0.
|
||||||
|
msg[0] |= MIDI.getChannel() - 1;
|
||||||
|
}
|
||||||
msg[1] = MIDI.getData1();
|
msg[1] = MIDI.getData1();
|
||||||
msg[2] = MIDI.getData2();
|
msg[2] = MIDI.getData2();
|
||||||
Midi.SendData(msg, 0);
|
Midi.SendData(msg, 0);
|
||||||
|
|
Loading…
Reference in a new issue