comparison examples/basic_analog_output/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 // Set range for analog outputs designed for driving LEDs 14 // Set range for analog outputs designed for driving LEDs
26 // userData holds an opaque pointer to a data structure that was passed 26 // userData holds an opaque pointer to a data structure that was passed
27 // in from the call to initAudio(). 27 // in from the call to initAudio().
28 // 28 //
29 // Return true on success; returning false halts the program. 29 // Return true on success; returning false halts the program.
30 30
31 bool setup(BeagleRTContext *context, void *userData) 31 bool setup(BelaContext *context, void *userData)
32 { 32 {
33 // Retrieve a parameter passed in from the initAudio() call 33 // Retrieve a parameter passed in from the initAudio() call
34 gFrequency = *(float *)userData; 34 gFrequency = *(float *)userData;
35 35
36 if(context->analogFrames == 0) { 36 if(context->analogFrames == 0) {
47 // render() is called regularly at the highest priority by the audio engine. 47 // render() is called regularly at the highest priority by the audio engine.
48 // Input and output are given from the audio hardware and the other 48 // Input and output are given from the audio hardware and the other
49 // ADCs and DACs (if available). If only audio is available, numMatrixFrames 49 // ADCs and DACs (if available). If only audio is available, numMatrixFrames
50 // will be 0. 50 // will be 0.
51 51
52 void render(BeagleRTContext *context, void *userData) 52 void render(BelaContext *context, void *userData)
53 { 53 {
54 for(unsigned int n = 0; n < context->analogFrames; n++) { 54 for(unsigned int n = 0; n < context->analogFrames; n++) {
55 // Set LED to different phase for each matrix channel 55 // Set LED to different phase for each matrix channel
56 float relativePhase = 0.0; 56 float relativePhase = 0.0;
57 for(unsigned int channel = 0; channel < context->analogChannels; channel++) { 57 for(unsigned int channel = 0; channel < context->analogChannels; channel++) {
70 } 70 }
71 71
72 // cleanup() is called once at the end, after the audio has stopped. 72 // cleanup() is called once at the end, after the audio has stopped.
73 // Release any resources that were allocated in setup(). 73 // Release any resources that were allocated in setup().
74 74
75 void cleanup(BeagleRTContext *context, void *userData) 75 void cleanup(BelaContext *context, void *userData)
76 { 76 {
77 77
78 } 78 }