aboutsummaryrefslogtreecommitdiffstats
path: root/OpenAL32/Include
diff options
context:
space:
mode:
authorChris Robinson <[email protected]>2017-09-27 08:55:42 -0700
committerChris Robinson <[email protected]>2017-09-27 08:55:42 -0700
commit101d284a1801532e12b7867aed3499896d7a9a6f (patch)
treec9ae9c08e48b5c0a0dd579b43de40887a8e22a8d /OpenAL32/Include
parent2f6613905399aa06a253a421352e6fff57a1dce1 (diff)
Update the context state properties separately
The context state properties are less likely to change compared to the listener state, and future changes may prefer more infrequent updates to the context state. Note that this puts the MetersPerUnit in as a context state, even though it's handled through the listener functions. Considering the infrequency that it's updated at (generally set just once for the context's lifetime), it makes more sense to put it there than with the more frequently updated listener properties. The aforementioned future changes would also prefer MetersPerUnit to not be updated unnecessarily.
Diffstat (limited to 'OpenAL32/Include')
-rw-r--r--OpenAL32/Include/alListener.h19
-rw-r--r--OpenAL32/Include/alMain.h5
-rw-r--r--OpenAL32/Include/alu.h2
3 files changed, 18 insertions, 8 deletions
diff --git a/OpenAL32/Include/alListener.h b/OpenAL32/Include/alListener.h
index eb386f7f..ae66b0e3 100644
--- a/OpenAL32/Include/alListener.h
+++ b/OpenAL32/Include/alListener.h
@@ -8,19 +8,23 @@
extern "C" {
#endif
+struct ALcontextProps {
+ ALfloat DopplerFactor;
+ ALfloat DopplerVelocity;
+ ALfloat SpeedOfSound;
+ ALboolean SourceDistanceModel;
+ enum DistanceModel DistanceModel;
+ ALfloat MetersPerUnit;
+
+ ATOMIC(struct ALcontextProps*) next;
+};
+
struct ALlistenerProps {
ALfloat Position[3];
ALfloat Velocity[3];
ALfloat Forward[3];
ALfloat Up[3];
ALfloat Gain;
- ALfloat MetersPerUnit;
-
- ALfloat DopplerFactor;
- ALfloat DopplerVelocity;
- ALfloat SpeedOfSound;
- ALboolean SourceDistanceModel;
- enum DistanceModel DistanceModel;
ATOMIC(struct ALlistenerProps*) next;
};
@@ -31,7 +35,6 @@ typedef struct ALlistener {
ALfloat Forward[3];
ALfloat Up[3];
ALfloat Gain;
- ALfloat MetersPerUnit;
/* Pointer to the most recent property values that are awaiting an update.
*/
diff --git a/OpenAL32/Include/alMain.h b/OpenAL32/Include/alMain.h
index 614c3b43..95137972 100644
--- a/OpenAL32/Include/alMain.h
+++ b/OpenAL32/Include/alMain.h
@@ -382,6 +382,7 @@ struct Hrtf;
struct HrtfEntry;
struct FrontStablizer;
struct Compressor;
+struct ALcontextProps;
#define DEFAULT_OUTPUT_RATE (44100)
@@ -851,6 +852,7 @@ struct ALCcontext_struct {
ALfloat DopplerFactor;
ALfloat DopplerVelocity;
ALfloat SpeedOfSound;
+ ALfloat MetersPerUnit;
ATOMIC(ALenum) DeferUpdates;
RWLock PropLock;
@@ -863,6 +865,9 @@ struct ALCcontext_struct {
ALfloat GainBoost;
+ ATOMIC(struct ALcontextProps*) Update;
+ ATOMIC(struct ALcontextProps*) FreeList;
+
struct ALvoice **Voices;
ALsizei VoiceCount;
ALsizei MaxVoices;
diff --git a/OpenAL32/Include/alu.h b/OpenAL32/Include/alu.h
index 1295fee3..2344cc6d 100644
--- a/OpenAL32/Include/alu.h
+++ b/OpenAL32/Include/alu.h
@@ -514,6 +514,8 @@ void aluMixData(ALCdevice *device, ALvoid *OutBuffer, ALsizei NumSamples);
/* Caller must lock the device. */
void aluHandleDisconnect(ALCdevice *device);
+void UpdateContextProps(ALCcontext *context);
+
extern ALfloat ConeScale;
extern ALfloat ZScale;
extern ALboolean OverrideReverbSpeedOfSound;