Go to the documentation of this file.
36 #ifndef _AK_SPEAKER_VOLUMES_H_
37 #define _AK_SPEAKER_VOLUMES_H_
40 #include <AK/SoundEngine/Platforms/Generic/AkSpeakerVolumes.h>
47 namespace SpeakerVolumes
60 AKASSERT( ( in_pVolumesDst && in_pVolumesSrc ) || in_uNumChannels == 0 );
61 if ( in_uNumChannels )
62 memcpy( in_pVolumesDst, in_pVolumesSrc, in_uNumChannels *
sizeof(
AkReal32 ) );
68 AKASSERT( ( in_pVolumesDst && in_pVolumesSrc ) || in_uNumChannels == 0 );
69 for (
AkUInt32 uChan = 0; uChan < in_uNumChannels; uChan++ )
71 in_pVolumesDst[uChan] = in_pVolumesSrc[uChan] * in_fGain;
78 AKASSERT( in_pVolumes || in_uNumChannels == 0 );
79 if ( in_uNumChannels )
80 memset( in_pVolumes, 0, in_uNumChannels *
sizeof(
AkReal32 ) );
86 AKASSERT( ( in_pVolumesDst && in_pVolumesSrc ) || in_uNumChannels == 0 );
87 for (
AkUInt32 uChan = 0; uChan < in_uNumChannels; uChan++ )
89 in_pVolumesDst[uChan] += in_pVolumesSrc[uChan];
97 AKASSERT((io_pVolumes) || in_uNumChannels == 0);
98 for (
AkUInt32 uChan = 0; uChan < in_uNumChannels; uChan++)
100 total += io_pVolumes[uChan];
109 AKASSERT( in_pVolumesDst || in_uNumChannels == 0 );
110 for (
AkUInt32 uChan = 0; uChan < in_uNumChannels; uChan++ )
112 in_pVolumesDst[uChan] *= in_fVol;
119 AKASSERT( ( in_pVolumesDst && in_pVolumesSrc ) || in_uNumChannels == 0 );
120 for (
AkUInt32 uChan = 0; uChan < in_uNumChannels; uChan++ )
122 in_pVolumesDst[uChan] *= in_pVolumesSrc[uChan];
129 AKASSERT( ( in_pVolumesDst && in_pVolumesSrc ) || in_uNumChannels == 0 );
130 for (
AkUInt32 uChan = 0; uChan < in_uNumChannels; uChan++ )
132 in_pVolumesDst[uChan] =
AkMax( in_pVolumesDst[uChan], in_pVolumesSrc[uChan] );
139 AKASSERT( ( in_pVolumesDst && in_pVolumesSrc ) || in_uNumChannels == 0 );
140 for (
AkUInt32 uChan = 0; uChan < in_uNumChannels; uChan++ )
142 in_pVolumesDst[uChan] =
AkMin( in_pVolumesDst[uChan], in_pVolumesSrc[uChan] );
180 AKASSERT( ( in_pVolumesDst && in_pVolumesSrc ) || uNumElements == 0 );
182 memcpy( in_pVolumesDst, in_pVolumesSrc, uNumElements *
sizeof(
AkReal32 ) );
189 AKASSERT( ( in_pVolumesDst && in_pVolumesSrc ) || uNumElements == 0 );
190 for (
AkUInt32 uChan = 0; uChan < uNumElements; uChan++ )
192 in_pVolumesDst[uChan] = in_pVolumesSrc[uChan] * in_fGain;
200 AKASSERT( in_pVolumes || uNumElements == 0 );
202 memset( in_pVolumes, 0, uNumElements *
sizeof(
AkReal32 ) );
209 AKASSERT( in_pVolumesDst || uNumElements == 0 );
210 for (
AkUInt32 uChan = 0; uChan < uNumElements; uChan++ )
212 in_pVolumesDst[uChan] *= in_fVol;
220 AKASSERT((in_pVolumesDst && in_pVolumesSrc) || uNumElements == 0);
221 for (
AkUInt32 uChan = 0; uChan < uNumElements; uChan++)
223 in_pVolumesDst[uChan] += in_pVolumesSrc[uChan];
231 AKASSERT((in_pVolumesDst && in_pVolumesSrc) || uNumElements == 0);
232 for (
AkUInt32 uChan = 0; uChan < uNumElements; uChan++)
234 in_pVolumesDst[uChan] += in_pVolumesSrc[uChan] * in_fGain;
242 AKASSERT( ( in_pVolumesDst && in_pVolumesSrc ) || uNumElements == 0 );
243 for (
AkUInt32 uChan = 0; uChan < uNumElements; uChan++ )
245 in_pVolumesDst[uChan] = ((in_pVolumesDst[uChan] * in_pVolumesDst[uChan]) > (in_pVolumesSrc[uChan] * in_pVolumesSrc[uChan])) ? in_pVolumesDst[uChan] : in_pVolumesSrc[uChan];
253 AKASSERT((in_pVolumesDst && in_pVolumesSrc) || uNumElements == 0);
254 for (
AkUInt32 uChan = 0; uChan < uNumElements; uChan++)
256 in_pVolumesDst[uChan] = (in_pVolumesDst[uChan] > in_pVolumesSrc[uChan]) ? in_pVolumesDst[uChan] : in_pVolumesSrc[uChan];
263 #endif //_AK_SPEAKER_VOLUMES_H_
AkForceInline void Copy(VectorPtr in_pVolumesDst, ConstVectorPtr in_pVolumesSrc, AkUInt32 in_uNumChannels)
Copy volumes.
AkForceInline AkReal32 L1Norm(ConstVectorPtr io_pVolumes, AkUInt32 in_uNumChannels)
Compute the sum of all components of a volume vector.
AkForceInline void Max(AkReal32 *in_pVolumesDst, const AkReal32 *in_pVolumesSrc, AkUInt32 in_uNumChannels)
Get max for all elements of two volume vectors, independently.
AkForceInline AkUInt32 GetRequiredSize(AkUInt32 in_uNumChannelsIn, AkUInt32 in_uNumChannelsOut)
Compute size (in bytes) required for given channel configurations.
AkForceInline void Zero(MatrixPtr in_pVolumes, AkUInt32 in_uNumChannelsIn, AkUInt32 in_uNumChannelsOut)
Clear matrix.
AkForceInline AkUInt32 GetNumElements(AkUInt32 in_uNumChannelsIn, AkUInt32 in_uNumChannelsOut)
Compute size (in number of elements) required for given channel configurations.
float AkReal32
32-bit floating point
AkForceInline void AbsMax(MatrixPtr in_pVolumesDst, ConstMatrixPtr in_pVolumesSrc, AkUInt32 in_uNumChannelsIn, AkUInt32 in_uNumChannelsOut)
Get absolute max for all elements of two volume matrices, independently.
AkReal32 * VectorPtr
Volume vector. Access each element with the standard bracket [] operator.
AkForceInline VectorPtr GetChannel(MatrixPtr in_pVolumeMx, AkUInt32 in_uIdxChannelIn, AkUInt32 in_uNumChannelsOut)
Get pointer to volume distribution for input channel in_uIdxChannelIn.
#define AKASSERT(Condition)
AkForceInline void Add(MatrixPtr in_pVolumesDst, ConstMatrixPtr in_pVolumesSrc, AkUInt32 in_uNumChannelsIn, AkUInt32 in_uNumChannelsOut)
Add all elements of two volume matrices, independently.
const AkReal32 * ConstMatrixPtr
Constant volume matrix. Access each input channel vector with AK::SpeakerVolumes::Matrix::GetChannel(...
AkForceInline void Zero(VectorPtr in_pVolumes, AkUInt32 in_uNumChannels)
Clear volumes.
AkForceInline void MAdd(MatrixPtr in_pVolumesDst, ConstMatrixPtr in_pVolumesSrc, AkUInt32 in_uNumChannelsIn, AkUInt32 in_uNumChannelsOut, AkReal32 in_fGain)
Pointwise Multiply-Add of all elements of two volume matrices.
AkForceInline void Add(VectorPtr in_pVolumesDst, ConstVectorPtr in_pVolumesSrc, AkUInt32 in_uNumChannels)
Accumulate two volume vectors.
AkReal32 * MatrixPtr
Volume matrix. Access each input channel vector with AK::SpeakerVolumes::Matrix::GetChannel().
AkForceInline void Mul(MatrixPtr in_pVolumesDst, const AkReal32 in_fVol, AkUInt32 in_uNumChannelsIn, AkUInt32 in_uNumChannelsOut)
Multiply a matrix with a scalar.
uint32_t AkUInt32
Unsigned 32-bit integer.
AkForceInline void Copy(MatrixPtr in_pVolumesDst, ConstMatrixPtr in_pVolumesSrc, AkUInt32 in_uNumChannelsIn, AkUInt32 in_uNumChannelsOut)
Copy matrix.
AkForceInline void Max(MatrixPtr in_pVolumesDst, ConstMatrixPtr in_pVolumesSrc, AkUInt32 in_uNumChannelsIn, AkUInt32 in_uNumChannelsOut)
Get max for all elements of two volume matrices, independently.
const AkReal32 * ConstVectorPtr
Constant volume vector. Access each element with the standard bracket [] operator.
AkForceInline void Min(AkReal32 *in_pVolumesDst, const AkReal32 *in_pVolumesSrc, AkUInt32 in_uNumChannels)
Get min for all elements of two volume vectors, independently.
AkForceInline void Mul(VectorPtr in_pVolumesDst, const AkReal32 in_fVol, AkUInt32 in_uNumChannels)
Multiply volume vector with a scalar.
Tell us about your project. We're here to help.
Register your project and we'll help you get started with no strings attached!
Get started with Wwise