comparison examples/basic_analog_input/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
4 * Created on: Oct 24, 2014 4 * Created on: Oct 24, 2014
5 * Author: parallels 5 * Author: parallels
6 */ 6 */
7 7
8 8
9 #include <BeagleRT.h> 9 #include <Bela.h>
10 #include <Utilities.h> 10 #include <Utilities.h>
11 #include <rtdk.h> 11 #include <rtdk.h>
12 #include <cmath> 12 #include <cmath>
13 13
14 float gPhase; 14 float gPhase;
29 // userData holds an opaque pointer to a data structure that was passed 29 // userData holds an opaque pointer to a data structure that was passed
30 // in from the call to initAudio(). 30 // in from the call to initAudio().
31 // 31 //
32 // Return true on success; returning false halts the program. 32 // Return true on success; returning false halts the program.
33 33
34 bool setup(BeagleRTContext *context, void *userData) 34 bool setup(BelaContext *context, void *userData)
35 { 35 {
36 if(context->analogFrames == 0 || context->analogFrames > context->audioFrames) { 36 if(context->analogFrames == 0 || context->analogFrames > context->audioFrames) {
37 rt_printf("Error: this example needs analog enabled, with 4 or 8 channels\n"); 37 rt_printf("Error: this example needs analog enabled, with 4 or 8 channels\n");
38 return false; 38 return false;
39 } 39 }
48 // render() is called regularly at the highest priority by the audio engine. 48 // render() is called regularly at the highest priority by the audio engine.
49 // Input and output are given from the audio hardware and the other 49 // Input and output are given from the audio hardware and the other
50 // ADCs and DACs (if available). If only audio is available, numMatrixFrames 50 // ADCs and DACs (if available). If only audio is available, numMatrixFrames
51 // will be 0. 51 // will be 0.
52 52
53 void render(BeagleRTContext *context, void *userData) 53 void render(BelaContext *context, void *userData)
54 { 54 {
55 float frequency = 440.0; 55 float frequency = 440.0;
56 float amplitude = 0.8; 56 float amplitude = 0.8;
57 57
58 // There are twice as many audio frames as matrix frames since audio sample rate 58 // There are twice as many audio frames as matrix frames since audio sample rate
77 } 77 }
78 78
79 // cleanup() is called once at the end, after the audio has stopped. 79 // cleanup() is called once at the end, after the audio has stopped.
80 // Release any resources that were allocated in setup(). 80 // Release any resources that were allocated in setup().
81 81
82 void cleanup(BeagleRTContext *context, void *userData) 82 void cleanup(BelaContext *context, void *userData)
83 { 83 {
84 84
85 } 85 }