123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104 |
- #ifndef _AKFXPARAMETERCHANGEHANDLER_H_
- #define _AKFXPARAMETERCHANGEHANDLER_H_
- #include <AK/SoundEngine/Common/AkTypes.h>
- #include <AK/Tools/Common/AkAssert.h>
- #include <AK/Tools/Common/AkPlatformFuncs.h>
- namespace AK
- {
- template <AkUInt32 T_MAXNUMPARAMS>
- class AkFXParameterChangeHandler
- {
- public:
- inline AkFXParameterChangeHandler()
- {
- ResetAllParamChanges( );
- }
- inline void SetParamChange( AkPluginParamID in_ID )
- {
- AKASSERT( in_ID <= T_MAXNUMPARAMS );
- const AkUInt32 uByteIndex = in_ID/8;
- const AkUInt32 uBitMask = 1<<(in_ID-uByteIndex*8);
- m_uParamBitArray[uByteIndex] |= uBitMask;
- }
- inline bool HasChanged( AkPluginParamID in_ID )
- {
- AKASSERT( in_ID <= T_MAXNUMPARAMS );
- const AkUInt32 uByteIndex = in_ID/8;
- const AkUInt32 uBitMask = 1<<(in_ID-uByteIndex*8);
- return (m_uParamBitArray[uByteIndex] & uBitMask) > 0;
- }
- inline bool HasAnyChanged()
- {
- AkUInt32 uByteIndex = 0;
- do
- {
- if ( m_uParamBitArray[uByteIndex] > 0 )
- return true;
- ++uByteIndex;
- } while (uByteIndex < (((T_MAXNUMPARAMS) + ((8)-1)) & ~((8)-1))/8 );
- return false;
- }
- inline void ResetParamChange( AkPluginParamID in_ID )
- {
- AKASSERT( in_ID <= T_MAXNUMPARAMS );
- const AkUInt32 uByteIndex = in_ID/8;
- const AkUInt32 uBitMask = 1<<(in_ID-uByteIndex*8);
- m_uParamBitArray[uByteIndex] &= ~uBitMask;
- }
- inline void ResetAllParamChanges( )
- {
- AkZeroMemSmall( m_uParamBitArray, sizeof(m_uParamBitArray) );
- }
- inline void SetAllParamChanges( )
- {
- AKPLATFORM::AkMemSet( m_uParamBitArray, 0xFF, sizeof(m_uParamBitArray) );
- }
- protected:
-
- AkUInt8 m_uParamBitArray[(((T_MAXNUMPARAMS) + ((8)-1)) & ~((8)-1))/8];
- };
- }
- #endif
|