Mercurial > hg > beaglert
comparison examples/d-box/render.cpp @ 301:e4392164b458 prerelease
RENAMED BeagleRT to Bela AAAAAAAAAAAAAAAAAAAAAAAAAAAAAA, scripts probably not working
author | Giulio Moro <giuliomoro@yahoo.it> |
---|---|
date | Fri, 27 May 2016 14:34:41 +0100 |
parents | dbeed520b014 |
children | 421a69d42943 |
comparison
equal
deleted
inserted
replaced
300:dbeed520b014 | 301:e4392164b458 |
---|---|
3 * | 3 * |
4 * Created on: May 28, 2014 | 4 * Created on: May 28, 2014 |
5 * Author: Victor Zappi | 5 * Author: Victor Zappi |
6 */ | 6 */ |
7 | 7 |
8 #include <BeagleRT.h> | 8 #include <Bela.h> |
9 #include <PRU.h> | 9 #include <PRU.h> |
10 | 10 |
11 #include "StatusLED.h" | 11 #include "StatusLED.h" |
12 #include "config.h" | 12 #include "config.h" |
13 #include "OscillatorBank.h" | 13 #include "OscillatorBank.h" |
151 #ifdef DBOX_CAPE_TEST | 151 #ifdef DBOX_CAPE_TEST |
152 void render_capetest(int numMatrixFrames, int numAudioFrames, float *audioIn, float *audioOut, | 152 void render_capetest(int numMatrixFrames, int numAudioFrames, float *audioIn, float *audioOut, |
153 uint16_t *matrixIn, uint16_t *matrixOut); | 153 uint16_t *matrixIn, uint16_t *matrixOut); |
154 #endif | 154 #endif |
155 | 155 |
156 bool setup(BeagleRTContext *context, void *userData) { | 156 bool setup(BelaContext *context, void *userData) { |
157 int oscBankHopSize = *(int *)userData; | 157 int oscBankHopSize = *(int *)userData; |
158 | 158 |
159 if(context->analogChannels != 8) { | 159 if(context->analogChannels != 8) { |
160 printf("Error: D-Box needs matrix enabled with 8 channels.\n"); | 160 printf("Error: D-Box needs matrix enabled with 8 channels.\n"); |
161 return false; | 161 return false; |
227 PeakBurst[1].setDecayRate(.5 * context->analogSampleRate); | 227 PeakBurst[1].setDecayRate(.5 * context->analogSampleRate); |
228 PeakBurst[0].setSustainLevel(0.0); | 228 PeakBurst[0].setSustainLevel(0.0); |
229 PeakBurst[1].setSustainLevel(0.0); | 229 PeakBurst[1].setSustainLevel(0.0); |
230 | 230 |
231 // Initialise auxiliary tasks | 231 // Initialise auxiliary tasks |
232 if((gMediumPriorityRender = BeagleRT_createAuxiliaryTask(&render_medium_prio, BEAGLERT_AUDIO_PRIORITY - 10, "dbox-calculation-medium")) == 0) | 232 if((gMediumPriorityRender = Bela_createAuxiliaryTask(&render_medium_prio, BEAGLERT_AUDIO_PRIORITY - 10, "dbox-calculation-medium")) == 0) |
233 return false; | 233 return false; |
234 if((gLowPriorityRender = BeagleRT_createAuxiliaryTask(&render_low_prio, BEAGLERT_AUDIO_PRIORITY - 15, "dbox-calculation-low")) == 0) | 234 if((gLowPriorityRender = Bela_createAuxiliaryTask(&render_low_prio, BEAGLERT_AUDIO_PRIORITY - 15, "dbox-calculation-low")) == 0) |
235 return false; | 235 return false; |
236 | 236 |
237 return true; | 237 return true; |
238 } | 238 } |
239 | 239 |
240 void render(BeagleRTContext *context, void *userData) | 240 void render(BelaContext *context, void *userData) |
241 { | 241 { |
242 #ifdef DBOX_CAPE_TEST | 242 #ifdef DBOX_CAPE_TEST |
243 render_capetest(numMatrixFrames, numAudioFrames, audioIn, audioOut, matrixIn, matrixOut); | 243 render_capetest(numMatrixFrames, numAudioFrames, audioIn, audioOut, matrixIn, matrixOut); |
244 #else | 244 #else |
245 if(gOscBanks[gCurrentOscBank]->state==bank_toreset) | 245 if(gOscBanks[gCurrentOscBank]->state==bank_toreset) |
321 // New buffer size is whatever finished writing last hop | 321 // New buffer size is whatever finished writing last hop |
322 gOscillatorBufferReadCurrentSize = gOscillatorBufferWriteCurrentSize; | 322 gOscillatorBufferReadCurrentSize = gOscillatorBufferWriteCurrentSize; |
323 gOscillatorBufferReadPointer = 0; | 323 gOscillatorBufferReadPointer = 0; |
324 | 324 |
325 gOscillatorNeedsRender = true; | 325 gOscillatorNeedsRender = true; |
326 BeagleRT_scheduleAuxiliaryTask(gMediumPriorityRender); | 326 Bela_scheduleAuxiliaryTask(gMediumPriorityRender); |
327 } | 327 } |
328 } | 328 } |
329 #endif | 329 #endif |
330 } | 330 } |
331 else | 331 else |
416 int tableLength = gFeedbackOscillator.process(context->analogIn[n*8 + ADC_PIN2], &context->analogOut[n*8 + DAC_PIN2]); | 416 int tableLength = gFeedbackOscillator.process(context->analogIn[n*8 + ADC_PIN2], &context->analogOut[n*8 + DAC_PIN2]); |
417 if(tableLength != 0) { | 417 if(tableLength != 0) { |
418 gFeedbackOscillatorTableLength = tableLength; | 418 gFeedbackOscillatorTableLength = tableLength; |
419 gFeedbackOscillatorTable = gFeedbackOscillator.wavetable(); | 419 gFeedbackOscillatorTable = gFeedbackOscillator.wavetable(); |
420 gDynamicWavetableNeedsRender = true; | 420 gDynamicWavetableNeedsRender = true; |
421 BeagleRT_scheduleAuxiliaryTask(gLowPriorityRender); | 421 Bela_scheduleAuxiliaryTask(gLowPriorityRender); |
422 } | 422 } |
423 | 423 |
424 /* | 424 /* |
425 * Matrix Out 3, In 3 | 425 * Matrix Out 3, In 3 |
426 * | 426 * |
729 | 729 |
730 //dbox_printf("min %d max %d\n", gLoopPointMin, gLoopPointMax); | 730 //dbox_printf("min %d max %d\n", gLoopPointMin, gLoopPointMax); |
731 } | 731 } |
732 | 732 |
733 // Clean up at the end of render | 733 // Clean up at the end of render |
734 void cleanup(BeagleRTContext *context, void *userData) | 734 void cleanup(BelaContext *context, void *userData) |
735 { | 735 { |
736 free(gOscillatorBuffer1); | 736 free(gOscillatorBuffer1); |
737 free(gOscillatorBuffer2); | 737 free(gOscillatorBuffer2); |
738 free(gDynamicWavetable); | 738 free(gDynamicWavetable); |
739 } | 739 } |