annotate projects/heavy/envelopeTrigger/SignalDel1.h @ 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
rev   line source
chris@162 1 /**
chris@162 2 * Copyright (c) 2014, 2015, Enzien Audio Ltd.
chris@162 3 *
chris@162 4 * Permission to use, copy, modify, and/or distribute this software for any
chris@162 5 * purpose with or without fee is hereby granted, provided that the above
chris@162 6 * copyright notice and this permission notice appear in all copies.
chris@162 7 *
chris@162 8 * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH
chris@162 9 * REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
chris@162 10 * AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT,
chris@162 11 * INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
chris@162 12 * LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR
chris@162 13 * OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
chris@162 14 * PERFORMANCE OF THIS SOFTWARE.
chris@162 15 */
chris@162 16
chris@162 17 #ifndef _SIGNAL_DEL1_H_
chris@162 18 #define _SIGNAL_DEL1_H_
chris@162 19
chris@162 20 #include "HvBase.h"
chris@162 21
chris@162 22 typedef struct SignalDel1 {
chris@162 23 hv_bufferf_t x;
chris@162 24 } SignalDel1;
chris@162 25
chris@162 26 hv_size_t sDel1_init(SignalDel1 *o);
chris@162 27
chris@162 28 void sDel1_onMessage(HvBase *_c, SignalDel1 *o, int letIn, const HvMessage *m);
chris@162 29
chris@162 30 static inline void __hv_del1_f(SignalDel1 *o, hv_bInf_t bIn0, hv_bOutf_t bOut) {
chris@162 31 #if HV_SIMD_AVX
chris@162 32 __m256 x = _mm256_permute_ps(bIn0, _MM_SHUFFLE(2,1,0,3)); // [3 0 1 2 7 4 5 6]
chris@162 33 __m256 n = _mm256_permute2f128_ps(o->x,x,0x1); // [h e f g 3 0 1 2]
chris@162 34 *bOut = _mm256_blend_ps(x, n, 0x11); // [g 0 1 2 3 4 5 6]
chris@162 35 o->x = x;
chris@162 36 #elif HV_SIMD_SSE
chris@162 37 __m128 n = _mm_blend_ps(o->x, bIn0, 0x7);
chris@162 38 *bOut = _mm_shuffle_ps(n, n, _MM_SHUFFLE(2,1,0,3));
chris@162 39 o->x = bIn0;
chris@162 40 #elif HV_SIMD_NEON
chris@162 41 *bOut = vextq_f32(o->x, bIn0, 3);
chris@162 42 o->x = bIn0;
chris@162 43 #else
chris@162 44 *bOut = o->x;
chris@162 45 o->x = bIn0;
chris@162 46 #endif
chris@162 47 }
chris@162 48
chris@162 49 #endif // _SIGNAL_DEL1_H_