325 Commits

Author SHA1 Message Date
Chris Robinson
048aee66cf Avoid accessing source properties more than once when updating parameters 2011-07-01 01:46:56 -07:00
Chris Robinson
723755788d Rename Suspend/ProcessContext since they are locking a mutex 2011-06-30 18:10:04 -07:00
Chris Robinson
032d0836a7 Declare some variables closer to where they're used 2011-06-29 23:32:48 -07:00
Chris Robinson
5736bbc3e4 Add a source property to skip channel virtualization for multi-channel buffers
With virtualization disabled, channels are mapped directly from input to output
and any input channel that is missing an output is dropped. Any virtualization
effects (such as HRTF filters) for positional cues are also skipped.

The idea is to allow applications a way to play pre-filtered audio that channel
vitualization effects could interfere with.
2011-06-29 23:18:49 -07:00
Chris Robinson
1b773a8585 Select the correct resampler 2011-06-28 00:30:00 -07:00
Chris Robinson
efaaf9b5f9 Don't bother with a per-context lock for disconnecting devices 2011-06-26 01:26:50 -07:00
Chris Robinson
1fc44d5788 Select the mixer during a source update 2011-06-25 00:13:56 -07:00
Chris Robinson
3dcfd0dc98 Use 'Distance' for the unclamped distance value, since the clamped value is
only used for distance attenuation
2011-06-21 12:55:21 -07:00
Chris Robinson
40b8934487 Calculate wet gain when needed 2011-06-18 16:45:26 -07:00
Chris Robinson
753e64c76c Do stereo duplication in two passes
First using the rear channels, then using the normal stereo channels
2011-06-17 16:20:18 -07:00
Chris Robinson
8bee7a2b7f Don't suspend individual contexts when updating 2011-06-16 05:29:38 -07:00
Chris Robinson
7ddfacb58f Use a minimum phase HRTF data set
This reduces the coefficient size from 128 down to 32, with a set of delays
2011-06-03 01:06:00 -07:00
Chris Robinson
7da2eea8f0 Add a 5.1 device format that uses side channels instead of back 2011-05-28 19:35:32 -07:00
Chris Robinson
6b6a7757ce Clear HRTF coefficients for the LFE channel 2011-05-25 19:04:19 -07:00
Chris Robinson
af005668da Avoid using an unnecessary temp variable 2011-05-21 23:14:55 -07:00
Chris Robinson
a9d9553fff Use a multi-dimensional array for the panning LUT 2011-05-21 17:45:54 -07:00
Chris Robinson
5cdf774ea7 Use the stored sample and channel count 2011-05-21 17:36:54 -07:00
Chris Robinson
35a0430c81 Store the separate effect parameters in a union 2011-05-20 09:36:36 -07:00
Chris Robinson
cbbb04eb40 Always fully normalize the position when using HRTF 2011-05-20 07:58:05 -07:00
Chris Robinson
7396aaf2c2 Fix HRTF elevation calculation 2011-05-19 17:57:14 -07:00
Chris Robinson
7210796cb8 Combine multiple loops 2011-05-15 02:12:42 -07:00
Chris Robinson
949cfe2ceb Re-enable duplication for stereo sounds 2011-05-15 00:18:28 -07:00
Chris Robinson
674b14faa3 Make a couple more pointers restricted 2011-05-07 04:32:53 -07:00
Chris Robinson
a8fdcd30a5 Some minor cleanups 2011-05-07 04:31:43 -07:00
Chris Robinson
db3cb23c1d Add an option to reverse Z panning of mono sources
Applications that are not built around OpenAL's orientation system need to
convert their given vectors to it. Depending on how this is done, it can lead
to proper stereo (left-right) panning with improper surround sound (front-back)
panning, which thusly sounds correct with stereo output and incorrect with 4+
channel output.

This option is intended to help fix playback of such applications on surround
sound systems, without having to resort to forcing stereo output.
2011-05-07 03:54:46 -07:00
Chris Robinson
7972f7a2da Combine duplicate arrays 2011-05-06 23:25:15 -07:00
Chris Robinson
8c3d50be28 Skip LFE with HRTF output 2011-05-06 04:46:21 -07:00
Chris Robinson
c2a6efc77a Use the panning algorithms to build the multi-channel source matrix
This prevents the stereo-duplication option from working. It should hopefully
be restored soon.
2011-05-06 04:37:10 -07:00
Chris Robinson
6928487aa1 Remove some redundancy 2011-05-06 02:53:22 -07:00
Chris Robinson
f97eca34df Minor source update fixes 2011-05-06 00:51:12 -07:00
Chris Robinson
1363e044ac Remove the head_dampen option
Now that HRTF is properly supported, it's not needed
2011-05-06 00:38:10 -07:00
Chris Robinson
9967d4eadd Mark a couple more pointers as restricted 2011-05-06 00:33:58 -07:00
Chris Robinson
e2850df07e Use the same filters for mono sources and multi-channel 2011-05-03 16:18:46 -07:00
Chris Robinson
9a28402b90 Fix non-spatialized mono sources 2011-05-02 18:33:32 -07:00
Chris Robinson
f843b7e2e3 Implement HRTF mixers for multi-channel sources 2011-05-02 02:22:30 -07:00
Chris Robinson
eea86ab891 Use flags instead of separate bools 2011-05-01 18:18:37 -07:00
Chris Robinson
56d9418119 Add an HRTF filter for mono sources
The data is based on the KEMAR HRTF data provided by MIT, which can be found at
<http://sound.media.mit.edu/resources/KEMAR.html>. The compact measurements
were used. See hrtf_tables.inc for more information.

The filter is only available for stereo output, using a 44100hz playback rate.
Note also that it currently only applies to mono sounds, and the cf_level and
head_dampen config options are ignored while it is active.
2011-05-01 13:59:44 -07:00
Chris Robinson
10a9753183 Add a compatibility option to treat cone angles as half angles
All previous versions of the library treated the source cone angles as half
angles, which is contrary to the spec. Setting the __ALSOFT_HALF_ANGLE_CONES
environment variable to "true" or "1" restores the buggy behavior for
compatibility with applications that expect it.

This is not a config file option because new apps should not be made to depend
on the old behavior.
2011-04-22 23:17:27 -07:00
Chris Robinson
1e8718fe87 Convert full-width cone angle source properties to half-width
The spec intends the property values to be the full angle encompassed by the
cones, but the calculation interprets them as the angle from the center
point.
2011-04-22 22:59:58 -07:00
Chris Robinson
678d0b87d0 Apply the device matrix to the multi-channel source matrix
Mono sources and effects already output according to the available output
device channels. Multiplying the device matrix with the source matrix results
in a matrix that has the same effect as applying the source matrix followed by
the device matrix, so all the channel remixing can be done in one place.
2011-04-14 21:03:37 -07:00
Chris Robinson
4eeed5376f Invert the device matrix row/column
It is accessed now as mat[target][source]
2011-03-13 08:46:54 -07:00
Chris Robinson
77ad538e68 Remove more unneeded casts 2011-03-13 07:11:09 -07:00
Chris Robinson
b699aca65b Remove unnecessary casts 2011-03-13 06:34:41 -07:00
Chris Robinson
c3cd4c80b2 Use a matrix when rendering to the dry buffer 2010-12-09 16:37:23 -08:00
Chris Robinson
be3f3c4bf0 Make better use of the type range when converting from float 2010-12-09 05:06:29 -08:00
Chris Robinson
4010a6b745 Remove some now-unused functions 2010-12-08 02:56:24 -08:00
Chris Robinson
88e3a22772 Separate device format into 'channel config' and 'sample type' components 2010-12-04 19:50:00 -08:00
Chris Robinson
59990acc2a Add functions to write (signed) byte and ushort samples to devices 2010-12-02 16:36:37 -08:00
Chris Robinson
4a0bf9fd44 Template-ize the device buffer writing functions 2010-12-01 21:50:49 -08:00
Chris Robinson
9e8fb89a52 Rename OUTPUTCHANNELS to something more descriptive 2010-12-01 18:33:17 -08:00