Fix type in function parameters.

Add MIDI notes.
master
Holger Wirtz 7 years ago
parent 3014059571
commit 4a40382dec
  1. 21
      MIDITESTER.ino
  2. 5
      midinotes.h

@ -11,10 +11,10 @@
#define TEST_NOTE_MAX MIDI_B5 #define TEST_NOTE_MAX MIDI_B5
#define TEST_VEL_MIN 60 #define TEST_VEL_MIN 60
#define TEST_VEL_MAX 120 #define TEST_VEL_MAX 120
#define TEST_DUR_MIN 150 #define TEST_DUR_MIN 200
#define TEST_DUR_MAX 1000 #define TEST_DUR_MAX 1500
#define MASTER_KEY_MIDI MIDI_B6 #define MASTER_KEY_MIDI MIDI_C6
#define MASTER_NUM1 MIDI_C1 #define MASTER_NUM1 MIDI_C1
class midi_event { class midi_event {
@ -49,7 +49,7 @@ void setup()
MIDI.sendNoteOff(MIDI_E3, 0, 1); MIDI.sendNoteOff(MIDI_E3, 0, 1);
delay(500); delay(500);
MIDI.sendNoteOff(MASTER_KEY_MIDI, 0, 1); MIDI.sendNoteOff(MASTER_KEY_MIDI, 0, 1);
delay(2000); delay(2000);
// Volume change 0.5 // Volume change 0.5
@ -71,9 +71,9 @@ void setup()
MIDI.sendNoteOff(MIDI_FIS3, 0, 1); MIDI.sendNoteOff(MIDI_FIS3, 0, 1);
delay(500); delay(500);
MIDI.sendNoteOff(MASTER_KEY_MIDI, 0, 1); MIDI.sendNoteOff(MASTER_KEY_MIDI, 0, 1);
delay(2000); delay(2000);
// Sound change 17 // Sound change 17
MIDI.sendNoteOn(MASTER_KEY_MIDI, 99, 1); MIDI.sendNoteOn(MASTER_KEY_MIDI, 99, 1);
delay(500); delay(500);
@ -85,7 +85,7 @@ void setup()
delay(2000); delay(2000);
// Volume change 0.1 // Volume change 0.1
MIDI.sendNoteOn(MASTER_KEY_MIDI, 99, 1); MIDI.sendNoteOn(MASTER_KEY_MIDI, 99, 1);
delay(500); delay(500);
MIDI.sendNoteOn(MIDI_DIS1, 66, 1); MIDI.sendNoteOn(MIDI_DIS1, 66, 1);
@ -93,7 +93,7 @@ void setup()
MIDI.sendNoteOff(MIDI_DIS1, 0, 1); MIDI.sendNoteOff(MIDI_DIS1, 0, 1);
delay(500); delay(500);
MIDI.sendNoteOff(MASTER_KEY_MIDI, 0, 1); MIDI.sendNoteOff(MASTER_KEY_MIDI, 0, 1);
delay(5000); delay(5000);
} }
@ -107,7 +107,7 @@ void loop()
sched.scheduler(); sched.scheduler();
} }
void sendMIDI(int8_t note, int8_t vel, int8_t chan, int8_t dur) void sendMIDI(int8_t note, int8_t vel, int8_t chan, uint32_t dur)
{ {
midi_event *m = new midi_event(); midi_event *m = new midi_event();
m->note = note; m->note = note;
@ -140,8 +140,7 @@ void do_midi_events(void)
{ {
midi_event *m = MIDIEvents.get(i); midi_event *m = MIDIEvents.get(i);
// If its a mammal, then print it's name if (millis() > m->dur)
if (m->dur < millis())
{ {
MIDI.sendNoteOff(m->note, 0, m->chan); MIDI.sendNoteOff(m->note, 0, m->chan);
MIDIEvents.remove(i); MIDIEvents.remove(i);

@ -2,6 +2,9 @@
* MIDI note values * MIDI note values
*************************************************/ *************************************************/
#ifndef _MIDINOTES_H
#define _MIDINOTES_H
#define MIDI_A0 21 #define MIDI_A0 21
#define MIDI_AIS0 22 #define MIDI_AIS0 22
#define MIDI_B0 23 #define MIDI_B0 23
@ -90,3 +93,5 @@
#define MIDI_AIS7 106 #define MIDI_AIS7 106
#define MIDI_B7 107 #define MIDI_B7 107
#define MIDI_C8 108 #define MIDI_C8 108
#endif

Loading…
Cancel
Save