Avoid using memcpy to copy a single struct
This commit is contained in:
+4
-4
@@ -581,7 +581,7 @@ static void InitPanning(ALCdevice *device)
|
||||
device->Dry.CoeffCount = 0;
|
||||
device->Dry.NumChannels = count;
|
||||
|
||||
memcpy(&device->FOAOut.Ambi, &device->Dry.Ambi, sizeof(device->FOAOut.Ambi));
|
||||
device->FOAOut.Ambi = device->Dry.Ambi;
|
||||
device->FOAOut.CoeffCount = device->Dry.CoeffCount;
|
||||
}
|
||||
else
|
||||
@@ -708,7 +708,7 @@ static void InitHQPanning(ALCdevice *device, const AmbDecConf *conf, const ALuin
|
||||
|
||||
if(bformatdec_getOrder(device->AmbiDecoder) < 2)
|
||||
{
|
||||
memcpy(&device->FOAOut.Ambi, &device->Dry.Ambi, sizeof(device->FOAOut.Ambi));
|
||||
device->FOAOut.Ambi = device->Dry.Ambi;
|
||||
device->FOAOut.CoeffCount = device->Dry.CoeffCount;
|
||||
}
|
||||
else
|
||||
@@ -763,7 +763,7 @@ static void InitHrtfPanning(ALCdevice *device)
|
||||
&device->Dry.NumChannels, AL_TRUE);
|
||||
device->Dry.CoeffCount = 4;
|
||||
|
||||
memcpy(&device->FOAOut.Ambi, &device->Dry.Ambi, sizeof(device->FOAOut.Ambi));
|
||||
device->FOAOut.Ambi = device->Dry.Ambi;
|
||||
device->FOAOut.CoeffCount = device->Dry.CoeffCount;
|
||||
|
||||
for(i = 0;i < device->Dry.NumChannels;i++)
|
||||
@@ -788,7 +788,7 @@ static void InitUhjPanning(ALCdevice *device)
|
||||
device->Dry.CoeffCount = 0;
|
||||
device->Dry.NumChannels = count;
|
||||
|
||||
memcpy(&device->FOAOut.Ambi, &device->Dry.Ambi, sizeof(device->FOAOut.Ambi));
|
||||
device->FOAOut.Ambi = device->Dry.Ambi;
|
||||
device->FOAOut.CoeffCount = device->Dry.CoeffCount;
|
||||
}
|
||||
|
||||
|
||||
+12
-14
@@ -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<<HRTF_HISTORY_BITS)
|
||||
@@ -599,16 +606,10 @@ struct ALCdevice_struct
|
||||
|
||||
/* The "dry" path corresponds to the main output. */
|
||||
struct {
|
||||
union {
|
||||
/* 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];
|
||||
} Ambi;
|
||||
/* Number of coefficients in each ChannelConfig to mix together (4 for
|
||||
* first-order, 9 for second-order, etc). If the count is 0, the
|
||||
* BFChannelConfig is used instead to map each output to a coefficient
|
||||
* index.
|
||||
AmbiConfig Ambi;
|
||||
/* Number of coefficients in each Ambi.Coeffs to mix together (4 for
|
||||
* first-order, 9 for second-order, etc). If the count is 0, Ambi.Map
|
||||
* is used instead to map each output to a coefficient index.
|
||||
*/
|
||||
ALuint CoeffCount;
|
||||
|
||||
@@ -618,10 +619,7 @@ struct ALCdevice_struct
|
||||
|
||||
/* First-order ambisonics output, to be upsampled to the dry buffer if different. */
|
||||
struct {
|
||||
union {
|
||||
ChannelConfig Coeffs[MAX_OUTPUT_CHANNELS];
|
||||
BFChannelConfig Map[MAX_OUTPUT_CHANNELS];
|
||||
} Ambi;
|
||||
AmbiConfig Ambi;
|
||||
/* Will only be 4 or 0. */
|
||||
ALuint CoeffCount;
|
||||
|
||||
|
||||
@@ -511,7 +511,7 @@ ALenum InitializeEffect(ALCdevice *Device, ALeffectslot *EffectSlot, ALeffect *e
|
||||
else
|
||||
{
|
||||
EffectSlot->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.
|
||||
*/
|
||||
|
||||
Reference in New Issue
Block a user