zynaddsubfx

ZynAddSubFX open source synthesizer
Log | Files | Refs | Submodules | LICENSE

commit 99e1cf8ecf653b57520ee4824a4826306fca5768
parent cd69c43d482554ec32960fc8cea45736b981ff1b
Author: fundamental <mark.d.mccurry@gmail.com>
Date:   Thu,  9 Jun 2016 13:37:21 -0400

Master: Add Port For Tracking On/Off Notes

Diffstat:
Msrc/Misc/Master.cpp | 15++++++++++++++-
Msrc/Misc/Master.h | 3+++
2 files changed, 17 insertions(+), 1 deletion(-)

diff --git a/src/Misc/Master.cpp b/src/Misc/Master.cpp @@ -140,6 +140,13 @@ static const Ports master_ports = { m->part[i] = p; p->initialize_rt(); }}, + {"active_keys:", rProp("Obtain a list of active notes"), 0, + rBegin; + char keys[129] = {0}; + for(int i=0; i<128; ++i) + keys[i] = m->activeNotes[i] ? 'T' : 'F'; + d.broadcast(d.loc, keys); + rEnd}, {"Pvolume::i", rProp(parameter) rLinear(0,127) rDoc("Master Volume"), 0, [](const char *m, rtosc::RtData &d) { if(rtosc_narguments(m)==0) { @@ -366,6 +373,9 @@ Master::Master(const SYNTH_T &synth_, Config* config) for(int nefx = 0; nefx < NUM_SYS_EFX; ++nefx) sysefx[nefx] = new EffectMgr(*memory, synth, 0, &time); + //Note Visualization + for(int i=0; i<128; ++i) + activeNotes[i] = 0; defaults(); @@ -432,12 +442,14 @@ void Master::defaults() void Master::noteOn(char chan, char note, char velocity) { if(velocity) { - for(int npart = 0; npart < NUM_MIDI_PARTS; ++npart) + for(int npart = 0; npart < NUM_MIDI_PARTS; ++npart) { if(chan == part[npart]->Prcvchn) { fakepeakpart[npart] = velocity * 2; if(part[npart]->Penabled) part[npart]->NoteOn(note, velocity, keyshift); } + } + activeNotes[(int)note] = 1; } else this->noteOff(chan, note); @@ -452,6 +464,7 @@ void Master::noteOff(char chan, char note) for(int npart = 0; npart < NUM_MIDI_PARTS; ++npart) if((chan == part[npart]->Prcvchn) && part[npart]->Penabled) part[npart]->NoteOff(note); + activeNotes[(int)note] = 0; } /* diff --git a/src/Misc/Master.h b/src/Misc/Master.h @@ -159,6 +159,9 @@ class Master //Statistics on output levels vuData vu; + //Display info on midi notes + bool activeNotes[128]; + //Other watchers WatchManager watcher;