# HG changeset patch # User Giulio Moro # Date 1466535612 -3600 # Node ID eb237b131ec78632d2a0ceca824c3ef9be203fe8 # Parent a5867381a97bfc6815ee037a43946a1a0332b152 Tested and fixed midi glitches heavy diff -r a5867381a97b -r eb237b131ec7 scripts/hvresources/heavy_render.cpp --- a/scripts/hvresources/heavy_render.cpp Tue Jun 21 19:58:32 2016 +0100 +++ b/scripts/hvresources/heavy_render.cpp Tue Jun 21 20:00:12 2016 +0100 @@ -170,7 +170,7 @@ //[print pgmin_number] hvMidiHashes[kmmProgramChange] = hv_stringToHash("__hv_pgmin"); hvMidiHashes[kmmPolyphonicKeyPressure] = hv_stringToHash("__hv_polytouchin"); - hvMidiHashes[kmmChannelPressure] = hv_stringToHash("__hv_touch"); + hvMidiHashes[kmmChannelPressure] = hv_stringToHash("__hv_touchin"); hvMidiHashes[kmmPitchBend] = hv_stringToHash("__hv_bendin"); gHeavyContext = hv_bela_new(context->audioSampleRate); @@ -243,7 +243,7 @@ int channel = message.getChannel(); // rt_printf("message: noteNumber: %f, velocity: %f, channel: %f\n", noteNumber, velocity, channel); hv_vscheduleMessageForReceiver(gHeavyContext, hvMidiHashes[kmmNoteOn], 0, "fff", - (float)noteNumber, (float)velocity, (float)channel); + (float)noteNumber, (float)velocity, (float)channel+1); break; } case kmmNoteOff: { @@ -256,7 +256,7 @@ int channel = message.getChannel(); // note we are sending the below to hvHashes[kmmNoteOn] !! hv_vscheduleMessageForReceiver(gHeavyContext, hvMidiHashes[kmmNoteOn], 0, "fff", - (float)noteNumber, (float)0, (float)channel); + (float)noteNumber, (float)0, (float)channel+1); break; } case kmmControlChange: { @@ -264,33 +264,34 @@ int controller = message.getDataByte(0); int value = message.getDataByte(1); hv_vscheduleMessageForReceiver(gHeavyContext, hvMidiHashes[kmmControlChange], 0, "fff", - (float)value, (float)controller, (float)channel); + (float)value, (float)controller, (float)channel+1); break; } case kmmProgramChange: { + message.prettyPrint(); int channel = message.getChannel(); int program = message.getDataByte(0); hv_vscheduleMessageForReceiver(gHeavyContext, hvMidiHashes[kmmProgramChange], 0, "ff", - (float)program, (float)channel); + (float)program, (float)channel+1); break; } case kmmPolyphonicKeyPressure: { + message.prettyPrint(); + //TODO: untested, I do not have anything with polyTouch... who does, anyhow? int channel = message.getChannel(); int pitch = message.getDataByte(0); int value = message.getDataByte(1); hv_vscheduleMessageForReceiver(gHeavyContext, hvMidiHashes[kmmPolyphonicKeyPressure], 0, "fff", - (float)channel, (float)pitch, (float)value); + (float)channel+1, (float)pitch, (float)value); break; } case kmmChannelPressure: { - //TODO: untested, I do not have anything with aftertouch... int channel = message.getChannel(); int value = message.getDataByte(0); - //TODO: maybe the order of the arguments is wrong here? hv_vscheduleMessageForReceiver(gHeavyContext, hvMidiHashes[kmmChannelPressure], 0, "ff", - (float)channel, (float)value); + (float)value, (float)channel+1); break; } case kmmPitchBend: @@ -298,7 +299,7 @@ int channel = message.getChannel(); int value = ((message.getDataByte(1) << 7) | message.getDataByte(0)) - 8192; hv_vscheduleMessageForReceiver(gHeavyContext, hvMidiHashes[kmmPitchBend], 0, "ff", - (float)channel, (float)value); + (float)channel+1, (float)value); break; } case kmmNone: