Mercurial > hg > beaglert
comparison projects/filter_IIR/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 | 5433c83ce04e |
comparison
equal
deleted
inserted
replaced
55:41d24dba6b74 | 56:3c3a1357657d |
---|---|
4 * Created on: Oct 24, 2014 | 4 * Created on: Oct 24, 2014 |
5 * Author: Andrew McPherson and Victor Zappi | 5 * Author: Andrew McPherson and Victor Zappi |
6 */ | 6 */ |
7 | 7 |
8 | 8 |
9 #include "../../include/BeagleRT.h" // to schedule lower prio parallel process | 9 #include <BeagleRT.h> // to schedule lower prio parallel process |
10 #include <rtdk.h> | 10 #include <rtdk.h> |
11 #include <cmath> | 11 #include <cmath> |
12 #include <stdio.h> | 12 #include <stdio.h> |
13 #include "SampleData.h" | 13 #include "SampleData.h" |
14 | 14 |
42 | 42 |
43 | 43 |
44 extern float gCutFreq; | 44 extern float gCutFreq; |
45 | 45 |
46 | 46 |
47 // initialise_render() is called once before the audio rendering starts. | 47 // setup() is called once before the audio rendering starts. |
48 // Use it to perform any initialisation and allocation which is dependent | 48 // Use it to perform any initialisation and allocation which is dependent |
49 // on the period size or sample rate. | 49 // on the period size or sample rate. |
50 // | 50 // |
51 // userData holds an opaque pointer to a data structure that was passed | 51 // userData holds an opaque pointer to a data structure that was passed |
52 // in from the call to initAudio(). | 52 // in from the call to initAudio(). |
53 // | 53 // |
54 // Return true on success; returning false halts the program. | 54 // Return true on success; returning false halts the program. |
55 | 55 |
56 bool initialise_render(BeagleRTContext *context, void *userData) | 56 bool setup(BeagleRTContext *context, void *userData) |
57 { | 57 { |
58 | 58 |
59 // Retrieve a parameter passed in from the initAudio() call | 59 // Retrieve a parameter passed in from the initAudio() call |
60 gSampleData = *(SampleData *)userData; | 60 gSampleData = *(SampleData *)userData; |
61 | 61 |
210 } | 210 } |
211 } | 211 } |
212 | 212 |
213 | 213 |
214 | 214 |
215 // cleanup_render() is called once at the end, after the audio has stopped. | 215 // cleanup() is called once at the end, after the audio has stopped. |
216 // Release any resources that were allocated in initialise_render(). | 216 // Release any resources that were allocated in setup(). |
217 | 217 |
218 void cleanup_render(BeagleRTContext *context, void *userData) | 218 void cleanup(BeagleRTContext *context, void *userData) |
219 { | 219 { |
220 delete[] gSampleData.samples; | 220 delete[] gSampleData.samples; |
221 } | 221 } |