Commit Graph

2910 Commits

Author SHA1 Message Date
Chris Robinson
03fd2b8266 Remove setState from the MidiSynth vtable 2014-03-23 18:34:49 -07:00
Chris Robinson
de5c54db09 Remove an unused method 2014-03-23 17:47:58 -07:00
Chris Robinson
cbb82647fb Remove an unnecessary conditional 2014-03-23 17:44:26 -07:00
Chris Robinson
e2cb41dc61 Remove the last bits of the predictive sample processing 2014-03-23 17:33:57 -07:00
Chris Robinson
72986882f5 Remove the click removal buffers for auxiliary effect slots 2014-03-23 16:28:55 -07:00
Chris Robinson
a25260ea8a Identity gain step is 1, not 0 2014-03-23 16:13:46 -07:00
Chris Robinson
f5e10b9945 Fix Neon gain step loops 2014-03-23 16:13:13 -07:00
Chris Robinson
52deb557d5 Add gain stepping to the send mixers 2014-03-23 16:11:21 -07:00
Chris Robinson
83038c0dab Add some integer casts, and a range check 2014-03-23 15:22:37 -07:00
Chris Robinson
55f851093f Remove the now-unneeded click removal buffers for the device
They are still there for auxiliary sends. However, they should go away soon
enough too, and then we won't have to mess around with calculating extra
"predictive" samples in the mixer.
2014-03-23 07:31:33 -07:00
Chris Robinson
92433532fe Don't feed the HRTF mix to the click removal and pending click buffers
The coefficients (which control the volume and panning) already use stepping to
non-abruptly fade the mix.
2014-03-23 07:18:49 -07:00
Chris Robinson
81e049bd47 Step mixing gains per-sample for non-HRTF mixing
This fades the dry mixing gains using a logarithmic curve, which should produce
a smoother transition than a linear one. It functions similarly to a linear
fade except that

step = (target - current) / numsteps;
...
gain += step;

becomes

step = powf(target / current, 1.0f / numsteps);
...
gain *= step;

where 'target' and 'current' are clamped to a lower bound that is greater than
0 (which makes no sense on a logarithmic scale).

Consequently, the non-HRTF direct mixers do not do not feed into the click
removal and pending click buffers, as this per-sample fading would do an
adequate job of stopping clicks and pops caused by extreme gain changes. These
buffers should be removed shortly.
2014-03-23 06:57:00 -07:00
Chris Robinson
0ce0a88fd6 Move the step counter and moving flag to DirectParams 2014-03-23 03:03:03 -07:00
Chris Robinson
b0d511a860 Store the HrtfState directly in the DirectParams 2014-03-23 02:45:50 -07:00
Chris Robinson
cc599333a8 Don't try to use __restrict as a replacement for restrict
The compiler it's intended for, MSVC, can't use it anyway because of problems
it causes with __declspec(restrict).
2014-03-23 01:35:15 -07:00
Chris Robinson
9959972c7e Add a stub 'soft' MIDI synth handler
Eventually this one will be used to handle MIDI internally, using our own
mixers and resamplers.
2014-03-22 21:53:00 -07:00
Chris Robinson
842aeb888b Move some HRTF and mixer structs to alu.h 2014-03-22 02:39:57 -07:00
Chris Robinson
22f6eb18a2 Use a void* for the MidiSynth Delete method param 2014-03-22 01:49:03 -07:00
Chris Robinson
d8bfd12d31 Use a void* for the backend Delete method param 2014-03-22 00:28:55 -07:00
Chris Robinson
0a030c2bd9 Use a void* for the effect state Delete method param 2014-03-21 23:56:18 -07:00
Chris Robinson
f5ce73646c Avoid a size_t-to-ALuint conversion warning 2014-03-21 17:29:20 -07:00
Chris Robinson
8c33b4d742 Increase the vector reserve as needed when pushing in new items 2014-03-21 16:35:38 -07:00
Chris Robinson
983fa4630a Rename the vector's Max field to Capacity 2014-03-21 14:03:26 -07:00
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