comparison projects/analogDigitalDemo/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 a6d223473ea2
children 567bd8f76714
comparison
equal deleted inserted replaced
55:41d24dba6b74 56:3c3a1357657d
2 * 2 *
3 * Andrew McPherson and Victor Zappi 3 * Andrew McPherson and Victor Zappi
4 * Queen Mary, University of London 4 * Queen Mary, University of London
5 */ 5 */
6 6
7 #include "../../include/BeagleRT.h" 7 #include <BeagleRT.h>
8 #include "../../include/Utilities.h" 8 #include <Utilities.h>
9 #include <cmath> 9 #include <cmath>
10 #include <rtdk.h> 10 #include <rtdk.h>
11 11
12 /* TASK: declare any global variables you need here */ 12 // setup() is called once before the audio rendering starts.
13
14 // initialise_render() is called once before the audio rendering starts.
15 // Use it to perform any initialisation and allocation which is dependent 13 // Use it to perform any initialisation and allocation which is dependent
16 // on the period size or sample rate. 14 // on the period size or sample rate.
17 // 15 //
18 // userData holds an opaque pointer to a data structure that was passed 16 // userData holds an opaque pointer to a data structure that was passed
19 // in from the call to initAudio(). 17 // in from the call to initAudio().
20 // 18 //
21 // Return true on success; returning false halts the program. 19 // Return true on success; returning false halts the program.
22 20
23 bool initialise_render(BeagleRTContext *context, void *userData) 21 bool setup(BeagleRTContext *context, void *userData)
24 { 22 {
25 return true; 23 return true;
26 } 24 }
27 25
28 // render() is called regularly at the highest priority by the audio engine. 26 // render() is called regularly at the highest priority by the audio engine.
81 // rt_printf("\n"); 79 // rt_printf("\n");
82 } 80 }
83 return; 81 return;
84 82
85 } 83 }
86 // cleanup_render() is called once at the end, after the audio has stopped.
87 // Release any resources that were allocated in initialise_render().
88 84
89 void cleanup_render(BeagleRTContext *context, void *userData) 85 // cleanup() is called once at the end, after the audio has stopped.
86 // Release any resources that were allocated in setup().
87
88 void cleanup(BeagleRTContext *context, void *userData)
90 { 89 {
91 /* TASK: 90 // Nothing to do here
92 * If you allocate any memory, be sure to release it here.
93 * You may or may not need anything in this function, depending
94 * on your implementation.
95 */
96 } 91 }