summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGoran Mekić <meka@tilda.center>2017-12-30 01:14:35 +0100
committerGoran Mekić <meka@tilda.center>2017-12-30 15:18:26 +0100
commit17220d8e06998160ba0f8678649e62872fda9727 (patch)
tree89b8f43ce4efe97eff241f384f00474ff50fdce5
parent5bdf69cb2748ce9c83de3d9d45bea67d096fe04d (diff)
Hardcode instrument, otherwise play notes
-rw-r--r--drumgizmo/input/ossmidi.cc7
1 files changed, 7 insertions, 0 deletions
diff --git a/drumgizmo/input/ossmidi.cc b/drumgizmo/input/ossmidi.cc
index 4473557..03e8481 100644
--- a/drumgizmo/input/ossmidi.cc
+++ b/drumgizmo/input/ossmidi.cc
@@ -90,6 +90,7 @@ void OSSInputEngine::stop()
void OSSInputEngine::pre()
{
+ events.clear();
}
@@ -103,6 +104,12 @@ void OSSInputEngine::run(size_t pos, size_t len, std::vector<event_t>& events)
if (masked_note == NOTE_ON) {
int note = buf[1];
int velocity = buf[2];
+ event_t event;
+ event.type = 0;
+ event.offset = 0;
+ event.velocity = velocity / 127.0;
+ event.instrument = 12;
+ events.push_back(event);
std::cout << "note = " << note << ", velocity = " << velocity << std::endl;
}
} else if (errno != EAGAIN) {