comparison scripts/hvresources/heavy_render.cpp @ 489:45dee9066d43 prerelease

Better heavy: fixed MIDI ctlin range, commented out unused variables
author Giulio Moro <giuliomoro@yahoo.it>
date Tue, 21 Jun 2016 16:44:50 +0100
parents 7eefd4b3aec3
children e9821d65b9ba
comparison
equal deleted inserted replaced
488:441c8429f27c 489:45dee9066d43
132 132
133 /* 133 /*
134 * SETUP, RENDER LOOP & CLEANUP 134 * SETUP, RENDER LOOP & CLEANUP
135 */ 135 */
136 136
137 // leaving this here, trying to come up with a coherent interface with libpd.
138 // commenting them out so the compiler does not warn
137 // 2 audio + (up to)8 analog + (up to) 16 digital + 4 scope outputs 139 // 2 audio + (up to)8 analog + (up to) 16 digital + 4 scope outputs
138 static const unsigned int gChannelsInUse = 30; 140 //static const unsigned int gChannelsInUse = 30;
139 static unsigned int gAnalogChannelsInUse = 8; // hard-coded for the moment, TODO: get it at run-time from hv_context 141 //static unsigned int gAnalogChannelsInUse = 8; // hard-coded for the moment, TODO: get it at run-time from hv_context
140 //static const unsigned int gFirstAudioChannel = 0; 142 //static const unsigned int gFirstAudioChannel = 0;
141 static const unsigned int gFirstAnalogChannel = 2; 143 //static const unsigned int gFirstAnalogChannel = 2;
142 static const unsigned int gFirstDigitalChannel = 10; 144 static const unsigned int gFirstDigitalChannel = 10;
143 static const unsigned int gFirstScopeChannel = 26; 145 static const unsigned int gFirstScopeChannel = 26;
144 static unsigned int gDigitalSigInChannelsInUse; 146 static unsigned int gDigitalSigInChannelsInUse;
145 static unsigned int gDigitalSigOutChannelsInUse; 147 static unsigned int gDigitalSigOutChannelsInUse;
146 148
256 hv_vscheduleMessageForReceiver(gHeavyContext, hvMidiHashes[kmmNoteOn], 0, "fff", 258 hv_vscheduleMessageForReceiver(gHeavyContext, hvMidiHashes[kmmNoteOn], 0, "fff",
257 (float)noteNumber, (float)0, (float)channel); 259 (float)noteNumber, (float)0, (float)channel);
258 break; 260 break;
259 } 261 }
260 case kmmControlChange: { 262 case kmmControlChange: {
261 message.prettyPrint();
262 int channel = message.getChannel(); 263 int channel = message.getChannel();
263 int controller = message.getDataByte(0); 264 int controller = message.getDataByte(0);
264 int value = message.getDataByte(1); 265 int value = message.getDataByte(1);
265 hv_vscheduleMessageForReceiver(gHeavyContext, hvMidiHashes[kmmControlChange], 0, "fff", 266 hv_vscheduleMessageForReceiver(gHeavyContext, hvMidiHashes[kmmControlChange], 0, "fff",
266 (float)value, (float)controller, (float)channel); 267 (float)value, (float)controller, (float)channel);
292 (float)channel, (float)value); 293 (float)channel, (float)value);
293 break; 294 break;
294 } 295 }
295 case kmmPitchBend: 296 case kmmPitchBend:
296 { 297 {
297 //TODO: untested, I do not have anything with bend at the moment... 298 int channel = message.getChannel();
298 //TODO: check for both argument order and if the value range is correct? 299 int value = ((message.getDataByte(1) << 7) | message.getDataByte(0)) - 8192;
299 int channel = message.getChannel();
300 int value = ((message.getDataByte(1) << 7) | message.getDataByte(0)) + 8192;
301 hv_vscheduleMessageForReceiver(gHeavyContext, hvMidiHashes[kmmPitchBend], 0, "ff", 300 hv_vscheduleMessageForReceiver(gHeavyContext, hvMidiHashes[kmmPitchBend], 0, "ff",
302 (float)channel, (float)value); 301 (float)channel, (float)value);
303 break; 302 break;
304 } 303 }
305 case kmmNone: 304 case kmmNone:
392 if(gScopeChannelsInUse > 0) 391 if(gScopeChannelsInUse > 0)
393 { 392 {
394 unsigned int j, k; 393 unsigned int j, k;
395 float *p0, *p1; 394 float *p0, *p1;
396 const unsigned int gLibpdBlockSize = context->audioFrames; 395 const unsigned int gLibpdBlockSize = context->audioFrames;
397 const unsigned int audioFrameBase = 0;
398 float* gOutBuf = gHvOutputBuffers; 396 float* gOutBuf = gHvOutputBuffers;
399 397
400 // block below copy/pasted from libpd 398 // block below copy/pasted from libpd
401 for (j = 0, p0 = gOutBuf; j < gLibpdBlockSize; ++j, ++p0) { 399 for (j = 0, p0 = gOutBuf; j < gLibpdBlockSize; ++j, ++p0) {
402 for (k = 0, p1 = p0 + gLibpdBlockSize * gFirstScopeChannel; k < gScopeChannelsInUse; k++, p1 += gLibpdBlockSize) { 400 for (k = 0, p1 = p0 + gLibpdBlockSize * gFirstScopeChannel; k < gScopeChannelsInUse; k++, p1 += gLibpdBlockSize) {