diff options
author | Chris Robinson <[email protected]> | 2018-11-30 16:56:23 -0800 |
---|---|---|
committer | Chris Robinson <[email protected]> | 2018-11-30 16:56:23 -0800 |
commit | 4b7ac4a6ed290182de945274afd90fc4cece0283 (patch) | |
tree | 93cdffafcbd6388bd5fea1bdbf874b92a729b094 /OpenAL32 | |
parent | 364850e8f9a224144c91c7b562d44321b7aa4505 (diff) |
Don't bother making ALvoiceProps dynamically sized
Diffstat (limited to 'OpenAL32')
-rw-r--r-- | OpenAL32/Include/alSource.h | 1 | ||||
-rw-r--r-- | OpenAL32/Include/alu.h | 24 | ||||
-rw-r--r-- | OpenAL32/alSource.cpp | 4 |
3 files changed, 11 insertions, 18 deletions
diff --git a/OpenAL32/Include/alSource.h b/OpenAL32/Include/alSource.h index 2cbc5ddc..62c6fae3 100644 --- a/OpenAL32/Include/alSource.h +++ b/OpenAL32/Include/alSource.h @@ -7,7 +7,6 @@ #include "almalloc.h" #include "atomic.h" -#define MAX_SENDS 16 #define DEFAULT_SENDS 2 #ifdef __cplusplus diff --git a/OpenAL32/Include/alu.h b/OpenAL32/Include/alu.h index e178a5a6..2ff69058 100644 --- a/OpenAL32/Include/alu.h +++ b/OpenAL32/Include/alu.h @@ -17,11 +17,13 @@ #include "math_defs.h" #include "filters/defs.h" #include "filters/nfc.h" +#include "almalloc.h" enum class DistanceModel; -#define MAX_PITCH (255) +#define MAX_PITCH 255 +#define MAX_SENDS 16 /* Maximum number of samples to pad on either end of a buffer for resampling. * Note that both the beginning and end need padding! @@ -29,10 +31,6 @@ enum class DistanceModel; #define MAX_RESAMPLE_PADDING 24 -#ifdef __cplusplus -extern "C" { -#endif - struct BSincTable; struct ALsource; struct ALbufferlistitem; @@ -144,8 +142,6 @@ typedef struct SendParams { struct ALvoiceProps { - std::atomic<ALvoiceProps*> next; - ALfloat Pitch; ALfloat Gain; ALfloat OuterGain; @@ -194,7 +190,11 @@ struct ALvoiceProps { ALfloat HFReference; ALfloat GainLF; ALfloat LFReference; - } Send[]; + } Send[MAX_SENDS]; + + std::atomic<ALvoiceProps*> next; + + DEF_NEWDEL(ALvoiceProps) }; #define VOICE_IS_STATIC (1<<0) @@ -203,13 +203,13 @@ struct ALvoiceProps { #define VOICE_HAS_NFC (1<<3) typedef struct ALvoice { - ALvoiceProps *Props; - std::atomic<ALvoiceProps*> Update; std::atomic<ALuint> SourceID; std::atomic<bool> Playing; + ALvoiceProps Props; + /** * Source offset in samples, relative to the currently playing buffer, NOT * the whole queue, and the fractional (fixed-point) offset to the next @@ -487,8 +487,4 @@ extern ALfloat ConeScale; extern ALfloat ZScale; extern ALboolean OverrideReverbSpeedOfSound; -#ifdef __cplusplus -} -#endif - #endif diff --git a/OpenAL32/alSource.cpp b/OpenAL32/alSource.cpp index c0e48c5c..87729c73 100644 --- a/OpenAL32/alSource.cpp +++ b/OpenAL32/alSource.cpp @@ -68,9 +68,7 @@ void UpdateSourceProps(ALsource *source, ALvoice *voice, ALCcontext *context) /* Get an unused property container, or allocate a new one as needed. */ ALvoiceProps *props{context->FreeVoiceProps.load(std::memory_order_acquire)}; if(!props) - props = static_cast<ALvoiceProps*>(al_calloc(16, - FAM_SIZE(ALvoiceProps, Send, source->Send.size())) - ); + props = new ALvoiceProps{}; else { ALvoiceProps *next; |