Closed fredOnGitHub closed 3 years ago
Here the code
//https://youtu.be/Twx0kzxXvp4?t=309
//MIDI for the Arduino - MIDI Input Test
//Notes and Volts
#include <MIDI.h>
//#define GG
#ifdef GG
MIDI_CREATE_DEFAULT_INSTANCE();
#else
//https://github.com/FortySevenEffects/arduino_midi_library/wiki/Using-custom-Settings
struct MySettings : public midi::DefaultSettings
{
static const long BaudRate = 115200;
};
// Create a 'MIDI' object using MySettings bound to Serial2.
MIDI_CREATE_CUSTOM_INSTANCE(HardwareSerial, Serial, MIDI, MySettings);
#endif
void setup() {
#ifdef GG
Serial.begin(115200);
#endif
// MIDI.begin(MIDI_CHANNEL_OMNI);//listen all ports
MIDI.begin(1);
MIDI.setHandleNoteOn(MyHandleNoteOn);
MIDI.setHandleNoteOff(MyHandleNoteOff);
MIDI.setHandleControlChange(MyCCFunction);
}
void loop() {
MIDI.read();
}
void MyHandleNoteOn(byte channel, byte pitch, byte velocity) {
}
void MyHandleNoteOff(byte channel, byte pitch, byte velocity) {
}
void MyCCFunction(byte channel, byte number, byte value) {
}
Maybe the solution is
MIDI.turnThruOff();
I got the seem results in USB mode device mode so i have tested this code line in USB mode device mode and OK now.
I'll test it in serial mode.
Device Chip : 16U2
That's OK with MIDI.turnThruOff();
New code :
#include <MIDI.h>
#define SERIE
#ifdef SERIE
#define BAUD 115200
#else
#define BAUD 31250 // USB MIDI MODE for MOCO lufa
#endif
//https://github.com/FortySevenEffects/arduino_midi_library/wiki/Using-custom-Settings
//static const long BaudRate = 31250; by default if use
//Note : 115200 for hairless - 31250 for MOCO lufa
struct MySettings : public midi::DefaultSettings
{
static const long BaudRate = BAUD;
};
// Create a 'MIDI' object using MySettings bound to Serial2.
MIDI_CREATE_CUSTOM_INSTANCE(HardwareSerial, Serial, MIDI, MySettings);
void setup() {
MIDI.begin(MIDI_CHANNEL_OMNI);//listen all ports
MIDI.setHandleNoteOn(MyHandleNoteOn);
MIDI.setHandleNoteOff(MyHandleNoteOff);
MIDI.setHandleControlChange(MyCCFunction);
MIDI.turnThruOff();
pinMode (LED_BUILTIN, OUTPUT);
}
void loop() {
MIDI.read();
}
void MyHandleNoteOn(byte channel, byte pitch, byte velocity) {
}
void MyHandleNoteOff(byte channel, byte pitch, byte velocity) {
}
void MyCCFunction(byte channel, byte number, byte value) {
digitalWrite(LED_BUILTIN, 1);
delay(50);
digitalWrite(LED_BUILTIN, 0);
delay(50);
}
Windows 10
Hello, you can see in this video that
At 0:25 min Hairless bug and exit
Hairless with in and out open (p1, p2)
Traktor : how send volume state
I see input of Hairless going into his output.
Normally i have to see only Hairless' input ...
Thanks for your helping