1313 Commits

Author SHA1 Message Date
Chris Robinson
9c5307a48a Rename BiquadState to BiquadFilter 2018-04-04 18:07:46 -07:00
Chris Robinson
5aecce5a0d Store the ALbufferlistitem's composited/max sample length 2018-03-27 18:09:28 -07:00
Chris Robinson
6990478369 Rename ALfilterState/Type to BiquadState/Type 2018-03-23 14:52:59 -07:00
Chris Robinson
8e976a92f7 Move NFC filters to the filter directory 2018-03-22 07:17:48 -07:00
Chris Robinson
7a23330ffe Move the filter implementation to a separate directory 2018-03-22 07:05:40 -07:00
Raulshc
6fd23f0984
EFX:Pitch Shifter implementation
Add pitch shifter effect using standard phase vocoder, based on work of Stephan Bernsee. Only mono signal processing by now.
2018-03-18 17:47:17 +01:00
Chris Robinson
8eb7a94e1c Apply a distance decay on the source send for the reverb's DecayLFRatio 2018-03-11 22:40:08 -07:00
Chris Robinson
30821e978b Add extern "C" to some headers 2018-03-09 17:24:03 -08:00
Chris Robinson
2187316bce Use function-like macros to call filter and effect vtable methods 2018-03-08 17:48:22 -08:00
Chris Robinson
07c8857558 Fix struct forward declaration typo 2018-03-08 17:48:21 -08:00
Chris Robinson
4e6c758daf Use a plain mutex for the property lock 2018-03-03 13:42:37 -08:00
Chris Robinson
bd32a682f7 Use atomic variables instead of volatile 2018-03-02 19:16:55 -08:00
Chris Robinson
812cb62617 Fix a comment regarding the effect slot channel scaling 2018-02-28 20:39:53 -08:00
Chris Robinson
a211c2f5e4 Avoid AL prefix on internal effect state factory types
Also avoid using the generic V/V0 macros for them
2018-02-28 19:37:12 -08:00
Chris Robinson
d25398d2c7 Avoid using static inline in headers 2018-02-25 13:14:14 -08:00
Chris Robinson
c7456affd5 Don't make the source state atomic 2018-02-24 09:44:52 -08:00
Chris Robinson
b5aa0c0759 Remove the unnecessary ComputeAmbientGains 2018-02-18 23:56:51 -08:00
Chris Robinson
e63e0ee596 Combine multiple functions called sequentially 2018-02-11 22:23:03 -08:00
Chris Robinson
5b11129eaa Use a function pointer for applying the dry mix post-process 2018-02-10 15:50:05 -08:00
Chris Robinson
9b878c64f9 Make the Connected state atomic
Also don't send the Disconnected event more than once.
2018-02-04 00:01:12 -08:00
Chris Robinson
b99e64a0e3 Provide more descriptive messages to disconnection events 2018-02-03 13:54:42 -08:00
Chris Robinson
40bda4d93f Add a disconnected event type 2018-02-03 01:07:06 -08:00
Chris Robinson
80cc32d77b Remove the unused thunk code 2018-02-02 22:59:06 -08:00
Chris Robinson
28fa82378b Remove the individual source queue and buffer locks
They're inherently protected by the mutex for their respective lists. Should
those mutexes be replaced by rwlocks the individual locks should also be
reinstated, but they're unlikely to be unless a lot of contention starts
happening in the read-only case.
2018-02-02 22:24:33 -08:00
Chris Robinson
6a4a88f8f5 Store an index to a given source's voice
For more efficient voice lookups when needed.
2018-02-01 23:56:35 -08:00
Chris Robinson
e240351d81 Use a semaphore to signal the event handler
Semaphores allow for semi-persistent signals, compared to a condition variable
which requires a mutex for proper detection. A semaphore can be 'post'ed after
writing some data on one thread, and another thread will be able to recognize
it quickly even if the post occured in between checking for data and waiting.

