commit dc455f06df29606bd585ca1ff8dcbac0d3be1386
parent 395fddc4ec669e7b4a36f677a5b2cc55a00040d9
Author: Damien Goutte-Gattat <[email protected]>
Date: Sat, 29 Oct 2011 20:07:10 +0200
Load instrument upon reception of Program Change
Add a public method in Master allowing to programmatically change
the instrument used on a MIDI channel. This method is called by
the input manager upon reception of a Program Change event.
Diffstat:
3 files changed, 9 insertions(+), 0 deletions(-)
diff --git a/src/Misc/Master.cpp b/src/Misc/Master.cpp
@@ -188,6 +188,13 @@ void Master::setController(char chan, int type, int par)
}
}
+void Master::setProgram(char chan, unsigned int pgm)
+{
+ for(int npart = 0; npart < NUM_MIDI_PARTS; ++npart)
+ if(chan == part[npart]->Prcvchn)
+ bank.loadfromslot(pgm, part[npart]);
+}
+
void Master::vuUpdate(const float *outl, const float *outr)
{
//Peak computation (for vumeters)
diff --git a/src/Misc/Master.h b/src/Misc/Master.h
@@ -91,6 +91,7 @@ class Master
void noteOn(char chan, char note, char velocity);
void noteOff(char chan, char note);
void setController(char chan, int type, int par);
+ void setProgram(char chan, unsigned int pgm);
//void NRPN...
diff --git a/src/Nio/InMgr.cpp b/src/Nio/InMgr.cpp
@@ -84,6 +84,7 @@ void InMgr::flush()
break;
case M_PGMCHANGE:
+ master.setProgram(ev.channel, ev.num);
break;
}
}