2454 Commits

Author SHA1 Message Date
Chris Robinson
70b23ab77f Add a helper to search for a channel index by name 2014-10-02 21:19:34 -07:00
Chris Robinson
79fb86d8f7 Store default speaker configurations in a struct 2014-10-02 20:25:30 -07:00
Chris Robinson
95ba18cf4e Make ComputeAngleGains use ComputeDirectionalGains 2014-10-02 18:05:42 -07:00
Chris Robinson
918c773a59 Use helpers to set the gain step values 2014-10-02 00:56:29 -07:00
Chris Robinson
3aa63e3e9b Use VECTOR_FIND_IF instead of manual loops 2014-09-30 22:42:07 -07:00
Chris Robinson
2d89d33dd1 Add a cast for MSVC 2014-09-30 21:50:29 -07:00
Chris Robinson
af7330de88 Copy the null terminator from the string instead of appending it 2014-09-30 21:49:29 -07:00
Chris Robinson
d82d6c701d Use size_t for the vector size and capacity 2014-09-30 21:47:22 -07:00
Chris Robinson
4d36ef65b2 Use an ambisonics-based panning method
For mono sources, third-order ambisonics is utilized to generate panning gains.
The general idea is that a panned mono sound can be encoded into b-format
ambisonics as:

w[i] = sample[i] * 0.7071;
x[i] = sample[i] * dir[0];
y[i] = sample[i] * dir[1];
...

and subsequently rendered using:

output[chan][i] = w[i] * w_coeffs[chan] +
                  x[i] * x_coeffs[chan] +
                  y[i] * y_coeffs[chan] +
                  ...;

By reordering the math, channel gains can be generated by doing:

gain[chan] = 0.7071 * w_coeffs[chan] +
             dir[0] * x_coeffs[chan] +
             dir[1] * y_coeffs[chan] +
             ...;

which then get applied as normal:

output[chan][i] = sample[i] * gain[chan];

One of the reasons to use ambisonics for panning is that it provides arguably
better reproduction for sounds emanating from between two speakers. As well,
this makes it easier to pan in all 3 dimensions, with for instance a "3D7.1" or
8-channel cube speaker configuration by simply providing the necessary
coefficients (this will need some work since some methods still use angle-based
panpot, particularly multi-channel sources).

Unfortunately, the math to reliably generate the coefficients for a given
speaker configuration is too costly to do at run-time. They have to be pre-
generated based on a pre-specified speaker arangement, which means the config
options for tweaking speaker angles are no longer supportable. Eventually I
hope to provide config options for custom coefficients, which can either be
generated and written in manually, or via alsoft-config from user-specified
speaker positions.

