Mercurial > hg > beaglert
comparison projects/filter_FIR/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> |
10 #include <rtdk.h> | |
11 #include <cmath> | 10 #include <cmath> |
12 #include <stdio.h> | |
13 #include <NE10.h> // neon library | 11 #include <NE10.h> // neon library |
14 #include "SampleData.h" | 12 #include "SampleData.h" |
15 #include "FIRfilter.h" | 13 #include "FIRfilter.h" |
16 | 14 |
17 SampleData gSampleData; // User defined structure to get complex data from main | 15 SampleData gSampleData; // User defined structure to get complex data from main |
24 ne10_uint32_t blockSize; | 22 ne10_uint32_t blockSize; |
25 ne10_float32_t *gFIRfilterState; | 23 ne10_float32_t *gFIRfilterState; |
26 | 24 |
27 void initialise_filter(BeagleRTContext *context); | 25 void initialise_filter(BeagleRTContext *context); |
28 | 26 |
29 | |
30 // Task for handling the update of the frequencies using the matrix | 27 // Task for handling the update of the frequencies using the matrix |
31 AuxiliaryTask gTriggerSamplesTask; | 28 AuxiliaryTask gTriggerSamplesTask; |
32 | 29 |
33 bool initialise_trigger(); | 30 bool initialise_trigger(); |
34 void trigger_samples(); | 31 void trigger_samples(); |
35 | 32 |
36 // initialise_render() is called once before the audio rendering starts. | 33 // setup() is called once before the audio rendering starts. |
37 // Use it to perform any initialisation and allocation which is dependent | 34 // Use it to perform any initialisation and allocation which is dependent |
38 // on the period size or sample rate. | 35 // on the period size or sample rate. |
39 // | 36 // |
40 // userData holds an opaque pointer to a data structure that was passed | 37 // userData holds an opaque pointer to a data structure that was passed |
41 // in from the call to initAudio(). | 38 // in from the call to initAudio(). |
42 // | 39 // |
43 // Return true on success; returning false halts the program. | 40 // Return true on success; returning false halts the program. |
44 | 41 |
45 bool initialise_render(BeagleRTContext *context, void *userData) | 42 bool setup(BeagleRTContext *context, void *userData) |
46 { | 43 { |
47 | 44 |
48 // Retrieve a parameter passed in from the initAudio() call | 45 // Retrieve a parameter passed in from the initAudio() call |
49 gSampleData = *(SampleData *)userData; | 46 gSampleData = *(SampleData *)userData; |
50 | 47 |
149 } | 146 } |
150 } | 147 } |
151 | 148 |
152 | 149 |
153 | 150 |
154 // cleanup_render() is called once at the end, after the audio has stopped. | 151 // cleanup() is called once at the end, after the audio has stopped. |
155 // Release any resources that were allocated in initialise_render(). | 152 // Release any resources that were allocated in setup(). |
156 | 153 |
157 void cleanup_render(BeagleRTContext *context, void *userData) | 154 void cleanup(BeagleRTContext *context, void *userData) |
158 { | 155 { |
159 delete[] gSampleData.samples; | 156 delete[] gSampleData.samples; |
160 | 157 |
161 NE10_FREE(gFIRfilterState); | 158 NE10_FREE(gFIRfilterState); |
162 NE10_FREE(gFIRfilterIn); | 159 NE10_FREE(gFIRfilterIn); |