From f0f2899bc811fcd2fcbb116198ac2eab241dc254 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Goran=20Meki=C4=87?= Date: Sat, 30 Dec 2017 01:20:48 +0100 Subject: Calculate instrument properly --- drumgizmo/input/ossmidi.cc | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) (limited to 'drumgizmo/input') diff --git a/drumgizmo/input/ossmidi.cc b/drumgizmo/input/ossmidi.cc index 03e8481..c504781 100644 --- a/drumgizmo/input/ossmidi.cc +++ b/drumgizmo/input/ossmidi.cc @@ -107,8 +107,12 @@ void OSSInputEngine::run(size_t pos, size_t len, std::vector& events) event_t event; event.type = 0; event.offset = 0; - event.velocity = velocity / 127.0; - event.instrument = 12; + int i = mmap.lookup(note); + if(i != -1) + { + event.instrument = i; + event.velocity = velocity / 127.0; + } events.push_back(event); std::cout << "note = " << note << ", velocity = " << velocity << std::endl; } -- cgit v1.2.3