diff options
Diffstat (limited to 'src/midimapper.cc')
-rw-r--r-- | src/midimapper.cc | 11 |
1 files changed, 7 insertions, 4 deletions
diff --git a/src/midimapper.cc b/src/midimapper.cc index 6bf38c7..243c22e 100644 --- a/src/midimapper.cc +++ b/src/midimapper.cc @@ -26,6 +26,8 @@ */ #include "midimapper.h" +#include <stdio.h> + #define NOTE_ON 0x9 MidiMapper::MidiMapper(DrumKit *drumkit) @@ -63,11 +65,11 @@ MidiMapper::MidiMapper(DrumKit *drumkit) Sample *MidiMapper::map(jack_midi_event_t event) { Sample *sample = NULL; - +#if 0 // printf("m"); fflush(stdout); if(event.size != 3) return NULL; - if(event.buffer[0] & NOTE_ON != NOTE_ON) return NULL; + if((event.buffer[0] & NOTE_ON) != NOTE_ON) return NULL; int key = event.buffer[1]; int velocity = event.buffer[2]; @@ -82,15 +84,16 @@ Sample *MidiMapper::map(jack_midi_event_t event) } printf("]\n"); */ + if(drumkit->instruments.find(key) == drumkit->instruments.end()) { printf("Unknown instrument %d\n", key); return NULL; } - + Velocity *v = drumkit->instruments[key]->getVelocity(velocity); if(!v) return NULL; sample = v->getSample(); - +#endif return sample; } |