comparison projects/heavy/samphold/SignalSamphold.c @ 160:5bcf04234f80 heavy-updated

- added -std=c99 to Makefile for user-supplied C files (required for heavy files) - changed heavy core render.cpp file to use latest API and removed all redundant functions (e.g. foleyDesigner/touchkey stuff) - use build_pd.sh to compile and run pd files (-h for usage instructions)
author chnrx <chris.heinrichs@gmail.com>
date Thu, 05 Nov 2015 18:58:26 +0000
parents
children
comparison
equal deleted inserted replaced
159:1e7db6610600 160:5bcf04234f80
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 "SignalSamphold.h"
18
19 hv_size_t sSamphold_init(SignalSamphold *o) {
20 #if HV_SIMD_AVX
21 o->s = _mm256_setzero_ps();
22 #elif HV_SIMD_SSE
23 o->s = _mm_setzero_ps();
24 #elif HV_SIMD_NEON
25 o->s = vdupq_n_f32(0.0f);
26 #else
27 o->s = 0.0f;
28 #endif
29 return 0;
30 }
31
32 void sSamphold_onMessage(HvBase *_c, SignalSamphold *o, int letIndex,
33 const HvMessage *const m, void *sendMessage) {
34 switch (letIndex) {
35 case 2: {
36 if (msg_isFloat(m,0)) {
37 #if HV_SIMD_AVX
38 o->s = _mm256_set1_ps(msg_getFloat(m,0));
39 #elif HV_SIMD_SSE
40 o->s = _mm_set1_ps(msg_getFloat(m,0));
41 #elif HV_SIMD_NEON
42 o->s = vdupq_n_f32(msg_getFloat(m,0));
43 #else
44 o->s = msg_getFloat(m,0);
45 #endif
46 }
47 break;
48 }
49 default: break;
50 }
51 }