comparison examples/10-Instruments/airharp/render.cpp @ 543:8f8809c77dda prerelease

updated basics, digital, instruments, extras examples
author chnrx <chris.heinrichs@gmail.com>
date Fri, 24 Jun 2016 13:19:52 +0100
parents 8fcfbfb32aa0
children
comparison
equal deleted inserted replaced
542:3016638b4da2 543:8f8809c77dda
1 /*
2 ____ _____ _ _
3 | __ )| ____| | / \
4 | _ \| _| | | / _ \
5 | |_) | |___| |___ / ___ \
6 |____/|_____|_____/_/ \_\
7
8 The platform for ultra-low latency audio and sensor processing
9
10 http://bela.io
11
12 A project of the Augmented Instruments Laboratory within the
13 Centre for Digital Music at Queen Mary University of London.
14 http://www.eecs.qmul.ac.uk/~andrewm
15
16 (c) 2016 Augmented Instruments Laboratory: Andrew McPherson,
17 Astrid Bin, Liam Donovan, Christian Heinrichs, Robert Jack,
18 Giulio Moro, Laurel Pardue, Victor Zappi. All rights reserved.
19
20 The Bela software is distributed under the GNU Lesser General Public License
21 (LGPL 3.0), available here: https://www.gnu.org/licenses/lgpl-3.0.txt
22 */
23
24
1 /* 25 /*
2 * AIR-HARP 26 * AIR-HARP
3 * Physically modelled strings using waveguide junctions and mass-spring-dampers 27 * Physically modelled strings using waveguide junctions and mass-spring-dampers
28 * controllable using an accelerometer
4 * 29 *
5 * render.cpp 30 * render.cpp
6 * 31 *
7 * Christian Heinrichs 04/2015 32 * Christian Heinrichs 04/2015
8 * 33 *
42 float gAccel_x[ACCEL_BUF_SIZE] = {0}; 67 float gAccel_x[ACCEL_BUF_SIZE] = {0};
43 int gAccelReadPtr = 0; 68 int gAccelReadPtr = 0;
44 69
45 // DC BLOCK BUTTERWORTH 70 // DC BLOCK BUTTERWORTH
46 71
47 // Coefficients for 100hz cut-off 72 // Coefficients for 100hz high-pass centre frequency
48 float a0_l = 0.9899759179893742; 73 float a0_l = 0.9899759179893742;
49 float a1_l = -1.9799518359787485; 74 float a1_l = -1.9799518359787485;
50 float a2_l = 0.9899759179893742; 75 float a2_l = 0.9899759179893742;
51 float a3_l = -1.979851353142371; 76 float a3_l = -1.979851353142371;
52 float a4_l = 0.9800523188151258; 77 float a4_l = 0.9800523188151258;
192 x1_r = temp_in; 217 x1_r = temp_in;
193 /* shift y1 to y2, result to y1 */ 218 /* shift y1 to y2, result to y1 */
194 y2_r = y1_r; 219 y2_r = y1_r;
195 y1_r = out_r; 220 y1_r = out_r;
196 221
197 context->audioOut[n * context->audioChannels + 1] = out_l * out_gain; 222 context->audioOut[n * context->audioOutChannels + 1] = out_l * out_gain;
198 context->audioOut[n * context->audioChannels + 0] = out_r * out_gain; 223 context->audioOut[n * context->audioOutChannels + 0] = out_r * out_gain;
199 224
200 } 225 }
201 226
202 } 227 }
203 228