Mercurial > hg > beaglert
comparison projects/cape_test/render.cpp @ 56:3c3a1357657d newapi
Further API update to name three primary functions setup(), render() and cleanup(). Changed include paths so now can #include <BeagleRT.h>. Removed stale pru_rtaudio.bin file as this is now done as pru_rtaudio_bin.h. Updated examples to new API and fixed minor compiler warnings along the way. Network example needs further attention to compile.
author | andrewm |
---|---|
date | Wed, 15 Jul 2015 12:10:51 +0100 |
parents | 41d24dba6b74 |
children | 8d80eda512cd |
comparison
equal
deleted
inserted
replaced
55:41d24dba6b74 | 56:3c3a1357657d |
---|---|
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 "../../include/BeagleRT.h" | 9 #include <BeagleRT.h> |
10 #include <cmath> | 10 #include <cmath> |
11 | 11 |
12 #define ANALOG_LOW (2048.0 / 65536.0) | 12 #define ANALOG_LOW (2048.0 / 65536.0) |
13 #define ANALOG_HIGH (50000.0 / 65536.0) | 13 #define ANALOG_HIGH (50000.0 / 65536.0) |
14 | 14 |
17 uint64_t gLastErrorFrame = 0; | 17 uint64_t gLastErrorFrame = 0; |
18 uint32_t gEnvelopeSampleCount = 0; | 18 uint32_t gEnvelopeSampleCount = 0; |
19 float gEnvelopeValue = 0.5; | 19 float gEnvelopeValue = 0.5; |
20 float gEnvelopeDecayRate = 0.9995; | 20 float gEnvelopeDecayRate = 0.9995; |
21 | 21 |
22 // initialise_render() is called once before the audio rendering starts. | 22 // setup() is called once before the audio rendering starts. |
23 // Use it to perform any initialisation and allocation which is dependent | 23 // Use it to perform any initialisation and allocation which is dependent |
24 // on the period size or sample rate. | 24 // on the period size or sample rate. |
25 // | 25 // |
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 initialise_render(BeagleRTContext *context, void *userData) | 31 bool setup(BeagleRTContext *context, void *userData) |
32 { | 32 { |
33 return true; | 33 return true; |
34 } | 34 } |
35 | 35 |
36 // render() is called regularly at the highest priority by the audio engine. | 36 // render() is called regularly at the highest priority by the audio engine. |
130 invertChannel = 0; | 130 invertChannel = 0; |
131 } | 131 } |
132 } | 132 } |
133 } | 133 } |
134 | 134 |
135 // cleanup_render() is called once at the end, after the audio has stopped. | 135 // cleanup() is called once at the end, after the audio has stopped. |
136 // Release any resources that were allocated in initialise_render(). | 136 // Release any resources that were allocated in setup(). |
137 | 137 |
138 void cleanup_render(BeagleRTContext *context, void *userData) | 138 void cleanup(BeagleRTContext *context, void *userData) |
139 { | 139 { |
140 | 140 |
141 } | 141 } |