This more correctly fixes a race condition with events since the mixer
shouldn't be using mutexes, and arbitrary wake-ups just to make sure an event
wasn't missed was quite inefficient.
2018-02-01 18:20:14 -08:00
Chris Robinson
bcdc399029 Send buffer completed events when enabled 2018-02-01 01:36:03 -08:00
Chris Robinson
7256bc92fa Add a thread to marshal events from the mixer
To avoid having unknown user code running in the mixer thread that could
significantly delay the mixed output, a lockless ringbuffer is used for the
mixer to provide events that a secondary thread will pop off and process.
2018-01-31 20:21:54 -08:00
Chris Robinson
0394d5a44f Rename EventLock to make it more clear it's protecting the callback 2018-01-30 12:34:25 -08:00
Chris Robinson
c2710ffe87 Make EnabledEvts atomic 2018-01-28 16:58:41 -08:00
Chris Robinson
dcc5a10c7b Use a fixed array for the effect state factory list 2018-01-28 00:10:12 -08:00
Chris Robinson
0051ebace0 Don't bother with a return value that's never used 2018-01-27 23:50:04 -08:00
Chris Robinson
f16ece6048 Move some inline functions into a header instead of copying them
Unfortunately does not include the Lookup* functions, which need the full type
declaration to offset the pointer.
2018-01-27 21:16:24 -08:00
Chris Robinson
cb9fb31214 Store filters in an array of lists 2018-01-27 19:40:47 -08:00
Chris Robinson
e8c268ef09 Store effects in an array of lists 2018-01-27 19:04:32 -08:00
Chris Robinson
6a839600b9 Use a vector to store the effect slot pointers
And make the ID a simple index into it (1-base, to avoid ID 0).
2018-01-27 19:04:32 -08:00
Chris Robinson
031cf24880 Use an array lookup for source IDs
This is now similar to buffers, being stored in groups of 64 in a vector with
the ID providing the array indices.
2018-01-27 14:34:05 -08:00
Chris Robinson
38261a0f2a Make some more functions static where they're used 2018-01-27 14:34:05 -08:00
Chris Robinson
f76ab02bd4 Add a ctz64 fallback using _BitScanForward when available 2018-01-27 14:34:05 -08:00
Chris Robinson
9718502e5d Check for _BitScanForward64 before using it 2018-01-27 11:11:39 -08:00
Chris Robinson
9613b4bfe2 Use a different method for storing and looking up buffers
Rather than each buffer being individually allocated with a generated 'thunk'
ID that's used with a uint:ptr map, buffers are allocated in arrays of 64
within a vector. Each group of 64 has an associated 64-bit mask indicating
which are free to use, and the buffer ID is comprised of the two array indices
which directly locate the buffer (no searching, binary or otherwise).

Currently no buffers are actually deallocated after being allocated, though
they are reused. So an app that creates a ton of buffers once, then deletes
them all and uses only a couple from then on, will have a bit of waste, while
an app that's more consistent with the number of used buffers won't be a
problem. This can be improved by removing elements of the containing vector
that contain all-free buffers while there are plenty of other free buffers.

Also, this method can easily be applied to other resources, like sources.
2018-01-27 01:51:01 -08:00
Chris Robinson
5d2196c119 Don't rely on alMain.h in alBuffer.h 2018-01-26 21:32:43 -08:00
Chris Robinson
a885fd6d0e Make some functions static that are only used in one source 2018-01-26 21:11:12 -08:00
Chris Robinson
6ae7fc5df1 Add the printf-format attribute to alSetError 2018-01-25 23:52:09 -08:00
Chris Robinson
99f0377ae3 Construct error messages using parameterized values 2018-01-25 15:59:59 -08:00
Chris Robinson
f5236ab186 Use more appropriate enum values for events 2018-01-24 19:25:15 -08:00
Chris Robinson
2a7f5aa569 Add a deprecated event type for alDopplerVelocity 2018-01-24 18:47:19 -08:00
Chris Robinson
2ded5547ba Provide messages for the remaining AL errors 2018-01-24 17:07:01 -08:00
Chris Robinson
395278fcdb Set the buffer load error in LoadData 2018-01-24 12:45:56 -08:00
Chris Robinson
786a05876e Call the event callback when an error is generated
Most errors don't yet provide correct object IDs or text messages for the AL
error.
2018-01-24 12:10:48 -08:00