comparison core/default_libpd_render.cpp @ 476:838a4a4a8580 prerelease

Removed warnings, now libpd_render can compile with Clang as well
author Giulio Moro <giuliomoro@yahoo.it>
date Mon, 20 Jun 2016 21:20:28 +0100
parents efc9a9f8e63d
children 4ff80956c27a
comparison
equal deleted inserted replaced
475:faa5f58c71af 476:838a4a4a8580
124 124
125 static unsigned int gAnalogChannelsInUse; 125 static unsigned int gAnalogChannelsInUse;
126 static unsigned int gLibpdBlockSize; 126 static unsigned int gLibpdBlockSize;
127 // 2 audio + (up to)8 analog + (up to) 16 digital + 4 scope outputs 127 // 2 audio + (up to)8 analog + (up to) 16 digital + 4 scope outputs
128 static const unsigned int gChannelsInUse = 30; 128 static const unsigned int gChannelsInUse = 30;
129 static const unsigned int gFirstAudioChannel = 0; 129 //static const unsigned int gFirstAudioChannel = 0;
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 gScopeChannels = 4;
136 float* gScopeOut;
137
136 bool setup(BelaContext *context, void *userData) 138 bool setup(BelaContext *context, void *userData)
137 { 139 {
138 scope.setup(gScopeChannels, context->audioSampleRate); 140 scope.setup(gScopeChannels, context->audioSampleRate);
141 gScopeOut = new float[gScopeChannels];
139 142
140 // 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.
141 char file[] = "_main.pd"; 144 char file[] = "_main.pd";
142 char folder[] = "./"; 145 char folder[] = "./";
143 unsigned int strSize = strlen(file) + strlen(folder) + 1; 146 unsigned int strSize = strlen(file) + strlen(folder) + 1;
383 audioWrite(context, audioFrameBase + j, k, *p1); 386 audioWrite(context, audioFrameBase + j, k, *p1);
384 } 387 }
385 } 388 }
386 //scope 389 //scope
387 for (j = 0, p0 = gOutBuf; j < gLibpdBlockSize; ++j, ++p0) { 390 for (j = 0, p0 = gOutBuf; j < gLibpdBlockSize; ++j, ++p0) {
388 float scopeOut[gScopeChannels]={0};
389 for (k = 0, p1 = p0 + gLibpdBlockSize * gFirstScopeChannel; k < gScopeChannels; k++, p1 += gLibpdBlockSize) { 391 for (k = 0, p1 = p0 + gLibpdBlockSize * gFirstScopeChannel; k < gScopeChannels; k++, p1 += gLibpdBlockSize) {
390 scopeOut[k] = *p1; 392 gScopeOut[k] = *p1;
391 } 393 }
392 scope.log(scopeOut[0], scopeOut[1], scopeOut[2], scopeOut[3]); 394 scope.log(gScopeOut[0], gScopeOut[1], gScopeOut[2], gScopeOut[3]);
393 } 395 }
394 396
395 397
396 //analog 398 //analog
397 if(context->analogChannels == 8){ 399 if(context->analogChannels == 8){
423 // cleanup() is called once at the end, after the audio has stopped. 425 // cleanup() is called once at the end, after the audio has stopped.
424 // Release any resources that were allocated in setup(). 426 // Release any resources that were allocated in setup().
425 427
426 void cleanup(BelaContext *context, void *userData) 428 void cleanup(BelaContext *context, void *userData)
427 { 429 {
428 } 430 delete [] gScopeOut;
431 }