comparison examples/scope_analogue/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 // this example reads the analogue inputs 0 and 1 1 // this example reads the analogue inputs 0 and 1
2 // and generates a sine wave with an amplitude and 2 // and generates a sine wave with an amplitude and
3 // frequency determined by their values 3 // frequency determined by their values
4 // it then plots these on the oscilloscope 4 // it then plots these on the oscilloscope
5 5
6 #include <BeagleRT.h> 6 #include <Bela.h>
7 #include <cmath> 7 #include <cmath>
8 #include <Scope.h> 8 #include <Scope.h>
9 9
10 Scope scope; 10 Scope scope;
11 11
12 float gInverseSampleRate; 12 float gInverseSampleRate;
13 float gPhase; 13 float gPhase;
14 14
15 bool setup(BeagleRTContext *context, void *userData) 15 bool setup(BelaContext *context, void *userData)
16 { 16 {
17 17
18 // setup the scope with 3 channels at the audio sample rate 18 // setup the scope with 3 channels at the audio sample rate
19 scope.setup(3, context->audioSampleRate); 19 scope.setup(3, context->audioSampleRate);
20 20
22 gPhase = 0.0; 22 gPhase = 0.0;
23 23
24 return true; 24 return true;
25 } 25 }
26 26
27 void render(BeagleRTContext *context, void *userData) 27 void render(BelaContext *context, void *userData)
28 { 28 {
29 29
30 for(unsigned int n = 0; n < context->audioFrames; n++) { 30 for(unsigned int n = 0; n < context->audioFrames; n++) {
31 31
32 // read analogIn channels 0 and 1 32 // read analogIn channels 0 and 1
51 context->audioOut[n * context->audioChannels + channel] = out; 51 context->audioOut[n * context->audioChannels + channel] = out;
52 52
53 } 53 }
54 } 54 }
55 55
56 void cleanup(BeagleRTContext *context, void *userData) 56 void cleanup(BelaContext *context, void *userData)
57 { 57 {
58 58
59 } 59 }