commit bd4c2a6488f5f81b5e05a021ae7fe859406a067b
parent 59315edbe05268fdf38279eb8470f2f1a1ab0d29
Author: Hans Petter Selasky <[email protected]>
Date: Tue, 22 Jan 2019 14:03:44 +0100
Add support for M_FLOAT_NOTE MIDI event type.
Signed-off-by: Hans Petter Selasky <[email protected]>
Diffstat:
2 files changed, 19 insertions(+), 10 deletions(-)
diff --git a/src/Nio/InMgr.cpp b/src/Nio/InMgr.cpp
@@ -32,6 +32,13 @@ ostream &operator<<(ostream &out, const MidiEvent &ev)
<< " velocity(" << ev.value << ")";
break;
+ case M_FLOAT_NOTE:
+ out << "MidiNote: note(" << ev.num << ")\n"
+ << " channel(" << ev.channel << ")\n"
+ << " velocity(" << ev.value << ")\n"
+ << " log2_freq(" << ev.log2_freq << ")";
+ break;
+
case M_CONTROLLER:
out << "MidiCtl: controller(" << ev.num << ")\n"
<< " channel(" << ev.channel << ")\n"
@@ -93,10 +100,11 @@ void InMgr::flush(unsigned frameStart, unsigned frameStop)
switch(ev.type) {
case M_NOTE:
- if(ev.value)
- master->noteOn(ev.channel, ev.num, ev.value);
- else
- master->noteOff(ev.channel, ev.num);
+ master->noteOn(ev.channel, ev.num, ev.value);
+ break;
+
+ case M_FLOAT_NOTE:
+ master->noteOn(ev.channel, ev.num, ev.value, ev.log2_freq);
break;
case M_CONTROLLER:
diff --git a/src/Nio/InMgr.h b/src/Nio/InMgr.h
@@ -19,12 +19,12 @@
namespace zyn {
enum midi_type {
- M_NOTE = 1,
- M_CONTROLLER = 2,
- M_PGMCHANGE = 3,
- M_PRESSURE = 4
-}; //type=1 for note, type=2 for controller, type=3 for program change
-//type=4 for polyphonic aftertouch
+ M_NOTE = 1, // for note
+ M_CONTROLLER = 2, // for controller
+ M_PGMCHANGE = 3, // for program change
+ M_PRESSURE = 4, // for polyphonic aftertouch
+ M_FLOAT_NOTE = 5 // for floating point note
+};
struct MidiEvent {
MidiEvent();
@@ -33,6 +33,7 @@ struct MidiEvent {
int num; //note, controller or program number
int value; //velocity or controller value
int time; //time offset of event (used only in jack->jack case at the moment)
+ float log2_freq; //type=5 for logarithmic representation of note
};
//super simple class to manage the inputs