The current default set of coefficients were generated using the MATLAB scripts
(compatible with GNU Octave) from the excellent Ambisonic Decoder Toolbox, at
https://bitbucket.org/ambidecodertoolbox/adt/
2014-09-30 07:33:13 -07:00
Chris Robinson
4e66224d6c Combine some fields into a struct 2014-09-10 17:53:01 -07:00
Chris Robinson
01adfde199 Invert the ChannelOffsets array 2014-09-10 16:52:54 -07:00
Chris Robinson
49cb2421c7 Use a wave file channel mask based on the actual format 2014-09-10 08:30:07 -07:00
Chris Robinson
4a712dc612 Remove some unnecessary config options 2014-09-08 15:29:07 -07:00
Chris Robinson
7a31847f7d Use a vector instead of a manual dynamic array 2014-09-08 15:24:27 -07:00
Chris Robinson
5ff1730e02 Don't modify a capture device's format
OpenAL's capture API guarantees the application gets the format requested, or
else the device will fail to open. The only valid change is that the capture
buffer can be larger than requested.
2014-09-08 14:29:59 -07:00
Chris Robinson
a234fc11e5 Remove the GetLatency method from the old BackendFuncs 2014-09-08 06:59:58 -07:00
Chris Robinson
9dacd89a02 Convert the winmm backend to the new backend API 2014-09-08 06:46:20 -07:00
Chris Robinson
2be33d8a77 Only pass nano seconds to al_nssleep 2014-09-08 04:37:52 -07:00
Chris Robinson
0b250b246d Use a standard pointer-sized integer type 2014-09-04 23:23:48 -07:00
Chris Robinson
2f2768e7c3 Make the fontsound's buffer and link fields atomic 2014-09-03 16:29:17 -07:00
Chris Robinson
ba827cdfff Fix Neon mixer definition 2014-08-31 23:46:43 -07:00
Chris Robinson
705c60d924 Use al_calloc/al_free to allocate contexts and voices 2014-08-30 20:59:46 -07:00
Chris Robinson
f04b15692e Setup the HRTF format before tracing the pre-reset format 2014-08-29 19:34:20 -07:00
Chris Robinson
f18d2f2445 Check mmdevapi device ids to match the default device
Seems Windows can return different IMMDevice object pointers for the same
endpoint.
2014-08-28 18:22:17 -07:00
Chris Robinson
2b87ffece5 Return the correct default capture device name 2014-08-26 14:52:36 -07:00
Chris Robinson
368bf037dd Check the given CoreAudio capture device name 2014-08-26 14:50:14 -07:00
Chris Robinson
99b71278db Remove a couple unnecessary typedefs 2014-08-24 23:48:42 -07:00
Chris Robinson
a3bba200c0 Convert the wave writer backend to the new API 2014-08-24 22:20:02 -07:00
Chris Robinson
259e265920 Rename activesource to voice 2014-08-21 03:41:13 -07:00
Chris Robinson
65d2e0eb8d Use an array of objects for active sources instead of pointers 2014-08-21 02:27:56 -07:00
Chris Robinson
b92e643e97 Use a NULL source for inactive activesources
Also only access the activesource's source field once per update.
2014-08-21 00:29:42 -07:00
Chris Robinson
e3d72ccd15 Support brace-enclosed environment variable names
This makes it possible to append alpha-numeric characters directly to an
environment variable value, e.g. ${FOO}bar will use "FOO" as the variable name
and keep the "bar" as-is, whereas $FOObar will take "FOObar" as the variable
name.
2014-08-19 16:54:53 -07:00
François Cami
3c13e1e333 Update COPYING to the latest https://www.gnu.org/licenses/old-licenses/lgpl-2.0.txt to fix the FSF' address Fix the FSF' address in the source 2014-08-18 11:34:29 -07:00
Chris Robinson
8364aa5f6f ALC_SOFT_pause_device is finished 2014-08-12 08:45:11 -07:00
Chris Robinson
ba3f1e7468 Assume SSE is available if building with support and no run-time checking 2014-08-11 14:45:28 -07:00
Chris Robinson
74c8de6372 Try the __cpuid intrinsic if GCC's __get_cpuid isn't available 2014-08-11 14:19:15 -07:00
Chris Robinson
e3ee534c39 Check for GCC's __get_cpuid before using it 2014-08-11 13:38:43 -07:00
Chris Robinson
a3c236598a Simplify some vector size range checks 2014-08-10 10:52:08 -07:00
Chris Robinson
936a79da7d Give NULL for null-vector iterators 2014-08-10 09:12:08 -07:00
Chris Robinson
94013216b6 Pass pointer-to-vector types as char* instead of void*
C aliasing rules only allow char* to alias an otherwise-incompatible type,
rather than void*.
2014-08-10 08:46:55 -07:00
Chris Robinson
f173a67870 Use VECTOR_FIND_IF and VECTOR_FOR_EACH instead of manual loops 2014-08-09 06:15:11 -07:00
Chris Robinson
1692dda4b9 Use the default input device for portaudio's default capture device 2014-08-08 19:48:45 -07:00
Chris Robinson
e64d0f83cd Disable the autowah effect
There's apparently some issues with it causing noise or killing the output. It
might be due to the per-sample changes being too harsh for the filter to keep
up with, but it's not something I can take care of in time for release.

This commit should be reverted after release when work on fixing it can resume.
2014-08-06 23:38:05 -07:00
Chris Robinson
23441be474 Make the DYNLOAD LoadFSynth function non-inline 2014-08-05 19:38:33 -07:00
Chris Robinson
7b4a2335eb Load fluidsynth dynamically when possible 2014-08-05 01:48:30 -07:00
Chris Robinson
f5194a9d8e Use an ATOMIC_INIT macro instead of ATOMIC_LOAD_UNSAFE 2014-08-03 00:26:21 -07:00
Chris Robinson
87423f046e Use atomics for the device and context list heads 2014-08-01 02:04:40 -07:00
Chris Robinson
15a58eb383 Make the source's buffer queue head and current queue item atomic 2014-07-31 07:20:36 -07:00
Chris Robinson
ce046d2f03 Rename ATOMIC_COMPARE_EXCHANGE to ATOMIC_COMPARE_EXCHANGE_STRONG 2014-07-31 04:34:46 -07:00
Chris Robinson
6864053eee Use pulseaudio's write callback to signal a mixer proc wakeup 2014-07-26 22:04:26 -07:00