changeset 289:156e6955ccf6 prerelease

Updated heavy render to latest Heavy API
author Giulio Moro <giuliomoro@yahoo.it>
date Sat, 21 May 2016 15:20:06 +0100
parents 771a0920c626
children 9e5156589124
files projects/heavy/pd/hello-midi/_main.pd scripts/hvresources/render.cpp
diffstat 2 files changed, 13 insertions(+), 7 deletions(-) [+]
line wrap: on
line diff
--- a/projects/heavy/pd/hello-midi/_main.pd	Wed May 18 01:50:01 2016 +0100
+++ b/projects/heavy/pd/hello-midi/_main.pd	Sat May 21 15:20:06 2016 +0100
@@ -7,9 +7,9 @@
 #X text 202 438 @krighxz / BELA / heavy / 12/2015;
 #X text 226 457 beaglert.cc / enzienaudio.com;
 #X obj 39 132 mtof;
-#X floatatom 79 59 5 0 0 0 - - -;
-#X floatatom 122 59 5 0 0 0 - - -;
-#X floatatom 41 63 5 0 0 0 - - -;
+#X floatatom 79 59 5 0 0 0 - - -, f 5;
+#X floatatom 122 59 5 0 0 0 - - -, f 5;
+#X floatatom 41 63 5 0 0 0 - - -, f 5;
 #X obj 26 170 phasor~ 440;
 #X text 100 363 (the harsh sound of success);
 #X obj 260 83 * 20;
@@ -36,12 +36,13 @@
 #X obj 40 28 bela_notein 0;
 #X obj 260 60 bela_ctlin 5 0;
 #X obj 220 151 bela_ctlin 6 0;
-#X obj 408 121 bela_pgmin 3;
 #X text 537 58 [ctlin];
 #X text 332 27 [notein];
 #X text 140 29 <== the bela equivalent of ==>;
 #X text 349 59 <== the bela equivalent of ==>;
 #X text 483 121 <== the bela equivalent of ==>;
+#X obj 405 175 print pgmin;
+#X obj 408 121 bela_pgmin 0;
 #X connect 3 0 0 1;
 #X connect 3 0 0 0;
 #X connect 7 0 11 0;
@@ -77,3 +78,4 @@
 #X connect 33 2 9 0;
 #X connect 34 0 13 0;
 #X connect 35 0 19 0;
+#X connect 42 0 41 0;
--- a/scripts/hvresources/render.cpp	Wed May 18 01:50:01 2016 +0100
+++ b/scripts/hvresources/render.cpp	Sat May 21 15:20:06 2016 +0100
@@ -117,6 +117,10 @@
 	//hv_vscheduleMessageForReceiver(gHeavyContext, "bbb_bang", 0.0f, "b");
 	{
 		int num;
+		unsigned int hvHashes[3];
+		hvHashes[0] = hv_stringToHash("bela_notein");
+		hvHashes[1] = hv_stringToHash("bela_ctlin");
+		hvHashes[2] = hv_stringToHash("bela_pgmin"); 
 		while((num = midi.getParser()->numAvailableMessages()) > 0){
 			static MidiChannelMessage message;
 			message = midi.getParser()->getNextChannelMessage();
@@ -127,16 +131,16 @@
 					float velocity = message.getDataByte(1);
 					float channel = message.getChannel();
 //					rt_printf("message: noteNumber: %f, velocity: %f, channel: %f\n", noteNumber, velocity, channel);
-					hv_vscheduleMessageForReceiver(gHeavyContext, "bela_notein", 0, "fff", noteNumber, velocity, channel);
+					hv_vscheduleMessageForReceiver(gHeavyContext, hvHashes[0], 0, "fff", noteNumber, velocity, channel);
 				}
 				break;
 			case kmmControlChange: {
-				hv_vscheduleMessageForReceiver(gHeavyContext, "bela_ctlin", 0, "fff",
+				hv_vscheduleMessageForReceiver(gHeavyContext, hvHashes[1], 0, "fff",
 						(float)message.getDataByte(1), (float)message.getDataByte(0), (float)message.getChannel());
 				}
 				break;
 			case kmmProgramChange:
-				hv_vscheduleMessageForReceiver(gHeavyContext, "bela_pgmin", 0, "ff",
+				hv_vscheduleMessageForReceiver(gHeavyContext, hvHashes[2], 0, "ff",
 						(float)message.getDataByte(0), (float)message.getChannel());
 				break;
 			}