Debian Codegraph @

src/objects/hrtfmodule.c

raw
1 /**************************************************************************
2 * Copyright 2009-2018 Olivier Belanger *
3 * *
4 * self file is part of pyo, a python module to help digital signal *
5 * processing script creation. *
6 * *
7 * pyo is free software: you can redistribute it and/or modify *
8 * it under the terms of the GNU Lesser General Public License as *
9 * published by the Free Software Foundation, either version 3 of the *
10 * License, or (at your option) any later version. *
11 * *
12 * pyo is distributed in the hope that it will be useful, *
13 * but WITHOUT ANY WARRANTY; without even the implied warranty of *
14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
15 * GNU Lesser General Public License for more details. *
16 * *
17 * You should have received a copy of the GNU Lesser General Public *
18 * License along with pyo. If not, see <http://www.gnu.org/licenses/>. *
19 *************************************************************************/
20
21 #include <Python.h>
22 #include "structmember.h"
23 #include <math.h>
24 #include "pyomodule.h"
25 #include "streammodule.h"
26 #include "servermodule.h"
27 #include "dummymodule.h"
28 #include "sndfile.h"
29 #include "fft.h"
30 #include "wind.h"
31 #include "vbap.h"
32
33 /************************************************************************************************/
34 /* HRTFData streamer object */
35 /************************************************************************************************/
36 typedef struct
37 {
38 PyObject_HEAD
39 int length;
40 MYFLT hrtf_diff[14];
41 int files_per_folder[14];
42 MYFLT ***hrtf_left;
43 MYFLT ***hrtf_right;
44 MYFLT ***mag_left;
45 MYFLT ***ang_left;
46 MYFLT ***mag_right;
47 MYFLT ***ang_right;
48 } HRTFData;
49
50 static int
51 HRTFData_traverse(HRTFData *self, visitproc visit, void *arg)
52 {
53 return 0;
54 }
55
56 static int
57 HRTFData_clear(HRTFData *self)
58 {
59 return 0;
60 }
61
62 static void
63 HRTFData_dealloc(HRTFData* self)
64 {
65 int i, j;
66
67 for (i = 0; i < 14; i++)
68 {
69 int howmany = self->files_per_folder[i] * 2 - 1;
70
71 for (j = 0; j < howmany; j++)
72 {
73 PyMem_RawFree(self->hrtf_left[i][j]);
74 PyMem_RawFree(self->hrtf_right[i][j]);
75 PyMem_RawFree(self->mag_left[i][j]);
76 PyMem_RawFree(self->ang_left[i][j]);
77 PyMem_RawFree(self->mag_right[i][j]);
78 PyMem_RawFree(self->ang_right[i][j]);
79 }
80
81 PyMem_RawFree(self->hrtf_left[i]);
82 PyMem_RawFree(self->hrtf_right[i]);
83 PyMem_RawFree(self->mag_left[i]);
84 PyMem_RawFree(self->ang_left[i]);
85 PyMem_RawFree(self->mag_right[i]);
86 PyMem_RawFree(self->ang_right[i]);
87 }
88
89 PyMem_RawFree(self->hrtf_left);
90 PyMem_RawFree(self->hrtf_right);
91 PyMem_RawFree(self->mag_left);
92 PyMem_RawFree(self->ang_left);
93 PyMem_RawFree(self->mag_right);
94 PyMem_RawFree(self->ang_right);
95 HRTFData_clear(self);
96 Py_TYPE(self)->tp_free((PyObject*)self);
97 }
98
99 MYFLT ***
100 HRTFData_getHRTFLeft(HRTFData *self)
101 {
102 return (MYFLT ***)self->hrtf_left;
103 }
104
105 MYFLT ***
106 HRTFData_getHRTFRight(HRTFData *self)
107 {
108 return (MYFLT ***)self->hrtf_right;
109 }
110
111 MYFLT ***
112 HRTFData_getMagLeft(HRTFData *self)
113 {
114 return (MYFLT ***)self->mag_left;
115 }
116
117 MYFLT ***
118 HRTFData_getAngLeft(HRTFData *self)
119 {
120 return (MYFLT ***)self->ang_left;
121 }
122
123 MYFLT ***
124 HRTFData_getMagRight(HRTFData *self)
125 {
126 return (MYFLT ***)self->mag_right;
127 }
128
129 MYFLT ***
130 HRTFData_getAngRight(HRTFData *self)
131 {
132 return (MYFLT ***)self->ang_right;
133 }
134
135 MYFLT *
136 HRTFData_getHRTFDiff(HRTFData *self)
137 {
138 return (MYFLT *)self->hrtf_diff;
139 }
140
141 int HRTFData_getImpulseLength(HRTFData *self)
142 {
143 return self->length;
144 }
145
146 static PyObject *
147 HRTFData_new(PyTypeObject *type, PyObject *args, PyObject *kwds)
148 {
149 int i, j, k, howmany;
150 PyObject *impulses; // list of lists of lists of samples
151
152 HRTFData *self;
153 self = (HRTFData *)type->tp_alloc(type, 0);
154
155 /* Dataset descriptors. */
156 self->length = 128;
157 MYFLT hrtf_diff[14] = {6.5, 6.0, 5.0, 5.0, 5.0, 5.0, 5.0, 6.0, 6.5, 8.185, 10.0, 15.0, 30.0, 0.0};
158 memcpy(self->hrtf_diff, hrtf_diff, sizeof(self->hrtf_diff));
159 int files_per_folder[14] = {29, 31, 37, 37, 37, 37, 37, 31, 29, 23, 19, 13, 7, 1};
160 memcpy(self->files_per_folder, files_per_folder, sizeof(self->files_per_folder));
161
162 static char *kwlist[] = {"path", "length", NULL};
163
164 if (! PyArg_ParseTupleAndKeywords(args, kwds, "O|i", kwlist, &impulses, &self->length))
165 Py_RETURN_NONE;
166
167 /* Store HRIRs. */
168 self->hrtf_left = (MYFLT ***)PyMem_RawRealloc(self->hrtf_left, 14 * sizeof(MYFLT **));
169 self->hrtf_right = (MYFLT ***)PyMem_RawRealloc(self->hrtf_right, 14 * sizeof(MYFLT **));
170
171 for (i = 0; i < 14; i++)
172 {
173 howmany = files_per_folder[i];
174 self->hrtf_left[i] = (MYFLT **)PyMem_RawMalloc((howmany * 2 - 1) * sizeof(MYFLT *));
175 self->hrtf_right[i] = (MYFLT **)PyMem_RawMalloc((howmany * 2 - 1) * sizeof(MYFLT *));
176
177 for (j = 0; j < howmany; j++)
178 {
179 self->hrtf_left[i][j] = (MYFLT *)PyMem_RawMalloc(self->length * sizeof(MYFLT));
180 self->hrtf_right[i][j] = (MYFLT *)PyMem_RawMalloc(self->length * sizeof(MYFLT));
181
182 for (k = 0; k < self->length; k++)
183 {
184 self->hrtf_left[i][j][k] = PyFloat_AsDouble(PyList_GET_ITEM(PyList_GET_ITEM(PyList_GET_ITEM(PyList_GET_ITEM(impulses, 0), i), j), k));
185 self->hrtf_right[i][j][k] = PyFloat_AsDouble(PyList_GET_ITEM(PyList_GET_ITEM(PyList_GET_ITEM(PyList_GET_ITEM(impulses, 1), i), j), k));
186 }
187 }
188
189 for (j = 0; j < (howmany - 1); j++)
190 {
191 self->hrtf_left[i][howmany + j] = (MYFLT *)PyMem_RawMalloc(self->length * sizeof(MYFLT));
192 self->hrtf_right[i][howmany + j] = (MYFLT *)PyMem_RawMalloc(self->length * sizeof(MYFLT));
193
194 for (k = 0; k < self->length; k++)
195 {
196 self->hrtf_left[i][howmany + j][k] = self->hrtf_right[i][howmany - 2 - j][k];
197 self->hrtf_right[i][howmany + j][k] = self->hrtf_left[i][howmany - 2 - j][k];
198 }
199 }
200 }
201
202 /* Compute magnitudes and unwrapped phases for each impulse. */
203 MYFLT re, im, ma, ph;
204 int hsize = self->length / 2;
205 int n8 = self->length >> 3;
206 MYFLT outframe[self->length];
207
208 for (i = 0; i < self->length; i++)
209 {
210 outframe[i] = 0.0;
211 }
212
213 MYFLT real[hsize], imag[hsize], magn[hsize], freq[hsize];
214
215 for (i = 0; i < hsize; i++)
216 {
217 real[i] = imag[i] = magn[i] = freq[i] = 0.0;
218 }
219
220 MYFLT **twiddle = (MYFLT **)PyMem_RawMalloc(4 * sizeof(MYFLT *));
221
222 for (i = 0; i < 4; i++)
223 twiddle[i] = (MYFLT *)PyMem_RawMalloc(n8 * sizeof(MYFLT));
224
225 fft_compute_split_twiddle(twiddle, self->length);
226
227 self->mag_left = (MYFLT ***)PyMem_RawRealloc(self->mag_left, 14 * sizeof(MYFLT **));
228 self->ang_left = (MYFLT ***)PyMem_RawRealloc(self->ang_left, 14 * sizeof(MYFLT **));
229 self->mag_right = (MYFLT ***)PyMem_RawRealloc(self->mag_right, 14 * sizeof(MYFLT **));
230 self->ang_right = (MYFLT ***)PyMem_RawRealloc(self->ang_right, 14 * sizeof(MYFLT **));
231
232 for (i = 0; i < 14; i++)
233 {
234 howmany = files_per_folder[i];
235 self->mag_left[i] = (MYFLT **)PyMem_RawMalloc((howmany * 2 - 1) * sizeof(MYFLT *));
236 self->ang_left[i] = (MYFLT **)PyMem_RawMalloc((howmany * 2 - 1) * sizeof(MYFLT *));
237 self->mag_right[i] = (MYFLT **)PyMem_RawMalloc((howmany * 2 - 1) * sizeof(MYFLT *));
238 self->ang_right[i] = (MYFLT **)PyMem_RawMalloc((howmany * 2 - 1) * sizeof(MYFLT *));
239
240 for (j = 0; j < (howmany * 2 - 1); j++)
241 {
242 self->mag_left[i][j] = (MYFLT *)PyMem_RawMalloc(hsize * sizeof(MYFLT));
243 self->ang_left[i][j] = (MYFLT *)PyMem_RawMalloc(hsize * sizeof(MYFLT));
244 self->mag_right[i][j] = (MYFLT *)PyMem_RawMalloc(hsize * sizeof(MYFLT));
245 self->ang_right[i][j] = (MYFLT *)PyMem_RawMalloc(hsize * sizeof(MYFLT));
246
247 /* Left channel */
248 realfft_split(self->hrtf_left[i][j], outframe, self->length, twiddle);
249 real[0] = outframe[0];
250 imag[0] = 0.0;
251
252 for (k = 1; k < hsize; k++)
253 {
254 real[k] = outframe[k];
255 imag[k] = outframe[self->length - k];
256 }
257
258 for (k = 0; k < hsize; k++)
259 {
260 re = real[k];
261 im = imag[k];
262 ma = MYSQRT(re * re + im * im);
263 ph = MYATAN2(im, re);
264
265 while (ph > PI) ph -= TWOPI;
266
267 while (ph < -PI) ph += TWOPI;
268
269 self->mag_left[i][j][k] = ma;
270 self->ang_left[i][j][k] = ph;
271 }
272
273 /* Right channel */
274 realfft_split(self->hrtf_right[i][j], outframe, self->length, twiddle);
275 real[0] = outframe[0];
276 imag[0] = 0.0;
277
278 for (k = 1; k < hsize; k++)
279 {
280 real[k] = outframe[k];
281 imag[k] = outframe[self->length - k];
282 }
283
284 for (k = 0; k < hsize; k++)
285 {
286 re = real[k];
287 im = imag[k];
288 ma = MYSQRT(re * re + im * im);
289 ph = MYATAN2(im, re);
290
291 while (ph > PI) ph -= TWOPI;
292
293 while (ph < -PI) ph += TWOPI;
294
295 self->mag_right[i][j][k] = ma;
296 self->ang_right[i][j][k] = ph;
297 }
298 }
299 }
300
301 for (i = 0; i < 4; i++)
302 {
303 PyMem_RawFree(twiddle[i]);
304 }
305
306 PyMem_RawFree(twiddle);
307
308 return (PyObject *)self;
309 }
310
311 static PyMemberDef HRTFData_members[] =
312 {
313 {NULL} /* Sentinel */
314 };
315
316 static PyMethodDef HRTFData_methods[] =
317 {
318 {NULL} /* Sentinel */
319 };
320
321 PyTypeObject HRTFDataType =
322 {
323 PyVarObject_HEAD_INIT(NULL, 0)
324 "_pyo.HRTFData_base", /*tp_name*/
325 sizeof(HRTFData), /*tp_basicsize*/
326 0, /*tp_itemsize*/
327 (destructor)HRTFData_dealloc, /*tp_dealloc*/
328 0, /*tp_print*/
329 0, /*tp_getattr*/
330 0, /*tp_setattr*/
331 0, /*tp_as_async (tp_compare in Python 2)*/
332 0, /*tp_repr*/
333 0, /*tp_as_number*/
334 0, /*tp_as_sequence*/
335 0, /*tp_as_mapping*/
336 0, /*tp_hash */
337 0, /*tp_call*/
338 0, /*tp_str*/
339 0, /*tp_getattro*/
340 0, /*tp_setattro*/
341 0, /*tp_as_buffer*/
342 Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE | Py_TPFLAGS_HAVE_GC, /*tp_flags*/
343 "HRTFData objects. Store the HRIRs for a given set.", /* tp_doc */
344 (traverseproc)HRTFData_traverse, /* tp_traverse */
345 (inquiry)HRTFData_clear, /* tp_clear */
346 0, /* tp_richcompare */
347 0, /* tp_weaklistoffset */
348 0, /* tp_iter */
349 0, /* tp_iternext */
350 HRTFData_methods, /* tp_methods */
351 HRTFData_members, /* tp_members */
352 0, /* tp_getset */
353 0, /* tp_base */
354 0, /* tp_dict */
355 0, /* tp_descr_get */
356 0, /* tp_descr_set */
357 0, /* tp_dictoffset */
358 0, /* tp_init */
359 0, /* tp_alloc */
360 HRTFData_new, /* tp_new */
361 };
362
363
364 /************************************************************************************************/
365 /* HRTFSpat main object */
366 /************************************************************************************************/
367 typedef struct
368 {
369 pyo_audio_HEAD
370 HRTFData *hrtfdata;
371 PyObject *input;
372 Stream *input_stream;
373 PyObject *azi;
374 Stream *azi_stream;
375 PyObject *ele;
376 Stream *ele_stream;
377 int length;
378 int hrtf_count;
379 int hrtf_sample_count;
380 MYFLT hrtf_last_azi;
381 MYFLT hrtf_last_ele;
382 MYFLT *hrtf_input_tmp;
383 MYFLT **current_impulses;
384 MYFLT **previous_impulses;
385 MYFLT **twiddle;
386 int modebuffer[2];
387 MYFLT *buffer_streams;
388 } HRTFSpatter;
389
390 static void
391 HRTFSpatter_splitter(HRTFSpatter *self)
392 {
393 int i, k, hsize = self->length / 2;
394 int tmp_count, azim_index_down, azim_index_up, elev_index, elev_index_array;
395 MYFLT azi, ele, norm_elev, sig, elev_frac, elev_frac_inv;
396 MYFLT azim_frac_down, azim_frac_inv_down, azim_frac_up, azim_frac_inv_up, cross_coeff, cross_coeff_inv;
397 MYFLT magL, angL, magR, angR;
398 MYFLT inframeL[self->length], inframeR[self->length];
399 MYFLT realL[hsize], imagL[hsize], realR[hsize], imagR[hsize];
400 MYFLT *hrtf_diff = HRTFData_getHRTFDiff((HRTFData *)self->hrtfdata);
401 MYFLT ***mag_left = HRTFData_getMagLeft((HRTFData *)self->hrtfdata);
402 MYFLT ***ang_left = HRTFData_getAngLeft((HRTFData *)self->hrtfdata);
403 MYFLT ***mag_right = HRTFData_getMagRight((HRTFData *)self->hrtfdata);
404 MYFLT ***ang_right = HRTFData_getAngRight((HRTFData *)self->hrtfdata);
405
406 MYFLT *in = Stream_getData((Stream *)self->input_stream);
407
408 for (i = 0; i < self->bufsize; i++)
409 {
410 if (self->hrtf_sample_count == 0)
411 {
412 if (self->modebuffer[0])
413 azi = Stream_getData((Stream *)self->azi_stream)[i];
414 else
415 azi = PyFloat_AS_DOUBLE(self->azi);
416
417 if (self->modebuffer[1])
418 ele = Stream_getData((Stream *)self->ele_stream)[i];
419 else
420 ele = PyFloat_AS_DOUBLE(self->ele);
421
422 if (azi < 0.0f)
423 {
424 azi += 360.0f;
425 }
426
427 if (azi >= 359.9999f)
428 {
429 azi = 359.9999f;
430 }
431
432 if (ele < -39.9999f)
433 {
434 ele = -39.9999f;
435 }
436 else if (ele >= 89.9999f)
437 {
438 ele = 89.9999f;
439 }
440
441 /* Removes the chirp at 360->0 degrees azimuth boundary. */
442 if (MYFABS(self->hrtf_last_azi - azi) > 300.0f)
443 {
444 self->hrtf_last_azi = azi;
445 }
446
447 self->hrtf_last_azi = azi + (self->hrtf_last_azi - azi) * 0.5;
448 self->hrtf_last_ele = ele + (self->hrtf_last_ele - ele) * 0.5;
449
450 for (k = 0; k < self->length; k++)
451 {
452 self->previous_impulses[0][k] = self->current_impulses[0][k];
453 self->previous_impulses[1][k] = self->current_impulses[1][k];
454 }
455
456 norm_elev = self->hrtf_last_ele * 0.1f;
457 elev_index = (int)MYFLOOR(norm_elev);
458 elev_index_array = elev_index + 4;
459 elev_frac = norm_elev - elev_index;
460 elev_frac_inv = 1.0f - elev_frac;
461
462 if (norm_elev < 8.0f) // If elevation is less than 80 degrees.
463 {
464 azim_index_down = (int)(self->hrtf_last_azi / hrtf_diff[elev_index_array]);
465 azim_frac_down = (self->hrtf_last_azi / hrtf_diff[elev_index_array]) - azim_index_down;
466 azim_frac_inv_down = 1.0f - azim_frac_down;
467 azim_index_up = (int)(self->hrtf_last_azi / hrtf_diff[elev_index_array + 1]);
468 azim_frac_up = (self->hrtf_last_azi / hrtf_diff[elev_index_array + 1]) - azim_index_up;
469 azim_frac_inv_up = 1.0f - azim_frac_up;
470
471 for (k = 0; k < hsize; k++)
472 {
473 magL = elev_frac_inv *
474 (azim_frac_inv_down * mag_left[elev_index_array][azim_index_down][k] +
475 azim_frac_down * mag_left[elev_index_array][azim_index_down + 1][k]) +
476 elev_frac *
477 (azim_frac_inv_up * mag_left[elev_index_array + 1][azim_index_up][k] +
478 azim_frac_up * mag_left[elev_index_array + 1][azim_index_up + 1][k]);
479 angL = elev_frac_inv *
480 (azim_frac_inv_down * ang_left[elev_index_array][azim_index_down][k] +
481 azim_frac_down * ang_left[elev_index_array][azim_index_down + 1][k]) +
482 elev_frac *
483 (azim_frac_inv_up * ang_left[elev_index_array + 1][azim_index_up][k] +
484 azim_frac_up * ang_left[elev_index_array + 1][azim_index_up + 1][k]);
485 magR = elev_frac_inv *
486 (azim_frac_inv_down * mag_right[elev_index_array][azim_index_down][k] +
487 azim_frac_down * mag_right[elev_index_array][azim_index_down + 1][k]) +
488 elev_frac *
489 (azim_frac_inv_up * mag_right[elev_index_array + 1][azim_index_up][k] +
490 azim_frac_up * mag_right[elev_index_array + 1][azim_index_up + 1][k]);
491 angR = elev_frac_inv *
492 (azim_frac_inv_down * ang_right[elev_index_array][azim_index_down][k] +
493 azim_frac_down * ang_right[elev_index_array][azim_index_down + 1][k]) +
494 elev_frac *
495 (azim_frac_inv_up * ang_right[elev_index_array + 1][azim_index_up][k] +
496 azim_frac_up * ang_right[elev_index_array + 1][azim_index_up + 1][k]);
497 realL[k] = magL * MYCOS(angL);
498 imagL[k] = magL * MYSIN(angL);
499 realR[k] = magR * MYCOS(angR);
500 imagR[k] = magR * MYSIN(angR);
501 }
502 }
503 else // if elevation is 80 degrees or more, interpolation requires only three points (there's only one HRIR at 90 deg).
504 {
505 azim_index_down = (int)(self->hrtf_last_azi / hrtf_diff[elev_index_array]);
506 azim_frac_down = (self->hrtf_last_azi / hrtf_diff[elev_index_array]) - azim_index_down;
507 azim_frac_inv_down = 1.0f - azim_frac_down;
508
509 for (k = 0; k < hsize; k++)
510 {
511 magL = elev_frac_inv *
512 (azim_frac_inv_down * mag_left[elev_index_array][azim_index_down][k] +
513 azim_frac_down * mag_left[elev_index_array][azim_index_down + 1][k]) +
514 elev_frac * mag_left[13][0][k];
515 angL = elev_frac_inv *
516 (azim_frac_inv_down * ang_left[elev_index_array][azim_index_down][k] +
517 azim_frac_down * ang_left[elev_index_array][azim_index_down + 1][k]) +
518 elev_frac * ang_left[13][0][k];
519 magR = elev_frac_inv *
520 (azim_frac_inv_down * mag_right[elev_index_array][azim_index_down][k] +
521 azim_frac_down * mag_right[elev_index_array][azim_index_down + 1][k]) +
522 elev_frac * mag_right[13][0][k];
523 angR = elev_frac_inv *
524 (azim_frac_inv_down * ang_right[elev_index_array][azim_index_down][k] +
525 azim_frac_down * ang_right[elev_index_array][azim_index_down + 1][k]) +
526 elev_frac * ang_right[13][0][k];
527 realL[k] = magL * MYCOS(angL);
528 imagL[k] = magL * MYSIN(angL);
529 realR[k] = magR * MYCOS(angR);
530 imagR[k] = magR * MYSIN(angR);
531 }
532 }
533
534 inframeL[0] = realL[0];
535 inframeR[0] = realR[0];
536 inframeL[hsize] = 0.0;
537 inframeR[hsize] = 0.0;
538
539 for (k = 1; k < hsize; k++)
540 {
541 inframeL[k] = realL[k];
542 inframeL[self->length - k] = imagL[k];
543 inframeR[k] = realR[k];
544 inframeR[self->length - k] = imagR[k];
545 }
546
547 irealfft_split(inframeL, self->current_impulses[0], self->length, self->twiddle);
548 irealfft_split(inframeR, self->current_impulses[1], self->length, self->twiddle);
549 }
550
551 tmp_count = self->hrtf_count;
552 cross_coeff = (MYFLT)self->hrtf_sample_count / (MYFLT)self->length;
553 cross_coeff_inv = 1.0 - cross_coeff;
554 self->buffer_streams[i] = 0.0;
555 self->buffer_streams[i + self->bufsize] = 0.0;
556
557 for (k = 0; k < self->length; k++)
558 {
559 if (tmp_count < 0)
560 {
561 tmp_count += self->length;
562 }
563
564 sig = self->hrtf_input_tmp[tmp_count];
565 self->buffer_streams[i] += sig * (cross_coeff * self->current_impulses[0][k] +
566 cross_coeff_inv * self->previous_impulses[0][k]);
567 self->buffer_streams[i + self->bufsize] += sig * (cross_coeff * self->current_impulses[1][k] +
568 cross_coeff_inv * self->previous_impulses[1][k]);
569 tmp_count--;
570 }
571
572 self->hrtf_count++;
573
574 if (self->hrtf_count >= self->length)
575 {
576 self->hrtf_count = 0;
577 }
578
579 self->hrtf_input_tmp[self->hrtf_count] = in[i];
580
581 self->hrtf_sample_count += 1;
582
583 if (self->hrtf_sample_count >= self->length)
584 {
585 self->hrtf_sample_count = 0;
586 }
587 }
588 }
589
590 MYFLT *
591 HRTFSpatter_getSamplesBuffer(HRTFSpatter *self)
592 {
593 return (MYFLT *)self->buffer_streams;
594 }
595
596 static void
597 HRTFSpatter_setProcMode(HRTFSpatter *self)
598 {
599 self->proc_func_ptr = HRTFSpatter_splitter;
600 }
601
602 static void
603 HRTFSpatter_compute_next_data_frame(HRTFSpatter *self)
604 {
605 (*self->proc_func_ptr)(self);
606 }
607
608 static int
609 HRTFSpatter_traverse(HRTFSpatter *self, visitproc visit, void *arg)
610 {
611 pyo_VISIT
612 Py_VISIT(self->hrtfdata);
613 Py_VISIT(self->input);
614 Py_VISIT(self->azi);
615 Py_VISIT(self->ele);
616 return 0;
617 }
618
619 static int
620 HRTFSpatter_clear(HRTFSpatter *self)
621 {
622 pyo_CLEAR
623 Py_CLEAR(self->hrtfdata);
624 Py_CLEAR(self->input);
625 Py_CLEAR(self->azi);
626 Py_CLEAR(self->ele);
627 return 0;
628 }
629
630 static void
631 HRTFSpatter_dealloc(HRTFSpatter* self)
632 {
633 int i;
634 pyo_DEALLOC
635 PyMem_RawFree(self->buffer_streams);
636 PyMem_RawFree(self->hrtf_input_tmp);
637
638 for (i = 0; i < 2; i++)
639 {
640 PyMem_RawFree(self->current_impulses[i]);
641 PyMem_RawFree(self->previous_impulses[i]);
642 }
643
644 PyMem_RawFree(self->current_impulses);
645 PyMem_RawFree(self->previous_impulses);
646
647 for (i = 0; i < 4; i++)
648 {
649 PyMem_RawFree(self->twiddle[i]);
650 }
651
652 PyMem_RawFree(self->twiddle);
653 HRTFSpatter_clear(self);
654 Py_TYPE(self->stream)->tp_free((PyObject*)self->stream);
655 Py_TYPE(self)->tp_free((PyObject*)self);
656 }
657
658 static PyObject *
659 HRTFSpatter_new(PyTypeObject *type, PyObject *args, PyObject *kwds)
660 {
661 int i, j, k;
662 PyObject *inputtmp, *input_streamtmp, *hrtfdatatmp = NULL, *azitmp = NULL, *eletmp = NULL;
663 HRTFSpatter *self;
664 self = (HRTFSpatter *)type->tp_alloc(type, 0);
665
666 INIT_OBJECT_COMMON
667 Stream_setFunctionPtr(self->stream, HRTFSpatter_compute_next_data_frame);
668 self->mode_func_ptr = HRTFSpatter_setProcMode;
669
670 self->azi = PyFloat_FromDouble(0.0);
671 self->ele = PyFloat_FromDouble(0.0);
672 self->hrtf_sample_count = 0;
673 self->hrtf_count = 0;
674 self->hrtf_last_azi = 0.0;
675 self->hrtf_last_ele = 0.0;
676 self->modebuffer[0] = 0;
677 self->modebuffer[1] = 0;
678
679 static char *kwlist[] = {"input", "hrtfdata", "azi", "ele", NULL};
680
681 if (! PyArg_ParseTupleAndKeywords(args, kwds, "O|OOO", kwlist, &inputtmp, &hrtfdatatmp, &azitmp, &eletmp))
682 Py_RETURN_NONE;
683
684 INIT_INPUT_STREAM
685
686 self->hrtfdata = (HRTFData *)hrtfdatatmp;
687 Py_INCREF(self->hrtfdata);
688
689 self->length = HRTFData_getImpulseLength(self->hrtfdata);
690
691 if (azitmp)
692 {
693 PyObject_CallMethod((PyObject *)self, "setAzimuth", "O", azitmp);
694 }
695
696 if (eletmp)
697 {
698 PyObject_CallMethod((PyObject *)self, "setElevation", "O", eletmp);
699 }
700
701 PyObject_CallMethod(self->server, "addStream", "O", self->stream);
702
703 self->buffer_streams = (MYFLT *)PyMem_RawRealloc(self->buffer_streams, 2 * self->bufsize * sizeof(MYFLT));
704 self->hrtf_input_tmp = (MYFLT *)PyMem_RawRealloc(self->hrtf_input_tmp, self->length * sizeof(MYFLT));
705 self->current_impulses = (MYFLT **)PyMem_RawRealloc(self->current_impulses, 2 * sizeof(MYFLT *));
706 self->previous_impulses = (MYFLT **)PyMem_RawRealloc(self->previous_impulses, 2 * sizeof(MYFLT *));
707
708 for (k = 0; k < (2 * self->bufsize); k++)
709 {
710 self->buffer_streams[k] = 0.0;
711 }
712
713 for (j = 0; j < 2; j++)
714 {
715 self->current_impulses[j] = (MYFLT *)PyMem_RawMalloc(self->length * sizeof(MYFLT));
716 self->previous_impulses[j] = (MYFLT *)PyMem_RawMalloc(self->length * sizeof(MYFLT));
717
718 for (k = 0; k < self->length; k++)
719 {
720 self->current_impulses[j][k] = 0.0;
721 self->previous_impulses[j][k] = 0.0;
722 }
723 }
724
725 for (k = 0; k < self->length; k++)
726 {
727 self->hrtf_input_tmp[k] = 0.0;
728 }
729
730 int n8 = self->length >> 3;
731 self->twiddle = (MYFLT **)PyMem_RawRealloc(self->twiddle, 4 * sizeof(MYFLT *));
732
733 for (i = 0; i < 4; i++)
734 self->twiddle[i] = (MYFLT *)PyMem_RawMalloc(n8 * sizeof(MYFLT));
735
736 fft_compute_split_twiddle(self->twiddle, self->length);
737
738 (*self->mode_func_ptr)(self);
739
740 return (PyObject *)self;
741 }
742
743 static PyObject * HRTFSpatter_getServer(HRTFSpatter* self) { GET_SERVER };
744 static PyObject * HRTFSpatter_getStream(HRTFSpatter* self) { GET_STREAM };
745
746 static PyObject * HRTFSpatter_play(HRTFSpatter *self, PyObject *args, PyObject *kwds) { PLAY };
747 static PyObject * HRTFSpatter_stop(HRTFSpatter *self, PyObject *args, PyObject *kwds) { STOP };
748
749 static PyObject * HRTFSpatter_setAzimuth(HRTFSpatter *self, PyObject *arg) { SET_PARAM(self->azi, self->azi_stream, 0); }
750 static PyObject * HRTFSpatter_setElevation(HRTFSpatter *self, PyObject *arg) { SET_PARAM(self->ele, self->ele_stream, 1); }
751
752 static PyMemberDef HRTFSpatter_members[] =
753 {
754 {"server", T_OBJECT_EX, offsetof(HRTFSpatter, server), 0, "Pyo server."},
755 {"stream", T_OBJECT_EX, offsetof(HRTFSpatter, stream), 0, "Stream object."},
756 {"hrtfdata", T_OBJECT_EX, offsetof(HRTFSpatter, hrtfdata), 0, "HRIR dataset."},
757 {"input", T_OBJECT_EX, offsetof(HRTFSpatter, input), 0, "Input sound object."},
758 {"azi", T_OBJECT_EX, offsetof(HRTFSpatter, azi), 0, "Azimuth object."},
759 {"ele", T_OBJECT_EX, offsetof(HRTFSpatter, ele), 0, "Elevation object."},
760 {NULL} /* Sentinel */
761 };
762
763 static PyMethodDef HRTFSpatter_methods[] =
764 {
765 {"getServer", (PyCFunction)HRTFSpatter_getServer, METH_NOARGS, "Returns server object."},
766 {"_getStream", (PyCFunction)HRTFSpatter_getStream, METH_NOARGS, "Returns stream object."},
767 {"play", (PyCFunction)HRTFSpatter_play, METH_VARARGS | METH_KEYWORDS, "Starts computing without sending sound to soundcard."},
768 {"stop", (PyCFunction)HRTFSpatter_stop, METH_VARARGS | METH_KEYWORDS, "Stops computing."},
769 {"setAzimuth", (PyCFunction)HRTFSpatter_setAzimuth, METH_O, "Sets azimuth value between -180 and 180 degrees."},
770 {"setElevation", (PyCFunction)HRTFSpatter_setElevation, METH_O, "Sets elevation value between -40 and 90 degrees."},
771 {NULL} /* Sentinel */
772 };
773
774 PyTypeObject HRTFSpatterType =
775 {
776 PyVarObject_HEAD_INIT(NULL, 0)
777 "_pyo.HRTFSpatter_base", /*tp_name*/
778 sizeof(HRTFSpatter), /*tp_basicsize*/
779 0, /*tp_itemsize*/
780 (destructor)HRTFSpatter_dealloc, /*tp_dealloc*/
781 0, /*tp_print*/
782 0, /*tp_getattr*/
783 0, /*tp_setattr*/
784 0, /*tp_as_async (tp_compare in Python 2)*/
785 0, /*tp_repr*/
786 0, /*tp_as_number*/
787 0, /*tp_as_sequence*/
788 0, /*tp_as_mapping*/
789 0, /*tp_hash */
790 0, /*tp_call*/
791 0, /*tp_str*/
792 0, /*tp_getattro*/
793 0, /*tp_setattro*/
794 0, /*tp_as_buffer*/
795 Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE | Py_TPFLAGS_HAVE_GC, /*tp_flags*/
796 "HRTFSpatter main objects.", /* tp_doc */
797 (traverseproc)HRTFSpatter_traverse, /* tp_traverse */
798 (inquiry)HRTFSpatter_clear, /* tp_clear */
799 0, /* tp_richcompare */
800 0, /* tp_weaklistoffset */
801 0, /* tp_iter */
802 0, /* tp_iternext */
803 HRTFSpatter_methods, /* tp_methods */
804 HRTFSpatter_members, /* tp_members */
805 0, /* tp_getset */
806 0, /* tp_base */
807 0, /* tp_dict */
808 0, /* tp_descr_get */
809 0, /* tp_descr_set */
810 0, /* tp_dictoffset */
811 0, /* tp_init */
812 0, /* tp_alloc */
813 HRTFSpatter_new, /* tp_new */
814 };
815
816 /************************************************************************************************/
817 /* HRTFSpat streamer object */
818 /************************************************************************************************/
819 typedef struct
820 {
821 pyo_audio_HEAD
822 HRTFSpatter *mainSplitter;
823 int modebuffer[2];
824 int chnl; // panning order
825 } HRTF;
826
827 static void HRTF_postprocessing_ii(HRTF *self) { POST_PROCESSING_II };
828 static void HRTF_postprocessing_ai(HRTF *self) { POST_PROCESSING_AI };
829 static void HRTF_postprocessing_ia(HRTF *self) { POST_PROCESSING_IA };
830 static void HRTF_postprocessing_aa(HRTF *self) { POST_PROCESSING_AA };
831 static void HRTF_postprocessing_ireva(HRTF *self) { POST_PROCESSING_IREVA };
832 static void HRTF_postprocessing_areva(HRTF *self) { POST_PROCESSING_AREVA };
833 static void HRTF_postprocessing_revai(HRTF *self) { POST_PROCESSING_REVAI };
834 static void HRTF_postprocessing_revaa(HRTF *self) { POST_PROCESSING_REVAA };
835 static void HRTF_postprocessing_revareva(HRTF *self) { POST_PROCESSING_REVAREVA };
836
837 static void
838 HRTF_setProcMode(HRTF *self)
839 {
840 int muladdmode;
841 muladdmode = self->modebuffer[0] + self->modebuffer[1] * 10;
842
843 switch (muladdmode)
844 {
845 case 0:
846 self->muladd_func_ptr = HRTF_postprocessing_ii;
847 break;
848
849 case 1:
850 self->muladd_func_ptr = HRTF_postprocessing_ai;
851 break;
852
853 case 2:
854 self->muladd_func_ptr = HRTF_postprocessing_revai;
855 break;
856
857 case 10:
858 self->muladd_func_ptr = HRTF_postprocessing_ia;
859 break;
860
861 case 11:
862 self->muladd_func_ptr = HRTF_postprocessing_aa;
863 break;
864
865 case 12:
866 self->muladd_func_ptr = HRTF_postprocessing_revaa;
867 break;
868
869 case 20:
870 self->muladd_func_ptr = HRTF_postprocessing_ireva;
871 break;
872
873 case 21:
874 self->muladd_func_ptr = HRTF_postprocessing_areva;
875 break;
876
877 case 22:
878 self->muladd_func_ptr = HRTF_postprocessing_revareva;
879 break;
880 }
881 }
882
883 static void
884 HRTF_compute_next_data_frame(HRTF *self)
885 {
886 int i;
887 MYFLT *tmp;
888 int offset = self->chnl * self->bufsize;
889 tmp = HRTFSpatter_getSamplesBuffer((HRTFSpatter *)self->mainSplitter);
890
891 for (i = 0; i < self->bufsize; i++)
892 {
893 self->data[i] = tmp[i + offset];
894 }
895
896 (*self->muladd_func_ptr)(self);
897 }
898
899 static int
900 HRTF_traverse(HRTF *self, visitproc visit, void *arg)
901 {
902 pyo_VISIT
903 Py_VISIT(self->mainSplitter);
904 return 0;
905 }
906
907 static int
908 HRTF_clear(HRTF *self)
909 {
910 pyo_CLEAR
911 Py_CLEAR(self->mainSplitter);
912 return 0;
913 }
914
915 static void
916 HRTF_dealloc(HRTF* self)
917 {
918 pyo_DEALLOC
919 HRTF_clear(self);
920 Py_TYPE(self->stream)->tp_free((PyObject*)self->stream);
921 Py_TYPE(self)->tp_free((PyObject*)self);
922 }
923
924 static PyObject *
925 HRTF_new(PyTypeObject *type, PyObject *args, PyObject *kwds)
926 {
927 int i;
928 PyObject *maintmp = NULL, *multmp = NULL, *addtmp = NULL;
929 HRTF *self;
930 self = (HRTF *)type->tp_alloc(type, 0);
931
932 self->modebuffer[0] = 0;
933 self->modebuffer[1] = 0;
934
935 INIT_OBJECT_COMMON
936 Stream_setFunctionPtr(self->stream, HRTF_compute_next_data_frame);
937 self->mode_func_ptr = HRTF_setProcMode;
938
939 static char *kwlist[] = {"mainSplitter", "chnl", "mul", "add", NULL};
940
941 if (! PyArg_ParseTupleAndKeywords(args, kwds, "Oi|OO", kwlist, &maintmp, &self->chnl, &multmp, &addtmp))
942 Py_RETURN_NONE;
943
944 self->mainSplitter = (HRTFSpatter *)maintmp;
945 Py_INCREF(self->mainSplitter);
946
947 if (multmp)
948 {
949 PyObject_CallMethod((PyObject *)self, "setMul", "O", multmp);
950 }
951
952 if (addtmp)
953 {
954 PyObject_CallMethod((PyObject *)self, "setAdd", "O", addtmp);
955 }
956
957 PyObject_CallMethod(self->server, "addStream", "O", self->stream);
958
959 (*self->mode_func_ptr)(self);
960
961 return (PyObject *)self;
962 }
963
964 static PyObject * HRTF_getServer(HRTF* self) { GET_SERVER };
965 static PyObject * HRTF_getStream(HRTF* self) { GET_STREAM };
966 static PyObject * HRTF_setMul(HRTF *self, PyObject *arg) { SET_MUL };
967 static PyObject * HRTF_setAdd(HRTF *self, PyObject *arg) { SET_ADD };
968 static PyObject * HRTF_setSub(HRTF *self, PyObject *arg) { SET_SUB };
969 static PyObject * HRTF_setDiv(HRTF *self, PyObject *arg) { SET_DIV };
970
971 static PyObject * HRTF_play(HRTF *self, PyObject *args, PyObject *kwds) { PLAY };
972 static PyObject * HRTF_out(HRTF *self, PyObject *args, PyObject *kwds) { OUT };
973 static PyObject * HRTF_stop(HRTF *self, PyObject *args, PyObject *kwds) { STOP };
974
975 static PyObject * HRTF_multiply(HRTF *self, PyObject *arg) { MULTIPLY };
976 static PyObject * HRTF_inplace_multiply(HRTF *self, PyObject *arg) { INPLACE_MULTIPLY };
977 static PyObject * HRTF_add(HRTF *self, PyObject *arg) { ADD };
978 static PyObject * HRTF_inplace_add(HRTF *self, PyObject *arg) { INPLACE_ADD };
979 static PyObject * HRTF_sub(HRTF *self, PyObject *arg) { SUB };
980 static PyObject * HRTF_inplace_sub(HRTF *self, PyObject *arg) { INPLACE_SUB };
981 static PyObject * HRTF_div(HRTF *self, PyObject *arg) { DIV };
982 static PyObject * HRTF_inplace_div(HRTF *self, PyObject *arg) { INPLACE_DIV };
983
984 static PyMemberDef HRTF_members[] =
985 {
986 {"server", T_OBJECT_EX, offsetof(HRTF, server), 0, "Pyo server."},
987 {"stream", T_OBJECT_EX, offsetof(HRTF, stream), 0, "Stream object."},
988 {"mul", T_OBJECT_EX, offsetof(HRTF, mul), 0, "Mul factor."},
989 {"add", T_OBJECT_EX, offsetof(HRTF, add), 0, "Add factor."},
990 {NULL} /* Sentinel */
991 };
992
993 static PyMethodDef HRTF_methods[] =
994 {
995 {"getServer", (PyCFunction)HRTF_getServer, METH_NOARGS, "Returns server object."},
996 {"_getStream", (PyCFunction)HRTF_getStream, METH_NOARGS, "Returns stream object."},
997 {"play", (PyCFunction)HRTF_play, METH_VARARGS | METH_KEYWORDS, "Starts computing without sending sound to soundcard."},
998 {"out", (PyCFunction)HRTF_out, METH_VARARGS | METH_KEYWORDS, "Starts computing and sends sound to soundcard channel speficied by argument."},
999 {"stop", (PyCFunction)HRTF_stop, METH_VARARGS | METH_KEYWORDS, "Stops computing."},
1000 {"setMul", (PyCFunction)HRTF_setMul, METH_O, "Sets HRTF mul factor."},
1001 {"setAdd", (PyCFunction)HRTF_setAdd, METH_O, "Sets HRTF add factor."},
1002 {"setSub", (PyCFunction)HRTF_setSub, METH_O, "Sets inverse add factor."},
1003 {"setDiv", (PyCFunction)HRTF_setDiv, METH_O, "Sets inverse mul factor."},
1004 {NULL} /* Sentinel */
1005 };
1006
1007 static PyNumberMethods HRTF_as_number =
1008 {
1009 (binaryfunc)HRTF_add, /*nb_add*/
1010 (binaryfunc)HRTF_sub, /*nb_subtract*/
1011 (binaryfunc)HRTF_multiply, /*nb_multiply*/
1012 0, /*nb_remainder*/
1013 0, /*nb_divmod*/
1014 0, /*nb_power*/
1015 0, /*nb_neg*/
1016 0, /*nb_pos*/
1017 0, /*(unaryfunc)array_abs,*/
1018 0, /*nb_nonzero*/
1019 0, /*nb_invert*/
1020 0, /*nb_lshift*/
1021 0, /*nb_rshift*/
1022 0, /*nb_and*/
1023 0, /*nb_xor*/
1024 0, /*nb_or*/
1025 0, /*nb_int*/
1026 0, /*nb_long*/
1027 0, /*nb_float*/
1028 (binaryfunc)HRTF_inplace_add, /*inplace_add*/
1029 (binaryfunc)HRTF_inplace_sub, /*inplace_subtract*/
1030 (binaryfunc)HRTF_inplace_multiply, /*inplace_multiply*/
1031 0, /*inplace_remainder*/
1032 0, /*inplace_power*/
1033 0, /*inplace_lshift*/
1034 0, /*inplace_rshift*/
1035 0, /*inplace_and*/
1036 0, /*inplace_xor*/
1037 0, /*inplace_or*/
1038 0, /*nb_floor_divide*/
1039 (binaryfunc)HRTF_div, /*nb_true_divide*/
1040 0, /*nb_inplace_floor_divide*/
1041 (binaryfunc)HRTF_inplace_div, /*nb_inplace_true_divide*/
1042 0, /* nb_index */
1043 };
1044
1045 PyTypeObject HRTFType =
1046 {
1047 PyVarObject_HEAD_INIT(NULL, 0)
1048 "_pyo.HRTF_base", /*tp_name*/
1049 sizeof(HRTF), /*tp_basicsize*/
1050 0, /*tp_itemsize*/
1051 (destructor)HRTF_dealloc, /*tp_dealloc*/
1052 0, /*tp_print*/
1053 0, /*tp_getattr*/
1054 0, /*tp_setattr*/
1055 0, /*tp_as_async (tp_compare in Python 2)*/
1056 0, /*tp_repr*/
1057 &HRTF_as_number, /*tp_as_number*/
1058 0, /*tp_as_sequence*/
1059 0, /*tp_as_mapping*/
1060 0, /*tp_hash */
1061 0, /*tp_call*/
1062 0, /*tp_str*/
1063 0, /*tp_getattro*/
1064 0, /*tp_setattro*/
1065 0, /*tp_as_buffer*/
1066 Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE | Py_TPFLAGS_HAVE_GC, /*tp_flags*/
1067 "HRTF objects. Reads one channel from a HRTFter.", /* tp_doc */
1068 (traverseproc)HRTF_traverse, /* tp_traverse */
1069 (inquiry)HRTF_clear, /* tp_clear */
1070 0, /* tp_richcompare */
1071 0, /* tp_weaklistoffset */
1072 0, /* tp_iter */
1073 0, /* tp_iternext */
1074 HRTF_methods, /* tp_methods */
1075 HRTF_members, /* tp_members */
1076 0, /* tp_getset */
1077 0, /* tp_base */
1078 0, /* tp_dict */
1079 0, /* tp_descr_get */
1080 0, /* tp_descr_set */
1081 0, /* tp_dictoffset */
1082 0, /* tp_init */
1083 0, /* tp_alloc */
1084 HRTF_new, /* tp_new */
1085 };
1086
1087 static MYFLT BINAURAL_LEFT_HRTF_0[128] = {0.001495361328125, -0.00274658203125, 0.00384521484375, -0.005645751953125, 0.0067138671875, -0.00762939453125, 0.0091552734375, -0.00244140625, 0.25164794921875, 0.286895751953125, -0.32781982421875, -0.11444091796875, -0.044036865234375, -0.064453125, 0.348297119140625, 0.128021240234375, 0.244354248046875, 0.615478515625, 0.18951416015625, -0.406768798828125, -0.086944580078125, 0.039093017578125, -0.44964599609375, -0.373809814453125, -0.05902099609375, -0.112274169921875, -0.2093505859375, 0.0279541015625, 0.085418701171875, -0.010833740234375, 0.065460205078125, 0.149932861328125, 0.128326416015625, 0.08551025390625, 0.074798583984375, 0.000213623046875, -0.03741455078125, -0.003814697265625, 0.0484619140625, 0.002716064453125, -0.04498291015625, -0.040802001953125, -0.05401611328125, -0.08758544921875, -0.1322021484375, -0.15673828125, -0.12567138671875, -0.037139892578125, 0.0189208984375, 0.012725830078125, 0.027099609375, 0.061798095703125, 0.08172607421875, 0.06927490234375, 0.039825439453125, 0.02777099609375, 0.022369384765625, 0.00775146484375, -0.007568359375, -0.01116943359375, -0.022674560546875, -0.02850341796875, -0.024261474609375, -0.032989501953125, -0.035125732421875, -0.02197265625, -0.020355224609375, -0.024566650390625, -0.0133056640625, 0.000152587890625, -0.001190185546875, 0.003173828125, 0.015838623046875, 0.023162841796875, 0.016754150390625, 0.004302978515625, -0.00067138671875, 0.0006103515625, 0.000518798828125, -0.00396728515625, -0.0050048828125, -0.01373291015625, -0.0205078125, -0.01605224609375, -0.011871337890625, -0.010650634765625, -0.005462646484375, -0.000396728515625, -0.002685546875, -0.00579833984375, 0.00146484375, 0.01007080078125, 0.01043701171875, 0.0076904296875, 0.00341796875, -0.0009765625, -0.002838134765625, -0.003448486328125, -0.007049560546875, -0.00885009765625, -0.01025390625, -0.014923095703125, -0.015106201171875, -0.00787353515625, -0.000732421875, 0.002532958984375, 6.103515625e-05, -0.002777099609375, -0.002899169921875, -0.003326416015625, -0.00408935546875, -0.002899169921875, -0.003021240234375, -0.0045166015625, -0.00299072265625, -0.0018310546875, -0.001220703125, -0.000244140625, -0.000244140625, -0.0023193359375, -0.004180908203125, -0.003448486328125, -0.001556396484375, 0.000701904296875, 0.00189208984375, 0.000762939453125, 0.000274658203125, -0.00067138671875};
1088 static MYFLT BINAURAL_RIGHT_HRTF_0[128] = {-9.1552734375e-05, 3.0517578125e-05, 0.0, -9.1552734375e-05, 6.103515625e-05, 0.0, 6.103515625e-05, 0.000152587890625, -9.1552734375e-05, 0.0003662109375, -0.000579833984375, 0.00091552734375, -0.00115966796875, 0.00128173828125, -0.001251220703125, 0.002288818359375, 0.007598876953125, 0.104827880859375, 0.082183837890625, -0.091400146484375, 0.0135498046875, -0.01043701171875, -0.06341552734375, 0.109832763671875, 0.106414794921875, 0.074554443359375, 0.20806884765625, 0.2091064453125, -0.054840087890625, -0.069061279296875, 0.0552978515625, -0.111175537109375, -0.21051025390625, -0.06414794921875, -0.045440673828125, -0.1259765625, -0.04718017578125, 0.016204833984375, -0.008697509765625, 0.00592041015625, 0.058074951171875, 0.05810546875, 0.037506103515625, 0.05841064453125, 0.04876708984375, 0.0037841796875, 0.00311279296875, 0.024078369140625, 0.00262451171875, -0.019561767578125, -0.022857666015625, -0.03192138671875, -0.048431396484375, -0.05194091796875, -0.04083251953125, -0.03619384765625, -0.028961181640625, -0.01556396484375, -0.005462646484375, 0.0013427734375, 0.004486083984375, 0.00335693359375, -0.001434326171875, -0.00390625, -0.001312255859375, 0.003326416015625, -0.000518798828125, -0.006072998046875, -0.0037841796875, -0.0054931640625, -0.010833740234375, -0.010955810546875, -0.012359619140625, -0.013336181640625, -0.00750732421875, -0.00286865234375, -0.004302978515625, -0.00390625, 0.0008544921875, 0.001983642578125, 3.0517578125e-05, 0.0, 0.001129150390625, -0.000762939453125, -0.00408935546875, -0.005096435546875, -0.00439453125, -0.006011962890625, -0.007354736328125, -0.005340576171875, -0.004913330078125, -0.006256103515625, -0.004913330078125, -0.003509521484375, -0.004119873046875, -0.003387451171875, -0.000732421875, -0.00091552734375, -0.003509521484375, -0.002410888671875, -0.000274658203125, -0.001220703125, -0.002349853515625, -0.002105712890625, -0.003692626953125, -0.005279541015625, -0.005035400390625, -0.0045166015625, -0.00390625, -0.003204345703125, -0.003509521484375, -0.004150390625, -0.002838134765625, -0.000946044921875, -0.000457763671875, -0.001434326171875, -0.001953125, -0.00128173828125, -0.001861572265625, -0.003326416015625, -0.00341796875, -0.0035400390625, -0.004669189453125, -0.005035400390625, -0.004669189453125, -0.00445556640625, -0.0037841796875, -0.002471923828125};
1089 static MYFLT BINAURAL_LEFT_HRTF_1[128] = {0.0, -9.1552734375e-05, -9.1552734375e-05, 0.000152587890625, -6.103515625e-05, 0.0, 0.0001220703125, -0.0001220703125, 0.000396728515625, -0.00067138671875, 0.001007080078125, -0.0013427734375, 0.00152587890625, -0.001800537109375, 0.002593994140625, 0.009033203125, 0.12103271484375, 0.087799072265625, -0.11053466796875, 0.0184326171875, -0.01690673828125, -0.074676513671875, 0.132568359375, 0.116790771484375, 0.0811767578125, 0.237457275390625, 0.221466064453125, -0.079803466796875, -0.079742431640625, 0.05810546875, -0.14154052734375, -0.240325927734375, -0.063201904296875, -0.0462646484375, -0.138427734375, -0.041015625, 0.0322265625, -0.00762939453125, 0.008575439453125, 0.0657958984375, 0.060760498046875, 0.038238525390625, 0.061126708984375, 0.050537109375, -0.0001220703125, 0.001068115234375, 0.023162841796875, -0.00189208984375, -0.021484375, -0.02191162109375, -0.037628173828125, -0.05670166015625, -0.05767822265625, -0.04595947265625, -0.03436279296875, -0.02252197265625, -0.0074462890625, -0.00018310546875, 0.004302978515625, 0.0087890625, 0.007049560546875, 0.001068115234375, -0.002105712890625, -0.0009765625, 6.103515625e-05, -0.00274658203125, -0.006927490234375, -0.0072021484375, -0.00994873046875, -0.01458740234375, -0.013397216796875, -0.012847900390625, -0.011474609375, -0.006256103515625, -0.0035400390625, -0.00396728515625, -0.00360107421875, 0.000335693359375, 0.00244140625, 0.002105712890625, 0.001983642578125, 0.002166748046875, -0.0003662109375, -0.00433349609375, -0.00628662109375, -0.005035400390625, -0.006072998046875, -0.00799560546875, -0.0054931640625, -0.00421142578125, -0.005523681640625, -0.004852294921875, -0.003082275390625, -0.004241943359375, -0.004486083984375, -0.00213623046875, -0.00225830078125, -0.004669189453125, -0.002532958984375, 0.001129150390625, 0.000274658203125, -0.001922607421875, -0.002105712890625, -0.004119873046875, -0.005950927734375, -0.005218505859375, -0.004730224609375, -0.004058837890625, -0.003173828125, -0.0029296875, -0.003173828125, -0.00225830078125, -0.000762939453125, -9.1552734375e-05, -0.000701904296875, -0.001861572265625, -0.00152587890625, -0.002349853515625, -0.004119873046875, -0.004608154296875, -0.00518798828125, -0.005767822265625, -0.005615234375, -0.004119873046875, -0.003662109375, -0.003082275390625, -0.00225830078125, -0.002288818359375};
1090 static MYFLT BINAURAL_RIGHT_HRTF_1[128] = {-0.000396728515625, 0.00091552734375, -0.001617431640625, 0.0025634765625, -0.00482177734375, 0.0067138671875, -0.008453369140625, 0.00946044921875, 0.01959228515625, 0.327728271484375, 0.1124267578125, -0.35467529296875, 0.038360595703125, -0.128753662109375, 0.01007080078125, 0.373565673828125, 0.08013916015625, 0.285888671875, 0.59112548828125, 0.057159423828125, -0.4461669921875, 0.031463623046875, 0.00518798828125, -0.520355224609375, -0.30059814453125, 0.01983642578125, -0.16802978515625, -0.216217041015625, 0.092742919921875, 0.0650634765625, -0.02911376953125, 0.086151123046875, 0.1732177734375, 0.10400390625, 0.075653076171875, 0.109283447265625, -0.013031005859375, -0.080047607421875, 0.019073486328125, 0.052825927734375, -0.032928466796875, -0.04632568359375, -0.031280517578125, -0.066375732421875, -0.09326171875, -0.09796142578125, -0.132080078125, -0.1309814453125, -0.039398193359375, 0.025787353515625, 0.012725830078125, 0.026153564453125, 0.061065673828125, 0.07781982421875, 0.063507080078125, 0.037689208984375, 0.028411865234375, 0.0191650390625, 0.0018310546875, -0.006256103515625, -0.0098876953125, -0.025177001953125, -0.025604248046875, -0.022552490234375, -0.03424072265625, -0.0322265625, -0.019195556640625, -0.022857666015625, -0.027557373046875, -0.01287841796875, -0.00054931640625, -0.001220703125, 0.0057373046875, 0.017120361328125, 0.021484375, 0.013824462890625, 0.005126953125, 0.001220703125, 0.0020751953125, -0.00213623046875, -0.00531005859375, -0.004974365234375, -0.014404296875, -0.017913818359375, -0.014007568359375, -0.01220703125, -0.011688232421875, -0.0047607421875, -9.1552734375e-05, -0.004608154296875, -0.005767822265625, 0.003814697265625, 0.010223388671875, 0.008514404296875, 0.006072998046875, 0.00299072265625, -0.001739501953125, -0.002655029296875, -0.003265380859375, -0.0074462890625, -0.008880615234375, -0.009674072265625, -0.013580322265625, -0.013214111328125, -0.006103515625, 0.000244140625, 0.0015869140625, -0.001983642578125, -0.003265380859375, -0.00250244140625, -0.003570556640625, -0.003814697265625, -0.001861572265625, -0.00311279296875, -0.00469970703125, -0.00262451171875, -0.001861572265625, -0.0013427734375, 0.000457763671875, 0.000213623046875, -0.0018310546875, -0.002777099609375, -0.00225830078125, -0.001953125, -0.000457763671875, -0.0003662109375, -0.001434326171875, 0.0003662109375};
1091 static MYFLT BINAURAL_LEFT_HRTF_2[128] = {9.1552734375e-05, 9.1552734375e-05, 9.1552734375e-05, 0.000152587890625, 0.0001220703125, 0.000152587890625, 0.000152587890625, 0.0001220703125, 0.0001220703125, 9.1552734375e-05, 0.000152587890625, 0.00018310546875, 0.00018310546875, 0.000152587890625, 0.000244140625, 9.1552734375e-05, 0.000274658203125, 0.0001220703125, 0.000457763671875, 0.000213623046875, 0.00018310546875, 0.000396728515625, 0.001007080078125, -0.000213623046875, 0.00042724609375, 0.0020751953125, 0.03070068359375, 0.04376220703125, -0.002777099609375, 0.013671875, 0.00799560546875, -0.02685546875, 0.019683837890625, 0.0455322265625, 0.049652099609375, 0.0885009765625, 0.11865234375, 0.05828857421875, 0.01861572265625, 0.0484619140625, 0.002838134765625, -0.06341552734375, -0.048980712890625, -0.03704833984375, -0.0548095703125, -0.024810791015625, 0.01007080078125, 0.005157470703125, -0.0006103515625, 0.01025390625, 0.01556396484375, 0.0010986328125, -0.00714111328125, -0.01190185546875, -0.021026611328125, -0.018341064453125, -0.012908935546875, -0.0157470703125, -0.013671875, -0.006072998046875, -0.006195068359375, -0.015533447265625, -0.021484375, -0.01715087890625, -0.01123046875, -0.010650634765625, -0.00860595703125, -0.0023193359375, 0.001495361328125, 0.002410888671875, 0.001373291015625, -0.000701904296875, -0.004150390625, -0.008026123046875, -0.0089111328125, -0.00885009765625, -0.0093994140625, -0.00897216796875, -0.008575439453125, -0.008392333984375, -0.0069580078125, -0.005584716796875, -0.006011962890625, -0.00482177734375, -0.00238037109375, -0.0020751953125, -0.002532958984375, -0.00128173828125, -0.000244140625, -0.00054931640625, -0.00115966796875, -0.001617431640625, -0.002227783203125, -0.003875732421875, -0.0057373046875, -0.0067138671875, -0.0068359375, -0.00616455078125, -0.004852294921875, -0.003875732421875, -0.003936767578125, -0.003631591796875, -0.003143310546875, -0.002471923828125, -0.001983642578125, -0.00146484375, -0.000946044921875, -0.0010986328125, -0.00048828125, -0.000335693359375, -0.000823974609375, -0.00128173828125, -0.001708984375, -0.002685546875, -0.00421142578125, -0.00482177734375, -0.0052490234375, -0.0054931640625, -0.00518798828125, -0.004913330078125, -0.00445556640625, -0.00341796875, -0.0018310546875, -0.00067138671875, 0.0, 9.1552734375e-05, -0.000518798828125, -0.001129150390625};
1092 static MYFLT BINAURAL_RIGHT_HRTF_2[128] = {0.0035400390625, -0.006011962890625, 0.006072998046875, 0.04205322265625, 0.45623779296875, 0.1639404296875, -0.609344482421875, -0.19586181640625, 0.243865966796875, 0.130645751953125, 0.048248291015625, 0.598907470703125, 0.64190673828125, -0.161163330078125, -0.14251708984375, 0.108551025390625, -0.12890625, -0.248931884765625, -0.22149658203125, -0.3280029296875, -0.216064453125, -0.08770751953125, -0.0576171875, -0.04193115234375, -0.060943603515625, 0.0587158203125, 0.0606689453125, 0.04071044921875, 0.12457275390625, 0.171173095703125, 0.0845947265625, 0.038970947265625, 0.06536865234375, 0.03607177734375, -0.04351806640625, -0.12396240234375, -0.13006591796875, -0.141204833984375, -0.13751220703125, -0.1292724609375, -0.084014892578125, -0.008758544921875, 0.03460693359375, 0.038177490234375, 0.02813720703125, 0.033355712890625, 0.04345703125, 0.046722412109375, 0.0384521484375, 0.037750244140625, 0.02655029296875, 0.0018310546875, -0.00738525390625, -0.00567626953125, -0.021148681640625, -0.03851318359375, -0.04071044921875, -0.04803466796875, -0.053802490234375, -0.03619384765625, -0.010345458984375, -0.000152587890625, 0.00213623046875, 0.008636474609375, 0.01458740234375, 0.015380859375, 0.018310546875, 0.024810791015625, 0.018524169921875, 0.0028076171875, -0.004852294921875, -0.00640869140625, -0.01483154296875, -0.013580322265625, -0.004638671875, -0.00732421875, -0.014862060546875, -0.01409912109375, -0.0081787109375, -0.007354736328125, -0.00177001953125, 0.00701904296875, 0.007080078125, 0.001068115234375, -0.001678466796875, 0.000213623046875, 0.0064697265625, 0.01116943359375, 0.0086669921875, -0.0028076171875, -0.013519287109375, -0.014739990234375, -0.01239013671875, -0.0081787109375, -0.00482177734375, -0.005462646484375, -0.01202392578125, -0.0157470703125, -0.008880615234375, 0.002532958984375, 0.00787353515625, 0.003997802734375, -0.0013427734375, -0.004974365234375, -0.004241943359375, 0.000152587890625, 0.001251220703125, -0.002044677734375, -0.0078125, -0.011260986328125, -0.0107421875, -0.00677490234375, -0.00213623046875, -0.00054931640625, -0.001678466796875, -0.003936767578125, -0.001251220703125, 0.004302978515625, 0.00567626953125, 0.00445556640625, 0.002655029296875, -0.001068115234375, -0.004547119140625, -0.002838134765625, 0.001373291015625, 0.001556396484375, 0.0003662109375, -0.000518798828125};
1093 static MYFLT BINAURAL_LEFT_HRTF_3[128] = {0.0, 0.0, 3.0517578125e-05, 3.0517578125e-05, 3.0517578125e-05, 3.0517578125e-05, 0.0, 0.0, 0.0, 0.0, -3.0517578125e-05, 3.0517578125e-05, 0.0, 0.0, 9.1552734375e-05, 3.0517578125e-05, 3.0517578125e-05, 6.103515625e-05, 9.1552734375e-05, -0.0001220703125, 0.0001220703125, 0.000335693359375, -6.103515625e-05, 0.00030517578125, 0.00042724609375, 0.00030517578125, 0.00518798828125, 0.03375244140625, 0.027130126953125, -0.0166015625, -0.00537109375, 0.0194091796875, 0.010223388671875, 0.002410888671875, 0.022186279296875, 0.068359375, 0.090179443359375, 0.063018798828125, 0.0406494140625, 0.021820068359375, 0.00347900390625, -0.00848388671875, -0.027587890625, -0.013397216796875, 0.01397705078125, 0.01953125, 0.02734375, 0.028167724609375, 0.00750732421875, -0.017242431640625, -0.02508544921875, -0.031494140625, -0.043060302734375, -0.045684814453125, -0.037933349609375, -0.032135009765625, -0.0247802734375, -0.00946044921875, -0.00091552734375, 0.003814697265625, 0.010162353515625, 0.014617919921875, 0.0113525390625, 0.003875732421875, 0.00042724609375, -0.002838134765625, -0.007659912109375, -0.009674072265625, -0.009674072265625, -0.01153564453125, -0.014495849609375, -0.014404296875, -0.0140380859375, -0.014312744140625, -0.015411376953125, -0.013885498046875, -0.009735107421875, -0.00689697265625, -0.002593994140625, -0.000579833984375, -0.000152587890625, 9.1552734375e-05, -0.0003662109375, -0.001678466796875, -0.00384521484375, -0.003692626953125, -0.003265380859375, -0.00445556640625, -0.00567626953125, -0.00579833984375, -0.005096435546875, -0.004638671875, -0.00396728515625, -0.005035400390625, -0.005218505859375, -0.00396728515625, -0.00238037109375, -0.0018310546875, -0.002685546875, -0.002410888671875, -0.00323486328125, -0.003662109375, -0.002899169921875, -0.00250244140625, -0.00299072265625, -0.003692626953125, -0.004302978515625, -0.005706787109375, -0.00628662109375, -0.0054931640625, -0.0045166015625, -0.004119873046875, -0.003631591796875, -0.0030517578125, -0.003021240234375, -0.00299072265625, -0.003662109375, -0.0040283203125, -0.00347900390625, -0.00250244140625, -0.0018310546875, -0.00103759765625, -0.00030517578125, -0.0001220703125, -0.00054931640625, -0.00146484375, -0.002227783203125, -0.002960205078125};
1094 static MYFLT BINAURAL_RIGHT_HRTF_3[128] = {0.006805419921875, -0.01202392578125, 0.015869140625, -0.000701904296875, 0.4110107421875, 0.196197509765625, -0.6798095703125, -0.141845703125, 0.41094970703125, 0.067474365234375, 0.091339111328125, 0.6279296875, 0.158172607421875, -0.427703857421875, 0.192779541015625, 0.490203857421875, -0.089202880859375, -0.30572509765625, -0.111572265625, -0.240386962890625, -0.156768798828125, -0.0015869140625, -0.2349853515625, -0.29754638671875, -0.06329345703125, 0.091156005859375, 0.03997802734375, 0.03857421875, 0.137481689453125, 0.11383056640625, 0.059783935546875, 0.071990966796875, 0.016815185546875, -0.09197998046875, -0.050048828125, -0.014801025390625, -0.056060791015625, -0.09796142578125, -0.089111328125, -0.05169677734375, -0.026641845703125, 0.004974365234375, 0.0062255859375, -0.00933837890625, -0.0078125, 0.01385498046875, 0.02081298828125, 0.021240234375, 0.024444580078125, 0.0233154296875, 0.010162353515625, -0.00506591796875, -0.0040283203125, 0.001922607421875, -0.01617431640625, -0.02471923828125, -0.027374267578125, -0.036163330078125, -0.036285400390625, -0.016387939453125, -3.0517578125e-05, -0.005096435546875, -0.01068115234375, -0.003662109375, 0.00787353515625, 0.006927490234375, 0.012725830078125, 0.020233154296875, 0.01318359375, -0.002777099609375, -0.0030517578125, -0.00128173828125, -0.0089111328125, -0.006866455078125, 0.003082275390625, -0.005401611328125, -0.0162353515625, -0.0106201171875, -0.003814697265625, -0.003936767578125, 0.000701904296875, 0.00555419921875, -0.002593994140625, -0.007904052734375, -0.00390625, 0.0006103515625, 0.003082275390625, 0.0079345703125, 0.005096435546875, -0.004638671875, -0.009735107421875, -0.00579833984375, -0.00103759765625, 0.000762939453125, -0.00244140625, -0.00927734375, -0.015594482421875, -0.01458740234375, -0.00396728515625, 0.004669189453125, 0.0028076171875, -0.0050048828125, -0.009124755859375, -0.00927734375, -0.00439453125, 0.00213623046875, 0.00299072265625, -0.0037841796875, -0.0107421875, -0.012176513671875, -0.00726318359375, -0.0008544921875, 0.00244140625, 0.000579833984375, -0.003875732421875, -0.0048828125, -0.000823974609375, 0.003875732421875, 0.002899169921875, -0.000213623046875, -0.0023193359375, -0.004241943359375, -0.00457763671875, -0.00067138671875, 0.002288818359375, 0.000885009765625, -0.00140380859375, -0.002105712890625};
1095 static MYFLT BINAURAL_LEFT_HRTF_4[128] = {-9.1552734375e-05, -6.103515625e-05, -6.103515625e-05, -3.0517578125e-05, 0.0, -9.1552734375e-05, -6.103515625e-05, 9.1552734375e-05, -3.0517578125e-05, 0.0001220703125, -0.00018310546875, 0.000335693359375, -0.000518798828125, 0.00054931640625, -0.000762939453125, 0.0009765625, -0.00091552734375, 0.001800537109375, 0.001617431640625, 0.065093994140625, 0.124969482421875, -0.031524658203125, -0.102630615234375, 0.01483154296875, 0.02691650390625, -0.031829833984375, 0.1041259765625, 0.27166748046875, 0.127410888671875, -0.00421142578125, 0.064910888671875, 0.03521728515625, -0.062774658203125, -0.06097412109375, -0.08074951171875, -0.136322021484375, -0.093994140625, -0.04412841796875, -0.061431884765625, -0.054290771484375, 0.000335693359375, 0.026458740234375, 0.013153076171875, 0.038726806640625, 0.06103515625, 0.0341796875, 0.010986328125, 0.0140380859375, 0.009918212890625, -0.00494384765625, -0.008941650390625, -0.010162353515625, -0.01397705078125, -0.018280029296875, -0.02069091796875, -0.02203369140625, -0.017852783203125, -0.00634765625, 0.000335693359375, -0.00250244140625, -0.0050048828125, -0.004730224609375, -0.006439208984375, -0.009124755859375, -0.0074462890625, -0.0079345703125, -0.014556884765625, -0.016204833984375, -0.008056640625, -0.003631591796875, -0.004638671875, -0.000732421875, 0.001129150390625, -0.00201416015625, -0.003997802734375, -0.000885009765625, 0.001739501953125, -0.00115966796875, -0.00360107421875, -0.0035400390625, -0.004669189453125, -0.006103515625, -0.004547119140625, -0.003021240234375, -0.004486083984375, -0.00567626953125, -0.006591796875, -0.0087890625, -0.008636474609375, -0.00323486328125, -0.000457763671875, -0.003692626953125, -0.004791259765625, -0.003265380859375, -0.002288818359375, -0.002288818359375, -0.00140380859375, -0.00030517578125, -0.001251220703125, -0.0025634765625, -0.003814697265625, -0.005523681640625, -0.00592041015625, -0.00494384765625, -0.0052490234375, -0.00689697265625, -0.00732421875, -0.00579833984375, -0.0030517578125, -0.00030517578125, 0.000701904296875, -0.00140380859375, -0.004608154296875, -0.005340576171875, -0.003631591796875, -0.00177001953125, -0.001678466796875, -0.002838134765625, -0.0042724609375, -0.0050048828125, -0.00439453125, -0.0035400390625, -0.003082275390625, -0.00323486328125, -0.00396728515625, -0.004058837890625, -0.003082275390625, -0.00146484375};
1096 static MYFLT BINAURAL_RIGHT_HRTF_4[128] = {-0.0003662109375, 0.000762939453125, -0.000823974609375, 0.00054931640625, -0.000518798828125, 9.1552734375e-05, 9.1552734375e-05, -0.0006103515625, -3.0517578125e-05, 0.048583984375, 0.23309326171875, -0.003387451171875, -0.214019775390625, 0.074249267578125, 0.058868408203125, -0.117767333984375, 0.10491943359375, 0.393890380859375, 0.173553466796875, 0.067535400390625, 0.244873046875, 0.062957763671875, -0.1507568359375, -0.069122314453125, -0.112213134765625, -0.237060546875, -0.160003662109375, -0.129425048828125, -0.15869140625, -0.0908203125, -0.013824462890625, 0.01348876953125, 0.0216064453125, 0.0889892578125, 0.105682373046875, 0.04437255859375, 0.0323486328125, 0.03436279296875, -0.0015869140625, -0.032470703125, -0.029052734375, -0.031280517578125, -0.027618408203125, -0.038116455078125, -0.04833984375, -0.0577392578125, -0.04803466796875, -0.023773193359375, -0.020477294921875, -0.008819580078125, 0.01104736328125, 0.024200439453125, 0.024139404296875, 0.025146484375, 0.029998779296875, 0.02520751953125, 0.007476806640625, -0.00262451171875, -0.00341796875, -0.0135498046875, -0.021759033203125, -0.017364501953125, -0.016143798828125, -0.016326904296875, -0.014923095703125, -0.007354736328125, -0.003143310546875, -0.002410888671875, -0.00238037109375, -0.0015869140625, -0.000701904296875, -0.00201416015625, 0.00152587890625, 0.00421142578125, 0.000946044921875, -0.0032958984375, -0.0010986328125, -0.006622314453125, -0.014312744140625, -0.009979248046875, -0.0042724609375, -0.007232666015625, -0.00787353515625, -0.00531005859375, -0.0052490234375, -0.00469970703125, 0.001312255859375, 0.00360107421875, 0.000152587890625, 0.000518798828125, 0.002105712890625, 0.002197265625, 0.0025634765625, 0.0032958984375, 0.00091552734375, -0.002288818359375, -0.00421142578125, -0.005950927734375, -0.008087158203125, -0.009429931640625, -0.009796142578125, -0.00909423828125, -0.009521484375, -0.008819580078125, -0.00640869140625, -0.003753662109375, -0.00225830078125, -0.001800537109375, -0.00152587890625, -0.003021240234375, -0.003509521484375, -0.0029296875, -0.002655029296875, -0.003692626953125, -0.00469970703125, -0.005157470703125, -0.00457763671875, -0.003143310546875, -0.00164794921875, -0.000701904296875, -0.00054931640625, -0.0003662109375, 0.000213623046875, -0.0001220703125, -0.00054931640625, -0.000579833984375, -0.00054931640625, -0.001190185546875};
1097 static MYFLT BINAURAL_LEFT_HRTF_5[128] = {0.00042724609375, -0.000579833984375, 0.00091552734375, -0.0010986328125, 0.0009765625, -0.001251220703125, 0.00103759765625, -0.001220703125, 0.001190185546875, -0.001708984375, 0.063140869140625, 0.21466064453125, -0.026580810546875, -0.15606689453125, 0.05072021484375, 0.00238037109375, -0.07891845703125, 0.139678955078125, 0.368194580078125, 0.183746337890625, 0.087493896484375, 0.180450439453125, 0.0306396484375, -0.10345458984375, -0.078338623046875, -0.15087890625, -0.206878662109375, -0.150360107421875, -0.140655517578125, -0.13055419921875, -0.0733642578125, -0.0213623046875, 0.02044677734375, 0.035888671875, 0.083465576171875, 0.09014892578125, 0.045623779296875, 0.03179931640625, 0.021759033203125, -0.004150390625, -0.0272216796875, -0.025726318359375, -0.025604248046875, -0.025299072265625, -0.033843994140625, -0.04132080078125, -0.05926513671875, -0.05377197265625, -0.029449462890625, -0.0186767578125, -0.00469970703125, 0.00970458984375, 0.01837158203125, 0.02276611328125, 0.027984619140625, 0.031585693359375, 0.024658203125, 0.007293701171875, -0.000640869140625, -0.003082275390625, -0.01239013671875, -0.018524169921875, -0.014068603515625, -0.012725830078125, -0.014129638671875, -0.013153076171875, -0.008270263671875, -0.0059814453125, -0.004730224609375, -0.005279541015625, -0.006927490234375, -0.006561279296875, -0.00482177734375, -0.0006103515625, 0.004486083984375, 0.00335693359375, 6.103515625e-05, 0.000244140625, -0.0050048828125, -0.011016845703125, -0.0089111328125, -0.004852294921875, -0.005889892578125, -0.004669189453125, -0.004425048828125, -0.007293701171875, -0.0084228515625, -0.002532958984375, 0.002105712890625, 0.00201416015625, 0.00274658203125, 0.0020751953125, 0.0010986328125, 0.0015869140625, 0.001708984375, 0.0, -0.002197265625, -0.003875732421875, -0.00531005859375, -0.006866455078125, -0.00726318359375, -0.0078125, -0.0087890625, -0.011016845703125, -0.010986328125, -0.008331298828125, -0.0048828125, -0.00201416015625, -0.000640869140625, -0.001251220703125, -0.0032958984375, -0.00360107421875, -0.002777099609375, -0.00213623046875, -0.00201416015625, -0.0030517578125, -0.004425048828125, -0.00421142578125, -0.00286865234375, -0.00103759765625, -3.0517578125e-05, -0.000152587890625, -0.0013427734375, -0.001556396484375, -0.001373291015625, -0.001373291015625, -0.000579833984375, -0.000701904296875};
1098 static MYFLT BINAURAL_RIGHT_HRTF_5[128] = {-9.1552734375e-05, -6.103515625e-05, -3.0517578125e-05, -6.103515625e-05, -9.1552734375e-05, -0.0001220703125, 6.103515625e-05, 0.0, 0.00018310546875, -0.000213623046875, 0.000396728515625, -0.00054931640625, 0.00054931640625, -0.00079345703125, 0.001007080078125, -0.000946044921875, 0.00189208984375, 0.000946044921875, 0.0633544921875, 0.13848876953125, -0.02117919921875, -0.117889404296875, 0.003814697265625, 0.03314208984375, -0.0338134765625, 0.105743408203125, 0.300628662109375, 0.138336181640625, -0.01348876953125, 0.07281494140625, 0.044403076171875, -0.072174072265625, -0.074005126953125, -0.0826416015625, -0.14324951171875, -0.10943603515625, -0.04754638671875, -0.063079833984375, -0.0623779296875, 0.000640869140625, 0.0302734375, 0.012359619140625, 0.038330078125, 0.065093994140625, 0.04046630859375, 0.011871337890625, 0.0113525390625, 0.009521484375, -0.007720947265625, -0.00909423828125, -0.006195068359375, -0.017974853515625, -0.0269775390625, -0.026031494140625, -0.03350830078125, -0.0289306640625, -0.004241943359375, 0.009552001953125, 0.006866455078125, 0.002838134765625, 0.00677490234375, 0.0059814453125, -0.002166748046875, -0.00665283203125, -0.0108642578125, -0.014984130859375, -0.015777587890625, -0.01605224609375, -0.014434814453125, -0.008697509765625, -0.002532958984375, -0.0020751953125, -0.00653076171875, -0.004913330078125, 0.003143310546875, 0.004730224609375, 0.000640869140625, -0.00115966796875, -0.000885009765625, -0.002532958984375, -0.00457763671875, -0.003631591796875, -0.000640869140625, -0.002166748046875, -0.006317138671875, -0.008544921875, -0.011260986328125, -0.01129150390625, -0.00640869140625, -0.00274658203125, -0.004364013671875, -0.005767822265625, -0.0032958984375, -0.001922607421875, -0.00244140625, -0.000335693359375, 0.00164794921875, 0.001129150390625, -0.0013427734375, -0.003631591796875, -0.00518798828125, -0.00445556640625, -0.002960205078125, -0.003662109375, -0.00579833984375, -0.0076904296875, -0.00677490234375, -0.00433349609375, -0.001983642578125, -0.001617431640625, -0.00390625, -0.00677490234375, -0.007080078125, -0.003997802734375, -0.000946044921875, -0.00030517578125, -0.00140380859375, -0.0032958984375, -0.004364013671875, -0.003875732421875, -0.0028076171875, -0.002655029296875, -0.003631591796875, -0.0045166015625, -0.00469970703125, -0.003692626953125, -0.00164794921875, 0.000396728515625};
1099 static MYFLT BINAURAL_LEFT_HRTF_6[128] = {0.00579833984375, -0.0091552734375, 0.01190185546875, -0.01702880859375, 0.209686279296875, 0.427032470703125, -0.417877197265625, -0.456085205078125, 0.318115234375, 0.23236083984375, -0.040252685546875, 0.43212890625, 0.43597412109375, -0.326690673828125, -0.054962158203125, 0.516937255859375, 0.150665283203125, -0.31646728515625, -0.1697998046875, -0.157745361328125, -0.21533203125, -0.04119873046875, -0.146484375, -0.308349609375, -0.158721923828125, 0.059722900390625, 0.068572998046875, 0.015655517578125, 0.105560302734375, 0.13311767578125, 0.07177734375, 0.0638427734375, 0.05322265625, -0.06219482421875, -0.08642578125, -0.017120361328125, -0.0263671875, -0.08575439453125, -0.10247802734375, -0.055938720703125, -0.030303955078125, -0.006439208984375, 0.005584716796875, -0.00274658203125, -0.009613037109375, 0.0081787109375, 0.023406982421875, 0.0205078125, 0.021514892578125, 0.02667236328125, 0.01513671875, -0.005706787109375, -0.0081787109375, -0.000762939453125, -0.013946533203125, -0.02740478515625, -0.024169921875, -0.028839111328125, -0.034454345703125, -0.02239990234375, -0.00048828125, -0.0006103515625, -0.008209228515625, -0.007568359375, 0.004669189453125, 0.0078125, 0.00848388671875, 0.01751708984375, 0.016571044921875, 0.000762939453125, -0.00555419921875, 0.0, -0.00543212890625, -0.009307861328125, -0.000518798828125, -0.00201416015625, -0.015411376953125, -0.013671875, -0.0048828125, -0.003570556640625, -0.002288818359375, 0.004730224609375, 0.001007080078125, -0.006622314453125, -0.004730224609375, 0.000885009765625, 0.002899169921875, 0.005401611328125, 0.00634765625, -0.000640869140625, -0.008148193359375, -0.007415771484375, -0.0028076171875, -0.000244140625, -0.001800537109375, -0.006988525390625, -0.01312255859375, -0.01593017578125, -0.00750732421875, 0.0029296875, 0.0042724609375, -0.004547119140625, -0.00946044921875, -0.008270263671875, -0.00421142578125, 0.001708984375, 0.002716064453125, -0.00238037109375, -0.009063720703125, -0.010589599609375, -0.0081787109375, -0.00408935546875, -0.00054931640625, 0.00030517578125, -0.001861572265625, -0.004058837890625, -0.0029296875, 0.001129150390625, 0.0025634765625, 0.001220703125, -0.000518798828125, -0.0028076171875, -0.004364013671875, -0.001678466796875, 0.002655029296875, 0.002349853515625, -0.000396728515625, -0.00201416015625};
1100 static MYFLT BINAURAL_RIGHT_HRTF_6[128] = {3.0517578125e-05, 3.0517578125e-05, 3.0517578125e-05, 9.1552734375e-05, 3.0517578125e-05, 6.103515625e-05, 6.103515625e-05, 0.0, 3.0517578125e-05, 0.0, 3.0517578125e-05, 6.103515625e-05, -3.0517578125e-05, 3.0517578125e-05, 9.1552734375e-05, 3.0517578125e-05, 6.103515625e-05, 9.1552734375e-05, 0.000152587890625, -0.0001220703125, 0.000274658203125, 6.103515625e-05, 0.000335693359375, 0.000152587890625, 0.000823974609375, 0.002197265625, 0.031494140625, 0.041015625, -0.01324462890625, -0.01690673828125, 0.0194091796875, 0.013671875, -0.00091552734375, 0.015838623046875, 0.069793701171875, 0.099456787109375, 0.059783935546875, 0.027069091796875, 0.028656005859375, 0.02667236328125, 0.00360107421875, -0.02874755859375, -0.039581298828125, -0.036041259765625, -0.02056884765625, 0.00592041015625, 0.017730712890625, 0.025238037109375, 0.034210205078125, 0.016998291015625, -0.007537841796875, -0.005706787109375, -0.010894775390625, -0.03570556640625, -0.0455322265625, -0.033660888671875, -0.02349853515625, -0.0238037109375, -0.016448974609375, -0.006561279296875, -0.001861572265625, 0.001068115234375, 0.002044677734375, 0.000335693359375, 0.001251220703125, 0.00372314453125, 0.000762939453125, -0.00360107421875, -0.0045166015625, -0.0048828125, -0.0084228515625, -0.010772705078125, -0.0115966796875, -0.014190673828125, -0.01617431640625, -0.01556396484375, -0.01190185546875, -0.008636474609375, -0.007110595703125, -0.004913330078125, -0.003387451171875, -0.002655029296875, -0.0028076171875, -0.0020751953125, -0.000396728515625, 0.000732421875, 0.000213623046875, -0.00213623046875, -0.004150390625, -0.0035400390625, -0.00286865234375, -0.004241943359375, -0.0052490234375, -0.0052490234375, -0.005157470703125, -0.00482177734375, -0.00396728515625, -0.00360107421875, -0.0045166015625, -0.005340576171875, -0.004791259765625, -0.003387451171875, -0.002471923828125, -0.00189208984375, -0.001312255859375, -0.00225830078125, -0.0042724609375, -0.0059814453125, -0.005950927734375, -0.005035400390625, -0.00457763671875, -0.00396728515625, -0.003875732421875, -0.003814697265625, -0.00372314453125, -0.0040283203125, -0.004119873046875, -0.003326416015625, -0.00201416015625, -0.00128173828125, -0.00103759765625, -0.000762939453125, 0.000152587890625, 0.000701904296875, -9.1552734375e-05, -0.001495361328125, -0.00299072265625, -0.0037841796875};
1101 static MYFLT BINAURAL_LEFT_HRTF_7[128] = {-0.000640869140625, 0.0006103515625, -0.004058837890625, 0.128021240234375, 0.530426025390625, -0.12567138671875, -0.65423583984375, 0.032745361328125, 0.281463623046875, 0.0323486328125, 0.185272216796875, 0.778167724609375, 0.32952880859375, -0.30596923828125, 0.014068603515625, 0.102630615234375, -0.184295654296875, -0.231048583984375, -0.2530517578125, -0.313446044921875, -0.14556884765625, -0.06707763671875, -0.0531005859375, -0.100799560546875, -0.052978515625, 0.089080810546875, 0.0408935546875, 0.04644775390625, 0.149810791015625, 0.152130126953125, 0.058624267578125, 0.062896728515625, 0.071441650390625, 0.01861572265625, -0.07958984375, -0.131378173828125, -0.123199462890625, -0.13909912109375, -0.143157958984375, -0.12640380859375, -0.053985595703125, 0.011962890625, 0.03924560546875, 0.033477783203125, 0.024444580078125, 0.033660888671875, 0.047393798828125, 0.0447998046875, 0.037200927734375, 0.036834716796875, 0.016357421875, -0.003143310546875, -0.0047607421875, -0.0091552734375, -0.0302734375, -0.0413818359375, -0.04266357421875, -0.051361083984375, -0.049224853515625, -0.02703857421875, -0.00579833984375, -0.0018310546875, 0.002044677734375, 0.010833740234375, 0.01568603515625, 0.01422119140625, 0.02081298828125, 0.028106689453125, 0.01483154296875, -0.001708984375, -0.003631591796875, -0.007904052734375, -0.016632080078125, -0.010162353515625, -0.0035400390625, -0.0111083984375, -0.017486572265625, -0.013275146484375, -0.0084228515625, -0.006317138671875, 0.002349853515625, 0.009033203125, 0.004638671875, -0.000518798828125, -0.0008544921875, 0.002288818359375, 0.00762939453125, 0.010223388671875, 0.004791259765625, -0.007568359375, -0.01470947265625, -0.01336669921875, -0.01007080078125, -0.006500244140625, -0.004486083984375, -0.00750732421875, -0.014739990234375, -0.01580810546875, -0.005218505859375, 0.005706787109375, 0.006378173828125, 0.000946044921875, -0.003448486328125, -0.005462646484375, -0.003143310546875, 0.001251220703125, 0.000823974609375, -0.003936767578125, -0.009246826171875, -0.0120849609375, -0.00994873046875, -0.00506591796875, -0.0009765625, -0.00079345703125, -0.003265380859375, -0.004425048828125, -0.00030517578125, 0.0047607421875, 0.00482177734375, 0.004119873046875, 0.00164794921875, -0.0025634765625, -0.003936767578125, -0.00067138671875, 0.0023193359375, 0.0008544921875, -0.001312255859375, -0.002960205078125};
1102 static MYFLT BINAURAL_RIGHT_HRTF_7[128] = {0.0, 0.0, 0.0, 0.0, 3.0517578125e-05, 6.103515625e-05, 6.103515625e-05, 3.0517578125e-05, 6.103515625e-05, 0.0, -3.0517578125e-05, 3.0517578125e-05, 0.0, -3.0517578125e-05, 9.1552734375e-05, 3.0517578125e-05, -3.0517578125e-05, 0.00018310546875, -0.00018310546875, 0.00042724609375, -3.0517578125e-05, 0.000152587890625, 0.000396728515625, 0.000396728515625, -0.0001220703125, 6.103515625e-05, 0.000823974609375, 0.01776123046875, 0.044921875, 0.0125732421875, 0.004150390625, 0.01123046875, -0.017242431640625, 0.0166015625, 0.04168701171875, 0.03369140625, 0.06707763671875, 0.118255615234375, 0.08856201171875, 0.030517578125, 0.041107177734375, 0.021148681640625, -0.046417236328125, -0.05108642578125, -0.01947021484375, -0.027496337890625, -0.0299072265625, -0.01727294921875, -0.01885986328125, -0.018218994140625, -0.005889892578125, -0.002471923828125, -0.0189208984375, -0.02227783203125, -0.010528564453125, -0.008697509765625, -0.01123046875, -0.004669189453125, 0.001007080078125, 0.0023193359375, 0.004364013671875, 0.000213623046875, -0.0103759765625, -0.01715087890625, -0.0169677734375, -0.01544189453125, -0.017181396484375, -0.0146484375, -0.00909423828125, -0.00665283203125, -0.004180908203125, -0.003204345703125, -0.00335693359375, -0.00537109375, -0.006103515625, -0.004302978515625, -0.003936767578125, -0.0057373046875, -0.00653076171875, -0.0054931640625, -0.00592041015625, -0.006317138671875, -0.00634765625, -0.006805419921875, -0.00604248046875, -0.005279541015625, -0.004364013671875, -0.004058837890625, -0.0029296875, -0.001312255859375, -0.001617431640625, -0.002044677734375, -0.00244140625, -0.00250244140625, -0.00390625, -0.005889892578125, -0.005767822265625, -0.005157470703125, -0.004547119140625, -0.004119873046875, -0.003936767578125, -0.003814697265625, -0.00384521484375, -0.003082275390625, -0.003448486328125, -0.00323486328125, -0.002227783203125, -0.001312255859375, -0.000518798828125, -0.00067138671875, -0.000457763671875, -0.000946044921875, -0.0010986328125, -0.001983642578125, -0.0037841796875, -0.004974365234375, -0.00604248046875, -0.00604248046875, -0.006011962890625, -0.005462646484375, -0.0050048828125, -0.0040283203125, -0.00262451171875, -0.002105712890625, -0.0010986328125, -0.000457763671875, -0.000579833984375, -0.001312255859375};
1103 static MYFLT BINAURAL_LEFT_HRTF_8[128] = {0.00067138671875, -0.000579833984375, 0.001068115234375, -0.00225830078125, 0.00244140625, -0.004058837890625, 0.0054931640625, -0.007049560546875, 0.009246826171875, -0.0103759765625, 0.11614990234375, 0.259857177734375, 0.13519287109375, -0.340484619140625, -0.746337890625, 0.013397216796875, 0.544158935546875, 0.63995361328125, 0.60418701171875, 0.061553955078125, -0.182159423828125, -0.04443359375, 0.049713134765625, -0.14599609375, -0.23565673828125, -0.29925537109375, -0.24700927734375, -0.080291748046875, -0.081817626953125, -0.063232421875, -0.051513671875, 0.0032958984375, 0.054229736328125, 0.082366943359375, 0.1126708984375, 0.080596923828125, 0.078094482421875, 0.07037353515625, 0.0399169921875, -0.00341796875, -0.011566162109375, -0.0296630859375, -0.034820556640625, -0.06304931640625, -0.0843505859375, -0.04620361328125, -0.04388427734375, -0.035491943359375, -0.003631591796875, 0.01824951171875, 0.029449462890625, 0.03179931640625, -0.008026123046875, -0.000274658203125, 0.021697998046875, 0.016510009765625, 0.042388916015625, 0.030731201171875, -0.0113525390625, -0.025177001953125, -0.007110595703125, -0.01806640625, -0.0648193359375, -0.075042724609375, -0.04736328125, -0.0330810546875, -0.033905029296875, -0.025726318359375, -0.009307861328125, 0.017120361328125, 0.032745361328125, 0.02630615234375, 0.016143798828125, 0.008331298828125, 0.011016845703125, 0.013031005859375, 0.001739501953125, -0.0106201171875, -0.0147705078125, -0.018310546875, -0.015838623046875, -0.008636474609375, -0.006683349609375, -0.0093994140625, -0.015655517578125, -0.014129638671875, -0.009063720703125, -0.003265380859375, 0.00341796875, 0.010101318359375, 0.01019287109375, 0.00604248046875, 0.00286865234375, 0.000885009765625, 0.003326416015625, 0.003662109375, -0.001495361328125, -0.010284423828125, -0.014862060546875, -0.014312744140625, -0.011322021484375, -0.009033203125, -0.0101318359375, -0.01068115234375, -0.007781982421875, -0.003814697265625, 0.0006103515625, 0.002288818359375, 0.002166748046875, 0.002685546875, 0.000885009765625, -0.00164794921875, -0.002655029296875, -0.00390625, -0.00439453125, -0.00347900390625, -0.003143310546875, -0.003326416015625, -0.0032958984375, -0.002777099609375, -0.002685546875, -0.002197265625, -0.001861572265625, -0.0008544921875, 6.103515625e-05, 0.000457763671875, 0.001190185546875, 0.00152587890625};
1104 static MYFLT BINAURAL_RIGHT_HRTF_8[128] = {-3.0517578125e-05, -6.103515625e-05, -9.1552734375e-05, -3.0517578125e-05, 3.0517578125e-05, 3.0517578125e-05, -3.0517578125e-05, -3.0517578125e-05, 3.0517578125e-05, 0.0, 3.0517578125e-05, 0.0, -0.000152587890625, 0.000152587890625, -0.00048828125, 0.000762939453125, -0.0010986328125, 0.001190185546875, 0.003509521484375, 0.056243896484375, 0.0802001953125, 0.0343017578125, -0.110626220703125, -0.216156005859375, -0.064453125, 0.099761962890625, 0.25018310546875, 0.28179931640625, 0.1346435546875, 0.02618408203125, 0.028656005859375, 0.028656005859375, -0.019989013671875, -0.056854248046875, -0.105316162109375, -0.095550537109375, -0.07025146484375, -0.077239990234375, -0.060760498046875, -0.048187255859375, -0.032257080078125, -0.000335693359375, 0.02459716796875, 0.037353515625, 0.041778564453125, 0.04583740234375, 0.05291748046875, 0.05401611328125, 0.0343017578125, 0.00384521484375, -0.00933837890625, -0.0029296875, -0.017578125, -0.0350341796875, -0.034027099609375, -0.030029296875, -0.02801513671875, -0.019775390625, -0.014801025390625, -0.00982666015625, -0.002838134765625, -0.006011962890625, 0.009765625, 0.028289794921875, 0.018829345703125, 0.007080078125, 0.010955810546875, 0.007049560546875, -0.007720947265625, -0.018524169921875, -0.024322509765625, -0.025665283203125, -0.023193359375, -0.0216064453125, -0.0223388671875, -0.02081298828125, -0.0140380859375, -0.009796142578125, -0.00958251953125, -0.00732421875, -0.00335693359375, -0.003387451171875, -0.007354736328125, -0.006072998046875, -0.00433349609375, -0.004638671875, -0.005279541015625, -0.004058837890625, -0.004425048828125, -0.006591796875, -0.006988525390625, -0.006011962890625, -0.00494384765625, -0.005615234375, -0.006011962890625, -0.004547119140625, -0.001983642578125, -0.00067138671875, 0.00018310546875, 0.00067138671875, -9.1552734375e-05, -0.000518798828125, -0.000946044921875, -0.00091552734375, -0.000762939453125, -0.002288818359375, -0.004241943359375, -0.005340576171875, -0.005096435546875, -0.0057373046875, -0.006622314453125, -0.00616455078125, -0.0045166015625, -0.002960205078125, -0.00213623046875, -0.001708984375, -0.002105712890625, -0.001617431640625, -0.001068115234375, -0.000701904296875, -0.000946044921875, -0.00225830078125, -0.00347900390625, -0.00341796875, -0.002716064453125, -0.00225830078125, -0.001739501953125, -0.00250244140625};
1105 static MYFLT BINAURAL_LEFT_HRTF_9[128] = {-9.1552734375e-05, -9.1552734375e-05, 0.0, 3.0517578125e-05, 6.103515625e-05, -6.103515625e-05, -6.103515625e-05, 0.00018310546875, -9.1552734375e-05, 0.000152587890625, -9.1552734375e-05, -0.000213623046875, 9.1552734375e-05, -0.00048828125, 0.000946044921875, -0.001190185546875, 0.00140380859375, 0.005889892578125, 0.073211669921875, 0.08807373046875, 0.02117919921875, -0.152374267578125, -0.238494873046875, -0.027801513671875, 0.136932373046875, 0.29473876953125, 0.3055419921875, 0.113311767578125, 0.00616455078125, 0.028564453125, 0.02447509765625, -0.032989501953125, -0.073760986328125, -0.128448486328125, -0.10723876953125, -0.07373046875, -0.080047607421875, -0.06463623046875, -0.049560546875, -0.023651123046875, 0.005218505859375, 0.026092529296875, 0.0479736328125, 0.056915283203125, 0.051544189453125, 0.049713134765625, 0.04754638671875, 0.02935791015625, -0.004730224609375, -0.023193359375, -0.0057373046875, -0.016510009765625, -0.034637451171875, -0.031158447265625, -0.025726318359375, -0.02142333984375, -0.0137939453125, -0.012908935546875, -0.011444091796875, 0.00079345703125, -0.0013427734375, 0.008148193359375, 0.029296875, 0.022918701171875, 0.004913330078125, 0.004058837890625, 0.004180908203125, -0.005340576171875, -0.01873779296875, -0.02764892578125, -0.027008056640625, -0.02294921875, -0.02227783203125, -0.021575927734375, -0.02081298828125, -0.017608642578125, -0.01153564453125, -0.007659912109375, -0.002685546875, -0.0009765625, -0.003509521484375, -0.008758544921875, -0.007049560546875, -0.0010986328125, -0.0032958984375, -0.007049560546875, -0.00482177734375, -0.00390625, -0.006256103515625, -0.005706787109375, -0.005859375, -0.0078125, -0.007476806640625, -0.00604248046875, -0.0042724609375, -0.003814697265625, -0.00238037109375, 0.00152587890625, 0.002471923828125, 0.001495361328125, -0.000518798828125, -0.00146484375, -0.000396728515625, 0.000274658203125, -0.0009765625, -0.00408935546875, -0.00567626953125, -0.0054931640625, -0.005950927734375, -0.0068359375, -0.0064697265625, -0.005157470703125, -0.00457763671875, -0.0030517578125, -0.001556396484375, -0.001678466796875, -0.00103759765625, -0.0008544921875, -0.000579833984375, -0.0009765625, -0.00238037109375, -0.003692626953125, -0.00335693359375, -0.00189208984375, -0.001190185546875, -0.0008544921875, -0.002593994140625, -0.004302978515625};
1106 static MYFLT BINAURAL_RIGHT_HRTF_9[128] = {0.000244140625, 0.000152587890625, 0.0, 0.00018310546875, -0.0013427734375, 0.00140380859375, -0.00286865234375, 0.0045166015625, -0.00628662109375, 0.008575439453125, -0.003143310546875, 0.16748046875, 0.234466552734375, 0.03997802734375, -0.459197998046875, -0.6162109375, 0.202545166015625, 0.53826904296875, 0.634552001953125, 0.4959716796875, -0.03814697265625, -0.187744140625, -0.003631591796875, 0.018096923828125, -0.163238525390625, -0.224884033203125, -0.292327880859375, -0.173248291015625, -0.062225341796875, -0.090240478515625, -0.062774658203125, -0.05364990234375, 0.00433349609375, 0.063446044921875, 0.095611572265625, 0.093292236328125, 0.07318115234375, 0.088348388671875, 0.066864013671875, 0.0213623046875, -0.004364013671875, -0.005767822265625, -0.037078857421875, -0.04315185546875, -0.063140869140625, -0.0694580078125, -0.04840087890625, -0.04266357421875, -0.023345947265625, -0.001068115234375, 0.014984130859375, 0.02838134765625, 0.030792236328125, -0.0106201171875, -0.00738525390625, 0.01824951171875, 0.02899169921875, 0.050445556640625, 0.02947998046875, -0.011383056640625, -0.01812744140625, -0.006561279296875, -0.02191162109375, -0.0614013671875, -0.079864501953125, -0.065216064453125, -0.034637451171875, -0.025146484375, -0.03045654296875, -0.0108642578125, 0.024627685546875, 0.036590576171875, 0.0234375, 0.0150146484375, 0.010894775390625, 0.0108642578125, 0.008819580078125, -0.00042724609375, -0.01080322265625, -0.014892578125, -0.0159912109375, -0.013946533203125, -0.009368896484375, -0.007659912109375, -0.010528564453125, -0.01580810546875, -0.015625, -0.009490966796875, -0.001739501953125, 0.0047607421875, 0.010101318359375, 0.009033203125, 0.0059814453125, 0.00250244140625, 0.001007080078125, 0.003387451171875, 0.002044677734375, -0.00439453125, -0.01214599609375, -0.0146484375, -0.01373291015625, -0.010986328125, -0.008453369140625, -0.008514404296875, -0.00775146484375, -0.0057373046875, -0.0030517578125, 0.000274658203125, 0.002288818359375, 0.00244140625, 0.00164794921875, -0.000152587890625, -0.002105712890625, -0.002532958984375, -0.003997802734375, -0.005584716796875, -0.00567626953125, -0.004241943359375, -0.002044677734375, -0.002197265625, -0.003082275390625, -0.002838134765625, -0.00177001953125, -0.000946044921875, -6.103515625e-05, 0.000213623046875, 0.000213623046875, 0.000885009765625};
1107 static MYFLT BINAURAL_LEFT_HRTF_10[128] = {0.0, 0.0, 0.0, 0.0, 0.0, 3.0517578125e-05, 3.0517578125e-05, -6.103515625e-05, -3.0517578125e-05, -6.103515625e-05, -3.0517578125e-05, 0.0, 0.0, -3.0517578125e-05, -9.1552734375e-05, -6.103515625e-05, 0.0, 0.0001220703125, 9.1552734375e-05, -9.1552734375e-05, -6.103515625e-05, -3.0517578125e-05, 0.000640869140625, 0.0, -0.00048828125, 0.001312255859375, 0.023193359375, 0.04345703125, 0.046966552734375, -0.04119873046875, -0.145843505859375, -0.075103759765625, 0.052764892578125, 0.128265380859375, 0.1397705078125, 0.097991943359375, 0.0562744140625, 0.051483154296875, 0.05914306640625, 0.0384521484375, 0.01580810546875, -0.000885009765625, -0.014801025390625, -0.035552978515625, -0.04632568359375, -0.044830322265625, -0.050506591796875, -0.045745849609375, -0.03399658203125, -0.013885498046875, -0.007659912109375, -0.009613037109375, 0.01373291015625, 0.0303955078125, 0.02484130859375, 0.020782470703125, 0.020904541015625, 0.011993408203125, 0.001922607421875, -0.003143310546875, -0.017669677734375, -0.0301513671875, -0.027435302734375, -0.018310546875, -0.015289306640625, -0.013458251953125, -0.00848388671875, -0.003875732421875, -0.00262451171875, -0.006439208984375, -0.00311279296875, -0.00018310546875, -0.0047607421875, -0.00738525390625, -0.00390625, -0.002685546875, -0.007598876953125, -0.013153076171875, -0.01409912109375, -0.01019287109375, -0.007659912109375, -0.0079345703125, -0.008392333984375, -0.007293701171875, -0.007171630859375, -0.008087158203125, -0.0081787109375, -0.006744384765625, -0.006256103515625, -0.007720947265625, -0.0091552734375, -0.0091552734375, -0.008392333984375, -0.009368896484375, -0.0096435546875, -0.007843017578125, -0.0045166015625, -0.001312255859375, -6.103515625e-05, -0.000335693359375, -0.001220703125, -0.001495361328125, -0.002349853515625, -0.003387451171875, -0.0040283203125, -0.004425048828125, -0.004180908203125, -0.003936767578125, -0.003692626953125, -0.0035400390625, -0.003173828125, -0.002288818359375, -0.0015869140625, -0.001434326171875, -0.00146484375, -0.00164794921875, -0.00213623046875, -0.00299072265625, -0.0030517578125, -0.002685546875, -0.0028076171875, -0.00323486328125, -0.0037841796875, -0.00439453125, -0.0047607421875, -0.0040283203125, -0.002899169921875, -0.001800537109375};
1108 static MYFLT BINAURAL_RIGHT_HRTF_10[128] = {-0.0009765625, 0.00103759765625, -0.002288818359375, 0.00360107421875, -0.005584716796875, 0.007843017578125, -0.01220703125, 0.12078857421875, 0.3291015625, 0.140960693359375, -0.6568603515625, -0.626007080078125, 0.440826416015625, 0.541961669921875, 0.38568115234375, 0.331634521484375, 0.094818115234375, -0.006256103515625, 0.082733154296875, 0.1693115234375, -0.1680908203125, -0.297149658203125, -0.2236328125, -0.204620361328125, -0.228668212890625, -0.15777587890625, -0.089599609375, -0.129791259765625, -0.040130615234375, 0.05633544921875, 0.123809814453125, 0.06292724609375, 0.10797119140625, 0.14691162109375, 0.079803466796875, 0.05908203125, 0.059295654296875, 0.006378173828125, -0.042022705078125, -0.01922607421875, -0.0655517578125, -0.10614013671875, -0.09002685546875, -0.051788330078125, -0.049774169921875, -0.040252685546875, 0.0025634765625, 0.024169921875, 0.020904541015625, 0.0103759765625, 0.028350830078125, 0.03424072265625, 0.01507568359375, 0.009124755859375, -0.012664794921875, -0.043304443359375, -0.05010986328125, -0.029083251953125, -0.029266357421875, -0.02813720703125, -0.01275634765625, -0.00640869140625, -0.00531005859375, -0.00091552734375, 0.0079345703125, 0.007476806640625, 0.00335693359375, -0.0028076171875, -0.0035400390625, -0.0126953125, -0.012786865234375, 0.00018310546875, 0.00689697265625, -0.003509521484375, -0.008575439453125, -0.003204345703125, -0.004364013671875, -0.005096435546875, 0.000640869140625, 0.003021240234375, -0.003265380859375, -0.00604248046875, -0.00494384765625, -0.00390625, 0.0013427734375, 0.006927490234375, 0.00347900390625, -0.00518798828125, -0.00830078125, -0.0072021484375, -0.006591796875, -0.000732421875, -0.00042724609375, -0.007080078125, -0.012054443359375, -0.007568359375, -0.003387451171875, -0.001434326171875, -0.001373291015625, -0.003448486328125, -0.00347900390625, -0.00323486328125, -0.001678466796875, -0.00079345703125, -0.001983642578125, -0.003753662109375, -0.003387451171875, -0.004730224609375, -0.005340576171875, -0.005340576171875, -0.005035400390625, -0.00555419921875, -0.005859375, -0.005126953125, -0.004241943359375, -0.0029296875, -0.001708984375, -0.000579833984375, 0.000579833984375, 0.000640869140625, 0.00067138671875, 0.00128173828125, 0.00146484375, 0.000457763671875, -0.001190185546875, -0.002166748046875, -0.001983642578125, -0.001129150390625};
1109 static MYFLT BINAURAL_LEFT_HRTF_11[128] = {9.1552734375e-05, 0.0, -3.0517578125e-05, -6.103515625e-05, -6.103515625e-05, 3.0517578125e-05, 3.0517578125e-05, -3.0517578125e-05, -6.103515625e-05, -6.103515625e-05, 0.0, 9.1552734375e-05, -3.0517578125e-05, 0.0, -0.000213623046875, 0.0, -0.000335693359375, 0.000274658203125, -0.000213623046875, 0.0003662109375, 0.002044677734375, 0.0458984375, 0.10699462890625, 0.015899658203125, -0.16741943359375, -0.182647705078125, -0.01190185546875, 0.1597900390625, 0.22943115234375, 0.166412353515625, 0.06201171875, 0.050384521484375, 0.07550048828125, 0.0445556640625, -0.0128173828125, -0.03173828125, -0.0445556640625, -0.07012939453125, -0.07684326171875, -0.069305419921875, -0.063934326171875, -0.058135986328125, -0.040313720703125, -0.018646240234375, -0.018096923828125, -0.002655029296875, 0.03839111328125, 0.061004638671875, 0.058197021484375, 0.03564453125, 0.032806396484375, 0.026458740234375, 0.007537841796875, -0.00518798828125, -0.02899169921875, -0.04559326171875, -0.03399658203125, -0.01544189453125, -0.02044677734375, -0.028778076171875, -0.020294189453125, -0.005401611328125, -0.0010986328125, -0.000640869140625, 0.0009765625, -3.0517578125e-05, 0.002166748046875, 0.002532958984375, 0.0013427734375, 0.003082275390625, 0.00360107421875, -0.000152587890625, -0.006927490234375, -0.011810302734375, -0.01031494140625, -0.0106201171875, -0.0166015625, -0.02099609375, -0.024017333984375, -0.01824951171875, -0.00787353515625, -0.00518798828125, -0.005950927734375, -0.004913330078125, 0.00018310546875, 0.00323486328125, 0.002288818359375, 0.000579833984375, -0.003021240234375, -0.006378173828125, -0.005859375, -0.005615234375, -0.0074462890625, -0.008026123046875, -0.00714111328125, -0.00640869140625, -0.006805419921875, -0.007568359375, -0.00714111328125, -0.00543212890625, -0.003326416015625, -0.0015869140625, -0.001190185546875, -0.001312255859375, -0.001068115234375, -0.000762939453125, -0.0006103515625, -0.00128173828125, -0.002716064453125, -0.003814697265625, -0.004791259765625, -0.005157470703125, -0.00518798828125, -0.004150390625, -0.002471923828125, -0.001312255859375, -0.00146484375, -0.001861572265625, -0.001983642578125, -0.00189208984375, -0.001708984375, -0.002197265625, -0.002532958984375, -0.002593994140625, -0.00250244140625, -0.002777099609375, -0.004119873046875, -0.005126953125};
1110 static MYFLT BINAURAL_RIGHT_HRTF_11[128] = {0.0, 0.00030517578125, 0.0, -3.0517578125e-05, -0.0003662109375, -9.1552734375e-05, -0.0001220703125, 3.0517578125e-05, -0.00030517578125, 0.00042724609375, -0.0008544921875, 0.056854248046875, 0.216644287109375, 0.092559814453125, -0.3140869140625, -0.3426513671875, -0.055755615234375, 0.27032470703125, 0.500152587890625, 0.328948974609375, 0.0279541015625, 0.0081787109375, 0.152374267578125, 0.106201171875, -0.1065673828125, -0.159271240234375, -0.1256103515625, -0.1507568359375, -0.154327392578125, -0.1072998046875, -0.104339599609375, -0.092681884765625, -0.0328369140625, 0.00738525390625, 0.028289794921875, 0.03607177734375, 0.07928466796875, 0.066680908203125, 0.045623779296875, 0.0537109375, 0.026123046875, 0.003570556640625, 0.01055908203125, 0.001861572265625, -0.02685546875, -0.043212890625, -0.040252685546875, -0.032318115234375, -0.042755126953125, -0.04486083984375, -0.03662109375, -0.02435302734375, -0.012847900390625, -0.005218505859375, -0.002471923828125, 0.01007080078125, 0.02294921875, 0.020416259765625, 0.012847900390625, 0.00469970703125, -0.010772705078125, -0.022491455078125, -0.01910400390625, -0.012176513671875, -0.0137939453125, -0.015167236328125, -0.0113525390625, -0.006988525390625, -0.0047607421875, -0.0054931640625, -0.004180908203125, -0.001861572265625, 0.000640869140625, -0.00164794921875, -0.001678466796875, -0.0001220703125, -0.000579833984375, -0.00323486328125, -0.0048828125, -0.00518798828125, -0.005859375, -0.00494384765625, -0.002044677734375, -0.001251220703125, -0.004180908203125, -0.00653076171875, -0.007232666015625, -0.007537841796875, -0.005706787109375, -0.001953125, -0.00128173828125, -0.00140380859375, -0.00152587890625, -0.003082275390625, -0.003997802734375, -0.00146484375, 0.000457763671875, -0.00091552734375, -0.004241943359375, -0.006622314453125, -0.006927490234375, -0.005218505859375, -0.0048828125, -0.006317138671875, -0.007080078125, -0.0062255859375, -0.0035400390625, -0.0020751953125, -0.002105712890625, -0.00201416015625, -0.001251220703125, -0.001190185546875, -0.001190185546875, -0.001861572265625, -0.00323486328125, -0.004058837890625, -0.0037841796875, -0.00372314453125, -0.004180908203125, -0.00396728515625, -0.00421142578125, -0.004638671875, -0.00311279296875, -0.0008544921875, 0.00128173828125, 0.00244140625, 0.00238037109375, 0.002349853515625};
1111 static MYFLT BINAURAL_LEFT_HRTF_12[128] = {-9.1552734375e-05, 6.103515625e-05, 0.00030517578125, -3.0517578125e-05, 3.0517578125e-05, -0.000396728515625, 3.0517578125e-05, -0.000244140625, 0.0001220703125, -0.000274658203125, 0.000274658203125, 0.000244140625, 0.063934326171875, 0.212188720703125, 0.063720703125, -0.318023681640625, -0.33544921875, -0.031768798828125, 0.317169189453125, 0.47650146484375, 0.277862548828125, 0.0123291015625, 0.014251708984375, 0.155975341796875, 0.084197998046875, -0.1102294921875, -0.140625, -0.112640380859375, -0.14459228515625, -0.143402099609375, -0.099151611328125, -0.099273681640625, -0.081329345703125, -0.03118896484375, 0.00335693359375, 0.025787353515625, 0.045135498046875, 0.065887451171875, 0.047882080078125, 0.05303955078125, 0.050018310546875, 0.02410888671875, 0.011810302734375, 0.00811767578125, -0.000152587890625, -0.027252197265625, -0.042633056640625, -0.0396728515625, -0.03729248046875, -0.04571533203125, -0.0450439453125, -0.028289794921875, -0.0166015625, -0.0135498046875, -0.006256103515625, 0.005401611328125, 0.013336181640625, 0.015960693359375, 0.019500732421875, 0.016021728515625, 0.003936767578125, -0.01141357421875, -0.018341064453125, -0.015899658203125, -0.01080322265625, -0.010528564453125, -0.0145263671875, -0.0164794921875, -0.0120849609375, -0.00762939453125, -0.00732421875, -0.00677490234375, -0.006317138671875, -0.001922607421875, 0.0008544921875, 0.0015869140625, 0.00140380859375, -0.0001220703125, -0.00213623046875, -0.001373291015625, -0.001556396484375, -0.004913330078125, -0.006103515625, -0.00347900390625, -0.00225830078125, -0.005035400390625, -0.0074462890625, -0.009124755859375, -0.01068115234375, -0.007110595703125, -0.001800537109375, -0.001129150390625, -0.0020751953125, -0.00238037109375, -0.002838134765625, -0.00244140625, 0.000274658203125, 0.00079345703125, -0.001739501953125, -0.004608154296875, -0.005340576171875, -0.0052490234375, -0.00494384765625, -0.005462646484375, -0.00640869140625, -0.00665283203125, -0.005706787109375, -0.003814697265625, -0.00341796875, -0.003387451171875, -0.001739501953125, -9.1552734375e-05, -0.000335693359375, -0.001373291015625, -0.00262451171875, -0.004150390625, -0.004913330078125, -0.004119873046875, -0.003326416015625, -0.002899169921875, -0.00335693359375, -0.00433349609375, -0.003753662109375, -0.00177001953125, 6.103515625e-05, 0.001007080078125, 0.001190185546875, 0.001434326171875};
1112 static MYFLT BINAURAL_RIGHT_HRTF_12[128] = {3.0517578125e-05, -6.103515625e-05, -6.103515625e-05, -6.103515625e-05, 6.103515625e-05, 6.103515625e-05, -3.0517578125e-05, -6.103515625e-05, 0.0, 6.103515625e-05, 6.103515625e-05, -3.0517578125e-05, 3.0517578125e-05, -0.000213623046875, 9.1552734375e-05, -0.00030517578125, 0.00030517578125, -0.000274658203125, 0.000579833984375, 0.003692626953125, 0.0595703125, 0.117828369140625, -0.010040283203125, -0.2017822265625, -0.178466796875, 0.019927978515625, 0.19366455078125, 0.2510986328125, 0.15911865234375, 0.044891357421875, 0.052398681640625, 0.083160400390625, 0.037567138671875, -0.025146484375, -0.040985107421875, -0.056488037109375, -0.0789794921875, -0.0802001953125, -0.071136474609375, -0.067718505859375, -0.057037353515625, -0.03515625, -0.0115966796875, -0.00872802734375, -0.00335693359375, 0.032806396484375, 0.058380126953125, 0.05975341796875, 0.038299560546875, 0.030364990234375, 0.023834228515625, 0.008026123046875, -0.003448486328125, -0.027923583984375, -0.04815673828125, -0.043060302734375, -0.023193359375, -0.0194091796875, -0.023345947265625, -0.01702880859375, -0.00482177734375, 0.003173828125, 0.005035400390625, 0.00543212890625, 0.003173828125, 0.000885009765625, -0.000335693359375, 0.0018310546875, 0.00421142578125, 0.000885009765625, -0.00482177734375, -0.009552001953125, -0.010955810546875, -0.010101318359375, -0.011749267578125, -0.018707275390625, -0.0250244140625, -0.020904541015625, -0.00933837890625, -0.0045166015625, -0.006683349609375, -0.0078125, -0.004058837890625, 0.0008544921875, 0.001708984375, -9.1552734375e-05, -0.002410888671875, -0.0020751953125, -0.001007080078125, -0.003021240234375, -0.006378173828125, -0.007598876953125, -0.00732421875, -0.006927490234375, -0.00750732421875, -0.008209228515625, -0.008392333984375, -0.007171630859375, -0.00518798828125, -0.003631591796875, -0.001953125, -0.000946044921875, -0.000762939453125, -0.00079345703125, 6.103515625e-05, 0.000213623046875, -0.001007080078125, -0.0028076171875, -0.004058837890625, -0.004241943359375, -0.005157470703125, -0.006134033203125, -0.0052490234375, -0.003143310546875, -0.00201416015625, -0.00213623046875, -0.002044677734375, -0.001861572265625, -0.00091552734375, -0.000274658203125, -0.00152587890625, -0.0028076171875, -0.003143310546875, -0.002899169921875, -0.00274658203125, -0.003509521484375, -0.004608154296875, -0.004150390625};
1113 static MYFLT BINAURAL_LEFT_HRTF_13[128] = {-0.00079345703125, 0.000885009765625, -0.001922607421875, 0.00311279296875, -0.004913330078125, 0.007049560546875, -0.0113525390625, 0.116241455078125, 0.329437255859375, 0.12353515625, -0.66143798828125, -0.558990478515625, 0.44940185546875, 0.484283447265625, 0.34600830078125, 0.329986572265625, 0.11273193359375, 0.00506591796875, 0.104248046875, 0.16436767578125, -0.187225341796875, -0.282440185546875, -0.190643310546875, -0.19549560546875, -0.227020263671875, -0.15216064453125, -0.103668212890625, -0.141357421875, -0.04376220703125, 0.05291748046875, 0.116424560546875, 0.055999755859375, 0.104888916015625, 0.13983154296875, 0.07373046875, 0.05889892578125, 0.062225341796875, 0.007965087890625, -0.0303955078125, -0.002349853515625, -0.056671142578125, -0.1014404296875, -0.086944580078125, -0.049468994140625, -0.055816650390625, -0.0467529296875, -0.00030517578125, 0.013092041015625, 0.00604248046875, 0.00738525390625, 0.029693603515625, 0.0272216796875, 0.012115478515625, 0.011566162109375, -0.01019287109375, -0.03863525390625, -0.040924072265625, -0.020782470703125, -0.02679443359375, -0.02667236328125, -0.009490966796875, -0.004302978515625, -0.006561279296875, -0.0028076171875, 0.00830078125, 0.006378173828125, 0.0010986328125, -0.004547119140625, -0.006622314453125, -0.014251708984375, -0.012237548828125, -0.0006103515625, 0.004608154296875, -0.003082275390625, -0.006561279296875, -0.002532958984375, -0.00311279296875, -0.00262451171875, 0.002105712890625, 0.003021240234375, -0.00274658203125, -0.00555419921875, -0.0048828125, -0.00311279296875, 0.001373291015625, 0.00537109375, 0.001708984375, -0.006378173828125, -0.00933837890625, -0.006744384765625, -0.0052490234375, -0.001007080078125, -0.001129150390625, -0.007080078125, -0.01123046875, -0.0074462890625, -0.0030517578125, -0.0009765625, -0.001068115234375, -0.002532958984375, -0.0030517578125, -0.003021240234375, -0.001190185546875, -0.00054931640625, -0.002197265625, -0.00384521484375, -0.002960205078125, -0.004730224609375, -0.005645751953125, -0.0050048828125, -0.004791259765625, -0.005950927734375, -0.006439208984375, -0.005706787109375, -0.00421142578125, -0.002349853515625, -0.0013427734375, -0.000885009765625, 3.0517578125e-05, 0.000244140625, 0.000701904296875, 0.001861572265625, 0.0018310546875, 0.0009765625, -0.0003662109375, -0.00146484375, -0.0018310546875, -0.001251220703125};
1114 static MYFLT BINAURAL_RIGHT_HRTF_13[128] = {3.0517578125e-05, 3.0517578125e-05, 3.0517578125e-05, 0.0, 6.103515625e-05, 3.0517578125e-05, 3.0517578125e-05, 0.0, 3.0517578125e-05, 3.0517578125e-05, 3.0517578125e-05, 3.0517578125e-05, 6.103515625e-05, 0.0, 0.0, 0.0, 3.0517578125e-05, 3.0517578125e-05, 0.000244140625, -6.103515625e-05, 9.1552734375e-05, -9.1552734375e-05, 0.00103759765625, -0.000152587890625, 0.0, -0.00146484375, 0.014007568359375, 0.037811279296875, 0.05242919921875, 0.00189208984375, -0.12677001953125, -0.11236572265625, 0.02044677734375, 0.103485107421875, 0.126129150390625, 0.1038818359375, 0.07806396484375, 0.06903076171875, 0.071441650390625, 0.05340576171875, 0.02337646484375, -0.0003662109375, -0.013397216796875, -0.0299072265625, -0.05255126953125, -0.050537109375, -0.04937744140625, -0.05584716796875, -0.046173095703125, -0.019439697265625, -0.01715087890625, -0.011566162109375, 0.021392822265625, 0.03143310546875, 0.0274658203125, 0.029266357421875, 0.027374267578125, 0.01031494140625, 0.010009765625, 0.006866455078125, -0.02294921875, -0.039306640625, -0.02911376953125, -0.01824951171875, -0.019378662109375, -0.015594482421875, -0.011077880859375, -0.00787353515625, -0.0028076171875, 0.000946044921875, -0.00030517578125, -0.003570556640625, -0.00518798828125, -0.0057373046875, -0.002471923828125, -0.001190185546875, -0.004058837890625, -0.011199951171875, -0.01422119140625, -0.0107421875, -0.007659912109375, -0.00799560546875, -0.008697509765625, -0.007171630859375, -0.0086669921875, -0.009521484375, -0.008148193359375, -0.006378173828125, -0.005706787109375, -0.007476806640625, -0.00836181640625, -0.008026123046875, -0.0079345703125, -0.008056640625, -0.00836181640625, -0.008026123046875, -0.0057373046875, -0.00238037109375, -0.000946044921875, -0.00140380859375, -0.001708984375, -0.00225830078125, -0.00299072265625, -0.002777099609375, -0.00213623046875, -0.003326416015625, -0.004547119140625, -0.003875732421875, -0.00274658203125, -0.00274658203125, -0.00323486328125, -0.002716064453125, -0.001678466796875, -0.001678466796875, -0.0015869140625, -0.00146484375, -0.00189208984375, -0.002655029296875, -0.003143310546875, -0.0028076171875, -0.0028076171875, -0.003173828125, -0.003204345703125, -0.003631591796875, -0.003997802734375, -0.00347900390625, -0.002349853515625, -0.00164794921875};
1115 static MYFLT BINAURAL_LEFT_HRTF_14[128] = {-0.000152587890625, 0.000457763671875, -0.001220703125, 0.001556396484375, -0.002410888671875, 0.003173828125, -0.00421142578125, 0.005401611328125, -0.00634765625, 0.0654296875, 0.1702880859375, 0.237396240234375, 0.02557373046875, -0.454559326171875, -0.1126708984375, 0.332244873046875, 0.18524169921875, 0.10784912109375, 0.164825439453125, 0.140045166015625, 0.04827880859375, 0.017974853515625, -0.1427001953125, -0.225830078125, -0.1519775390625, -0.12408447265625, -0.138641357421875, -0.113677978515625, -0.0235595703125, 0.000396728515625, 0.025634765625, 0.04986572265625, 0.078643798828125, 0.072662353515625, 0.038787841796875, 0.048370361328125, 0.044830322265625, 0.0032958984375, -0.03057861328125, -0.012725830078125, -0.01300048828125, -0.0048828125, -0.002685546875, -0.04302978515625, -0.07659912109375, -0.068695068359375, -0.0460205078125, -0.02056884765625, 0.0067138671875, 0.02691650390625, 0.027679443359375, 0.015960693359375, 0.01934814453125, 0.02752685546875, 0.020050048828125, 0.001312255859375, -0.01025390625, -0.011505126953125, -0.00079345703125, 0.004180908203125, -0.013275146484375, -0.035675048828125, -0.0316162109375, -0.02203369140625, -0.021148681640625, -0.011566162109375, 0.00103759765625, 0.00360107421875, 0.001922607421875, -0.003509521484375, -0.014923095703125, -0.02130126953125, -0.014984130859375, -0.008148193359375, -0.01123046875, -0.01068115234375, -0.002960205078125, 0.000244140625, -0.001129150390625, 0.00189208984375, 0.004669189453125, 0.0059814453125, -0.0010986328125, -0.00775146484375, -0.009490966796875, -0.00616455078125, 0.0010986328125, -0.0018310546875, -0.010955810546875, -0.013092041015625, -0.007965087890625, -0.002685546875, -0.000885009765625, -0.0010986328125, -0.003662109375, -0.008819580078125, -0.011016845703125, -0.007232666015625, -0.001251220703125, 0.000762939453125, -0.0010986328125, -0.005767822265625, -0.00634765625, -0.001617431640625, 0.00323486328125, 0.00531005859375, 0.002899169921875, -0.003173828125, -0.0084228515625, -0.00994873046875, -0.005584716796875, 0.000518798828125, 0.00042724609375, -0.00799560546875, -0.01458740234375, -0.01190185546875, -0.0029296875, 0.008056640625, 0.00958251953125, -0.0003662109375, -0.009124755859375, -0.006988525390625, 6.103515625e-05, 0.0050048828125, 0.0025634765625, -0.003936767578125, -0.008880615234375, -0.009918212890625};
1116 static MYFLT BINAURAL_RIGHT_HRTF_14[128] = {-0.000152587890625, -0.000213623046875, 0.000335693359375, -0.0001220703125, 0.00030517578125, -0.00042724609375, 0.0003662109375, -0.000457763671875, 0.0001220703125, 0.00018310546875, -0.000396728515625, 0.000885009765625, 0.007843017578125, 0.07318115234375, 0.10577392578125, 0.084259033203125, -0.21759033203125, -0.3160400390625, 0.146270751953125, 0.324493408203125, 0.167449951171875, 0.07196044921875, 0.105560302734375, 0.098052978515625, 0.0770263671875, 0.032806396484375, -0.101531982421875, -0.13909912109375, -0.1055908203125, -0.081146240234375, -0.1064453125, -0.08612060546875, -0.034515380859375, -0.020477294921875, 0.000457763671875, 0.034698486328125, 0.061798095703125, 0.037139892578125, 0.0389404296875, 0.0482177734375, 0.02978515625, 0.003631591796875, -0.00787353515625, -0.006378173828125, -0.007171630859375, -0.005859375, -0.0252685546875, -0.0467529296875, -0.05670166015625, -0.04296875, -0.018402099609375, -0.005279541015625, 0.00201416015625, 0.016265869140625, 0.019317626953125, 0.012542724609375, 0.01678466796875, 0.019500732421875, 0.007965087890625, -0.004608154296875, -0.01177978515625, -0.0118408203125, -0.010894775390625, -0.013427734375, -0.018157958984375, -0.023590087890625, -0.0201416015625, -0.008941650390625, -0.001434326171875, -0.0001220703125, 0.004669189453125, 0.005828857421875, 0.00323486328125, 0.00042724609375, -0.002532958984375, -0.011627197265625, -0.025390625, -0.027313232421875, -0.016143798828125, -0.01275634765625, -0.020355224609375, -0.022125244140625, -0.01202392578125, 0.001617431640625, 0.007354736328125, 0.003692626953125, -0.000579833984375, 0.00067138671875, 0.002899169921875, 0.002685546875, -0.001556396484375, -0.00592041015625, -0.00775146484375, -0.008087158203125, -0.008697509765625, -0.010498046875, -0.01031494140625, -0.005523681640625, -0.002838134765625, -0.00494384765625, -0.00787353515625, -0.006927490234375, -0.00335693359375, -0.000640869140625, -0.00054931640625, -0.001678466796875, -0.000701904296875, 6.103515625e-05, 0.00067138671875, 0.0015869140625, 0.0015869140625, -0.0008544921875, -0.00372314453125, -0.00537109375, -0.005401611328125, -0.004150390625, -0.003082275390625, -0.003204345703125, -0.0035400390625, -0.003814697265625, -0.002960205078125, -0.0010986328125, -0.00115966796875, -0.001861572265625, -0.00164794921875, -0.00140380859375, -0.00238037109375, -0.00299072265625};
1117 static MYFLT BINAURAL_LEFT_HRTF_15[128] = {-0.000152587890625, -0.000213623046875, 0.000335693359375, -0.0001220703125, 0.00030517578125, -0.00042724609375, 0.0003662109375, -0.000457763671875, 0.0001220703125, 0.00018310546875, -0.000396728515625, 0.000885009765625, 0.007843017578125, 0.07318115234375, 0.10577392578125, 0.084259033203125, -0.21759033203125, -0.3160400390625, 0.146270751953125, 0.324493408203125, 0.167449951171875, 0.07196044921875, 0.105560302734375, 0.098052978515625, 0.0770263671875, 0.032806396484375, -0.101531982421875, -0.13909912109375, -0.1055908203125, -0.081146240234375, -0.1064453125, -0.08612060546875, -0.034515380859375, -0.020477294921875, 0.000457763671875, 0.034698486328125, 0.061798095703125, 0.037139892578125, 0.0389404296875, 0.0482177734375, 0.02978515625, 0.003631591796875, -0.00787353515625, -0.006378173828125, -0.007171630859375, -0.005859375, -0.0252685546875, -0.0467529296875, -0.05670166015625, -0.04296875, -0.018402099609375, -0.005279541015625, 0.00201416015625, 0.016265869140625, 0.019317626953125, 0.012542724609375, 0.01678466796875, 0.019500732421875, 0.007965087890625, -0.004608154296875, -0.01177978515625, -0.0118408203125, -0.010894775390625, -0.013427734375, -0.018157958984375, -0.023590087890625, -0.0201416015625, -0.008941650390625, -0.001434326171875, -0.0001220703125, 0.004669189453125, 0.005828857421875, 0.00323486328125, 0.00042724609375, -0.002532958984375, -0.011627197265625, -0.025390625, -0.027313232421875, -0.016143798828125, -0.01275634765625, -0.020355224609375, -0.022125244140625, -0.01202392578125, 0.001617431640625, 0.007354736328125, 0.003692626953125, -0.000579833984375, 0.00067138671875, 0.002899169921875, 0.002685546875, -0.001556396484375, -0.00592041015625, -0.00775146484375, -0.008087158203125, -0.008697509765625, -0.010498046875, -0.01031494140625, -0.005523681640625, -0.002838134765625, -0.00494384765625, -0.00787353515625, -0.006927490234375, -0.00335693359375, -0.000640869140625, -0.00054931640625, -0.001678466796875, -0.000701904296875, 6.103515625e-05, 0.00067138671875, 0.0015869140625, 0.0015869140625, -0.0008544921875, -0.00372314453125, -0.00537109375, -0.005401611328125, -0.004150390625, -0.003082275390625, -0.003204345703125, -0.0035400390625, -0.003814697265625, -0.002960205078125, -0.0010986328125, -0.00115966796875, -0.001861572265625, -0.00164794921875, -0.00140380859375, -0.00238037109375, -0.00299072265625};
1118 static MYFLT BINAURAL_RIGHT_HRTF_15[128] = {-0.000152587890625, 0.000457763671875, -0.001220703125, 0.001556396484375, -0.002410888671875, 0.003173828125, -0.00421142578125, 0.005401611328125, -0.00634765625, 0.0654296875, 0.1702880859375, 0.237396240234375, 0.02557373046875, -0.454559326171875, -0.1126708984375, 0.332244873046875, 0.18524169921875, 0.10784912109375, 0.164825439453125, 0.140045166015625, 0.04827880859375, 0.017974853515625, -0.1427001953125, -0.225830078125, -0.1519775390625, -0.12408447265625, -0.138641357421875, -0.113677978515625, -0.0235595703125, 0.000396728515625, 0.025634765625, 0.04986572265625, 0.078643798828125, 0.072662353515625, 0.038787841796875, 0.048370361328125, 0.044830322265625, 0.0032958984375, -0.03057861328125, -0.012725830078125, -0.01300048828125, -0.0048828125, -0.002685546875, -0.04302978515625, -0.07659912109375, -0.068695068359375, -0.0460205078125, -0.02056884765625, 0.0067138671875, 0.02691650390625, 0.027679443359375, 0.015960693359375, 0.01934814453125, 0.02752685546875, 0.020050048828125, 0.001312255859375, -0.01025390625, -0.011505126953125, -0.00079345703125, 0.004180908203125, -0.013275146484375, -0.035675048828125, -0.0316162109375, -0.02203369140625, -0.021148681640625, -0.011566162109375, 0.00103759765625, 0.00360107421875, 0.001922607421875, -0.003509521484375, -0.014923095703125, -0.02130126953125, -0.014984130859375, -0.008148193359375, -0.01123046875, -0.01068115234375, -0.002960205078125, 0.000244140625, -0.001129150390625, 0.00189208984375, 0.004669189453125, 0.0059814453125, -0.0010986328125, -0.00775146484375, -0.009490966796875, -0.00616455078125, 0.0010986328125, -0.0018310546875, -0.010955810546875, -0.013092041015625, -0.007965087890625, -0.002685546875, -0.000885009765625, -0.0010986328125, -0.003662109375, -0.008819580078125, -0.011016845703125, -0.007232666015625, -0.001251220703125, 0.000762939453125, -0.0010986328125, -0.005767822265625, -0.00634765625, -0.001617431640625, 0.00323486328125, 0.00531005859375, 0.002899169921875, -0.003173828125, -0.0084228515625, -0.00994873046875, -0.005584716796875, 0.000518798828125, 0.00042724609375, -0.00799560546875, -0.01458740234375, -0.01190185546875, -0.0029296875, 0.008056640625, 0.00958251953125, -0.0003662109375, -0.009124755859375, -0.006988525390625, 6.103515625e-05, 0.0050048828125, 0.0025634765625, -0.003936767578125, -0.008880615234375, -0.009918212890625};
1119
1120 static MYFLT BINAURAL_SETUP_X[16] = {0.9239000082015991, 0.9239000082015991, 0.38269996643066406, -0.38269996643066406, -0.9239000082015991, -0.9239000082015991, -0.38269996643066406, 0.38269996643066406, 0.7093999981880188, 0.7093999981880188, 0.0, -0.7093999981880188, -0.7093999981880188, 0.0, 0.0, 0.0};
1121 static MYFLT BINAURAL_SETUP_Y[16] = {-0.38269996643066406, 0.38269996643066406, 0.9239000082015991, 0.9239000082015991, 0.38269996643066406, -0.38269996643066406, -0.9239000082015991, -0.9239000082015991, -0.40960001945495605, 0.40960001945495605, 0.8192000389099121, 0.40960001945495605, -0.40960001945495605, -0.8192000389099121, -0.1736000031232834, 0.1736000031232834};
1122 static MYFLT BINAURAL_SETUP_Z[16] = {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.5735999941825867, 0.5735999941825867, 0.5735999941825867, 0.5735999941825867, 0.5735999941825867, 0.5735999941825867, 0.9847999811172485, 0.9847999811172485};
1123 static MYFLT BINAURAL_SETUP_AZIMUTH[16] = {337.5, 22.5, 67.5, 112.5, 157.5, 202.5, 247.5, 292.5, 330.0, 30.0, 90.0, 150.0, 210.0, 270.0, 270.0, 90.0};
1124 static MYFLT BINAURAL_SETUP_ELEVATION[16] = {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 35.0, 35.0, 35.0, 35.0, 35.0, 35.0, 80.0, 80.0};
1125
1126 /************************************************************************************************/
1127 /* Binaural main object */
1128 /************************************************************************************************/
1129 typedef struct
1130 {
1131 pyo_audio_HEAD
1132 PyObject *input;
1133 Stream *input_stream;
1134 PyObject *azi;
1135 Stream *azi_stream;
1136 PyObject *ele;
1137 Stream *ele_stream;
1138 PyObject *azispan;
1139 Stream *azispan_stream;
1140 PyObject *elespan;
1141 Stream *elespan_stream;
1142 VBAP_DATA *paramVBap;
1143 int hrtf_count[16];
1144 MYFLT last_azi;
1145 MYFLT last_ele;
1146 MYFLT last_azispan;
1147 MYFLT last_elespan;
1148 MYFLT hrtf_input_tmp[16][128];
1149 MYFLT hrtf_left_impulses[16][128];
1150 MYFLT hrtf_right_impulses[16][128];
1151 int modebuffer[4];
1152 MYFLT **vbap_buffer;
1153 MYFLT *buffer_streams;
1154 } Binauraler;
1155
1156 static void
1157 Binauraler_splitter(Binauraler *self)
1158 {
1159 int i, o, k, tmp_count;
1160 MYFLT azi, ele, azispan, elespan, gain, y, sig;
1161 MYFLT *in = Stream_getData((Stream *)self->input_stream);
1162
1163 if (self->modebuffer[0] == 0)
1164 azi = PyFloat_AS_DOUBLE(self->azi);
1165 else
1166 azi = Stream_getData((Stream *)self->azi_stream)[0];
1167
1168 if (self->modebuffer[1] == 0)
1169 ele = PyFloat_AS_DOUBLE(self->ele);
1170 else
1171 ele = Stream_getData((Stream *)self->ele_stream)[0];
1172
1173 if (self->modebuffer[2] == 0)
1174 azispan = PyFloat_AS_DOUBLE(self->azispan);
1175 else
1176 azispan = Stream_getData((Stream *)self->azispan_stream)[0];
1177
1178 if (self->modebuffer[3] == 0)
1179 elespan = PyFloat_AS_DOUBLE(self->elespan);
1180 else
1181 elespan = Stream_getData((Stream *)self->elespan_stream)[0];
1182
1183 ele = ele < 0.0 ? 0.0 : ele > 90.0 ? 90.0 : ele;
1184 azispan = azispan < 0.0 ? 0.0 : azispan > 1.0 ? 1.0 : azispan;
1185 elespan = elespan < 0.0 ? 0.0 : elespan > 1.0 ? 1.0 : elespan;
1186
1187 if (azi != self->last_azi || ele != self->last_ele ||
1188 azispan != self->last_azispan || elespan != self->last_elespan)
1189 {
1190 self->last_azi = azi;
1191 self->last_ele = ele;
1192 self->last_azispan = azispan;
1193 self->last_elespan = elespan;
1194 vbap2(azi, ele, azispan, elespan, self->paramVBap);
1195 }
1196
1197 for (i = 0; i < self->bufsize * 2; i++)
1198 {
1199 self->buffer_streams[i] = 0.0;
1200 }
1201
1202 for (o = 0; o < 16; o++)
1203 {
1204 memset(self->vbap_buffer[o], 0, sizeof(MYFLT) * self->bufsize);
1205 gain = self->paramVBap->gains[o];
1206 y = self->paramVBap->y[o];
1207
1208 for (i = 0; i < self->bufsize; i++)
1209 {
1210 y = gain + (y - gain) * 0.99;
1211
1212 if (y < 0.0000000000001f)
1213 {
1214 y = 0.0;
1215 }
1216 else
1217 {
1218 self->vbap_buffer[o][i] += in[i] * y;
1219 }
1220 }
1221
1222 self->paramVBap->y[o] = y;
1223
1224 for (i = 0; i < self->bufsize; i++)
1225 {
1226 tmp_count = self->hrtf_count[o];
1227
1228 for (k = 0; k < 128; ++k)
1229 {
1230 if (tmp_count < 0)
1231 {
1232 tmp_count += 128;
1233 }
1234
1235 sig = self->hrtf_input_tmp[o][tmp_count];
1236 self->buffer_streams[i] += sig * self->hrtf_left_impulses[o][k];
1237 self->buffer_streams[i + self->bufsize] += sig * self->hrtf_right_impulses[o][k];
1238 tmp_count--;
1239 }
1240
1241 self->hrtf_count[o]++;
1242
1243 if (self->hrtf_count[o] >= 128)
1244 {
1245 self->hrtf_count[o] = 0;
1246 }
1247
1248 self->hrtf_input_tmp[o][self->hrtf_count[o]] = self->vbap_buffer[o][i];
1249 }
1250 }
1251 }
1252
1253 MYFLT *
1254 Binauraler_getSamplesBuffer(Binauraler *self)
1255 {
1256 return (MYFLT *)self->buffer_streams;
1257 }
1258
1259 static void
1260 Binauraler_setProcMode(Binauraler *self)
1261 {
1262 self->proc_func_ptr = Binauraler_splitter;
1263 }
1264
1265 static void
1266 Binauraler_compute_next_data_frame(Binauraler *self)
1267 {
1268 (*self->proc_func_ptr)(self);
1269 }
1270
1271 static int
1272 Binauraler_traverse(Binauraler *self, visitproc visit, void *arg)
1273 {
1274 pyo_VISIT
1275 Py_VISIT(self->input);
1276 Py_VISIT(self->azi);
1277 Py_VISIT(self->ele);
1278 Py_VISIT(self->azispan);
1279 Py_VISIT(self->elespan);
1280 return 0;
1281 }
1282
1283 static int
1284 Binauraler_clear(Binauraler *self)
1285 {
1286 pyo_CLEAR
1287 Py_CLEAR(self->input);
1288 Py_CLEAR(self->azi);
1289 Py_CLEAR(self->ele);
1290 Py_CLEAR(self->azispan);
1291 Py_CLEAR(self->elespan);
1292 return 0;
1293 }
1294
1295 static void
1296 Binauraler_dealloc(Binauraler* self)
1297 {
1298 int i;
1299 pyo_DEALLOC
1300 PyMem_RawFree(self->buffer_streams);
1301 free_vbap_data(self->paramVBap);
1302
1303 for (i = 0; i < 16; i++)
1304 {
1305 PyMem_RawFree(self->vbap_buffer[i]);
1306 }
1307
1308 PyMem_RawFree(self->vbap_buffer);
1309 Binauraler_clear(self);
1310 Py_TYPE(self->stream)->tp_free((PyObject*)self->stream);
1311 Py_TYPE(self)->tp_free((PyObject*)self);
1312 }
1313
1314 static PyObject *
1315 Binauraler_new(PyTypeObject *type, PyObject *args, PyObject *kwds)
1316 {
1317 int i, j, k;
1318 PyObject *inputtmp, *input_streamtmp, *azitmp = NULL, *eletmp = NULL, *azispantmp = NULL, *elespantmp = NULL;
1319 Binauraler *self;
1320 self = (Binauraler *)type->tp_alloc(type, 0);
1321
1322 INIT_OBJECT_COMMON
1323 Stream_setFunctionPtr(self->stream, Binauraler_compute_next_data_frame);
1324 self->mode_func_ptr = Binauraler_setProcMode;
1325
1326 self->azi = PyFloat_FromDouble(0.0);
1327 self->ele = PyFloat_FromDouble(0.0);
1328 self->azispan = PyFloat_FromDouble(0.0);
1329 self->elespan = PyFloat_FromDouble(0.0);
1330 self->last_azi = self->last_ele = self->last_azispan = self->last_elespan = -1.0;
1331 self->modebuffer[0] = 0;
1332 self->modebuffer[1] = 0;
1333 self->modebuffer[2] = 0;
1334 self->modebuffer[3] = 0;
1335
1336 static char *kwlist[] = {"input", "azi", "ele", "azispan", "elespan", NULL};
1337
1338 if (! PyArg_ParseTupleAndKeywords(args, kwds, "O|OOOO", kwlist, &inputtmp, &azitmp, &eletmp, &azispantmp, &elespantmp))
1339 Py_RETURN_NONE;
1340
1341 INIT_INPUT_STREAM
1342
1343 if (azitmp)
1344 {
1345 PyObject_CallMethod((PyObject *)self, "setAzimuth", "O", azitmp);
1346 }
1347
1348 if (eletmp)
1349 {
1350 PyObject_CallMethod((PyObject *)self, "setElevation", "O", eletmp);
1351 }
1352
1353 if (azispantmp)
1354 {
1355 PyObject_CallMethod((PyObject *)self, "setAzispan", "O", azispantmp);
1356 }
1357
1358 if (elespantmp)
1359 {
1360 PyObject_CallMethod((PyObject *)self, "setElespan", "O", elespantmp);
1361 }
1362
1363 PyObject_CallMethod(self->server, "addStream", "O", self->stream);
1364
1365 /* Initialize VBAP data. */
1366 ls lss[16];
1367 int outputPatches[16];
1368
1369 for (i = 0; i < 16; i++)
1370 {
1371 lss[i].coords.x = BINAURAL_SETUP_X[i];
1372 lss[i].coords.y = BINAURAL_SETUP_Y[i];
1373 lss[i].coords.z = BINAURAL_SETUP_Z[i];
1374 lss[i].angles.azi = BINAURAL_SETUP_AZIMUTH[i];
1375 lss[i].angles.ele = BINAURAL_SETUP_ELEVATION[i];
1376 lss[i].angles.length = 1.0; // Always 1.0 for VBAP.
1377 outputPatches[i] = i + 1;
1378 }
1379
1380 self->paramVBap = init_vbap_from_speakers(lss, 16, 3, outputPatches, 16, NULL);
1381
1382 /* Initialize hrtf data. */
1383 for (i = 0; i < 16; i++)
1384 {
1385 self->hrtf_count[i] = 0;
1386
1387 for (j = 0; j < 128; j++)
1388 {
1389 self->hrtf_input_tmp[i][j] = 0.0;
1390 }
1391 }
1392
1393 for (i = 0; i < 128; i++)
1394 {
1395 self->hrtf_left_impulses[0][i] = BINAURAL_LEFT_HRTF_0[i];
1396 self->hrtf_right_impulses[0][i] = BINAURAL_RIGHT_HRTF_0[i];
1397 self->hrtf_left_impulses[1][i] = BINAURAL_LEFT_HRTF_1[i];
1398 self->hrtf_right_impulses[1][i] = BINAURAL_RIGHT_HRTF_1[i];
1399 self->hrtf_left_impulses[2][i] = BINAURAL_LEFT_HRTF_2[i];
1400 self->hrtf_right_impulses[2][i] = BINAURAL_RIGHT_HRTF_2[i];
1401 self->hrtf_left_impulses[3][i] = BINAURAL_LEFT_HRTF_3[i];
1402 self->hrtf_right_impulses[3][i] = BINAURAL_RIGHT_HRTF_3[i];
1403 self->hrtf_left_impulses[4][i] = BINAURAL_LEFT_HRTF_4[i];
1404 self->hrtf_right_impulses[4][i] = BINAURAL_RIGHT_HRTF_4[i];
1405 self->hrtf_left_impulses[5][i] = BINAURAL_LEFT_HRTF_5[i];
1406 self->hrtf_right_impulses[5][i] = BINAURAL_RIGHT_HRTF_5[i];
1407 self->hrtf_left_impulses[6][i] = BINAURAL_LEFT_HRTF_6[i];
1408 self->hrtf_right_impulses[6][i] = BINAURAL_RIGHT_HRTF_6[i];
1409 self->hrtf_left_impulses[7][i] = BINAURAL_LEFT_HRTF_7[i];
1410 self->hrtf_right_impulses[7][i] = BINAURAL_RIGHT_HRTF_7[i];
1411 self->hrtf_left_impulses[8][i] = BINAURAL_LEFT_HRTF_8[i];
1412 self->hrtf_right_impulses[8][i] = BINAURAL_RIGHT_HRTF_8[i];
1413 self->hrtf_left_impulses[9][i] = BINAURAL_LEFT_HRTF_9[i];
1414 self->hrtf_right_impulses[9][i] = BINAURAL_RIGHT_HRTF_9[i];
1415 self->hrtf_left_impulses[10][i] = BINAURAL_LEFT_HRTF_10[i];
1416 self->hrtf_right_impulses[10][i] = BINAURAL_RIGHT_HRTF_10[i];
1417 self->hrtf_left_impulses[11][i] = BINAURAL_LEFT_HRTF_11[i];
1418 self->hrtf_right_impulses[11][i] = BINAURAL_RIGHT_HRTF_11[i];
1419 self->hrtf_left_impulses[12][i] = BINAURAL_LEFT_HRTF_12[i];
1420 self->hrtf_right_impulses[12][i] = BINAURAL_RIGHT_HRTF_12[i];
1421 self->hrtf_left_impulses[13][i] = BINAURAL_LEFT_HRTF_13[i];
1422 self->hrtf_right_impulses[13][i] = BINAURAL_RIGHT_HRTF_13[i];
1423 self->hrtf_left_impulses[14][i] = BINAURAL_LEFT_HRTF_14[i];
1424 self->hrtf_right_impulses[14][i] = BINAURAL_RIGHT_HRTF_14[i];
1425 self->hrtf_left_impulses[15][i] = BINAURAL_LEFT_HRTF_15[i];
1426 self->hrtf_right_impulses[15][i] = BINAURAL_RIGHT_HRTF_15[i];
1427 }
1428
1429 self->vbap_buffer = (MYFLT **)PyMem_RawRealloc(self->vbap_buffer, 16 * sizeof(MYFLT *));
1430
1431 for (i = 0; i < 16; i++)
1432 {
1433 self->vbap_buffer[i] = (MYFLT *)PyMem_RawMalloc(self->bufsize * sizeof(MYFLT));
1434 }
1435
1436 self->buffer_streams = (MYFLT *)PyMem_RawRealloc(self->buffer_streams, 2 * self->bufsize * sizeof(MYFLT));
1437
1438 for (k = 0; k < (2 * self->bufsize); k++)
1439 {
1440 self->buffer_streams[k] = 0.0;
1441 }
1442
1443 (*self->mode_func_ptr)(self);
1444
1445 return (PyObject *)self;
1446 }
1447
1448 static PyObject * Binauraler_getServer(Binauraler* self) { GET_SERVER };
1449 static PyObject * Binauraler_getStream(Binauraler* self) { GET_STREAM };
1450
1451 static PyObject * Binauraler_play(Binauraler *self, PyObject *args, PyObject *kwds) { PLAY };
1452 static PyObject * Binauraler_stop(Binauraler *self, PyObject *args, PyObject *kwds) { STOP };
1453
1454 static PyObject * Binauraler_setAzimuth(Binauraler *self, PyObject *arg) { SET_PARAM(self->azi, self->azi_stream, 0); }
1455 static PyObject * Binauraler_setElevation(Binauraler *self, PyObject *arg) { SET_PARAM(self->ele, self->ele_stream, 1); }
1456 static PyObject * Binauraler_setAzispan(Binauraler *self, PyObject *arg) { SET_PARAM(self->azispan, self->azispan_stream, 2); }
1457 static PyObject * Binauraler_setElespan(Binauraler *self, PyObject *arg) { SET_PARAM(self->elespan, self->elespan_stream, 3); }
1458
1459 static PyMemberDef Binauraler_members[] =
1460 {
1461 {"server", T_OBJECT_EX, offsetof(Binauraler, server), 0, "Pyo server."},
1462 {"stream", T_OBJECT_EX, offsetof(Binauraler, stream), 0, "Stream object."},
1463 {"input", T_OBJECT_EX, offsetof(Binauraler, input), 0, "Input sound object."},
1464 {"azi", T_OBJECT_EX, offsetof(Binauraler, azi), 0, "Azimuth object."},
1465 {"ele", T_OBJECT_EX, offsetof(Binauraler, ele), 0, "Elevation object."},
1466 {"azispan", T_OBJECT_EX, offsetof(Binauraler, azispan), 0, "Azimuth spanning."},
1467 {"elespan", T_OBJECT_EX, offsetof(Binauraler, elespan), 0, "Elevation spanning."},
1468 {NULL} /* Sentinel */
1469 };
1470
1471 static PyMethodDef Binauraler_methods[] =
1472 {
1473 {"getServer", (PyCFunction)Binauraler_getServer, METH_NOARGS, "Returns server object."},
1474 {"_getStream", (PyCFunction)Binauraler_getStream, METH_NOARGS, "Returns stream object."},
1475 {"play", (PyCFunction)Binauraler_play, METH_VARARGS | METH_KEYWORDS, "Starts computing without sending sound to soundcard."},
1476 {"stop", (PyCFunction)Binauraler_stop, METH_VARARGS | METH_KEYWORDS, "Stops computing."},
1477 {"setAzimuth", (PyCFunction)Binauraler_setAzimuth, METH_O, "Sets azimuth value between -180 and 180 degrees."},
1478 {"setElevation", (PyCFunction)Binauraler_setElevation, METH_O, "Sets elevation value between -40 and 90 degrees."},
1479 {"setAzispan", (PyCFunction)Binauraler_setAzispan, METH_O, "Sets azimuth spanning value between 0 and 1."},
1480 {"setElespan", (PyCFunction)Binauraler_setElespan, METH_O, "Sets elevation spanning value between 0 and 1."},
1481 {NULL} /* Sentinel */
1482 };
1483
1484 PyTypeObject BinauralerType =
1485 {
1486 PyVarObject_HEAD_INIT(NULL, 0)
1487 "_pyo.Binauraler_base", /*tp_name*/
1488 sizeof(Binauraler), /*tp_basicsize*/
1489 0, /*tp_itemsize*/
1490 (destructor)Binauraler_dealloc, /*tp_dealloc*/
1491 0, /*tp_print*/
1492 0, /*tp_getattr*/
1493 0, /*tp_setattr*/
1494 0, /*tp_as_async (tp_compare in Python 2)*/
1495 0, /*tp_repr*/
1496 0, /*tp_as_number*/
1497 0, /*tp_as_sequence*/
1498 0, /*tp_as_mapping*/
1499 0, /*tp_hash */
1500 0, /*tp_call*/
1501 0, /*tp_str*/
1502 0, /*tp_getattro*/
1503 0, /*tp_setattro*/
1504 0, /*tp_as_buffer*/
1505 Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE | Py_TPFLAGS_HAVE_GC, /*tp_flags*/
1506 "Binauraler main objects.", /* tp_doc */
1507 (traverseproc)Binauraler_traverse, /* tp_traverse */
1508 (inquiry)Binauraler_clear, /* tp_clear */
1509 0, /* tp_richcompare */
1510 0, /* tp_weaklistoffset */
1511 0, /* tp_iter */
1512 0, /* tp_iternext */
1513 Binauraler_methods, /* tp_methods */
1514 Binauraler_members, /* tp_members */
1515 0, /* tp_getset */
1516 0, /* tp_base */
1517 0, /* tp_dict */
1518 0, /* tp_descr_get */
1519 0, /* tp_descr_set */
1520 0, /* tp_dictoffset */
1521 0, /* tp_init */
1522 0, /* tp_alloc */
1523 Binauraler_new, /* tp_new */
1524 };
1525
1526 /************************************************************************************************/
1527 /* BinauralSpat streamer object */
1528 /************************************************************************************************/
1529 typedef struct
1530 {
1531 pyo_audio_HEAD
1532 Binauraler *mainSplitter;
1533 int modebuffer[2];
1534 int chnl; // panning order
1535 } Binaural;
1536
1537 static void Binaural_postprocessing_ii(Binaural *self) { POST_PROCESSING_II };
1538 static void Binaural_postprocessing_ai(Binaural *self) { POST_PROCESSING_AI };
1539 static void Binaural_postprocessing_ia(Binaural *self) { POST_PROCESSING_IA };
1540 static void Binaural_postprocessing_aa(Binaural *self) { POST_PROCESSING_AA };
1541 static void Binaural_postprocessing_ireva(Binaural *self) { POST_PROCESSING_IREVA };
1542 static void Binaural_postprocessing_areva(Binaural *self) { POST_PROCESSING_AREVA };
1543 static void Binaural_postprocessing_revai(Binaural *self) { POST_PROCESSING_REVAI };
1544 static void Binaural_postprocessing_revaa(Binaural *self) { POST_PROCESSING_REVAA };
1545 static void Binaural_postprocessing_revareva(Binaural *self) { POST_PROCESSING_REVAREVA };
1546
1547 static void
1548 Binaural_setProcMode(Binaural *self)
1549 {
1550 int muladdmode;
1551 muladdmode = self->modebuffer[0] + self->modebuffer[1] * 10;
1552
1553 switch (muladdmode)
1554 {
1555 case 0:
1556 self->muladd_func_ptr = Binaural_postprocessing_ii;
1557 break;
1558
1559 case 1:
1560 self->muladd_func_ptr = Binaural_postprocessing_ai;
1561 break;
1562
1563 case 2:
1564 self->muladd_func_ptr = Binaural_postprocessing_revai;
1565 break;
1566
1567 case 10:
1568 self->muladd_func_ptr = Binaural_postprocessing_ia;
1569 break;
1570
1571 case 11:
1572 self->muladd_func_ptr = Binaural_postprocessing_aa;
1573 break;
1574
1575 case 12:
1576 self->muladd_func_ptr = Binaural_postprocessing_revaa;
1577 break;
1578
1579 case 20:
1580 self->muladd_func_ptr = Binaural_postprocessing_ireva;
1581 break;
1582
1583 case 21:
1584 self->muladd_func_ptr = Binaural_postprocessing_areva;
1585 break;
1586
1587 case 22:
1588 self->muladd_func_ptr = Binaural_postprocessing_revareva;
1589 break;
1590 }
1591 }
1592
1593 static void
1594 Binaural_compute_next_data_frame(Binaural *self)
1595 {
1596 int i;
1597 MYFLT *tmp;
1598 int offset = self->chnl * self->bufsize;
1599 tmp = Binauraler_getSamplesBuffer((Binauraler *)self->mainSplitter);
1600
1601 for (i = 0; i < self->bufsize; i++)
1602 {
1603 self->data[i] = tmp[i + offset];
1604 }
1605
1606 (*self->muladd_func_ptr)(self);
1607 }
1608
1609 static int
1610 Binaural_traverse(Binaural *self, visitproc visit, void *arg)
1611 {
1612 pyo_VISIT
1613 Py_VISIT(self->mainSplitter);
1614 return 0;
1615 }
1616
1617 static int
1618 Binaural_clear(Binaural *self)
1619 {
1620 pyo_CLEAR
1621 Py_CLEAR(self->mainSplitter);
1622 return 0;
1623 }
1624
1625 static void
1626 Binaural_dealloc(Binaural* self)
1627 {
1628 pyo_DEALLOC
1629 Binaural_clear(self);
1630 Py_TYPE(self->stream)->tp_free((PyObject*)self->stream);
1631 Py_TYPE(self)->tp_free((PyObject*)self);
1632 }
1633
1634 static PyObject *
1635 Binaural_new(PyTypeObject *type, PyObject *args, PyObject *kwds)
1636 {
1637 int i;
1638 PyObject *maintmp = NULL, *multmp = NULL, *addtmp = NULL;
1639 Binaural *self;
1640 self = (Binaural *)type->tp_alloc(type, 0);
1641
1642 self->modebuffer[0] = 0;
1643 self->modebuffer[1] = 0;
1644
1645 INIT_OBJECT_COMMON
1646 Stream_setFunctionPtr(self->stream, Binaural_compute_next_data_frame);
1647 self->mode_func_ptr = Binaural_setProcMode;
1648
1649 static char *kwlist[] = {"mainSplitter", "chnl", "mul", "add", NULL};
1650
1651 if (! PyArg_ParseTupleAndKeywords(args, kwds, "Oi|OO", kwlist, &maintmp, &self->chnl, &multmp, &addtmp))
1652 Py_RETURN_NONE;
1653
1654 self->mainSplitter = (Binauraler *)maintmp;
1655 Py_INCREF(self->mainSplitter);
1656
1657 if (multmp)
1658 {
1659 PyObject_CallMethod((PyObject *)self, "setMul", "O", multmp);
1660 }
1661
1662 if (addtmp)
1663 {
1664 PyObject_CallMethod((PyObject *)self, "setAdd", "O", addtmp);
1665 }
1666
1667 PyObject_CallMethod(self->server, "addStream", "O", self->stream);
1668
1669 (*self->mode_func_ptr)(self);
1670
1671 return (PyObject *)self;
1672 }
1673
1674 static PyObject * Binaural_getServer(Binaural* self) { GET_SERVER };
1675 static PyObject * Binaural_getStream(Binaural* self) { GET_STREAM };
1676 static PyObject * Binaural_setMul(Binaural *self, PyObject *arg) { SET_MUL };
1677 static PyObject * Binaural_setAdd(Binaural *self, PyObject *arg) { SET_ADD };
1678 static PyObject * Binaural_setSub(Binaural *self, PyObject *arg) { SET_SUB };
1679 static PyObject * Binaural_setDiv(Binaural *self, PyObject *arg) { SET_DIV };
1680
1681 static PyObject * Binaural_play(Binaural *self, PyObject *args, PyObject *kwds) { PLAY };
1682 static PyObject * Binaural_out(Binaural *self, PyObject *args, PyObject *kwds) { OUT };
1683 static PyObject * Binaural_stop(Binaural *self, PyObject *args, PyObject *kwds) { STOP };
1684
1685 static PyObject * Binaural_multiply(Binaural *self, PyObject *arg) { MULTIPLY };
1686 static PyObject * Binaural_inplace_multiply(Binaural *self, PyObject *arg) { INPLACE_MULTIPLY };
1687 static PyObject * Binaural_add(Binaural *self, PyObject *arg) { ADD };
1688 static PyObject * Binaural_inplace_add(Binaural *self, PyObject *arg) { INPLACE_ADD };
1689 static PyObject * Binaural_sub(Binaural *self, PyObject *arg) { SUB };
1690 static PyObject * Binaural_inplace_sub(Binaural *self, PyObject *arg) { INPLACE_SUB };
1691 static PyObject * Binaural_div(Binaural *self, PyObject *arg) { DIV };
1692 static PyObject * Binaural_inplace_div(Binaural *self, PyObject *arg) { INPLACE_DIV };
1693
1694 static PyMemberDef Binaural_members[] =
1695 {
1696 {"server", T_OBJECT_EX, offsetof(Binaural, server), 0, "Pyo server."},
1697 {"stream", T_OBJECT_EX, offsetof(Binaural, stream), 0, "Stream object."},
1698 {"mul", T_OBJECT_EX, offsetof(Binaural, mul), 0, "Mul factor."},
1699 {"add", T_OBJECT_EX, offsetof(Binaural, add), 0, "Add factor."},
1700 {NULL} /* Sentinel */
1701 };
1702
1703 static PyMethodDef Binaural_methods[] =
1704 {
1705 {"getServer", (PyCFunction)Binaural_getServer, METH_NOARGS, "Returns server object."},
1706 {"_getStream", (PyCFunction)Binaural_getStream, METH_NOARGS, "Returns stream object."},
1707 {"play", (PyCFunction)Binaural_play, METH_VARARGS | METH_KEYWORDS, "Starts computing without sending sound to soundcard."},
1708 {"out", (PyCFunction)Binaural_out, METH_VARARGS | METH_KEYWORDS, "Starts computing and sends sound to soundcard channel speficied by argument."},
1709 {"stop", (PyCFunction)Binaural_stop, METH_VARARGS | METH_KEYWORDS, "Stops computing."},
1710 {"setMul", (PyCFunction)Binaural_setMul, METH_O, "Sets Binaural mul factor."},
1711 {"setAdd", (PyCFunction)Binaural_setAdd, METH_O, "Sets Binaural add factor."},
1712 {"setSub", (PyCFunction)Binaural_setSub, METH_O, "Sets inverse add factor."},
1713 {"setDiv", (PyCFunction)Binaural_setDiv, METH_O, "Sets inverse mul factor."},
1714 {NULL} /* Sentinel */
1715 };
1716
1717 static PyNumberMethods Binaural_as_number =
1718 {
1719 (binaryfunc)Binaural_add, /*nb_add*/
1720 (binaryfunc)Binaural_sub, /*nb_subtract*/
1721 (binaryfunc)Binaural_multiply, /*nb_multiply*/
1722 0, /*nb_remainder*/
1723 0, /*nb_divmod*/
1724 0, /*nb_power*/
1725 0, /*nb_neg*/
1726 0, /*nb_pos*/
1727 0, /*(unaryfunc)array_abs,*/
1728 0, /*nb_nonzero*/
1729 0, /*nb_invert*/
1730 0, /*nb_lshift*/
1731 0, /*nb_rshift*/
1732 0, /*nb_and*/
1733 0, /*nb_xor*/
1734 0, /*nb_or*/
1735 0, /*nb_int*/
1736 0, /*nb_long*/
1737 0, /*nb_float*/
1738 (binaryfunc)Binaural_inplace_add, /*inplace_add*/
1739 (binaryfunc)Binaural_inplace_sub, /*inplace_subtract*/
1740 (binaryfunc)Binaural_inplace_multiply, /*inplace_multiply*/
1741 0, /*inplace_remainder*/
1742 0, /*inplace_power*/
1743 0, /*inplace_lshift*/
1744 0, /*inplace_rshift*/
1745 0, /*inplace_and*/
1746 0, /*inplace_xor*/
1747 0, /*inplace_or*/
1748 0, /*nb_floor_divide*/
1749 (binaryfunc)Binaural_div, /*nb_true_divide*/
1750 0, /*nb_inplace_floor_divide*/
1751 (binaryfunc)Binaural_inplace_div, /*nb_inplace_true_divide*/
1752 0, /* nb_index */
1753 };
1754
1755 PyTypeObject BinauralType =
1756 {
1757 PyVarObject_HEAD_INIT(NULL, 0)
1758 "_pyo.Binaural_base", /*tp_name*/
1759 sizeof(Binaural), /*tp_basicsize*/
1760 0, /*tp_itemsize*/
1761 (destructor)Binaural_dealloc, /*tp_dealloc*/
1762 0, /*tp_print*/
1763 0, /*tp_getattr*/
1764 0, /*tp_setattr*/
1765 0, /*tp_as_async (tp_compare in Python 2)*/
1766 0, /*tp_repr*/
1767 &Binaural_as_number, /*tp_as_number*/
1768 0, /*tp_as_sequence*/
1769 0, /*tp_as_mapping*/
1770 0, /*tp_hash */
1771 0, /*tp_call*/
1772 0, /*tp_str*/
1773 0, /*tp_getattro*/
1774 0, /*tp_setattro*/
1775 0, /*tp_as_buffer*/
1776 Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE | Py_TPFLAGS_HAVE_GC, /*tp_flags*/
1777 "Binaural objects. Reads one channel from a Binauralter.", /* tp_doc */
1778 (traverseproc)Binaural_traverse, /* tp_traverse */
1779 (inquiry)Binaural_clear, /* tp_clear */
1780 0, /* tp_richcompare */
1781 0, /* tp_weaklistoffset */
1782 0, /* tp_iter */
1783 0, /* tp_iternext */
1784 Binaural_methods, /* tp_methods */
1785 Binaural_members, /* tp_members */
1786 0, /* tp_getset */
1787 0, /* tp_base */
1788 0, /* tp_dict */
1789 0, /* tp_descr_get */
1790 0, /* tp_descr_set */
1791 0, /* tp_dictoffset */
1792 0, /* tp_init */
1793 0, /* tp_alloc */
1794 Binaural_new, /* tp_new */
1795 };