annotate projects/heavy/envelopeTrigger/HvContext_bbb.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
rev   line source
chris@162 1
chris@162 2 /**
chris@162 3 * Copyright (c) 2014,2015 Enzien Audio, Ltd.
chris@162 4 *
chris@162 5 * Permission is hereby granted, free of charge, to any person obtaining a copy
chris@162 6 * of this software and associated documentation files (the "Software"),
chris@162 7 * to deal in the Software without restriction, including without limitation
chris@162 8 * the rights to use, copy, modify, merge, publish, distribute, and/or
chris@162 9 * sublicense copies of the Software, strictly on a non-commercial basis,
chris@162 10 * and to permit persons to whom the Software is furnished to do so,
chris@162 11 * subject to the following conditions:
chris@162 12 *
chris@162 13 * The above copyright notice and this permission notice shall be included in
chris@162 14 * all copies or substantial portions of the Software.
chris@162 15 *
chris@162 16 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
chris@162 17 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
chris@162 18 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
chris@162 19 * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
chris@162 20 * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
chris@162 21 * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
chris@162 22 * IN THE SOFTWARE.
chris@162 23 *
chris@162 24 * DO NOT MODIFY. THIS CODE IS MACHINE GENERATED BY THE SECTION6 HEAVY COMPILER.
chris@162 25 */
chris@162 26
chris@162 27 /*
chris@162 28 * System Includes
chris@162 29 */
chris@162 30
chris@162 31 #include <assert.h>
chris@162 32 #include <math.h>
chris@162 33 #include <string.h>
chris@162 34 #include <stdarg.h>
chris@162 35 #include "HvContext_bbb.h"
chris@162 36 #include "HeavyMath.h"
chris@162 37
chris@162 38
chris@162 39 /*
chris@162 40 * Function Declarations
chris@162 41 */
chris@162 42 static const float hTable_Pcegq_data[512] = {0.0f, 0.0625f, 0.0883883f, 0.108253f, 0.125f, 0.139754f, 0.153093f, 0.165359f, 0.176777f, 0.1875f, 0.197642f, 0.207289f, 0.216506f, 0.225347f, 0.233854f, 0.242061f, 0.25f, 0.257694f, 0.265165f, 0.272431f, 0.279509f, 0.286411f, 0.293151f, 0.299739f, 0.306186f, 0.3125f, 0.318689f, 0.32476f, 0.330719f, 0.336573f, 0.342327f, 0.347985f, 0.353553f, 0.359035f, 0.364434f, 0.369755f, 0.375f, 0.380173f, 0.385276f, 0.390312f, 0.395285f, 0.400195f, 0.405046f, 0.40984f, 0.414578f, 0.419263f, 0.423896f, 0.428478f, 0.433013f, 0.4375f, 0.441942f, 0.446339f, 0.450694f, 0.455007f, 0.459279f, 0.463512f, 0.467707f, 0.471865f, 0.475986f, 0.480072f, 0.484123f, 0.488141f, 0.492125f, 0.496078f, 0.5f, 0.503891f, 0.507752f, 0.511585f, 0.515388f, 0.519164f, 0.522913f, 0.526634f, 0.53033f, 0.534f, 0.537645f, 0.541266f, 0.544862f, 0.548435f, 0.551985f, 0.555512f, 0.559017f, 0.5625f, 0.565962f, 0.569402f, 0.572822f, 0.576222f, 0.579601f, 0.582961f, 0.586302f, 0.589624f, 0.592927f, 0.596212f, 0.599479f, 0.602728f, 0.60596f, 0.609175f, 0.612372f, 0.615554f, 0.618718f, 0.621867f, 0.625f, 0.628117f, 0.631219f, 0.634306f, 0.637377f, 0.640434f, 0.643477f, 0.646505f, 0.649519f, 0.652519f, 0.655506f, 0.658478f, 0.661438f, 0.664384f, 0.667317f, 0.670238f, 0.673146f, 0.676041f, 0.678924f, 0.681795f, 0.684653f, 0.6875f, 0.690335f, 0.693159f, 0.695971f, 0.698771f, 0.701561f, 0.704339f, 0.707107f, 0.709864f, 0.71261f, 0.715345f, 0.71807f, 0.720785f, 0.72349f, 0.726184f, 0.728869f, 0.731544f, 0.734209f, 0.736864f, 0.73951f, 0.742146f, 0.744773f, 0.747391f, 0.75f, 0.7526f, 0.75519f, 0.757772f, 0.760345f, 0.76291f, 0.765466f, 0.768013f, 0.770552f, 0.773082f, 0.775605f, 0.778119f, 0.780625f, 0.783123f, 0.785613f, 0.788095f, 0.790569f, 0.793036f, 0.795495f, 0.797947f, 0.800391f, 0.802827f, 0.805256f, 0.807678f, 0.810093f, 0.8125f, 0.8149f, 0.817294f, 0.81968f, 0.822059f, 0.824432f, 0.826797f, 0.829156f, 0.831508f, 0.833854f, 0.836193f, 0.838525f, 0.840851f, 0.843171f, 0.845484f, 0.847791f, 0.850092f, 0.852386f, 0.854675f, 0.856957f, 0.859233f, 0.861503f, 0.863767f, 0.866025f, 0.868278f, 0.870524f, 0.872765f, 0.875f, 0.877229f, 0.879453f, 0.881671f, 0.883883f, 0.88609f, 0.888292f, 0.890488f, 0.892679f, 0.894864f, 0.897044f, 0.899218f, 0.901388f, 0.903552f, 0.905711f, 0.907865f, 0.910014f, 0.912157f, 0.914296f, 0.91643f, 0.918559f, 0.920682f, 0.922801f, 0.924916f, 0.927025f, 0.929129f, 0.931229f, 0.933324f, 0.935414f, 0.9375f, 0.939581f, 0.941657f, 0.943729f, 0.945797f, 0.947859f, 0.949918f, 0.951972f, 0.954021f, 0.956066f, 0.958107f, 0.960143f, 0.962175f, 0.964203f, 0.966227f, 0.968246f, 0.970261f, 0.972272f, 0.974279f, 0.976281f, 0.97828f, 0.980274f, 0.982265f, 0.984251f, 0.986233f, 0.988212f, 0.990186f, 0.992157f, 0.994123f, 0.996086f, 0.998045f, 1.0f, 0.992172f, 0.984375f, 0.976609f, 0.968874f, 0.961169f, 0.953495f, 0.945852f, 0.938239f, 0.930657f, 0.923106f, 0.915586f, 0.908097f, 0.900638f, 0.89321f, 0.885813f, 0.878447f, 0.871111f, 0.863806f, 0.856532f, 0.849289f, 0.842076f, 0.834894f, 0.827743f, 0.820623f, 0.813533f, 0.806474f, 0.799446f, 0.792449f, 0.785483f, 0.778547f, 0.771642f, 0.764767f, 0.757924f, 0.751111f, 0.744329f, 0.737578f, 0.730857f, 0.724168f, 0.717509f, 0.71088f, 0.704283f, 0.697716f, 0.69118f, 0.684675f, 0.678201f, 0.671757f, 0.665344f, 0.658962f, 0.652611f, 0.64629f, 0.64f, 0.633741f, 0.627513f, 0.621315f, 0.615148f, 0.609012f, 0.602907f, 0.596832f, 0.590788f, 0.584775f, 0.578793f, 0.572841f, 0.56692f, 0.56103f, 0.555171f, 0.549343f, 0.543545f, 0.537778f, 0.532041f, 0.526336f, 0.520661f, 0.515017f, 0.509404f, 0.503822f, 0.49827f, 0.492749f, 0.487259f, 0.481799f, 0.476371f, 0.470973f, 0.465605f, 0.460269f, 0.454963f, 0.449689f, 0.444444f, 0.439231f, 0.434048f, 0.428897f, 0.423775f, 0.418685f, 0.413625f, 0.408597f, 0.403599f, 0.398631f, 0.393695f, 0.388789f, 0.383914f, 0.37907f, 0.374256f, 0.369473f, 0.364721f, 0.36f, 0.355309f, 0.35065f, 0.346021f, 0.341423f, 0.336855f, 0.332318f, 0.327812f, 0.323337f, 0.318893f, 0.314479f, 0.310096f, 0.305744f, 0.301423f, 0.297132f, 0.292872f, 0.288643f, 0.284444f, 0.280277f, 0.27614f, 0.272034f, 0.267958f, 0.263914f, 0.2599f, 0.255917f, 0.251965f, 0.248043f, 0.244152f, 0.240292f, 0.236463f, 0.232664f, 0.228897f, 0.22516f, 0.221453f, 0.217778f, 0.214133f, 0.210519f, 0.206936f, 0.203383f, 0.199862f, 0.196371f, 0.19291f, 0.189481f, 0.186082f, 0.182714f, 0.179377f, 0.176071f, 0.172795f, 0.16955f, 0.166336f, 0.163153f, 0.16f, 0.156878f, 0.153787f, 0.150727f, 0.147697f, 0.144698f, 0.14173f, 0.138793f, 0.135886f, 0.13301f, 0.130165f, 0.127351f, 0.124567f, 0.121815f, 0.119093f, 0.116401f, 0.113741f, 0.111111f, 0.108512f, 0.105944f, 0.103406f, 0.1009f, 0.0984237f, 0.0959785f, 0.093564f, 0.0911803f, 0.0888274f, 0.0865052f, 0.0842138f, 0.0819531f, 0.0797232f, 0.077524f, 0.0753556f, 0.073218f, 0.0711111f, 0.069035f, 0.0669896f, 0.064975f, 0.0629911f, 0.0610381f, 0.0591157f, 0.0572241f, 0.0553633f, 0.0535332f, 0.0517339f, 0.0499654f, 0.0482276f, 0.0465206f, 0.0448443f, 0.0431988f, 0.041584f, 0.04f, 0.0384467f, 0.0369243f, 0.0354325f, 0.0339715f, 0.0325413f, 0.0311419f, 0.0297732f, 0.0284352f, 0.027128f, 0.0258516f, 0.0246059f, 0.023391f, 0.0222068f, 0.0210534f, 0.0199308f, 0.0188389f, 0.0177778f, 0.0167474f, 0.0157478f, 0.0147789f, 0.0138408f, 0.0129335f, 0.0120569f, 0.0112111f, 0.010396f, 0.00961169f, 0.00885813f, 0.00813533f, 0.00744329f, 0.00678201f, 0.00615148f, 0.00555171f, 0.0049827f, 0.00444444f, 0.00393695f, 0.00346021f, 0.00301423f, 0.002599f, 0.00221453f, 0.00186082f, 0.00153787f, 0.00124567f, 0.000984237f, 0.000753556f, 0.000553633f, 0.000384467f, 0.000246059f, 0.000138408f, 6.15148e-05f, 1.53787e-05f, 0.0f};
chris@162 43 static void cVar_rLv9w_sendMessage(HvBase *, int, const HvMessage *const);
chris@162 44 static void cSystem_tp4VA_sendMessage(HvBase *, int, const HvMessage *const);
chris@162 45 static void cVar_rQhd0_sendMessage(HvBase *, int, const HvMessage *const);
chris@162 46 static void cSlice_LzkmO_sendMessage(HvBase *, int, const HvMessage *const);
chris@162 47 static void cSwitchcase_y60Gw_onMessage(HvBase *, void *, int letIn, const HvMessage *const, void *);
chris@162 48 static void cLoadbang_TuCQI_sendMessage(HvBase *, int, const HvMessage *const);
chris@162 49 static void cBinop_ER1x8_sendMessage(HvBase *, int, const HvMessage *const);
chris@162 50 static void cMsg_oCnjm_sendMessage(HvBase *, int, const HvMessage *const);
chris@162 51 static void cSlice_HqIeY_sendMessage(HvBase *, int, const HvMessage *const);
chris@162 52 static void cVar_BTo3t_sendMessage(HvBase *, int, const HvMessage *const);
chris@162 53 static void cVar_ZzlGn_sendMessage(HvBase *, int, const HvMessage *const);
chris@162 54 static void cBinop_HqDsI_sendMessage(HvBase *, int, const HvMessage *const);
chris@162 55 static void cSwitchcase_EV1Bl_onMessage(HvBase *, void *, int letIn, const HvMessage *const, void *);
chris@162 56 static void cLoadbang_nVUh2_sendMessage(HvBase *, int, const HvMessage *const);
chris@162 57 static void cSystem_jIjhB_sendMessage(HvBase *, int, const HvMessage *const);
chris@162 58 static void cMsg_En77U_sendMessage(HvBase *, int, const HvMessage *const);
chris@162 59 static void cMsg_IbQ3q_sendMessage(HvBase *, int, const HvMessage *const);
chris@162 60 static void cSystem_zz1F7_sendMessage(HvBase *, int, const HvMessage *const);
chris@162 61 static void cBinop_oOwFV_sendMessage(HvBase *, int, const HvMessage *const);
chris@162 62 static void cBinop_P09tj_sendMessage(HvBase *, int, const HvMessage *const);
chris@162 63 static void cVar_NnTc2_sendMessage(HvBase *, int, const HvMessage *const);
chris@162 64 static void cLoadbang_2QoTi_sendMessage(HvBase *, int, const HvMessage *const);
chris@162 65 static void cBinop_f8PBr_sendMessage(HvBase *, int, const HvMessage *const);
chris@162 66 static void cMsg_qocid_sendMessage(HvBase *, int, const HvMessage *const);
chris@162 67 static void cBinop_ITJR9_sendMessage(HvBase *, int, const HvMessage *const);
chris@162 68 static void cUnop_nBNe2_sendMessage(HvBase *, int, const HvMessage *const);
chris@162 69 static void cSystem_ZnUnS_sendMessage(HvBase *, int, const HvMessage *const);
chris@162 70 static void cMsg_FhRde_sendMessage(HvBase *, int, const HvMessage *const);
chris@162 71 static void cBinop_cxljx_sendMessage(HvBase *, int, const HvMessage *const);
chris@162 72 static void cBinop_0UlVT_sendMessage(HvBase *, int, const HvMessage *const);
chris@162 73 static void cBinop_MJQIs_sendMessage(HvBase *, int, const HvMessage *const);
chris@162 74 static void cMsg_xzUtJ_sendMessage(HvBase *, int, const HvMessage *const);
chris@162 75 static void cBinop_a2rE6_sendMessage(HvBase *, int, const HvMessage *const);
chris@162 76 static void cBinop_govla_sendMessage(HvBase *, int, const HvMessage *const);
chris@162 77 static void cSlice_oxbrV_sendMessage(HvBase *, int, const HvMessage *const);
chris@162 78 static void cBinop_rzeQ2_sendMessage(HvBase *, int, const HvMessage *const);
chris@162 79 static void cSlice_yZctV_sendMessage(HvBase *, int, const HvMessage *const);
chris@162 80 static void cSlice_HCNcS_sendMessage(HvBase *, int, const HvMessage *const);
chris@162 81 static void cVar_ItOCU_sendMessage(HvBase *, int, const HvMessage *const);
chris@162 82 static void cSlice_Nx0UC_sendMessage(HvBase *, int, const HvMessage *const);
chris@162 83 static void cLoadbang_4O9oF_sendMessage(HvBase *, int, const HvMessage *const);
chris@162 84 static void cVar_VE9tg_sendMessage(HvBase *, int, const HvMessage *const);
chris@162 85 static void cBinop_RE1w0_sendMessage(HvBase *, int, const HvMessage *const);
chris@162 86 static void cSlice_Pkd46_sendMessage(HvBase *, int, const HvMessage *const);
chris@162 87 static void cLoadbang_KAaax_sendMessage(HvBase *, int, const HvMessage *const);
chris@162 88
chris@162 89
chris@162 90
chris@162 91 /*
chris@162 92 * Static Helper Functions
chris@162 93 */
chris@162 94
chris@162 95 static void ctx_intern_scheduleMessageForReceiver(
chris@162 96 HvBase *const _c, const char *name, HvMessage *m) {
chris@162 97 switch (msg_symbolToHash(name)) {
chris@162 98 default: return;
chris@162 99 }
chris@162 100 }
chris@162 101
chris@162 102 static struct HvTable *ctx_intern_getTableForHash(HvBase *const _c, hv_uint32_t h) {
chris@162 103 switch (h) {
chris@162 104 case 0xB6D0D974: return &Context(_c)->hTable_Pcegq; // env1
chris@162 105 default: return NULL;
chris@162 106 }
chris@162 107 }
chris@162 108
chris@162 109
chris@162 110
chris@162 111 /*
chris@162 112 * Context Include and Implementatons
chris@162 113 */
chris@162 114
chris@162 115 Hv_bbb *hv_bbb_new_with_pool(double sampleRate, int poolKb) {
chris@162 116 hv_assert(sampleRate > 0.0); // can't initialise with sampling rate of 0
chris@162 117 hv_assert(poolKb >= 1); // a message pool of some reasonable size is always needed
chris@162 118 Hv_bbb *const _c = (Hv_bbb *) hv_malloc(sizeof(Hv_bbb));
chris@162 119
chris@162 120 Base(_c)->numInputChannels = 10;
chris@162 121 Base(_c)->numOutputChannels = 2;
chris@162 122 Base(_c)->sampleRate = sampleRate;
chris@162 123 Base(_c)->blockStartTimestamp = 0;
chris@162 124 Base(_c)->f_scheduleMessageForReceiver = &ctx_intern_scheduleMessageForReceiver;
chris@162 125 Base(_c)->f_getTableForHash = &ctx_intern_getTableForHash;
chris@162 126 mq_initWithPoolSize(&Base(_c)->mq, poolKb);
chris@162 127 Base(_c)->basePath = NULL;
chris@162 128 Base(_c)->printHook = NULL;
chris@162 129 Base(_c)->sendHook = NULL;
chris@162 130 Base(_c)->userData = NULL;
chris@162 131 Base(_c)->name = "bbb";
chris@162 132
chris@162 133 Base(_c)->numBytes = sizeof(Hv_bbb);
chris@162 134 Base(_c)->numBytes += sVarf_init(&_c->sVarf_DIQHM, 1.0f, 0.0f, false);
chris@162 135 Base(_c)->numBytes += sVarf_init(&_c->sVarf_EIzJc, 44100.0f, 0.0f, false);
chris@162 136 Base(_c)->numBytes += sVarf_init(&_c->sVarf_J0BAW, 0.0f, 0.0f, false);
chris@162 137 Base(_c)->numBytes += sRPole_init(&_c->sRPole_vtJYw);
chris@162 138 Base(_c)->numBytes += sVarf_init(&_c->sVarf_haFXq, 1.0f, 0.0f, false);
chris@162 139 Base(_c)->numBytes += sDel1_init(&_c->sDel1_8dkfF);
chris@162 140 Base(_c)->numBytes += sVarf_init(&_c->sVarf_4RU63, 0.0f, 0.0f, false);
chris@162 141 Base(_c)->numBytes += sVarf_init(&_c->sVarf_5BIjv, 0.0f, 0.0f, false);
chris@162 142 Base(_c)->numBytes += sVarf_init(&_c->sVarf_82QyC, -1e-37f, 0.0f, false);
chris@162 143 Base(_c)->numBytes += sBiquad_k_init(&_c->sBiquad_k_8Keaz, -1.0f, 1.0f, 0.0f, 0.0f, 0.0f);
chris@162 144 Base(_c)->numBytes += sVarf_init(&_c->sVarf_2muG8, 0.5f, 0.0f, false);
chris@162 145 Base(_c)->numBytes += sVarf_init(&_c->sVarf_YrcAl, 0.0f, 0.0f, false);
chris@162 146 Base(_c)->numBytes += sVarf_init(&_c->sVarf_1pbLN, -1e-37f, 0.0f, false);
chris@162 147 Base(_c)->numBytes += sRPole_init(&_c->sRPole_Q5SA1);
chris@162 148 Base(_c)->numBytes += sVarf_init(&_c->sVarf_ZTuE8, 1.0f, 0.0f, false);
chris@162 149 Base(_c)->numBytes += sVarf_init(&_c->sVarf_9Q4iz, 0.0f, 0.0f, false);
chris@162 150 Base(_c)->numBytes += sVarf_init(&_c->sVarf_QHeut, 1.0f, 0.0f, false);
chris@162 151 Base(_c)->numBytes += sVarf_init(&_c->sVarf_BWg3y, 100000.0f, 0.0f, false);
chris@162 152 Base(_c)->numBytes += sVarf_init(&_c->sVarf_yW7Co, 1e-05f, 0.0f, false);
chris@162 153 Base(_c)->numBytes += sVarf_init(&_c->sVarf_BMuCC, 0.0f, 0.0f, false);
chris@162 154 Base(_c)->numBytes += sVarf_init(&_c->sVarf_1vLiI, 0.0f, 0.0f, false);
chris@162 155 Base(_c)->numBytes += sVarf_init(&_c->sVarf_ZKIZB, 0.0f, 0.0f, false);
chris@162 156 Base(_c)->numBytes += sVarf_init(&_c->sVarf_SmDJi, 0.0f, 0.0f, false);
chris@162 157 Base(_c)->numBytes += sTabread_init(&_c->sTabread_ef8Y2, &_c->hTable_Pcegq, false);
chris@162 158 Base(_c)->numBytes += sVarf_init(&_c->sVarf_Z1CfH, 0.0f, 0.0f, false);
chris@162 159 Base(_c)->numBytes += sTabread_init(&_c->sTabread_nnJuj, &_c->hTable_Pcegq, false);
chris@162 160 Base(_c)->numBytes += sVarf_init(&_c->sVarf_CwdRa, 0.0f, 0.0f, false);
chris@162 161 Base(_c)->numBytes += sVarf_init(&_c->sVarf_z5YqL, 0.0f, 0.0f, false);
chris@162 162 Base(_c)->numBytes += sVarf_init(&_c->sVarf_AMYc1, 0.0f, 0.0f, false);
chris@162 163 Base(_c)->numBytes += sVarf_init(&_c->sVarf_yGh3v, 0.0f, 0.0f, false);
chris@162 164 Base(_c)->numBytes += sVarf_init(&_c->sVarf_ThV6W, 0.0f, 0.0f, false);
chris@162 165 Base(_c)->numBytes += sVarf_init(&_c->sVarf_U0HuI, 0.0f, 0.0f, false);
chris@162 166 Base(_c)->numBytes += sTabread_init(&_c->sTabread_g0gGp, &_c->hTable_Pcegq, false);
chris@162 167 Base(_c)->numBytes += sVarf_init(&_c->sVarf_rLY2o, 0.0f, 0.0f, false);
chris@162 168 Base(_c)->numBytes += sTabread_init(&_c->sTabread_joe74, &_c->hTable_Pcegq, false);
chris@162 169 Base(_c)->numBytes += sVarf_init(&_c->sVarf_tTp9Q, 0.0f, 0.0f, false);
chris@162 170 Base(_c)->numBytes += sVarf_init(&_c->sVarf_Ip7Ud, 0.0f, 0.0f, false);
chris@162 171 Base(_c)->numBytes += sPhasor_init(&_c->sPhasor_KqGIr, sampleRate);
chris@162 172 Base(_c)->numBytes += hTable_initWithData(&_c->hTable_Pcegq, 512, hTable_Pcegq_data);
chris@162 173 Base(_c)->numBytes += cVar_init_s(&_c->cVar_rLv9w, "env1");
chris@162 174 Base(_c)->numBytes += cVar_init_f(&_c->cVar_rQhd0, 0.0f);
chris@162 175 Base(_c)->numBytes += cSlice_init(&_c->cSlice_LzkmO, 1, 1);
chris@162 176 Base(_c)->numBytes += cSlice_init(&_c->cSlice_HqIeY, 1, 1);
chris@162 177 Base(_c)->numBytes += cVar_init_s(&_c->cVar_BTo3t, "env1");
chris@162 178 Base(_c)->numBytes += cVar_init_f(&_c->cVar_ZzlGn, 0.0f);
chris@162 179 Base(_c)->numBytes += cVar_init_f(&_c->cVar_NnTc2, 1.0f);
chris@162 180 Base(_c)->numBytes += cBinop_init(&_c->cBinop_ITJR9, 0.0f); // __div
chris@162 181 Base(_c)->numBytes += cBinop_init(&_c->cBinop_cxljx, 0.0f); // __mul
chris@162 182 Base(_c)->numBytes += cBinop_init(&_c->cBinop_0UlVT, 1.0f); // __min
chris@162 183 Base(_c)->numBytes += cBinop_init(&_c->cBinop_MJQIs, 0.0f); // __max
chris@162 184 Base(_c)->numBytes += cSlice_init(&_c->cSlice_oxbrV, 2, 1);
chris@162 185 Base(_c)->numBytes += cSlice_init(&_c->cSlice_yZctV, 3, 1);
chris@162 186 Base(_c)->numBytes += cSlice_init(&_c->cSlice_HCNcS, 4, 1);
chris@162 187 Base(_c)->numBytes += cVar_init_f(&_c->cVar_ItOCU, 0.0f);
chris@162 188 Base(_c)->numBytes += cSlice_init(&_c->cSlice_Nx0UC, 0, 1);
chris@162 189 Base(_c)->numBytes += cVar_init_f(&_c->cVar_VE9tg, 0.0f);
chris@162 190 Base(_c)->numBytes += cSlice_init(&_c->cSlice_Pkd46, 1, 1);
chris@162 191
chris@162 192 // loadbang
chris@162 193 ctx_scheduleMessage(Base(_c), msg_initWithBang(HV_MESSAGE_ON_STACK(1), 0), &cLoadbang_2QoTi_sendMessage, 0);
chris@162 194 ctx_scheduleMessage(Base(_c), msg_initWithBang(HV_MESSAGE_ON_STACK(1), 0), &cLoadbang_4O9oF_sendMessage, 0);
chris@162 195 ctx_scheduleMessage(Base(_c), msg_initWithBang(HV_MESSAGE_ON_STACK(1), 0), &cLoadbang_KAaax_sendMessage, 0);
chris@162 196 ctx_scheduleMessage(Base(_c), msg_initWithBang(HV_MESSAGE_ON_STACK(1), 0), &cLoadbang_TuCQI_sendMessage, 0);
chris@162 197 ctx_scheduleMessage(Base(_c), msg_initWithBang(HV_MESSAGE_ON_STACK(1), 0), &cLoadbang_nVUh2_sendMessage, 0);
chris@162 198
chris@162 199 return _c;
chris@162 200 }
chris@162 201
chris@162 202 Hv_bbb *hv_bbb_new(double sampleRate) {
chris@162 203 return hv_bbb_new_with_pool(sampleRate, 10); // default to 10KB MessagePool
chris@162 204 }
chris@162 205
chris@162 206 void hv_bbb_free(Hv_bbb *_c) {
chris@162 207 hTable_free(&_c->hTable_Pcegq);
chris@162 208
chris@162 209 hv_free(Base(_c)->basePath);
chris@162 210 mq_free(&Base(_c)->mq); // free queue after all objects have been freed, messages may be cancelled
chris@162 211
chris@162 212 hv_free(_c);
chris@162 213 }
chris@162 214
chris@162 215
chris@162 216
chris@162 217 /*
chris@162 218 * Static Function Implementation
chris@162 219 */
chris@162 220 static void hTable_Pcegq_sendMessage(HvBase *_c, int letIn, const HvMessage *const m) {
chris@162 221 }
chris@162 222
chris@162 223 static void cVar_rLv9w_sendMessage(HvBase *_c, int letIn, const HvMessage *const m) {
chris@162 224 cMsg_oCnjm_sendMessage(_c, 0, m);
chris@162 225 }
chris@162 226
chris@162 227 static void cSystem_tp4VA_sendMessage(HvBase *_c, int letIn, const HvMessage *const m) {
chris@162 228 cBinop_k_onMessage(_c, NULL, HV_BINOP_SUBTRACT, 2.0f, 0, m, &cBinop_ER1x8_sendMessage);
chris@162 229 }
chris@162 230
chris@162 231 static void cVar_rQhd0_sendMessage(HvBase *_c, int letIn, const HvMessage *const m) {
chris@162 232 cBinop_k_onMessage(_c, NULL, HV_BINOP_SUBTRACT, 2.0f, 0, m, &cBinop_ER1x8_sendMessage);
chris@162 233 }
chris@162 234
chris@162 235 static void cSlice_LzkmO_sendMessage(HvBase *_c, int letIn, const HvMessage *const m) {
chris@162 236 switch(letIn) {
chris@162 237 case 0: {
chris@162 238 sTabread_onMessage(_c, &Context(_c)->sTabread_ef8Y2, 1, m);
chris@162 239 sTabread_onMessage(_c, &Context(_c)->sTabread_nnJuj, 1, m);
chris@162 240 cVar_onMessage(_c, &Context(_c)->cVar_rLv9w, 0, m, &cVar_rLv9w_sendMessage);
chris@162 241 break;
chris@162 242 }
chris@162 243 case 1: {
chris@162 244 break;
chris@162 245 }
chris@162 246 default: return;
chris@162 247 }
chris@162 248 }
chris@162 249
chris@162 250 static void cSwitchcase_y60Gw_onMessage(HvBase *_c, void *o, int letIn, const HvMessage *const m, void *sendMessage) {
chris@162 251 switch (msg_getHash(m,0)) {
chris@162 252 case 0x3E004DAB: { // "set"
chris@162 253 cSlice_onMessage(_c, &Context(_c)->cSlice_LzkmO, 0, m, &cSlice_LzkmO_sendMessage);
chris@162 254 break;
chris@162 255 }
chris@162 256 default: {
chris@162 257 break;
chris@162 258 }
chris@162 259 }
chris@162 260 }
chris@162 261
chris@162 262 static void cLoadbang_TuCQI_sendMessage(HvBase *_c, int letIn, const HvMessage *const m) {
chris@162 263 cVar_onMessage(_c, &Context(_c)->cVar_rLv9w, 0, m, &cVar_rLv9w_sendMessage);
chris@162 264 }
chris@162 265
chris@162 266 static void cBinop_ER1x8_sendMessage(HvBase *_c, int letIn, const HvMessage *const m) {
chris@162 267 sVarf_onMessage(_c, &Context(_c)->sVarf_SmDJi, m);
chris@162 268 }
chris@162 269
chris@162 270 static void cMsg_oCnjm_sendMessage(HvBase *_c, int letIn, const HvMessage *const n) {
chris@162 271 HvMessage *m = NULL;
chris@162 272 m = HV_MESSAGE_ON_STACK(3);
chris@162 273 msg_init(m, 3, msg_getTimestamp(n));
chris@162 274 msg_setSymbol(m, 0, "table");
chris@162 275 msg_setElementToFrom(m, 1, n, 0);
chris@162 276 msg_setSymbol(m, 2, "size");
chris@162 277 cSystem_onMessage(_c, NULL, 0, m, &cSystem_tp4VA_sendMessage);
chris@162 278 }
chris@162 279
chris@162 280 static void cSlice_HqIeY_sendMessage(HvBase *_c, int letIn, const HvMessage *const m) {
chris@162 281 switch(letIn) {
chris@162 282 case 0: {
chris@162 283 sTabread_onMessage(_c, &Context(_c)->sTabread_g0gGp, 1, m);
chris@162 284 sTabread_onMessage(_c, &Context(_c)->sTabread_joe74, 1, m);
chris@162 285 cVar_onMessage(_c, &Context(_c)->cVar_BTo3t, 0, m, &cVar_BTo3t_sendMessage);
chris@162 286 break;
chris@162 287 }
chris@162 288 case 1: {
chris@162 289 break;
chris@162 290 }
chris@162 291 default: return;
chris@162 292 }
chris@162 293 }
chris@162 294
chris@162 295 static void cVar_BTo3t_sendMessage(HvBase *_c, int letIn, const HvMessage *const m) {
chris@162 296 cMsg_En77U_sendMessage(_c, 0, m);
chris@162 297 }
chris@162 298
chris@162 299 static void cVar_ZzlGn_sendMessage(HvBase *_c, int letIn, const HvMessage *const m) {
chris@162 300 cBinop_k_onMessage(_c, NULL, HV_BINOP_SUBTRACT, 2.0f, 0, m, &cBinop_HqDsI_sendMessage);
chris@162 301 }
chris@162 302
chris@162 303 static void cBinop_HqDsI_sendMessage(HvBase *_c, int letIn, const HvMessage *const m) {
chris@162 304 sVarf_onMessage(_c, &Context(_c)->sVarf_U0HuI, m);
chris@162 305 }
chris@162 306
chris@162 307 static void cSwitchcase_EV1Bl_onMessage(HvBase *_c, void *o, int letIn, const HvMessage *const m, void *sendMessage) {
chris@162 308 switch (msg_getHash(m,0)) {
chris@162 309 case 0x3E004DAB: { // "set"
chris@162 310 cSlice_onMessage(_c, &Context(_c)->cSlice_HqIeY, 0, m, &cSlice_HqIeY_sendMessage);
chris@162 311 break;
chris@162 312 }
chris@162 313 default: {
chris@162 314 break;
chris@162 315 }
chris@162 316 }
chris@162 317 }
chris@162 318
chris@162 319 static void cLoadbang_nVUh2_sendMessage(HvBase *_c, int letIn, const HvMessage *const m) {
chris@162 320 cVar_onMessage(_c, &Context(_c)->cVar_BTo3t, 0, m, &cVar_BTo3t_sendMessage);
chris@162 321 }
chris@162 322
chris@162 323 static void cSystem_jIjhB_sendMessage(HvBase *_c, int letIn, const HvMessage *const m) {
chris@162 324 cBinop_k_onMessage(_c, NULL, HV_BINOP_SUBTRACT, 2.0f, 0, m, &cBinop_HqDsI_sendMessage);
chris@162 325 }
chris@162 326
chris@162 327 static void cMsg_En77U_sendMessage(HvBase *_c, int letIn, const HvMessage *const n) {
chris@162 328 HvMessage *m = NULL;
chris@162 329 m = HV_MESSAGE_ON_STACK(3);
chris@162 330 msg_init(m, 3, msg_getTimestamp(n));
chris@162 331 msg_setSymbol(m, 0, "table");
chris@162 332 msg_setElementToFrom(m, 1, n, 0);
chris@162 333 msg_setSymbol(m, 2, "size");
chris@162 334 cSystem_onMessage(_c, NULL, 0, m, &cSystem_jIjhB_sendMessage);
chris@162 335 }
chris@162 336
chris@162 337 static void cMsg_IbQ3q_sendMessage(HvBase *_c, int letIn, const HvMessage *const n) {
chris@162 338 HvMessage *m = NULL;
chris@162 339 m = HV_MESSAGE_ON_STACK(1);
chris@162 340 msg_init(m, 1, msg_getTimestamp(n));
chris@162 341 msg_setSymbol(m, 0, "samplerate");
chris@162 342 cSystem_onMessage(_c, NULL, 0, m, &cSystem_zz1F7_sendMessage);
chris@162 343 }
chris@162 344
chris@162 345 static void cSystem_zz1F7_sendMessage(HvBase *_c, int letIn, const HvMessage *const m) {
chris@162 346 sVarf_onMessage(_c, &Context(_c)->sVarf_EIzJc, m);
chris@162 347 }
chris@162 348
chris@162 349 static void cBinop_oOwFV_sendMessage(HvBase *_c, int letIn, const HvMessage *const m) {
chris@162 350 cBinop_k_onMessage(_c, NULL, HV_BINOP_MULTIPLY, 0.5f, 0, m, &cBinop_a2rE6_sendMessage);
chris@162 351 }
chris@162 352
chris@162 353 static void cBinop_P09tj_sendMessage(HvBase *_c, int letIn, const HvMessage *const m) {
chris@162 354 sVarf_onMessage(_c, &Context(_c)->sVarf_J0BAW, m);
chris@162 355 }
chris@162 356
chris@162 357 static void cVar_NnTc2_sendMessage(HvBase *_c, int letIn, const HvMessage *const m) {
chris@162 358 cBinop_onMessage(_c, &Context(_c)->cBinop_cxljx, HV_BINOP_MULTIPLY, 0, m, &cBinop_cxljx_sendMessage);
chris@162 359 }
chris@162 360
chris@162 361 static void cLoadbang_2QoTi_sendMessage(HvBase *_c, int letIn, const HvMessage *const m) {
chris@162 362 cMsg_FhRde_sendMessage(_c, 0, m);
chris@162 363 cVar_onMessage(_c, &Context(_c)->cVar_NnTc2, 0, m, &cVar_NnTc2_sendMessage);
chris@162 364 }
chris@162 365
chris@162 366 static void cBinop_f8PBr_sendMessage(HvBase *_c, int letIn, const HvMessage *const m) {
chris@162 367 cBinop_onMessage(_c, &Context(_c)->cBinop_ITJR9, HV_BINOP_DIVIDE, 0, m, &cBinop_ITJR9_sendMessage);
chris@162 368 }
chris@162 369
chris@162 370 static void cMsg_qocid_sendMessage(HvBase *_c, int letIn, const HvMessage *const n) {
chris@162 371 HvMessage *m = NULL;
chris@162 372 m = HV_MESSAGE_ON_STACK(1);
chris@162 373 msg_init(m, 1, msg_getTimestamp(n));
chris@162 374 msg_setFloat(m, 0, 1.0f);
chris@162 375 cUnop_onMessage(_c, HV_UNOP_ATAN, m, &cUnop_nBNe2_sendMessage);
chris@162 376 }
chris@162 377
chris@162 378 static void cBinop_ITJR9_sendMessage(HvBase *_c, int letIn, const HvMessage *const m) {
chris@162 379 cBinop_onMessage(_c, &Context(_c)->cBinop_cxljx, HV_BINOP_MULTIPLY, 1, m, &cBinop_cxljx_sendMessage);
chris@162 380 }
chris@162 381
chris@162 382 static void cUnop_nBNe2_sendMessage(HvBase *_c, int letIn, const HvMessage *const m) {
chris@162 383 cBinop_k_onMessage(_c, NULL, HV_BINOP_MULTIPLY, 8.0f, 0, m, &cBinop_f8PBr_sendMessage);
chris@162 384 }
chris@162 385
chris@162 386 static void cSystem_ZnUnS_sendMessage(HvBase *_c, int letIn, const HvMessage *const m) {
chris@162 387 cBinop_onMessage(_c, &Context(_c)->cBinop_ITJR9, HV_BINOP_DIVIDE, 1, m, &cBinop_ITJR9_sendMessage);
chris@162 388 cMsg_qocid_sendMessage(_c, 0, m);
chris@162 389 }
chris@162 390
chris@162 391 static void cMsg_FhRde_sendMessage(HvBase *_c, int letIn, const HvMessage *const n) {
chris@162 392 HvMessage *m = NULL;
chris@162 393 m = HV_MESSAGE_ON_STACK(1);
chris@162 394 msg_init(m, 1, msg_getTimestamp(n));
chris@162 395 msg_setSymbol(m, 0, "samplerate");
chris@162 396 cSystem_onMessage(_c, NULL, 0, m, &cSystem_ZnUnS_sendMessage);
chris@162 397 }
chris@162 398
chris@162 399 static void cBinop_cxljx_sendMessage(HvBase *_c, int letIn, const HvMessage *const m) {
chris@162 400 cMsg_xzUtJ_sendMessage(_c, 0, m);
chris@162 401 }
chris@162 402
chris@162 403 static void cBinop_0UlVT_sendMessage(HvBase *_c, int letIn, const HvMessage *const m) {
chris@162 404 cBinop_onMessage(_c, &Context(_c)->cBinop_MJQIs, HV_BINOP_MAX, 0, m, &cBinop_MJQIs_sendMessage);
chris@162 405 }
chris@162 406
chris@162 407 static void cBinop_MJQIs_sendMessage(HvBase *_c, int letIn, const HvMessage *const m) {
chris@162 408 cBinop_k_onMessage(_c, NULL, HV_BINOP_ADD, 1.0f, 0, m, &cBinop_oOwFV_sendMessage);
chris@162 409 cBinop_k_onMessage(_c, NULL, HV_BINOP_MULTIPLY, -1.0f, 0, m, &cBinop_P09tj_sendMessage);
chris@162 410 }
chris@162 411
chris@162 412 static void cMsg_xzUtJ_sendMessage(HvBase *_c, int letIn, const HvMessage *const n) {
chris@162 413 HvMessage *m = NULL;
chris@162 414 m = HV_MESSAGE_ON_STACK(2);
chris@162 415 msg_init(m, 2, msg_getTimestamp(n));
chris@162 416 msg_setFloat(m, 0, 1.0f);
chris@162 417 msg_setElementToFrom(m, 1, n, 0);
chris@162 418 cBinop_k_onMessage(_c, NULL, HV_BINOP_SUBTRACT, 0.0f, 0, m, &cBinop_govla_sendMessage);
chris@162 419 }
chris@162 420
chris@162 421 static void cBinop_a2rE6_sendMessage(HvBase *_c, int letIn, const HvMessage *const m) {
chris@162 422 sVarf_onMessage(_c, &Context(_c)->sVarf_4RU63, m);
chris@162 423 }
chris@162 424
chris@162 425 static void cBinop_govla_sendMessage(HvBase *_c, int letIn, const HvMessage *const m) {
chris@162 426 cBinop_onMessage(_c, &Context(_c)->cBinop_0UlVT, HV_BINOP_MIN, 0, m, &cBinop_0UlVT_sendMessage);
chris@162 427 }
chris@162 428
chris@162 429 static void cSlice_oxbrV_sendMessage(HvBase *_c, int letIn, const HvMessage *const m) {
chris@162 430 switch(letIn) {
chris@162 431 case 0: {
chris@162 432 sBiquad_k_onMessage(&Context(_c)->sBiquad_k_8Keaz, 1, m);
chris@162 433 break;
chris@162 434 }
chris@162 435 case 1: {
chris@162 436 break;
chris@162 437 }
chris@162 438 default: return;
chris@162 439 }
chris@162 440 }
chris@162 441
chris@162 442 static void cBinop_rzeQ2_sendMessage(HvBase *_c, int letIn, const HvMessage *const m) {
chris@162 443 sBiquad_k_onMessage(&Context(_c)->sBiquad_k_8Keaz, 4, m);
chris@162 444 }
chris@162 445
chris@162 446 static void cSlice_yZctV_sendMessage(HvBase *_c, int letIn, const HvMessage *const m) {
chris@162 447 switch(letIn) {
chris@162 448 case 0: {
chris@162 449 sBiquad_k_onMessage(&Context(_c)->sBiquad_k_8Keaz, 2, m);
chris@162 450 break;
chris@162 451 }
chris@162 452 case 1: {
chris@162 453 break;
chris@162 454 }
chris@162 455 default: return;
chris@162 456 }
chris@162 457 }
chris@162 458
chris@162 459 static void cSlice_HCNcS_sendMessage(HvBase *_c, int letIn, const HvMessage *const m) {
chris@162 460 switch(letIn) {
chris@162 461 case 0: {
chris@162 462 sBiquad_k_onMessage(&Context(_c)->sBiquad_k_8Keaz, 3, m);
chris@162 463 break;
chris@162 464 }
chris@162 465 case 1: {
chris@162 466 break;
chris@162 467 }
chris@162 468 default: return;
chris@162 469 }
chris@162 470 }
chris@162 471
chris@162 472 static void cVar_ItOCU_sendMessage(HvBase *_c, int letIn, const HvMessage *const m) {
chris@162 473 cBinop_k_onMessage(_c, NULL, HV_BINOP_MULTIPLY, -1.0f, 0, m, &cBinop_RE1w0_sendMessage);
chris@162 474 }
chris@162 475
chris@162 476 static void cSlice_Nx0UC_sendMessage(HvBase *_c, int letIn, const HvMessage *const m) {
chris@162 477 switch(letIn) {
chris@162 478 case 0: {
chris@162 479 cBinop_k_onMessage(_c, NULL, HV_BINOP_MULTIPLY, -1.0f, 0, m, &cBinop_rzeQ2_sendMessage);
chris@162 480 break;
chris@162 481 }
chris@162 482 case 1: {
chris@162 483 break;
chris@162 484 }
chris@162 485 default: return;
chris@162 486 }
chris@162 487 }
chris@162 488
chris@162 489 static void cLoadbang_4O9oF_sendMessage(HvBase *_c, int letIn, const HvMessage *const m) {
chris@162 490 cVar_onMessage(_c, &Context(_c)->cVar_VE9tg, 0, m, &cVar_VE9tg_sendMessage);
chris@162 491 cVar_onMessage(_c, &Context(_c)->cVar_ItOCU, 0, m, &cVar_ItOCU_sendMessage);
chris@162 492 }
chris@162 493
chris@162 494 static void cVar_VE9tg_sendMessage(HvBase *_c, int letIn, const HvMessage *const m) {
chris@162 495 cBinop_k_onMessage(_c, NULL, HV_BINOP_MULTIPLY, -1.0f, 0, m, &cBinop_rzeQ2_sendMessage);
chris@162 496 }
chris@162 497
chris@162 498 static void cBinop_RE1w0_sendMessage(HvBase *_c, int letIn, const HvMessage *const m) {
chris@162 499 sBiquad_k_onMessage(&Context(_c)->sBiquad_k_8Keaz, 5, m);
chris@162 500 }
chris@162 501
chris@162 502 static void cSlice_Pkd46_sendMessage(HvBase *_c, int letIn, const HvMessage *const m) {
chris@162 503 switch(letIn) {
chris@162 504 case 0: {
chris@162 505 cBinop_k_onMessage(_c, NULL, HV_BINOP_MULTIPLY, -1.0f, 0, m, &cBinop_RE1w0_sendMessage);
chris@162 506 break;
chris@162 507 }
chris@162 508 case 1: {
chris@162 509 break;
chris@162 510 }
chris@162 511 default: return;
chris@162 512 }
chris@162 513 }
chris@162 514
chris@162 515 static void cLoadbang_KAaax_sendMessage(HvBase *_c, int letIn, const HvMessage *const m) {
chris@162 516 cMsg_IbQ3q_sendMessage(_c, 0, m);
chris@162 517 }
chris@162 518
chris@162 519
chris@162 520
chris@162 521
chris@162 522 /*
chris@162 523 * Context Process Implementation
chris@162 524 */
chris@162 525
chris@162 526 int hv_bbb_process(Hv_bbb *const _c, float **const inputBuffers, float **const outputBuffers, int nx) {
chris@162 527 const int n4 = nx & ~HV_N_SIMD_MASK; // ensure that the block size is a multiple of HV_N_SIMD
chris@162 528
chris@162 529 // temporary signal vars
chris@162 530 hv_bufferf_t Bf0, Bf1, Bf2, Bf3, Bf4, Bf5, Bf6, Bf7;
chris@162 531 hv_bufferi_t Bi0, Bi1;
chris@162 532
chris@162 533 // input and output vars
chris@162 534 hv_bufferf_t O0, O1;
chris@162 535 hv_bufferf_t I0, I1, I2, I3, I4, I5, I6, I7, I8, I9;
chris@162 536
chris@162 537 // declare and init the zero buffer
chris@162 538 hv_bufferf_t ZERO; __hv_zero_f(VOf(ZERO));
chris@162 539
chris@162 540 hv_uint32_t nextBlock = Base(_c)->blockStartTimestamp;
chris@162 541 for (int n = 0; n < n4; n += HV_N_SIMD) {
chris@162 542
chris@162 543 // process all of the messages for this block
chris@162 544 nextBlock += HV_N_SIMD;
chris@162 545 while (mq_hasMessageBefore(&Base(_c)->mq, nextBlock)) {
chris@162 546 MessageNode *const node = mq_peek(&Base(_c)->mq);
chris@162 547 node->sendMessage(Base(_c), node->let, node->m);
chris@162 548 mq_pop(&Base(_c)->mq);
chris@162 549 }
chris@162 550
chris@162 551 // load input buffers
chris@162 552 __hv_load_f(inputBuffers[0]+n, VOf(I0));
chris@162 553 __hv_load_f(inputBuffers[1]+n, VOf(I1));
chris@162 554 __hv_load_f(inputBuffers[2]+n, VOf(I2));
chris@162 555 __hv_load_f(inputBuffers[3]+n, VOf(I3));
chris@162 556 __hv_load_f(inputBuffers[4]+n, VOf(I4));
chris@162 557 __hv_load_f(inputBuffers[5]+n, VOf(I5));
chris@162 558 __hv_load_f(inputBuffers[6]+n, VOf(I6));
chris@162 559 __hv_load_f(inputBuffers[7]+n, VOf(I7));
chris@162 560 __hv_load_f(inputBuffers[8]+n, VOf(I8));
chris@162 561 __hv_load_f(inputBuffers[9]+n, VOf(I9));
chris@162 562
chris@162 563 // zero output buffers
chris@162 564 __hv_zero_f(VOf(O0));
chris@162 565 __hv_zero_f(VOf(O1));
chris@162 566
chris@162 567 // process all signal functions
chris@162 568 __hv_var_f(&_c->sVarf_DIQHM, VOf(Bf0));
chris@162 569 __hv_var_f(&_c->sVarf_EIzJc, VOf(Bf1));
chris@162 570 __hv_div_f(VIf(Bf0), VIf(Bf1), VOf(Bf1));
chris@162 571 __hv_var_f(&_c->sVarf_J0BAW, VOf(Bf0));
chris@162 572 __hv_rpole_f(&_c->sRPole_vtJYw, VIf(I7), VIf(Bf0), VOf(Bf0));
chris@162 573 __hv_var_f(&_c->sVarf_haFXq, VOf(Bf2));
chris@162 574 __hv_del1_f(&_c->sDel1_8dkfF, VIf(Bf0), VOf(Bf3));
chris@162 575 __hv_mul_f(VIf(Bf3), VIf(Bf2), VOf(Bf2));
chris@162 576 __hv_sub_f(VIf(Bf0), VIf(Bf2), VOf(Bf2));
chris@162 577 __hv_var_f(&_c->sVarf_4RU63, VOf(Bf0));
chris@162 578 __hv_mul_f(VIf(Bf2), VIf(Bf0), VOf(Bf0));
chris@162 579 __hv_abs_f(VIf(Bf0), VOf(Bf0));
chris@162 580 __hv_min_f(VIf(Bf0), VIf(I8), VOf(Bf0));
chris@162 581 __hv_sub_f(VIf(Bf0), VIf(I8), VOf(Bf0));
chris@162 582 __hv_var_f(&_c->sVarf_5BIjv, VOf(Bf2));
chris@162 583 __hv_min_f(VIf(Bf0), VIf(Bf2), VOf(Bf2));
chris@162 584 __hv_var_f(&_c->sVarf_82QyC, VOf(Bf0));
chris@162 585 __hv_max_f(VIf(Bf2), VIf(Bf0), VOf(Bf0));
chris@162 586 __hv_var_k_f(VOf(Bf2), 1e-37f, 1e-37f, 1e-37f, 1e-37f, 1e-37f, 1e-37f, 1e-37f, 1e-37f, 0);
chris@162 587 __hv_add_f(VIf(Bf0), VIf(Bf2), VOf(Bf2));
chris@162 588 __hv_var_k_f(VOf(Bf0), 1e+37f, 1e+37f, 1e+37f, 1e+37f, 1e+37f, 1e+37f, 1e+37f, 1e+37f, 0);
chris@162 589 __hv_mul_f(VIf(Bf2), VIf(Bf0), VOf(Bf0));
chris@162 590 __hv_biquad_k_f(&_c->sBiquad_k_8Keaz, VIf(Bf0), VOf(Bf2));
chris@162 591 __hv_var_k_f(VOf(Bf3), -1.0f, -1.0f, -1.0f, -1.0f, -1.0f, -1.0f, -1.0f, -1.0f, 0);
chris@162 592 __hv_mul_f(VIf(Bf2), VIf(Bf3), VOf(Bf3));
chris@162 593 __hv_var_f(&_c->sVarf_2muG8, VOf(Bf2));
chris@162 594 __hv_max_f(VIf(Bf3), VIf(Bf2), VOf(Bf3));
chris@162 595 __hv_sub_f(VIf(Bf3), VIf(Bf2), VOf(Bf2));
chris@162 596 __hv_var_k_f(VOf(Bf3), -1.0f, -1.0f, -1.0f, -1.0f, -1.0f, -1.0f, -1.0f, -1.0f, 0);
chris@162 597 __hv_mul_f(VIf(Bf2), VIf(Bf3), VOf(Bf3));
chris@162 598 __hv_var_f(&_c->sVarf_YrcAl, VOf(Bf2));
chris@162 599 __hv_min_f(VIf(Bf3), VIf(Bf2), VOf(Bf2));
chris@162 600 __hv_var_f(&_c->sVarf_1pbLN, VOf(Bf3));
chris@162 601 __hv_max_f(VIf(Bf2), VIf(Bf3), VOf(Bf3));
chris@162 602 __hv_var_k_f(VOf(Bf2), 1e-37f, 1e-37f, 1e-37f, 1e-37f, 1e-37f, 1e-37f, 1e-37f, 1e-37f, 0);
chris@162 603 __hv_add_f(VIf(Bf3), VIf(Bf2), VOf(Bf2));
chris@162 604 __hv_var_k_f(VOf(Bf3), 1e+37f, 1e+37f, 1e+37f, 1e+37f, 1e+37f, 1e+37f, 1e+37f, 1e+37f, 0);
chris@162 605 __hv_mul_f(VIf(Bf2), VIf(Bf3), VOf(Bf3));
chris@162 606 __hv_var_k_f(VOf(Bf2), -1.0f, -1.0f, -1.0f, -1.0f, -1.0f, -1.0f, -1.0f, -1.0f, 0);
chris@162 607 __hv_mul_f(VIf(Bf3), VIf(Bf2), VOf(Bf2));
chris@162 608 __hv_rpole_f(&_c->sRPole_Q5SA1, VIf(Bf1), VIf(Bf2), VOf(Bf2));
chris@162 609 __hv_var_f(&_c->sVarf_ZTuE8, VOf(Bf1));
chris@162 610 __hv_min_f(VIf(Bf2), VIf(Bf1), VOf(Bf1));
chris@162 611 __hv_var_f(&_c->sVarf_9Q4iz, VOf(Bf2));
chris@162 612 __hv_max_f(VIf(Bf1), VIf(Bf2), VOf(Bf2));
chris@162 613 __hv_var_f(&_c->sVarf_QHeut, VOf(Bf1));
chris@162 614 __hv_mul_f(VIf(I9), VIf(I9), VOf(Bf3));
chris@162 615 __hv_var_f(&_c->sVarf_BWg3y, VOf(Bf4));
chris@162 616 __hv_min_f(VIf(Bf3), VIf(Bf4), VOf(Bf4));
chris@162 617 __hv_var_f(&_c->sVarf_yW7Co, VOf(Bf3));
chris@162 618 __hv_max_f(VIf(Bf4), VIf(Bf3), VOf(Bf3));
chris@162 619 __hv_div_f(VIf(Bf1), VIf(Bf3), VOf(Bf3));
chris@162 620 __hv_mul_f(VIf(Bf2), VIf(Bf3), VOf(Bf3));
chris@162 621 __hv_var_k_f(VOf(Bf2), 512.0f, 512.0f, 512.0f, 512.0f, 512.0f, 512.0f, 512.0f, 512.0f, 0);
chris@162 622 __hv_mul_f(VIf(Bf3), VIf(Bf2), VOf(Bf2));
chris@162 623 __hv_var_f(&_c->sVarf_BMuCC, VOf(Bf3));
chris@162 624 __hv_var_f(&_c->sVarf_1vLiI, VOf(Bf1));
chris@162 625 __hv_var_f(&_c->sVarf_ZKIZB, VOf(Bf4));
chris@162 626 __hv_add_f(VIf(Bf2), VIf(Bf4), VOf(Bf4));
chris@162 627 __hv_var_f(&_c->sVarf_SmDJi, VOf(Bf5));
chris@162 628 __hv_min_f(VIf(Bf4), VIf(Bf5), VOf(Bf5));
chris@162 629 __hv_add_f(VIf(Bf1), VIf(Bf5), VOf(Bf5));
chris@162 630 __hv_var_k_f(VOf(Bf1), 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0);
chris@162 631 __hv_max_f(VIf(Bf5), VIf(Bf1), VOf(Bf1));
chris@162 632 __hv_cast_fi(VIf(Bf1), VOi(Bi0));
chris@162 633 __hv_var_k_i(VOi(Bi1), 1, 1, 1, 1, 1, 1, 1, 1, 0);
chris@162 634 __hv_add_i(VIi(Bi0), VIi(Bi1), VOi(Bi1));
chris@162 635 __hv_tabread_if(&_c->sTabread_ef8Y2, VIi(Bi1), VOf(Bf5));
chris@162 636 __hv_var_f(&_c->sVarf_Z1CfH, VOf(Bf4));
chris@162 637 __hv_add_f(VIf(Bf5), VIf(Bf4), VOf(Bf4));
chris@162 638 __hv_tabread_if(&_c->sTabread_nnJuj, VIi(Bi0), VOf(Bf5));
chris@162 639 __hv_sub_f(VIf(Bf4), VIf(Bf5), VOf(Bf4));
chris@162 640 __hv_add_f(VIf(Bf3), VIf(Bf4), VOf(Bf4));
chris@162 641 __hv_var_f(&_c->sVarf_CwdRa, VOf(Bf3));
chris@162 642 __hv_add_f(VIf(Bf3), VIf(Bf1), VOf(Bf3));
chris@162 643 __hv_floor_f(VIf(Bf1), VOf(Bf1));
chris@162 644 __hv_sub_f(VIf(Bf3), VIf(Bf1), VOf(Bf1));
chris@162 645 __hv_var_f(&_c->sVarf_z5YqL, VOf(Bf3));
chris@162 646 __hv_add_f(VIf(Bf5), VIf(Bf3), VOf(Bf3));
chris@162 647 __hv_fma_f(VIf(Bf4), VIf(Bf1), VIf(Bf3), VOf(Bf3));
chris@162 648 __hv_var_f(&_c->sVarf_AMYc1, VOf(Bf1));
chris@162 649 __hv_var_f(&_c->sVarf_yGh3v, VOf(Bf4));
chris@162 650 __hv_var_f(&_c->sVarf_ThV6W, VOf(Bf5));
chris@162 651 __hv_add_f(VIf(Bf2), VIf(Bf5), VOf(Bf5));
chris@162 652 __hv_var_f(&_c->sVarf_U0HuI, VOf(Bf6));
chris@162 653 __hv_min_f(VIf(Bf5), VIf(Bf6), VOf(Bf6));
chris@162 654 __hv_add_f(VIf(Bf4), VIf(Bf6), VOf(Bf6));
chris@162 655 __hv_var_k_f(VOf(Bf4), 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0);
chris@162 656 __hv_max_f(VIf(Bf6), VIf(Bf4), VOf(Bf4));
chris@162 657 __hv_cast_fi(VIf(Bf4), VOi(Bi0));
chris@162 658 __hv_var_k_i(VOi(Bi1), 1, 1, 1, 1, 1, 1, 1, 1, 0);
chris@162 659 __hv_add_i(VIi(Bi0), VIi(Bi1), VOi(Bi1));
chris@162 660 __hv_tabread_if(&_c->sTabread_g0gGp, VIi(Bi1), VOf(Bf6));
chris@162 661 __hv_var_f(&_c->sVarf_rLY2o, VOf(Bf5));
chris@162 662 __hv_add_f(VIf(Bf6), VIf(Bf5), VOf(Bf5));
chris@162 663 __hv_tabread_if(&_c->sTabread_joe74, VIi(Bi0), VOf(Bf6));
chris@162 664 __hv_sub_f(VIf(Bf5), VIf(Bf6), VOf(Bf5));
chris@162 665 __hv_add_f(VIf(Bf1), VIf(Bf5), VOf(Bf5));
chris@162 666 __hv_var_f(&_c->sVarf_tTp9Q, VOf(Bf1));
chris@162 667 __hv_add_f(VIf(Bf1), VIf(Bf4), VOf(Bf1));
chris@162 668 __hv_floor_f(VIf(Bf4), VOf(Bf4));
chris@162 669 __hv_sub_f(VIf(Bf1), VIf(Bf4), VOf(Bf4));
chris@162 670 __hv_var_f(&_c->sVarf_Ip7Ud, VOf(Bf1));
chris@162 671 __hv_add_f(VIf(Bf6), VIf(Bf1), VOf(Bf1));
chris@162 672 __hv_fma_f(VIf(Bf5), VIf(Bf4), VIf(Bf1), VOf(Bf1));
chris@162 673 __hv_mul_f(VIf(Bf1), VIf(Bf1), VOf(Bf1));
chris@162 674 __hv_var_k_f(VOf(Bf4), 1000.0f, 1000.0f, 1000.0f, 1000.0f, 1000.0f, 1000.0f, 1000.0f, 1000.0f, 0);
chris@162 675 __hv_var_k_f(VOf(Bf5), 50.0f, 50.0f, 50.0f, 50.0f, 50.0f, 50.0f, 50.0f, 50.0f, 0);
chris@162 676 __hv_fma_f(VIf(Bf1), VIf(Bf4), VIf(Bf5), VOf(Bf5));
chris@162 677 __hv_phasor_f(&_c->sPhasor_KqGIr, VIf(Bf5), VOf(Bf5));
chris@162 678 __hv_var_k_f(VOf(Bf4), 0.5f, 0.5f, 0.5f, 0.5f, 0.5f, 0.5f, 0.5f, 0.5f, 0);
chris@162 679 __hv_sub_f(VIf(Bf5), VIf(Bf4), VOf(Bf4));
chris@162 680 __hv_abs_f(VIf(Bf4), VOf(Bf4));
chris@162 681 __hv_var_k_f(VOf(Bf5), 0.25f, 0.25f, 0.25f, 0.25f, 0.25f, 0.25f, 0.25f, 0.25f, 0);
chris@162 682 __hv_sub_f(VIf(Bf4), VIf(Bf5), VOf(Bf5));
chris@162 683 __hv_var_k_f(VOf(Bf4), 6.28319f, 6.28319f, 6.28319f, 6.28319f, 6.28319f, 6.28319f, 6.28319f, 6.28319f, 0);
chris@162 684 __hv_mul_f(VIf(Bf5), VIf(Bf4), VOf(Bf4));
chris@162 685 __hv_mul_f(VIf(Bf4), VIf(Bf4), VOf(Bf5));
chris@162 686 __hv_mul_f(VIf(Bf4), VIf(Bf5), VOf(Bf1));
chris@162 687 __hv_mul_f(VIf(Bf1), VIf(Bf5), VOf(Bf5));
chris@162 688 __hv_var_k_f(VOf(Bf6), 0.00784314f, 0.00784314f, 0.00784314f, 0.00784314f, 0.00784314f, 0.00784314f, 0.00784314f, 0.00784314f, 0);
chris@162 689 __hv_var_k_f(VOf(Bf7), 0.166667f, 0.166667f, 0.166667f, 0.166667f, 0.166667f, 0.166667f, 0.166667f, 0.166667f, 0);
chris@162 690 __hv_mul_f(VIf(Bf1), VIf(Bf7), VOf(Bf7));
chris@162 691 __hv_sub_f(VIf(Bf4), VIf(Bf7), VOf(Bf7));
chris@162 692 __hv_fma_f(VIf(Bf5), VIf(Bf6), VIf(Bf7), VOf(Bf7));
chris@162 693 __hv_mul_f(VIf(Bf3), VIf(Bf7), VOf(Bf7));
chris@162 694 __hv_add_f(VIf(Bf7), VIf(O1), VOf(O1));
chris@162 695 __hv_add_f(VIf(Bf7), VIf(O0), VOf(O0));
chris@162 696
chris@162 697 // save output vars to output buffer
chris@162 698 __hv_store_f(outputBuffers[0]+n, VIf(O0));
chris@162 699 __hv_store_f(outputBuffers[1]+n, VIf(O1));
chris@162 700 }
chris@162 701
chris@162 702 Base(_c)->blockStartTimestamp = nextBlock;
chris@162 703
chris@162 704 return n4; // return the number of frames processed
chris@162 705 }
chris@162 706
chris@162 707 int hv_bbb_process_inline(Hv_bbb *c, float *const inputBuffers, float *const outputBuffers, int n4) {
chris@162 708 hv_assert(!(n4 & HV_N_SIMD_MASK)); // ensure that n4 is a multiple of HV_N_SIMD
chris@162 709 int i = ctx_getNumInputChannels(Base(c));
chris@162 710 float **bIn = (float **) hv_alloca(i*sizeof(float *));
chris@162 711 while (i--) bIn[i] = inputBuffers+(i*n4);
chris@162 712
chris@162 713 i = ctx_getNumOutputChannels(Base(c));
chris@162 714 float **bOut = (float **) hv_alloca(i*sizeof(float *));
chris@162 715 while (i--) bOut[i] = outputBuffers+(i*n4);
chris@162 716
chris@162 717 int n = hv_bbb_process(c, bIn, bOut, n4);
chris@162 718 return n;
chris@162 719 }
chris@162 720
chris@162 721 int hv_bbb_process_inline_short(Hv_bbb *c, short *const inputBuffers, short *const outputBuffers, int n4) {
chris@162 722 hv_assert(!(n4 & HV_N_SIMD_MASK)); // ensure that n4 is a multiple of HV_N_SIMD
chris@162 723 int numChannels = ctx_getNumInputChannels(Base(c));
chris@162 724 float *bIn = (float *) hv_alloca(numChannels*n4*sizeof(float));
chris@162 725 for (int i = 0; i < numChannels; ++i) {
chris@162 726 for (int j = 0; j < n4; ++j) {
chris@162 727 bIn[i*n4+j] = ((float) inputBuffers[i+numChannels*j]) * 0.00003051757813f;
chris@162 728 }
chris@162 729 }
chris@162 730
chris@162 731 numChannels = ctx_getNumOutputChannels(Base(c));
chris@162 732 float *bOut = (float *) hv_alloca(numChannels*n4*sizeof(float));
chris@162 733
chris@162 734 int n = hv_bbb_process_inline(c, bIn, bOut, n4);
chris@162 735
chris@162 736 for (int i = 0; i < numChannels; ++i) {
chris@162 737 for (int j = 0; j < n4; ++j) {
chris@162 738 outputBuffers[i+numChannels*j] = (short) (bOut[i*n4+j] * 32767.0f);
chris@162 739 }
chris@162 740 }
chris@162 741
chris@162 742 return n;
chris@162 743 }