From b495d80f5624328569bd0d8b9478927c0fc32100 Mon Sep 17 00:00:00 2001 From: Chris Robinson Date: Wed, 6 Jul 2016 13:33:40 -0700 Subject: Avoid using memcpy to copy a single struct --- OpenAL32/Include/alMain.h | 26 ++++++++++++-------------- OpenAL32/alAuxEffectSlot.c | 6 +++--- 2 files changed, 15 insertions(+), 17 deletions(-) (limited to 'OpenAL32') diff --git a/OpenAL32/Include/alMain.h b/OpenAL32/Include/alMain.h index e1411b83..13aadef5 100644 --- a/OpenAL32/Include/alMain.h +++ b/OpenAL32/Include/alMain.h @@ -504,6 +504,13 @@ typedef struct BFChannelConfig { ALuint Index; } BFChannelConfig; +typedef union AmbiConfig { + /* Ambisonic coefficients for mixing to the dry buffer. */ + ChannelConfig Coeffs[MAX_OUTPUT_CHANNELS]; + /* Coefficient channel mapping for mixing to the dry buffer. */ + BFChannelConfig Map[MAX_OUTPUT_CHANNELS]; +} AmbiConfig; + #define HRTF_HISTORY_BITS (6) #define HRTF_HISTORY_LENGTH (1<Effect.Type = effect->type; - memcpy(&EffectSlot->Effect.Props, &effect->Props, sizeof(EffectSlot->Effect.Props)); + EffectSlot->Effect.Props = effect->Props; } EffectSlot->Effect.State = State; @@ -519,7 +519,7 @@ ALenum InitializeEffect(ALCdevice *Device, ALeffectslot *EffectSlot, ALeffect *e } else if(effect) { - memcpy(&EffectSlot->Effect.Props, &effect->Props, sizeof(EffectSlot->Effect.Props)); + EffectSlot->Effect.Props = effect->Props; UpdateEffectSlotProps(EffectSlot); } @@ -630,7 +630,7 @@ void UpdateEffectSlotProps(ALeffectslot *slot) ATOMIC_STORE(&props->AuxSendAuto, slot->AuxSendAuto, almemory_order_relaxed); ATOMIC_STORE(&props->Type, slot->Effect.Type, almemory_order_relaxed); - memcpy(&props->Props, &slot->Effect.Props, sizeof(props->Props)); + props->Props = slot->Effect.Props; /* Swap out any stale effect state object there may be in the container, to * delete it. */ -- cgit v1.2.3