34 Commits

Author SHA1 Message Date
Chris Robinson
a502a41be3 Stop using almemory_order_consume 2016-11-17 00:46:46 -08:00
Chris Robinson
c7eb0b7393 Don't pass the context's distance model as the source's 2016-08-23 19:17:17 -07:00
Chris Robinson
dc8b7814c7 Avoid resupplying unneeded source updates
The source's voice holds a copy of the last properties it received, so listener
updates can make sources recalculate internal properties from that stored copy.
2016-08-23 18:56:01 -07:00
Chris Robinson
aff725cba3 Avoid redundantly storing distance model settings 2016-05-17 20:02:46 -07:00
Chris Robinson
b3338d25f6 Provide asynchronous property updates for sources
This necessitates a change in how source updates are handled. Rather than just
being able to update sources when a dependent object state is changed (e.g. a
listener gain change), now all source updates must be proactively provided.
Consequently, apps that do not utilize any deferring (AL_SOFT_defer_updates or
alcSuspendContext/alcProcessContext) may utilize more CPU since it'll be
filling out more update containers for the mixer thread to use.

The upside is that there's less blocking between the app's calling thread and
the mixer thread, particularly for vectors and other multi-value properties
(filters and sends). Deferring behavior when used is also improved, since
updates that shouldn't be applied yet are simply not provided. And when they
are provided, the mixer doesn't have to ignore them, meaning the actual
deferring of a context doesn't have to synchrnously force an update -- the
process call will send any pending updates, which the mixer will apply even if
another deferral occurs before the mixer runs, because it'll still be there
waiting on the next mixer invocation.

There is one slight bug introduced by this commit. When a listener change is
made, or changes to multiple sources while updates are being deferred, it is
possible for the mixer to run while the sources are prepping their updates,
causing some of the source updates to be seen before the other. This will be
fixed in short order.
2016-05-14 23:43:40 -07:00
Chris Robinson
f751f5e25e Store the remaining context properties with the listener properties 2016-05-13 20:21:20 -07:00
Chris Robinson
186b54aa3d Use a lockless method for updating listener and context properties
This uses a separate container to provide the relevant properties to the
internal update method, using atomic pointer swaps. A free-list is used to
avoid having too many individual containers.

This allows the mixer to update the internal listener properties without
requiring the lock to protect against async updates. It also allows concurrent
read access to the user-facing property values, even the multi-value ones (e.g.
the vectors).
2016-05-11 21:02:11 -07:00
Chris Robinson
3b8f54d572 Use aluVector in some more places 2014-12-16 07:20:27 -08: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
531c0d8e6b Explicitly pass the address of atomics and parameters that can be modified 2014-07-26 03:00:49 -07:00
Chris Robinson
5a339a2a5b Add macros for generic atomic functionality 2014-07-22 00:20:28 -07:00
Chris Robinson
0803f1b2f1 Remove al_try from alListener.c 2013-10-07 09:04:52 -07:00
Chris Robinson
1518895e15 Use an UNUSED macro instead of void-tagging unused parameters 2013-10-07 07:44:09 -07:00
Chris Robinson
39bc2ba65c Build the listener matrix separately 2012-10-09 06:19:36 -07:00
Chris Robinson
c22408cb2a Store a pointer to the listener in the context 2012-10-09 04:44:27 -07:00
Chris Robinson
248e079301 Switch alListener.c to the new error handling scheme, and get rid of more hungarian notation 2012-04-23 21:35:05 -07:00
Chris Robinson
fcf9034c2b Calculate the listener matrix when a new orientation is specified
This is so the matrix isn't derived each time a source is updated, and it will
make supporting user-defined matrices easier.
2011-10-30 08:27:24 -07:00
Chris Robinson
43350f9066 Silence some MSVC precision warnings 2011-09-22 00:35:08 -07:00
Chris Robinson
ab0b5d9890 Hold the context lock only as needed when handling the listener 2011-08-31 00:33:33 -07:00
Chris Robinson
1348bf2476 Make sure some listener property values are finite 2011-07-20 03:27:05 -07:00
Chris Robinson
1299fa2801 Avoid some alListenerfv calls while under the context lock 2011-07-11 01:21:29 -07:00
Chris Robinson
58466a304b Use a flag to signifiy that all sources need updating 2011-07-11 01:05:42 -07:00
Chris Robinson
723755788d Rename Suspend/ProcessContext since they are locking a mutex 2011-06-30 18:10:04 -07:00
Chris Robinson
7d73ac4405 Avoid calling some AL functions from under the context lock
There are still some more occurances to clear out (deletion in gen error,
effects, some filters), which shall be coming up. There is a possibility for a
deadlock between the listlock and the global/context lock, if another attempt
to get the listlock is made while under the context lock.
2011-06-16 09:14:41 -07:00
Chris Robinson
0378422fcb Use a map to store sources and buffers
And do a lookup using a binary search instead of linear
2010-05-01 19:59:41 -07:00
Chris Robinson
a572b13743 Don't use deprecated macros 2010-03-19 14:34:18 -07:00
Chris Robinson
f37cfc486d Pass the context to alSetError 2010-03-16 17:35:51 -07:00
Chris Robinson
ec917e8e2f Rename some struct members for consistency 2010-03-16 15:37:41 -07:00
Chris Robinson
658923175f Update source parameters only when they need changing 2009-11-25 16:21:47 -08:00
Chris Robinson
c8f700930a More modifications and fixes for context checks 2009-08-16 16:02:13 -07:00
Chris Robinson
462f27c129 Use a function to retrieve the current context in an already-locked state
This should help prevent race-conditions with a context being destroyed between
breing retrieved and locked
2009-08-16 14:09:23 -07:00
Chris Robinson
6735fc7911 Add missing config.h includes 2008-01-16 14:09:04 -08:00
Chris Robinson
28f80fa113 Add AL_METERS_PER_UNIT listener property 2007-12-17 19:40:43 -08:00
Chris Robinson
ae5f4e9a74 Initial import 2007-11-13 18:02:18 -08:00