Mercurial > hg > beaglert
comparison 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 |
comparison
equal
deleted
inserted
replaced
161:07735c9d95c8 | 162:c3e8226a5651 |
---|---|
1 | |
2 /** | |
3 * Copyright (c) 2014,2015 Enzien Audio, Ltd. | |
4 * | |
5 * Permission is hereby granted, free of charge, to any person obtaining a copy | |
6 * of this software and associated documentation files (the "Software"), | |
7 * to deal in the Software without restriction, including without limitation | |
8 * the rights to use, copy, modify, merge, publish, distribute, and/or | |
9 * sublicense copies of the Software, strictly on a non-commercial basis, | |
10 * and to permit persons to whom the Software is furnished to do so, | |
11 * subject to the following conditions: | |
12 * | |
13 * The above copyright notice and this permission notice shall be included in | |
14 * all copies or substantial portions of the Software. | |
15 * | |
16 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR | |
17 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, | |
18 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE | |
19 * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER | |
20 * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING | |
21 * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS | |
22 * IN THE SOFTWARE. | |
23 * | |
24 * DO NOT MODIFY. THIS CODE IS MACHINE GENERATED BY THE SECTION6 HEAVY COMPILER. | |
25 */ | |
26 | |
27 /* | |
28 * System Includes | |
29 */ | |
30 | |
31 #include <assert.h> | |
32 #include <math.h> | |
33 #include <string.h> | |
34 #include <stdarg.h> | |
35 #include "HvContext_bbb.h" | |
36 #include "HeavyMath.h" | |
37 | |
38 | |
39 /* | |
40 * Function Declarations | |
41 */ | |
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}; | |
43 static void cVar_rLv9w_sendMessage(HvBase *, int, const HvMessage *const); | |
44 static void cSystem_tp4VA_sendMessage(HvBase *, int, const HvMessage *const); | |
45 static void cVar_rQhd0_sendMessage(HvBase *, int, const HvMessage *const); | |
46 static void cSlice_LzkmO_sendMessage(HvBase *, int, const HvMessage *const); | |
47 static void cSwitchcase_y60Gw_onMessage(HvBase *, void *, int letIn, const HvMessage *const, void *); | |
48 static void cLoadbang_TuCQI_sendMessage(HvBase *, int, const HvMessage *const); | |
49 static void cBinop_ER1x8_sendMessage(HvBase *, int, const HvMessage *const); | |
50 static void cMsg_oCnjm_sendMessage(HvBase *, int, const HvMessage *const); | |
51 static void cSlice_HqIeY_sendMessage(HvBase *, int, const HvMessage *const); | |
52 static void cVar_BTo3t_sendMessage(HvBase *, int, const HvMessage *const); | |
53 static void cVar_ZzlGn_sendMessage(HvBase *, int, const HvMessage *const); | |
54 static void cBinop_HqDsI_sendMessage(HvBase *, int, const HvMessage *const); | |
55 static void cSwitchcase_EV1Bl_onMessage(HvBase *, void *, int letIn, const HvMessage *const, void *); | |
56 static void cLoadbang_nVUh2_sendMessage(HvBase *, int, const HvMessage *const); | |
57 static void cSystem_jIjhB_sendMessage(HvBase *, int, const HvMessage *const); | |
58 static void cMsg_En77U_sendMessage(HvBase *, int, const HvMessage *const); | |
59 static void cMsg_IbQ3q_sendMessage(HvBase *, int, const HvMessage *const); | |
60 static void cSystem_zz1F7_sendMessage(HvBase *, int, const HvMessage *const); | |
61 static void cBinop_oOwFV_sendMessage(HvBase *, int, const HvMessage *const); | |
62 static void cBinop_P09tj_sendMessage(HvBase *, int, const HvMessage *const); | |
63 static void cVar_NnTc2_sendMessage(HvBase *, int, const HvMessage *const); | |
64 static void cLoadbang_2QoTi_sendMessage(HvBase *, int, const HvMessage *const); | |
65 static void cBinop_f8PBr_sendMessage(HvBase *, int, const HvMessage *const); | |
66 static void cMsg_qocid_sendMessage(HvBase *, int, const HvMessage *const); | |
67 static void cBinop_ITJR9_sendMessage(HvBase *, int, const HvMessage *const); | |
68 static void cUnop_nBNe2_sendMessage(HvBase *, int, const HvMessage *const); | |
69 static void cSystem_ZnUnS_sendMessage(HvBase *, int, const HvMessage *const); | |
70 static void cMsg_FhRde_sendMessage(HvBase *, int, const HvMessage *const); | |
71 static void cBinop_cxljx_sendMessage(HvBase *, int, const HvMessage *const); | |
72 static void cBinop_0UlVT_sendMessage(HvBase *, int, const HvMessage *const); | |
73 static void cBinop_MJQIs_sendMessage(HvBase *, int, const HvMessage *const); | |
74 static void cMsg_xzUtJ_sendMessage(HvBase *, int, const HvMessage *const); | |
75 static void cBinop_a2rE6_sendMessage(HvBase *, int, const HvMessage *const); | |
76 static void cBinop_govla_sendMessage(HvBase *, int, const HvMessage *const); | |
77 static void cSlice_oxbrV_sendMessage(HvBase *, int, const HvMessage *const); | |
78 static void cBinop_rzeQ2_sendMessage(HvBase *, int, const HvMessage *const); | |
79 static void cSlice_yZctV_sendMessage(HvBase *, int, const HvMessage *const); | |
80 static void cSlice_HCNcS_sendMessage(HvBase *, int, const HvMessage *const); | |
81 static void cVar_ItOCU_sendMessage(HvBase *, int, const HvMessage *const); | |
82 static void cSlice_Nx0UC_sendMessage(HvBase *, int, const HvMessage *const); | |
83 static void cLoadbang_4O9oF_sendMessage(HvBase *, int, const HvMessage *const); | |
84 static void cVar_VE9tg_sendMessage(HvBase *, int, const HvMessage *const); | |
85 static void cBinop_RE1w0_sendMessage(HvBase *, int, const HvMessage *const); | |
86 static void cSlice_Pkd46_sendMessage(HvBase *, int, const HvMessage *const); | |
87 static void cLoadbang_KAaax_sendMessage(HvBase *, int, const HvMessage *const); | |
88 | |
89 | |
90 | |
91 /* | |
92 * Static Helper Functions | |
93 */ | |
94 | |
95 static void ctx_intern_scheduleMessageForReceiver( | |
96 HvBase *const _c, const char *name, HvMessage *m) { | |
97 switch (msg_symbolToHash(name)) { | |
98 default: return; | |
99 } | |
100 } | |
101 | |
102 static struct HvTable *ctx_intern_getTableForHash(HvBase *const _c, hv_uint32_t h) { | |
103 switch (h) { | |
104 case 0xB6D0D974: return &Context(_c)->hTable_Pcegq; // env1 | |
105 default: return NULL; | |
106 } | |
107 } | |
108 | |
109 | |
110 | |
111 /* | |
112 * Context Include and Implementatons | |
113 */ | |
114 | |
115 Hv_bbb *hv_bbb_new_with_pool(double sampleRate, int poolKb) { | |
116 hv_assert(sampleRate > 0.0); // can't initialise with sampling rate of 0 | |
117 hv_assert(poolKb >= 1); // a message pool of some reasonable size is always needed | |
118 Hv_bbb *const _c = (Hv_bbb *) hv_malloc(sizeof(Hv_bbb)); | |
119 | |
120 Base(_c)->numInputChannels = 10; | |
121 Base(_c)->numOutputChannels = 2; | |
122 Base(_c)->sampleRate = sampleRate; | |
123 Base(_c)->blockStartTimestamp = 0; | |
124 Base(_c)->f_scheduleMessageForReceiver = &ctx_intern_scheduleMessageForReceiver; | |
125 Base(_c)->f_getTableForHash = &ctx_intern_getTableForHash; | |
126 mq_initWithPoolSize(&Base(_c)->mq, poolKb); | |
127 Base(_c)->basePath = NULL; | |
128 Base(_c)->printHook = NULL; | |
129 Base(_c)->sendHook = NULL; | |
130 Base(_c)->userData = NULL; | |
131 Base(_c)->name = "bbb"; | |
132 | |
133 Base(_c)->numBytes = sizeof(Hv_bbb); | |
134 Base(_c)->numBytes += sVarf_init(&_c->sVarf_DIQHM, 1.0f, 0.0f, false); | |
135 Base(_c)->numBytes += sVarf_init(&_c->sVarf_EIzJc, 44100.0f, 0.0f, false); | |
136 Base(_c)->numBytes += sVarf_init(&_c->sVarf_J0BAW, 0.0f, 0.0f, false); | |
137 Base(_c)->numBytes += sRPole_init(&_c->sRPole_vtJYw); | |
138 Base(_c)->numBytes += sVarf_init(&_c->sVarf_haFXq, 1.0f, 0.0f, false); | |
139 Base(_c)->numBytes += sDel1_init(&_c->sDel1_8dkfF); | |
140 Base(_c)->numBytes += sVarf_init(&_c->sVarf_4RU63, 0.0f, 0.0f, false); | |
141 Base(_c)->numBytes += sVarf_init(&_c->sVarf_5BIjv, 0.0f, 0.0f, false); | |
142 Base(_c)->numBytes += sVarf_init(&_c->sVarf_82QyC, -1e-37f, 0.0f, false); | |
143 Base(_c)->numBytes += sBiquad_k_init(&_c->sBiquad_k_8Keaz, -1.0f, 1.0f, 0.0f, 0.0f, 0.0f); | |
144 Base(_c)->numBytes += sVarf_init(&_c->sVarf_2muG8, 0.5f, 0.0f, false); | |
145 Base(_c)->numBytes += sVarf_init(&_c->sVarf_YrcAl, 0.0f, 0.0f, false); | |
146 Base(_c)->numBytes += sVarf_init(&_c->sVarf_1pbLN, -1e-37f, 0.0f, false); | |
147 Base(_c)->numBytes += sRPole_init(&_c->sRPole_Q5SA1); | |
148 Base(_c)->numBytes += sVarf_init(&_c->sVarf_ZTuE8, 1.0f, 0.0f, false); | |
149 Base(_c)->numBytes += sVarf_init(&_c->sVarf_9Q4iz, 0.0f, 0.0f, false); | |
150 Base(_c)->numBytes += sVarf_init(&_c->sVarf_QHeut, 1.0f, 0.0f, false); | |
151 Base(_c)->numBytes += sVarf_init(&_c->sVarf_BWg3y, 100000.0f, 0.0f, false); | |
152 Base(_c)->numBytes += sVarf_init(&_c->sVarf_yW7Co, 1e-05f, 0.0f, false); | |
153 Base(_c)->numBytes += sVarf_init(&_c->sVarf_BMuCC, 0.0f, 0.0f, false); | |
154 Base(_c)->numBytes += sVarf_init(&_c->sVarf_1vLiI, 0.0f, 0.0f, false); | |
155 Base(_c)->numBytes += sVarf_init(&_c->sVarf_ZKIZB, 0.0f, 0.0f, false); | |
156 Base(_c)->numBytes += sVarf_init(&_c->sVarf_SmDJi, 0.0f, 0.0f, false); | |
157 Base(_c)->numBytes += sTabread_init(&_c->sTabread_ef8Y2, &_c->hTable_Pcegq, false); | |
158 Base(_c)->numBytes += sVarf_init(&_c->sVarf_Z1CfH, 0.0f, 0.0f, false); | |
159 Base(_c)->numBytes += sTabread_init(&_c->sTabread_nnJuj, &_c->hTable_Pcegq, false); | |
160 Base(_c)->numBytes += sVarf_init(&_c->sVarf_CwdRa, 0.0f, 0.0f, false); | |
161 Base(_c)->numBytes += sVarf_init(&_c->sVarf_z5YqL, 0.0f, 0.0f, false); | |
162 Base(_c)->numBytes += sVarf_init(&_c->sVarf_AMYc1, 0.0f, 0.0f, false); | |
163 Base(_c)->numBytes += sVarf_init(&_c->sVarf_yGh3v, 0.0f, 0.0f, false); | |
164 Base(_c)->numBytes += sVarf_init(&_c->sVarf_ThV6W, 0.0f, 0.0f, false); | |
165 Base(_c)->numBytes += sVarf_init(&_c->sVarf_U0HuI, 0.0f, 0.0f, false); | |
166 Base(_c)->numBytes += sTabread_init(&_c->sTabread_g0gGp, &_c->hTable_Pcegq, false); | |
167 Base(_c)->numBytes += sVarf_init(&_c->sVarf_rLY2o, 0.0f, 0.0f, false); | |
168 Base(_c)->numBytes += sTabread_init(&_c->sTabread_joe74, &_c->hTable_Pcegq, false); | |
169 Base(_c)->numBytes += sVarf_init(&_c->sVarf_tTp9Q, 0.0f, 0.0f, false); | |
170 Base(_c)->numBytes += sVarf_init(&_c->sVarf_Ip7Ud, 0.0f, 0.0f, false); | |
171 Base(_c)->numBytes += sPhasor_init(&_c->sPhasor_KqGIr, sampleRate); | |
172 Base(_c)->numBytes += hTable_initWithData(&_c->hTable_Pcegq, 512, hTable_Pcegq_data); | |
173 Base(_c)->numBytes += cVar_init_s(&_c->cVar_rLv9w, "env1"); | |
174 Base(_c)->numBytes += cVar_init_f(&_c->cVar_rQhd0, 0.0f); | |
175 Base(_c)->numBytes += cSlice_init(&_c->cSlice_LzkmO, 1, 1); | |
176 Base(_c)->numBytes += cSlice_init(&_c->cSlice_HqIeY, 1, 1); | |
177 Base(_c)->numBytes += cVar_init_s(&_c->cVar_BTo3t, "env1"); | |
178 Base(_c)->numBytes += cVar_init_f(&_c->cVar_ZzlGn, 0.0f); | |
179 Base(_c)->numBytes += cVar_init_f(&_c->cVar_NnTc2, 1.0f); | |
180 Base(_c)->numBytes += cBinop_init(&_c->cBinop_ITJR9, 0.0f); // __div | |
181 Base(_c)->numBytes += cBinop_init(&_c->cBinop_cxljx, 0.0f); // __mul | |
182 Base(_c)->numBytes += cBinop_init(&_c->cBinop_0UlVT, 1.0f); // __min | |
183 Base(_c)->numBytes += cBinop_init(&_c->cBinop_MJQIs, 0.0f); // __max | |
184 Base(_c)->numBytes += cSlice_init(&_c->cSlice_oxbrV, 2, 1); | |
185 Base(_c)->numBytes += cSlice_init(&_c->cSlice_yZctV, 3, 1); | |
186 Base(_c)->numBytes += cSlice_init(&_c->cSlice_HCNcS, 4, 1); | |
187 Base(_c)->numBytes += cVar_init_f(&_c->cVar_ItOCU, 0.0f); | |
188 Base(_c)->numBytes += cSlice_init(&_c->cSlice_Nx0UC, 0, 1); | |
189 Base(_c)->numBytes += cVar_init_f(&_c->cVar_VE9tg, 0.0f); | |
190 Base(_c)->numBytes += cSlice_init(&_c->cSlice_Pkd46, 1, 1); | |
191 | |
192 // loadbang | |
193 ctx_scheduleMessage(Base(_c), msg_initWithBang(HV_MESSAGE_ON_STACK(1), 0), &cLoadbang_2QoTi_sendMessage, 0); | |
194 ctx_scheduleMessage(Base(_c), msg_initWithBang(HV_MESSAGE_ON_STACK(1), 0), &cLoadbang_4O9oF_sendMessage, 0); | |
195 ctx_scheduleMessage(Base(_c), msg_initWithBang(HV_MESSAGE_ON_STACK(1), 0), &cLoadbang_KAaax_sendMessage, 0); | |
196 ctx_scheduleMessage(Base(_c), msg_initWithBang(HV_MESSAGE_ON_STACK(1), 0), &cLoadbang_TuCQI_sendMessage, 0); | |
197 ctx_scheduleMessage(Base(_c), msg_initWithBang(HV_MESSAGE_ON_STACK(1), 0), &cLoadbang_nVUh2_sendMessage, 0); | |
198 | |
199 return _c; | |
200 } | |
201 | |
202 Hv_bbb *hv_bbb_new(double sampleRate) { | |
203 return hv_bbb_new_with_pool(sampleRate, 10); // default to 10KB MessagePool | |
204 } | |
205 | |
206 void hv_bbb_free(Hv_bbb *_c) { | |
207 hTable_free(&_c->hTable_Pcegq); | |
208 | |
209 hv_free(Base(_c)->basePath); | |
210 mq_free(&Base(_c)->mq); // free queue after all objects have been freed, messages may be cancelled | |
211 | |
212 hv_free(_c); | |
213 } | |
214 | |
215 | |
216 | |
217 /* | |
218 * Static Function Implementation | |
219 */ | |
220 static void hTable_Pcegq_sendMessage(HvBase *_c, int letIn, const HvMessage *const m) { | |
221 } | |
222 | |
223 static void cVar_rLv9w_sendMessage(HvBase *_c, int letIn, const HvMessage *const m) { | |
224 cMsg_oCnjm_sendMessage(_c, 0, m); | |
225 } | |
226 | |
227 static void cSystem_tp4VA_sendMessage(HvBase *_c, int letIn, const HvMessage *const m) { | |
228 cBinop_k_onMessage(_c, NULL, HV_BINOP_SUBTRACT, 2.0f, 0, m, &cBinop_ER1x8_sendMessage); | |
229 } | |
230 | |
231 static void cVar_rQhd0_sendMessage(HvBase *_c, int letIn, const HvMessage *const m) { | |
232 cBinop_k_onMessage(_c, NULL, HV_BINOP_SUBTRACT, 2.0f, 0, m, &cBinop_ER1x8_sendMessage); | |
233 } | |
234 | |
235 static void cSlice_LzkmO_sendMessage(HvBase *_c, int letIn, const HvMessage *const m) { | |
236 switch(letIn) { | |
237 case 0: { | |
238 sTabread_onMessage(_c, &Context(_c)->sTabread_ef8Y2, 1, m); | |
239 sTabread_onMessage(_c, &Context(_c)->sTabread_nnJuj, 1, m); | |
240 cVar_onMessage(_c, &Context(_c)->cVar_rLv9w, 0, m, &cVar_rLv9w_sendMessage); | |
241 break; | |
242 } | |
243 case 1: { | |
244 break; | |
245 } | |
246 default: return; | |
247 } | |
248 } | |
249 | |
250 static void cSwitchcase_y60Gw_onMessage(HvBase *_c, void *o, int letIn, const HvMessage *const m, void *sendMessage) { | |
251 switch (msg_getHash(m,0)) { | |
252 case 0x3E004DAB: { // "set" | |
253 cSlice_onMessage(_c, &Context(_c)->cSlice_LzkmO, 0, m, &cSlice_LzkmO_sendMessage); | |
254 break; | |
255 } | |
256 default: { | |
257 break; | |
258 } | |
259 } | |
260 } | |
261 | |
262 static void cLoadbang_TuCQI_sendMessage(HvBase *_c, int letIn, const HvMessage *const m) { | |
263 cVar_onMessage(_c, &Context(_c)->cVar_rLv9w, 0, m, &cVar_rLv9w_sendMessage); | |
264 } | |
265 | |
266 static void cBinop_ER1x8_sendMessage(HvBase *_c, int letIn, const HvMessage *const m) { | |
267 sVarf_onMessage(_c, &Context(_c)->sVarf_SmDJi, m); | |
268 } | |
269 | |
270 static void cMsg_oCnjm_sendMessage(HvBase *_c, int letIn, const HvMessage *const n) { | |
271 HvMessage *m = NULL; | |
272 m = HV_MESSAGE_ON_STACK(3); | |
273 msg_init(m, 3, msg_getTimestamp(n)); | |
274 msg_setSymbol(m, 0, "table"); | |
275 msg_setElementToFrom(m, 1, n, 0); | |
276 msg_setSymbol(m, 2, "size"); | |
277 cSystem_onMessage(_c, NULL, 0, m, &cSystem_tp4VA_sendMessage); | |
278 } | |
279 | |
280 static void cSlice_HqIeY_sendMessage(HvBase *_c, int letIn, const HvMessage *const m) { | |
281 switch(letIn) { | |
282 case 0: { | |
283 sTabread_onMessage(_c, &Context(_c)->sTabread_g0gGp, 1, m); | |
284 sTabread_onMessage(_c, &Context(_c)->sTabread_joe74, 1, m); | |
285 cVar_onMessage(_c, &Context(_c)->cVar_BTo3t, 0, m, &cVar_BTo3t_sendMessage); | |
286 break; | |
287 } | |
288 case 1: { | |
289 break; | |
290 } | |
291 default: return; | |
292 } | |
293 } | |
294 | |
295 static void cVar_BTo3t_sendMessage(HvBase *_c, int letIn, const HvMessage *const m) { | |
296 cMsg_En77U_sendMessage(_c, 0, m); | |
297 } | |
298 | |
299 static void cVar_ZzlGn_sendMessage(HvBase *_c, int letIn, const HvMessage *const m) { | |
300 cBinop_k_onMessage(_c, NULL, HV_BINOP_SUBTRACT, 2.0f, 0, m, &cBinop_HqDsI_sendMessage); | |
301 } | |
302 | |
303 static void cBinop_HqDsI_sendMessage(HvBase *_c, int letIn, const HvMessage *const m) { | |
304 sVarf_onMessage(_c, &Context(_c)->sVarf_U0HuI, m); | |
305 } | |
306 | |
307 static void cSwitchcase_EV1Bl_onMessage(HvBase *_c, void *o, int letIn, const HvMessage *const m, void *sendMessage) { | |
308 switch (msg_getHash(m,0)) { | |
309 case 0x3E004DAB: { // "set" | |
310 cSlice_onMessage(_c, &Context(_c)->cSlice_HqIeY, 0, m, &cSlice_HqIeY_sendMessage); | |
311 break; | |
312 } | |
313 default: { | |
314 break; | |
315 } | |
316 } | |
317 } | |
318 | |
319 static void cLoadbang_nVUh2_sendMessage(HvBase *_c, int letIn, const HvMessage *const m) { | |
320 cVar_onMessage(_c, &Context(_c)->cVar_BTo3t, 0, m, &cVar_BTo3t_sendMessage); | |
321 } | |
322 | |
323 static void cSystem_jIjhB_sendMessage(HvBase *_c, int letIn, const HvMessage *const m) { | |
324 cBinop_k_onMessage(_c, NULL, HV_BINOP_SUBTRACT, 2.0f, 0, m, &cBinop_HqDsI_sendMessage); | |
325 } | |
326 | |
327 static void cMsg_En77U_sendMessage(HvBase *_c, int letIn, const HvMessage *const n) { | |
328 HvMessage *m = NULL; | |
329 m = HV_MESSAGE_ON_STACK(3); | |
330 msg_init(m, 3, msg_getTimestamp(n)); | |
331 msg_setSymbol(m, 0, "table"); | |
332 msg_setElementToFrom(m, 1, n, 0); | |
333 msg_setSymbol(m, 2, "size"); | |
334 cSystem_onMessage(_c, NULL, 0, m, &cSystem_jIjhB_sendMessage); | |
335 } | |
336 | |
337 static void cMsg_IbQ3q_sendMessage(HvBase *_c, int letIn, const HvMessage *const n) { | |
338 HvMessage *m = NULL; | |
339 m = HV_MESSAGE_ON_STACK(1); | |
340 msg_init(m, 1, msg_getTimestamp(n)); | |
341 msg_setSymbol(m, 0, "samplerate"); | |
342 cSystem_onMessage(_c, NULL, 0, m, &cSystem_zz1F7_sendMessage); | |
343 } | |
344 | |
345 static void cSystem_zz1F7_sendMessage(HvBase *_c, int letIn, const HvMessage *const m) { | |
346 sVarf_onMessage(_c, &Context(_c)->sVarf_EIzJc, m); | |
347 } | |
348 | |
349 static void cBinop_oOwFV_sendMessage(HvBase *_c, int letIn, const HvMessage *const m) { | |
350 cBinop_k_onMessage(_c, NULL, HV_BINOP_MULTIPLY, 0.5f, 0, m, &cBinop_a2rE6_sendMessage); | |
351 } | |
352 | |
353 static void cBinop_P09tj_sendMessage(HvBase *_c, int letIn, const HvMessage *const m) { | |
354 sVarf_onMessage(_c, &Context(_c)->sVarf_J0BAW, m); | |
355 } | |
356 | |
357 static void cVar_NnTc2_sendMessage(HvBase *_c, int letIn, const HvMessage *const m) { | |
358 cBinop_onMessage(_c, &Context(_c)->cBinop_cxljx, HV_BINOP_MULTIPLY, 0, m, &cBinop_cxljx_sendMessage); | |
359 } | |
360 | |
361 static void cLoadbang_2QoTi_sendMessage(HvBase *_c, int letIn, const HvMessage *const m) { | |
362 cMsg_FhRde_sendMessage(_c, 0, m); | |
363 cVar_onMessage(_c, &Context(_c)->cVar_NnTc2, 0, m, &cVar_NnTc2_sendMessage); | |
364 } | |
365 | |
366 static void cBinop_f8PBr_sendMessage(HvBase *_c, int letIn, const HvMessage *const m) { | |
367 cBinop_onMessage(_c, &Context(_c)->cBinop_ITJR9, HV_BINOP_DIVIDE, 0, m, &cBinop_ITJR9_sendMessage); | |
368 } | |
369 | |
370 static void cMsg_qocid_sendMessage(HvBase *_c, int letIn, const HvMessage *const n) { | |
371 HvMessage *m = NULL; | |
372 m = HV_MESSAGE_ON_STACK(1); | |
373 msg_init(m, 1, msg_getTimestamp(n)); | |
374 msg_setFloat(m, 0, 1.0f); | |
375 cUnop_onMessage(_c, HV_UNOP_ATAN, m, &cUnop_nBNe2_sendMessage); | |
376 } | |
377 | |
378 static void cBinop_ITJR9_sendMessage(HvBase *_c, int letIn, const HvMessage *const m) { | |
379 cBinop_onMessage(_c, &Context(_c)->cBinop_cxljx, HV_BINOP_MULTIPLY, 1, m, &cBinop_cxljx_sendMessage); | |
380 } | |
381 | |
382 static void cUnop_nBNe2_sendMessage(HvBase *_c, int letIn, const HvMessage *const m) { | |
383 cBinop_k_onMessage(_c, NULL, HV_BINOP_MULTIPLY, 8.0f, 0, m, &cBinop_f8PBr_sendMessage); | |
384 } | |
385 | |
386 static void cSystem_ZnUnS_sendMessage(HvBase *_c, int letIn, const HvMessage *const m) { | |
387 cBinop_onMessage(_c, &Context(_c)->cBinop_ITJR9, HV_BINOP_DIVIDE, 1, m, &cBinop_ITJR9_sendMessage); | |
388 cMsg_qocid_sendMessage(_c, 0, m); | |
389 } | |
390 | |
391 static void cMsg_FhRde_sendMessage(HvBase *_c, int letIn, const HvMessage *const n) { | |
392 HvMessage *m = NULL; | |
393 m = HV_MESSAGE_ON_STACK(1); | |
394 msg_init(m, 1, msg_getTimestamp(n)); | |
395 msg_setSymbol(m, 0, "samplerate"); | |
396 cSystem_onMessage(_c, NULL, 0, m, &cSystem_ZnUnS_sendMessage); | |
397 } | |
398 | |
399 static void cBinop_cxljx_sendMessage(HvBase *_c, int letIn, const HvMessage *const m) { | |
400 cMsg_xzUtJ_sendMessage(_c, 0, m); | |
401 } | |
402 | |
403 static void cBinop_0UlVT_sendMessage(HvBase *_c, int letIn, const HvMessage *const m) { | |
404 cBinop_onMessage(_c, &Context(_c)->cBinop_MJQIs, HV_BINOP_MAX, 0, m, &cBinop_MJQIs_sendMessage); | |
405 } | |
406 | |
407 static void cBinop_MJQIs_sendMessage(HvBase *_c, int letIn, const HvMessage *const m) { | |
408 cBinop_k_onMessage(_c, NULL, HV_BINOP_ADD, 1.0f, 0, m, &cBinop_oOwFV_sendMessage); | |
409 cBinop_k_onMessage(_c, NULL, HV_BINOP_MULTIPLY, -1.0f, 0, m, &cBinop_P09tj_sendMessage); | |
410 } | |
411 | |
412 static void cMsg_xzUtJ_sendMessage(HvBase *_c, int letIn, const HvMessage *const n) { | |
413 HvMessage *m = NULL; | |
414 m = HV_MESSAGE_ON_STACK(2); | |
415 msg_init(m, 2, msg_getTimestamp(n)); | |
416 msg_setFloat(m, 0, 1.0f); | |
417 msg_setElementToFrom(m, 1, n, 0); | |
418 cBinop_k_onMessage(_c, NULL, HV_BINOP_SUBTRACT, 0.0f, 0, m, &cBinop_govla_sendMessage); | |
419 } | |
420 | |
421 static void cBinop_a2rE6_sendMessage(HvBase *_c, int letIn, const HvMessage *const m) { | |
422 sVarf_onMessage(_c, &Context(_c)->sVarf_4RU63, m); | |
423 } | |
424 | |
425 static void cBinop_govla_sendMessage(HvBase *_c, int letIn, const HvMessage *const m) { | |
426 cBinop_onMessage(_c, &Context(_c)->cBinop_0UlVT, HV_BINOP_MIN, 0, m, &cBinop_0UlVT_sendMessage); | |
427 } | |
428 | |
429 static void cSlice_oxbrV_sendMessage(HvBase *_c, int letIn, const HvMessage *const m) { | |
430 switch(letIn) { | |
431 case 0: { | |
432 sBiquad_k_onMessage(&Context(_c)->sBiquad_k_8Keaz, 1, m); | |
433 break; | |
434 } | |
435 case 1: { | |
436 break; | |
437 } | |
438 default: return; | |
439 } | |
440 } | |
441 | |
442 static void cBinop_rzeQ2_sendMessage(HvBase *_c, int letIn, const HvMessage *const m) { | |
443 sBiquad_k_onMessage(&Context(_c)->sBiquad_k_8Keaz, 4, m); | |
444 } | |
445 | |
446 static void cSlice_yZctV_sendMessage(HvBase *_c, int letIn, const HvMessage *const m) { | |
447 switch(letIn) { | |
448 case 0: { | |
449 sBiquad_k_onMessage(&Context(_c)->sBiquad_k_8Keaz, 2, m); | |
450 break; | |
451 } | |
452 case 1: { | |
453 break; | |
454 } | |
455 default: return; | |
456 } | |
457 } | |
458 | |
459 static void cSlice_HCNcS_sendMessage(HvBase *_c, int letIn, const HvMessage *const m) { | |
460 switch(letIn) { | |
461 case 0: { | |
462 sBiquad_k_onMessage(&Context(_c)->sBiquad_k_8Keaz, 3, m); | |
463 break; | |
464 } | |
465 case 1: { | |
466 break; | |
467 } | |
468 default: return; | |
469 } | |
470 } | |
471 | |
472 static void cVar_ItOCU_sendMessage(HvBase *_c, int letIn, const HvMessage *const m) { | |
473 cBinop_k_onMessage(_c, NULL, HV_BINOP_MULTIPLY, -1.0f, 0, m, &cBinop_RE1w0_sendMessage); | |
474 } | |
475 | |
476 static void cSlice_Nx0UC_sendMessage(HvBase *_c, int letIn, const HvMessage *const m) { | |
477 switch(letIn) { | |
478 case 0: { | |
479 cBinop_k_onMessage(_c, NULL, HV_BINOP_MULTIPLY, -1.0f, 0, m, &cBinop_rzeQ2_sendMessage); | |
480 break; | |
481 } | |
482 case 1: { | |
483 break; | |
484 } | |
485 default: return; | |
486 } | |
487 } | |
488 | |
489 static void cLoadbang_4O9oF_sendMessage(HvBase *_c, int letIn, const HvMessage *const m) { | |
490 cVar_onMessage(_c, &Context(_c)->cVar_VE9tg, 0, m, &cVar_VE9tg_sendMessage); | |
491 cVar_onMessage(_c, &Context(_c)->cVar_ItOCU, 0, m, &cVar_ItOCU_sendMessage); | |
492 } | |
493 | |
494 static void cVar_VE9tg_sendMessage(HvBase *_c, int letIn, const HvMessage *const m) { | |
495 cBinop_k_onMessage(_c, NULL, HV_BINOP_MULTIPLY, -1.0f, 0, m, &cBinop_rzeQ2_sendMessage); | |
496 } | |
497 | |
498 static void cBinop_RE1w0_sendMessage(HvBase *_c, int letIn, const HvMessage *const m) { | |
499 sBiquad_k_onMessage(&Context(_c)->sBiquad_k_8Keaz, 5, m); | |
500 } | |
501 | |
502 static void cSlice_Pkd46_sendMessage(HvBase *_c, int letIn, const HvMessage *const m) { | |
503 switch(letIn) { | |
504 case 0: { | |
505 cBinop_k_onMessage(_c, NULL, HV_BINOP_MULTIPLY, -1.0f, 0, m, &cBinop_RE1w0_sendMessage); | |
506 break; | |
507 } | |
508 case 1: { | |
509 break; | |
510 } | |
511 default: return; | |
512 } | |
513 } | |
514 | |
515 static void cLoadbang_KAaax_sendMessage(HvBase *_c, int letIn, const HvMessage *const m) { | |
516 cMsg_IbQ3q_sendMessage(_c, 0, m); | |
517 } | |
518 | |
519 | |
520 | |
521 | |
522 /* | |
523 * Context Process Implementation | |
524 */ | |
525 | |
526 int hv_bbb_process(Hv_bbb *const _c, float **const inputBuffers, float **const outputBuffers, int nx) { | |
527 const int n4 = nx & ~HV_N_SIMD_MASK; // ensure that the block size is a multiple of HV_N_SIMD | |
528 | |
529 // temporary signal vars | |
530 hv_bufferf_t Bf0, Bf1, Bf2, Bf3, Bf4, Bf5, Bf6, Bf7; | |
531 hv_bufferi_t Bi0, Bi1; | |
532 | |
533 // input and output vars | |
534 hv_bufferf_t O0, O1; | |
535 hv_bufferf_t I0, I1, I2, I3, I4, I5, I6, I7, I8, I9; | |
536 | |
537 // declare and init the zero buffer | |
538 hv_bufferf_t ZERO; __hv_zero_f(VOf(ZERO)); | |
539 | |
540 hv_uint32_t nextBlock = Base(_c)->blockStartTimestamp; | |
541 for (int n = 0; n < n4; n += HV_N_SIMD) { | |
542 | |
543 // process all of the messages for this block | |
544 nextBlock += HV_N_SIMD; | |
545 while (mq_hasMessageBefore(&Base(_c)->mq, nextBlock)) { | |
546 MessageNode *const node = mq_peek(&Base(_c)->mq); | |
547 node->sendMessage(Base(_c), node->let, node->m); | |
548 mq_pop(&Base(_c)->mq); | |
549 } | |
550 | |
551 // load input buffers | |
552 __hv_load_f(inputBuffers[0]+n, VOf(I0)); | |
553 __hv_load_f(inputBuffers[1]+n, VOf(I1)); | |
554 __hv_load_f(inputBuffers[2]+n, VOf(I2)); | |
555 __hv_load_f(inputBuffers[3]+n, VOf(I3)); | |
556 __hv_load_f(inputBuffers[4]+n, VOf(I4)); | |
557 __hv_load_f(inputBuffers[5]+n, VOf(I5)); | |
558 __hv_load_f(inputBuffers[6]+n, VOf(I6)); | |
559 __hv_load_f(inputBuffers[7]+n, VOf(I7)); | |
560 __hv_load_f(inputBuffers[8]+n, VOf(I8)); | |
561 __hv_load_f(inputBuffers[9]+n, VOf(I9)); | |
562 | |
563 // zero output buffers | |
564 __hv_zero_f(VOf(O0)); | |
565 __hv_zero_f(VOf(O1)); | |
566 | |
567 // process all signal functions | |
568 __hv_var_f(&_c->sVarf_DIQHM, VOf(Bf0)); | |
569 __hv_var_f(&_c->sVarf_EIzJc, VOf(Bf1)); | |
570 __hv_div_f(VIf(Bf0), VIf(Bf1), VOf(Bf1)); | |
571 __hv_var_f(&_c->sVarf_J0BAW, VOf(Bf0)); | |
572 __hv_rpole_f(&_c->sRPole_vtJYw, VIf(I7), VIf(Bf0), VOf(Bf0)); | |
573 __hv_var_f(&_c->sVarf_haFXq, VOf(Bf2)); | |
574 __hv_del1_f(&_c->sDel1_8dkfF, VIf(Bf0), VOf(Bf3)); | |
575 __hv_mul_f(VIf(Bf3), VIf(Bf2), VOf(Bf2)); | |
576 __hv_sub_f(VIf(Bf0), VIf(Bf2), VOf(Bf2)); | |
577 __hv_var_f(&_c->sVarf_4RU63, VOf(Bf0)); | |
578 __hv_mul_f(VIf(Bf2), VIf(Bf0), VOf(Bf0)); | |
579 __hv_abs_f(VIf(Bf0), VOf(Bf0)); | |
580 __hv_min_f(VIf(Bf0), VIf(I8), VOf(Bf0)); | |
581 __hv_sub_f(VIf(Bf0), VIf(I8), VOf(Bf0)); | |
582 __hv_var_f(&_c->sVarf_5BIjv, VOf(Bf2)); | |
583 __hv_min_f(VIf(Bf0), VIf(Bf2), VOf(Bf2)); | |
584 __hv_var_f(&_c->sVarf_82QyC, VOf(Bf0)); | |
585 __hv_max_f(VIf(Bf2), VIf(Bf0), VOf(Bf0)); | |
586 __hv_var_k_f(VOf(Bf2), 1e-37f, 1e-37f, 1e-37f, 1e-37f, 1e-37f, 1e-37f, 1e-37f, 1e-37f, 0); | |
587 __hv_add_f(VIf(Bf0), VIf(Bf2), VOf(Bf2)); | |
588 __hv_var_k_f(VOf(Bf0), 1e+37f, 1e+37f, 1e+37f, 1e+37f, 1e+37f, 1e+37f, 1e+37f, 1e+37f, 0); | |
589 __hv_mul_f(VIf(Bf2), VIf(Bf0), VOf(Bf0)); | |
590 __hv_biquad_k_f(&_c->sBiquad_k_8Keaz, VIf(Bf0), VOf(Bf2)); | |
591 __hv_var_k_f(VOf(Bf3), -1.0f, -1.0f, -1.0f, -1.0f, -1.0f, -1.0f, -1.0f, -1.0f, 0); | |
592 __hv_mul_f(VIf(Bf2), VIf(Bf3), VOf(Bf3)); | |
593 __hv_var_f(&_c->sVarf_2muG8, VOf(Bf2)); | |
594 __hv_max_f(VIf(Bf3), VIf(Bf2), VOf(Bf3)); | |
595 __hv_sub_f(VIf(Bf3), VIf(Bf2), VOf(Bf2)); | |
596 __hv_var_k_f(VOf(Bf3), -1.0f, -1.0f, -1.0f, -1.0f, -1.0f, -1.0f, -1.0f, -1.0f, 0); | |
597 __hv_mul_f(VIf(Bf2), VIf(Bf3), VOf(Bf3)); | |
598 __hv_var_f(&_c->sVarf_YrcAl, VOf(Bf2)); | |
599 __hv_min_f(VIf(Bf3), VIf(Bf2), VOf(Bf2)); | |
600 __hv_var_f(&_c->sVarf_1pbLN, VOf(Bf3)); | |
601 __hv_max_f(VIf(Bf2), VIf(Bf3), VOf(Bf3)); | |
602 __hv_var_k_f(VOf(Bf2), 1e-37f, 1e-37f, 1e-37f, 1e-37f, 1e-37f, 1e-37f, 1e-37f, 1e-37f, 0); | |
603 __hv_add_f(VIf(Bf3), VIf(Bf2), VOf(Bf2)); | |
604 __hv_var_k_f(VOf(Bf3), 1e+37f, 1e+37f, 1e+37f, 1e+37f, 1e+37f, 1e+37f, 1e+37f, 1e+37f, 0); | |
605 __hv_mul_f(VIf(Bf2), VIf(Bf3), VOf(Bf3)); | |
606 __hv_var_k_f(VOf(Bf2), -1.0f, -1.0f, -1.0f, -1.0f, -1.0f, -1.0f, -1.0f, -1.0f, 0); | |
607 __hv_mul_f(VIf(Bf3), VIf(Bf2), VOf(Bf2)); | |
608 __hv_rpole_f(&_c->sRPole_Q5SA1, VIf(Bf1), VIf(Bf2), VOf(Bf2)); | |
609 __hv_var_f(&_c->sVarf_ZTuE8, VOf(Bf1)); | |
610 __hv_min_f(VIf(Bf2), VIf(Bf1), VOf(Bf1)); | |
611 __hv_var_f(&_c->sVarf_9Q4iz, VOf(Bf2)); | |
612 __hv_max_f(VIf(Bf1), VIf(Bf2), VOf(Bf2)); | |
613 __hv_var_f(&_c->sVarf_QHeut, VOf(Bf1)); | |
614 __hv_mul_f(VIf(I9), VIf(I9), VOf(Bf3)); | |
615 __hv_var_f(&_c->sVarf_BWg3y, VOf(Bf4)); | |
616 __hv_min_f(VIf(Bf3), VIf(Bf4), VOf(Bf4)); | |
617 __hv_var_f(&_c->sVarf_yW7Co, VOf(Bf3)); | |
618 __hv_max_f(VIf(Bf4), VIf(Bf3), VOf(Bf3)); | |
619 __hv_div_f(VIf(Bf1), VIf(Bf3), VOf(Bf3)); | |
620 __hv_mul_f(VIf(Bf2), VIf(Bf3), VOf(Bf3)); | |
621 __hv_var_k_f(VOf(Bf2), 512.0f, 512.0f, 512.0f, 512.0f, 512.0f, 512.0f, 512.0f, 512.0f, 0); | |
622 __hv_mul_f(VIf(Bf3), VIf(Bf2), VOf(Bf2)); | |
623 __hv_var_f(&_c->sVarf_BMuCC, VOf(Bf3)); | |
624 __hv_var_f(&_c->sVarf_1vLiI, VOf(Bf1)); | |
625 __hv_var_f(&_c->sVarf_ZKIZB, VOf(Bf4)); | |
626 __hv_add_f(VIf(Bf2), VIf(Bf4), VOf(Bf4)); | |
627 __hv_var_f(&_c->sVarf_SmDJi, VOf(Bf5)); | |
628 __hv_min_f(VIf(Bf4), VIf(Bf5), VOf(Bf5)); | |
629 __hv_add_f(VIf(Bf1), VIf(Bf5), VOf(Bf5)); | |
630 __hv_var_k_f(VOf(Bf1), 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0); | |
631 __hv_max_f(VIf(Bf5), VIf(Bf1), VOf(Bf1)); | |
632 __hv_cast_fi(VIf(Bf1), VOi(Bi0)); | |
633 __hv_var_k_i(VOi(Bi1), 1, 1, 1, 1, 1, 1, 1, 1, 0); | |
634 __hv_add_i(VIi(Bi0), VIi(Bi1), VOi(Bi1)); | |
635 __hv_tabread_if(&_c->sTabread_ef8Y2, VIi(Bi1), VOf(Bf5)); | |
636 __hv_var_f(&_c->sVarf_Z1CfH, VOf(Bf4)); | |
637 __hv_add_f(VIf(Bf5), VIf(Bf4), VOf(Bf4)); | |
638 __hv_tabread_if(&_c->sTabread_nnJuj, VIi(Bi0), VOf(Bf5)); | |
639 __hv_sub_f(VIf(Bf4), VIf(Bf5), VOf(Bf4)); | |
640 __hv_add_f(VIf(Bf3), VIf(Bf4), VOf(Bf4)); | |
641 __hv_var_f(&_c->sVarf_CwdRa, VOf(Bf3)); | |
642 __hv_add_f(VIf(Bf3), VIf(Bf1), VOf(Bf3)); | |
643 __hv_floor_f(VIf(Bf1), VOf(Bf1)); | |
644 __hv_sub_f(VIf(Bf3), VIf(Bf1), VOf(Bf1)); | |
645 __hv_var_f(&_c->sVarf_z5YqL, VOf(Bf3)); | |
646 __hv_add_f(VIf(Bf5), VIf(Bf3), VOf(Bf3)); | |
647 __hv_fma_f(VIf(Bf4), VIf(Bf1), VIf(Bf3), VOf(Bf3)); | |
648 __hv_var_f(&_c->sVarf_AMYc1, VOf(Bf1)); | |
649 __hv_var_f(&_c->sVarf_yGh3v, VOf(Bf4)); | |
650 __hv_var_f(&_c->sVarf_ThV6W, VOf(Bf5)); | |
651 __hv_add_f(VIf(Bf2), VIf(Bf5), VOf(Bf5)); | |
652 __hv_var_f(&_c->sVarf_U0HuI, VOf(Bf6)); | |
653 __hv_min_f(VIf(Bf5), VIf(Bf6), VOf(Bf6)); | |
654 __hv_add_f(VIf(Bf4), VIf(Bf6), VOf(Bf6)); | |
655 __hv_var_k_f(VOf(Bf4), 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0); | |
656 __hv_max_f(VIf(Bf6), VIf(Bf4), VOf(Bf4)); | |
657 __hv_cast_fi(VIf(Bf4), VOi(Bi0)); | |
658 __hv_var_k_i(VOi(Bi1), 1, 1, 1, 1, 1, 1, 1, 1, 0); | |
659 __hv_add_i(VIi(Bi0), VIi(Bi1), VOi(Bi1)); | |
660 __hv_tabread_if(&_c->sTabread_g0gGp, VIi(Bi1), VOf(Bf6)); | |
661 __hv_var_f(&_c->sVarf_rLY2o, VOf(Bf5)); | |
662 __hv_add_f(VIf(Bf6), VIf(Bf5), VOf(Bf5)); | |
663 __hv_tabread_if(&_c->sTabread_joe74, VIi(Bi0), VOf(Bf6)); | |
664 __hv_sub_f(VIf(Bf5), VIf(Bf6), VOf(Bf5)); | |
665 __hv_add_f(VIf(Bf1), VIf(Bf5), VOf(Bf5)); | |
666 __hv_var_f(&_c->sVarf_tTp9Q, VOf(Bf1)); | |
667 __hv_add_f(VIf(Bf1), VIf(Bf4), VOf(Bf1)); | |
668 __hv_floor_f(VIf(Bf4), VOf(Bf4)); | |
669 __hv_sub_f(VIf(Bf1), VIf(Bf4), VOf(Bf4)); | |
670 __hv_var_f(&_c->sVarf_Ip7Ud, VOf(Bf1)); | |
671 __hv_add_f(VIf(Bf6), VIf(Bf1), VOf(Bf1)); | |
672 __hv_fma_f(VIf(Bf5), VIf(Bf4), VIf(Bf1), VOf(Bf1)); | |
673 __hv_mul_f(VIf(Bf1), VIf(Bf1), VOf(Bf1)); | |
674 __hv_var_k_f(VOf(Bf4), 1000.0f, 1000.0f, 1000.0f, 1000.0f, 1000.0f, 1000.0f, 1000.0f, 1000.0f, 0); | |
675 __hv_var_k_f(VOf(Bf5), 50.0f, 50.0f, 50.0f, 50.0f, 50.0f, 50.0f, 50.0f, 50.0f, 0); | |
676 __hv_fma_f(VIf(Bf1), VIf(Bf4), VIf(Bf5), VOf(Bf5)); | |
677 __hv_phasor_f(&_c->sPhasor_KqGIr, VIf(Bf5), VOf(Bf5)); | |
678 __hv_var_k_f(VOf(Bf4), 0.5f, 0.5f, 0.5f, 0.5f, 0.5f, 0.5f, 0.5f, 0.5f, 0); | |
679 __hv_sub_f(VIf(Bf5), VIf(Bf4), VOf(Bf4)); | |
680 __hv_abs_f(VIf(Bf4), VOf(Bf4)); | |
681 __hv_var_k_f(VOf(Bf5), 0.25f, 0.25f, 0.25f, 0.25f, 0.25f, 0.25f, 0.25f, 0.25f, 0); | |
682 __hv_sub_f(VIf(Bf4), VIf(Bf5), VOf(Bf5)); | |
683 __hv_var_k_f(VOf(Bf4), 6.28319f, 6.28319f, 6.28319f, 6.28319f, 6.28319f, 6.28319f, 6.28319f, 6.28319f, 0); | |
684 __hv_mul_f(VIf(Bf5), VIf(Bf4), VOf(Bf4)); | |
685 __hv_mul_f(VIf(Bf4), VIf(Bf4), VOf(Bf5)); | |
686 __hv_mul_f(VIf(Bf4), VIf(Bf5), VOf(Bf1)); | |
687 __hv_mul_f(VIf(Bf1), VIf(Bf5), VOf(Bf5)); | |
688 __hv_var_k_f(VOf(Bf6), 0.00784314f, 0.00784314f, 0.00784314f, 0.00784314f, 0.00784314f, 0.00784314f, 0.00784314f, 0.00784314f, 0); | |
689 __hv_var_k_f(VOf(Bf7), 0.166667f, 0.166667f, 0.166667f, 0.166667f, 0.166667f, 0.166667f, 0.166667f, 0.166667f, 0); | |
690 __hv_mul_f(VIf(Bf1), VIf(Bf7), VOf(Bf7)); | |
691 __hv_sub_f(VIf(Bf4), VIf(Bf7), VOf(Bf7)); | |
692 __hv_fma_f(VIf(Bf5), VIf(Bf6), VIf(Bf7), VOf(Bf7)); | |
693 __hv_mul_f(VIf(Bf3), VIf(Bf7), VOf(Bf7)); | |
694 __hv_add_f(VIf(Bf7), VIf(O1), VOf(O1)); | |
695 __hv_add_f(VIf(Bf7), VIf(O0), VOf(O0)); | |
696 | |
697 // save output vars to output buffer | |
698 __hv_store_f(outputBuffers[0]+n, VIf(O0)); | |
699 __hv_store_f(outputBuffers[1]+n, VIf(O1)); | |
700 } | |
701 | |
702 Base(_c)->blockStartTimestamp = nextBlock; | |
703 | |
704 return n4; // return the number of frames processed | |
705 } | |
706 | |
707 int hv_bbb_process_inline(Hv_bbb *c, float *const inputBuffers, float *const outputBuffers, int n4) { | |
708 hv_assert(!(n4 & HV_N_SIMD_MASK)); // ensure that n4 is a multiple of HV_N_SIMD | |
709 int i = ctx_getNumInputChannels(Base(c)); | |
710 float **bIn = (float **) hv_alloca(i*sizeof(float *)); | |
711 while (i--) bIn[i] = inputBuffers+(i*n4); | |
712 | |
713 i = ctx_getNumOutputChannels(Base(c)); | |
714 float **bOut = (float **) hv_alloca(i*sizeof(float *)); | |
715 while (i--) bOut[i] = outputBuffers+(i*n4); | |
716 | |
717 int n = hv_bbb_process(c, bIn, bOut, n4); | |
718 return n; | |
719 } | |
720 | |
721 int hv_bbb_process_inline_short(Hv_bbb *c, short *const inputBuffers, short *const outputBuffers, int n4) { | |
722 hv_assert(!(n4 & HV_N_SIMD_MASK)); // ensure that n4 is a multiple of HV_N_SIMD | |
723 int numChannels = ctx_getNumInputChannels(Base(c)); | |
724 float *bIn = (float *) hv_alloca(numChannels*n4*sizeof(float)); | |
725 for (int i = 0; i < numChannels; ++i) { | |
726 for (int j = 0; j < n4; ++j) { | |
727 bIn[i*n4+j] = ((float) inputBuffers[i+numChannels*j]) * 0.00003051757813f; | |
728 } | |
729 } | |
730 | |
731 numChannels = ctx_getNumOutputChannels(Base(c)); | |
732 float *bOut = (float *) hv_alloca(numChannels*n4*sizeof(float)); | |
733 | |
734 int n = hv_bbb_process_inline(c, bIn, bOut, n4); | |
735 | |
736 for (int i = 0; i < numChannels; ++i) { | |
737 for (int j = 0; j < n4; ++j) { | |
738 outputBuffers[i+numChannels*j] = (short) (bOut[i*n4+j] * 32767.0f); | |
739 } | |
740 } | |
741 | |
742 return n; | |
743 } |