comparison core/default_libpd_render.cpp @ 483:dbc76783db2a prerelease

libpd minor refactoring
author Giulio Moro <giuliomoro@yahoo.it>
date Tue, 21 Jun 2016 14:28:17 +0100
parents 4ff80956c27a
children a5867381a97b
comparison
equal deleted inserted replaced
482:4d5edf7ee953 483:dbc76783db2a
130 static const unsigned int gFirstAnalogChannel = 2; 130 static const unsigned int gFirstAnalogChannel = 2;
131 static const unsigned int gFirstDigitalChannel = 10; 131 static const unsigned int gFirstDigitalChannel = 10;
132 static const unsigned int gFirstScopeChannel = 26; 132 static const unsigned int gFirstScopeChannel = 26;
133 133
134 Scope scope; 134 Scope scope;
135 unsigned int gScopeChannels = 4; 135 unsigned int gScopeChannelsInUse = 4;
136 float* gScopeOut; 136 float* gScopeOut;
137 137
138 bool setup(BelaContext *context, void *userData) 138 bool setup(BelaContext *context, void *userData)
139 { 139 {
140 scope.setup(gScopeChannels, context->audioSampleRate); 140 scope.setup(gScopeChannelsInUse, context->audioSampleRate);
141 gScopeOut = new float[gScopeChannels]; 141 gScopeOut = new float[gScopeChannelsInUse];
142 142
143 // Check first of all if file exists. Will actually open it later. 143 // Check first of all if file exists. Will actually open it later.
144 char file[] = "_main.pd"; 144 char file[] = "_main.pd";
145 char folder[] = "./"; 145 char folder[] = "./";
146 unsigned int strSize = strlen(file) + strlen(folder) + 1; 146 unsigned int strSize = strlen(file) + strlen(folder) + 1;
391 audioWrite(context, audioFrameBase + j, k, *p1); 391 audioWrite(context, audioFrameBase + j, k, *p1);
392 } 392 }
393 } 393 }
394 //scope 394 //scope
395 for (j = 0, p0 = gOutBuf; j < gLibpdBlockSize; ++j, ++p0) { 395 for (j = 0, p0 = gOutBuf; j < gLibpdBlockSize; ++j, ++p0) {
396 for (k = 0, p1 = p0 + gLibpdBlockSize * gFirstScopeChannel; k < gScopeChannels; k++, p1 += gLibpdBlockSize) { 396 for (k = 0, p1 = p0 + gLibpdBlockSize * gFirstScopeChannel; k < gScopeChannelsInUse; k++, p1 += gLibpdBlockSize) {
397 gScopeOut[k] = *p1; 397 gScopeOut[k] = *p1;
398 } 398 }
399 scope.log(gScopeOut[0], gScopeOut[1], gScopeOut[2], gScopeOut[3]); 399 scope.log(gScopeOut[0], gScopeOut[1], gScopeOut[2], gScopeOut[3]);
400 } 400 }
401 401