comparison examples/bucket_brigade_chorus/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 1feb9c23ac57
comparison
equal deleted inserted replaced
300:dbeed520b014 301:e4392164b458
1 #include <BeagleRT.h> 1 #include <Bela.h>
2 #include <Scope.h> 2 #include <Scope.h>
3 #include <cmath> 3 #include <cmath>
4 #include <Utilities.h> 4 #include <Utilities.h>
5 5
6 float gPhase1, gPhase2; 6 float gPhase1, gPhase2;
37 usleep(100); 37 usleep(100);
38 } 38 }
39 // gPRU->clearGPIOTestPin(); 39 // gPRU->clearGPIOTestPin();
40 } 40 }
41 41
42 bool setup(BeagleRTContext *context, void *userData) 42 bool setup(BelaContext *context, void *userData)
43 { 43 {
44 gInverseSampleRate = 1.0/context->audioSampleRate; 44 gInverseSampleRate = 1.0/context->audioSampleRate;
45 45
46 gPhase1 = 0.0; 46 gPhase1 = 0.0;
47 gPhase2 = 0.0; 47 gPhase2 = 0.0;
48 48
49 gFrequency1 = 200.0; 49 gFrequency1 = 200.0;
50 gFrequency2 = 201.0; 50 gFrequency2 = 201.0;
51 updatePll=BeagleRT_createAuxiliaryTask(&updatePllFunction, 91, "update PLL"); 51 updatePll=Bela_createAuxiliaryTask(&updatePllFunction, 91, "update PLL");
52 for(int n=0; n<delayLength; n++){ 52 for(int n=0; n<delayLength; n++){
53 delay[n]=0; 53 delay[n]=0;
54 } 54 }
55 return true; 55 return true;
56 } 56 }
58 // render() is called regularly at the highest priority by the audio engine. 58 // render() is called regularly at the highest priority by the audio engine.
59 // Input and output are given from the audio hardware and the other 59 // Input and output are given from the audio hardware and the other
60 // ADCs and DACs (if available). If only audio is available, numMatrixFrames 60 // ADCs and DACs (if available). If only audio is available, numMatrixFrames
61 // will be 0. 61 // will be 0.
62 62
63 void render(BeagleRTContext *context, void *userData) 63 void render(BelaContext *context, void *userData)
64 { 64 {
65 // printf("here\n"); 65 // printf("here\n");
66 static bool init = false; 66 static bool init = false;
67 if(init == false){ 67 if(init == false){
68 BeagleRT_scheduleAuxiliaryTask(updatePll); 68 Bela_scheduleAuxiliaryTask(updatePll);
69 // gAudioCodec->setPllP(2); 69 // gAudioCodec->setPllP(2);
70 // gAudioCodec->setPllR(); 70 // gAudioCodec->setPllR();
71 // gAudioCodec->setAudioSamplingRate(43600); 71 // gAudioCodec->setAudioSamplingRate(43600);
72 // printf("samplingRate: %f, k: %f\n", gAudioCodec->getAudioSamplingRate(), gAudioCodec->getPllK()); 72 // printf("samplingRate: %f, k: %f\n", gAudioCodec->getAudioSamplingRate(), gAudioCodec->getPllK());
73 init = true; 73 init = true;
113 } 113 }
114 114
115 // cleanup_render() is called once at the end, after the audio has stopped. 115 // cleanup_render() is called once at the end, after the audio has stopped.
116 // Release any resources that were allocated in initialise_render(). 116 // Release any resources that were allocated in initialise_render().
117 117
118 void cleanup(BeagleRTContext *context, void *userData) 118 void cleanup(BelaContext *context, void *userData)
119 { 119 {
120 120
121 } 121 }