changeset 496:eb237b131ec7 prerelease

Tested and fixed midi glitches heavy
author Giulio Moro <giuliomoro@yahoo.it>
date Tue, 21 Jun 2016 20:00:12 +0100
parents a5867381a97b
children 37f10f61433a
files scripts/hvresources/heavy_render.cpp
diffstat 1 files changed, 11 insertions(+), 10 deletions(-) [+]
line wrap: on
line diff
--- 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: