Commit Graph

2887 Commits

Author SHA1 Message Date
Chris Robinson
40a0692a1c Use vectors for the GenModList 2014-03-21 02:41:46 -07:00
Chris Robinson
ff63188cc2 Add a generic vector interface and use it for the active effect slots 2014-03-21 01:23:01 -07:00
Chris Robinson
e6e3937fa9 Use flexible array members to pad the device and context structs
This helps avoid the convoluted math otherwise required to ensure the default
slot and listener, respectively, are aligned.
2014-03-20 14:49:46 -07:00
Chris Robinson
168149ce9d Keep track of the mix count
The purpose of this is to provide a safe way to be able to "swap" resources
used by the mixer from other threads without the need to block the mixer, as
well as a way to track when mixes have occurred. The idea is two-fold:

It provides a way to safely swap resources. If the mixer were to (atomically)
get a reference to an object to access it from, another thread would be able
allocate and prepare a new object then swap the reference to it with the stored
one. The other thread would then be able to wait until (count&1) is clear,
indicating the mixer is not running, before safely freeing the old object for
the mixer to use the new one.

It also provides a way to tell if the mixer has run. With this, a thread would
be able to read multiple values, which could be altered by the mixer, without
requiring a mixer lock. Comparing the before and after counts for inequality
would signify if the mixer has (started to) run, indicating the values may be
out of sync and should try getting them again. Of course, it will still need
something like a RWLock to ensure another (non-mixer) thread doesn't try to
write to the values at the same time.

Note that because of the possibility of overflow, the counter is not reliable
as an absolute count.
2014-03-19 19:00:54 -07:00
Chris Robinson
0c5cbafcd8 Use a union to combine HRTF and non-HRTF mixer params 2014-03-19 17:55:09 -07:00
Chris Robinson
213e3ba4af Select the mixer when setting the mixer-specific parameters 2014-03-19 16:10:09 -07:00
Chris Robinson
6ee54fb1f3 Store some source mixing parameters in the active source struct 2014-03-19 13:14:11 -07:00
Chris Robinson
d6f7aac1bb Use a separate struct for tracking active sources 2014-03-18 19:56:25 -07:00
Chris Robinson
71b177918d Add another directory to .gitignore 2014-03-17 15:20:32 -07:00
Chris Robinson
be2aeeb2fb Remove some unneeded code and unnecessary macros in the OpenSL backend 2014-03-17 15:17:56 -07:00
Chris Robinson
dc74473025 Store the old-style backend funcs in the wrapper 2014-03-17 10:54:27 -07:00
Chris Robinson
d346038102 Don't define HAVE_DYNLOAD with the IDE parser 2014-03-17 09:46:07 -07:00
Chris Robinson
cf066fd306 Don't assume the default mmdevapi device is in the collection 2014-03-17 09:40:56 -07:00
Chris Robinson
bb787ba8ee Avoid GCC's macro arg concat extension with IDE parsing 2014-03-17 09:16:33 -07:00
Chris Robinson
308d87b12a Return the original value from CompExchange* 2014-03-09 03:49:40 -07:00
Chris Robinson
372f3178f8 Remove the Apple-specific atomic function implementations.
I'm not sure if they're even used, but they were rather ugly and are set to get
even uglier since they don't follow normal conventions (missing exchange, and
cas not returning the original value).
2014-03-09 03:28:00 -07:00
Chris Robinson
74f2864c74 Update config file comments 2014-03-09 00:32:57 -08:00
Chris Robinson
cde2f825d5 Use the correct array size 2014-03-08 22:48:36 -08:00
Chris Robinson
14a04020ff Improve int-to-float and uint-to-float conversions 2014-03-08 22:34:07 -08:00
Chris Robinson
2e279684d7 Only require MSADPCM block alignment to be a multiple of 2 2014-03-06 21:42:03 -08:00
Chris Robinson
7657fbb296 Only sign-expand the nibble when needed 2014-03-06 19:14:19 -08:00
Chris Robinson
143f786d1a Move the sample conversion routines to a separate file 2014-03-05 16:38:02 -08:00
Chris Robinson
bf4ddfef6d Implement a simplistic MSADPCM encoder
It's not particularly good, but it's better than silence.
2014-03-05 07:27:22 -08:00
Chris Robinson
61569e09ed Allocate enough temp space for the ADPCM decoders and encoders 2014-03-05 06:18:55 -08:00
Chris Robinson
a4126b66d4 Use specialized methods for converting ALshort to IMA4 and MSADPCM
As before, to avoid unnecessary direct copies
2014-03-05 06:13:00 -08:00
Chris Robinson
f82f3f10ab Use specialized methods for converting IMA4 and MSADPCM to ALshort
Since the decoder methods already convert to ALshort, there's no need to use a
temp buffer that's just going to copy directly to the destination.
2014-03-05 04:59:24 -08:00
Chris Robinson
15b68fe694 Use maxi to clamp an int to a lower-bound 2014-03-05 04:37:55 -08:00
Chris Robinson
fb1f9aad6e Expand the sign bit on the initial MSADPCM delta value 2014-03-05 00:30:23 -08:00
Chris Robinson
a1c440bd09 Add an extension to support MSADPCM buffer formats 2014-03-04 22:44:30 -08:00
Chris Robinson
f3a87d72b2 Add an extension to alter the block alignment for buffer unpack/pack ops
This is for unpacking (reading, e.g. alBufferData) and packing (writing, e.g.
alGetBufferSamplesSOFT) operations. The alignments are specified in sample
frames, with 0 meaning the default (65 for IMA4, 1 otherwise). IMA4 alignment
must be a multiple of 8, plus 1 (e.g. alignment = n*8 + 1), otherwise an error
will occur during (un)packing. Chenging the block alignment does not affect
already-loaded sample data, only future unpack/pack operations... so for
example, this is perfectly valid:

// Load mono IMA4 data with a block alignment of 1024 bytes, or 2041 sample
// frames.
alBufferi(buffer, AL_UNPACK_BLOCK_ALIGNMENT_SOFT, 2041);
alBufferData(buffer, AL_FORMAT_MONO_IMA4, data, data_len, srate);
alBufferi(buffer, AL_UNPACK_BLOCK_ALIGNMENT_SOFT, 0);
2014-03-04 05:53:35 -08:00
Chris Robinson
b0a6b6427c Parameterize the block alignment 2014-03-04 04:29:35 -08:00
Chris Robinson
a6eb38ea7f Use alloca for temp space decoding/encoding IMA4 blocks 2014-03-03 20:02:15 -08:00
Chris Robinson
a2d9133ffc Reduce explicit template declarations and ignore IMA4-to-IMA4 conversions
Since we never store IMA4 data in buffers, we should only ever convert from
(user input) or to (user output) IMA4. Once we allow user-specified pack/unpack
block alignment, this wouldn't be a simple memcpy anyway.
2014-03-03 17:25:46 -08:00
Chris Robinson
c442c93a93 Store the original frame size alignment in the buffer 2014-03-03 17:05:08 -08:00
Chris Robinson
ea8a85b19c Move PATH_MAX fallback definitions to alMain.h 2014-02-27 18:17:20 -08:00
Chris Robinson
3867e3857d Add back the missing PATH_MAX fallback 2014-02-27 02:55:43 -08:00
Chris Robinson
6e7c0e15eb Use OpenDataFile to load soundfonts relative to data directories 2014-02-27 02:20:51 -08:00
Chris Robinson
fd3acf19fe Add a note that absolute paths may be used for hrtf_tables 2014-02-27 01:54:45 -08:00
Chris Robinson
a8249c3469 Move OpenDataFile to helpers.c so other sources can use it 2014-02-27 01:49:23 -08:00
Chris Robinson
3145bac8c6 Add an explicit cast to make Windows happy 2014-02-26 17:45:18 -08:00
Chris Robinson
99d82690ef Don't fallback to relative filename handling if opening as absolute fails 2014-02-26 17:38:19 -08:00
Chris Robinson
1b9a722601 Expand environment variables for all config option values when loading 2014-02-26 17:25:05 -08:00
Chris Robinson
89506435fa Support environment variables in the hrtf_tables config value 2014-02-25 19:18:59 -08:00
Chris Robinson
0ddb9888fe Fix a config option comment 2014-02-23 21:46:11 -08:00
Chris Robinson
9dd16f8b9c Attempt to restore the Neon-enhanced ApplyCoeffsStep method
Unable to test, but it hopefully works.
2014-02-23 21:28:34 -08:00
Chris Robinson
9a4ded2491 Revert "Apply HRTF coefficient stepping separately"
This reverts commit 25b9c3d0c1.

Conflicts:
	Alc/mixer_neon.c

Unfortunately this also undoes the Neon-enhanced ApplyCoeffsStep method.
2014-02-23 21:17:09 -08:00
Chris Robinson
c68ce288d0 Move HRTF macros and function declarations to a separate header 2014-02-23 21:11:01 -08:00
Chris Robinson
5731534e8d Move the default hrtf table to an external file 2014-02-23 21:02:11 -08:00
Chris Robinson
9f43de62ab Add a return value to FindHrtfFormat 2014-02-23 20:14:07 -08:00
Chris Robinson
ef8002a832 Check the hrtf config option earlier
This is to make sure it tries to find an HRTF-compatible format before reseting
the device, just like when using ALC_HRTF_SOFT.
2014-02-23 20:00:52 -08:00