comparison projects/heavy/envelopeTrigger/SignalDel1.c @ 162:c3e8226a5651 heavy-updated

- added additional flags to C rules (-DNDEBUG, -mfpu=neon) - sample-accurate envelope triggering pd/heavy example
author chnrx <chris.heinrichs@gmail.com>
date Thu, 12 Nov 2015 14:59:46 +0000
parents
children
comparison
equal deleted inserted replaced
161:07735c9d95c8 162:c3e8226a5651
1 /**
2 * Copyright (c) 2014, 2015, Enzien Audio Ltd.
3 *
4 * Permission to use, copy, modify, and/or distribute this software for any
5 * purpose with or without fee is hereby granted, provided that the above
6 * copyright notice and this permission notice appear in all copies.
7 *
8 * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH
9 * REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
10 * AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT,
11 * INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
12 * LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR
13 * OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
14 * PERFORMANCE OF THIS SOFTWARE.
15 */
16
17 #include "SignalDel1.h"
18
19 hv_size_t sDel1_init(SignalDel1 *o) {
20 #if HV_SIMD_AVX
21 o->x = _mm256_setzero_ps();
22 #elif HV_SIMD_SSE
23 o->x = _mm_setzero_ps();
24 #elif HV_SIMD_NEON
25 o->x = vdupq_n_f32(0.0f);
26 #else
27 o->x = 0.0f;
28 #endif
29 return 0;
30 }
31
32 void sDel1_onMessage(HvBase *_c, SignalDel1 *o, int letIn, const HvMessage *m) {
33 if (letIn == 2) {
34 if (msg_compareSymbol(m, 0, "clear")) {
35 #if HV_SIMD_AVX
36 o->x = _mm256_setzero_ps();
37 #elif HV_SIMD_SSE
38 o->x = _mm_setzero_ps();
39 #elif HV_SIMD_NEON
40 o->x = vdupq_n_f32(0.0f);
41 #else
42 o->x = 0.0f;
43 #endif
44 }
45 }
46 }