summaryrefslogtreecommitdiff
path: root/vst/input_vst.cc
diff options
context:
space:
mode:
authorBent Bisballe Nyeng <deva@aasimon.org>2013-01-26 08:49:35 +0100
committerBent Bisballe Nyeng <deva@aasimon.org>2013-01-26 08:49:35 +0100
commitbe628876b0515ceee40946e923771e1b40d6641b (patch)
tree71fd3b3ccdc543ede0ae78ebb565a494242a6a7a /vst/input_vst.cc
parent838ca69e4b226fa11ce04247148559bef3370959 (diff)
Lots of integration work with GUI, as well as config storage.
Diffstat (limited to 'vst/input_vst.cc')
-rw-r--r--vst/input_vst.cc31
1 files changed, 22 insertions, 9 deletions
diff --git a/vst/input_vst.cc b/vst/input_vst.cc
index 52015ad..5cc73f9 100644
--- a/vst/input_vst.cc
+++ b/vst/input_vst.cc
@@ -27,6 +27,7 @@
#include "input_vst.h"
#include <midimapparser.h>
+#include <hugin.hpp>
InputVST::InputVST()
{
@@ -38,16 +39,10 @@ InputVST::~InputVST()
{
}
-bool InputVST::init(Instruments &instruments)
+bool InputVST::init(Instruments &i)
{
- MidiMapParser p(getenv("DRUMGIZMO_MIDIMAP"));
- if(p.parse()) {/*return false;*/}
- mmap.midimap = p.midimap;
-
- for(size_t i = 0; i < instruments.size(); i++) {
- mmap.instrmap[instruments[i].name()] = i;
- }
-
+ DEBUG(inputvst, "init\n");
+ instruments = &i;
return true;
}
@@ -98,6 +93,7 @@ void InputVST::processEvents(VstEvents* ev)
VstInt32 velocity = midiData[2] & 0x7f;
int i = mmap.lookup(note);
+ DEBUG(inputvst, "Note: %d -> %d\n", note, i);
if(velocity && i != -1) {
list[listsize].type = TYPE_ONSET;
list[listsize].instrument = i;
@@ -110,3 +106,20 @@ void InputVST::processEvents(VstEvents* ev)
event++;
}
}
+
+void InputVST::loadMidiMap(std::string f)
+{
+ DEBUG(inputvst, "load midi map %s\n", f.c_str());
+
+ MidiMapParser p(f);
+ if(p.parse()) {
+ ERR(inputvst, "Error loading midimap: %s\n", f.c_str());
+ return;
+ }
+ mmap.midimap = p.midimap;
+
+ for(size_t i = 0; i < instruments->size(); i++) {
+ DEBUG(inputvst, "Mapping %s to %d\n", (*instruments)[i]->name().c_str(), i);
+ mmap.instrmap[(*instruments)[i]->name()] = i;
+ }
+}