Table of Contents

Wwise SDK 2019.2.2
AkFXParameterChangeHandler.h
1 /*******************************************************************************
2 The content of this file includes portions of the AUDIOKINETIC Wwise Technology
3 released in source code form as part of the SDK installer package.
4 
5 Commercial License Usage
6 
7 Licensees holding valid commercial licenses to the AUDIOKINETIC Wwise Technology
8 may use this file in accordance with the end user license agreement provided
9 with the software or, alternatively, in accordance with the terms contained in a
10 written agreement between you and Audiokinetic Inc.
11 
12 Apache License Usage
13 
14 Alternatively, this file may be used under the Apache License, Version 2.0 (the
15 "Apache License"); you may not use this file except in compliance with the
16 Apache License. You may obtain a copy of the Apache License at
17 http://www.apache.org/licenses/LICENSE-2.0.
18 
19 Unless required by applicable law or agreed to in writing, software distributed
20 under the Apache License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES
21 OR CONDITIONS OF ANY KIND, either express or implied. See the Apache License for
22 the specific language governing permissions and limitations under the License.
23 
24  Version: <VERSION> Build: <BUILDNUMBER>
25  Copyright (c) <COPYRIGHTYEAR> Audiokinetic Inc.
26 *******************************************************************************/
27 
28 #ifndef _AKFXPARAMETERCHANGEHANDLER_H_
29 #define _AKFXPARAMETERCHANGEHANDLER_H_
30 
31 #include <AK/SoundEngine/Common/AkTypes.h>
32 #include <AK/Tools/Common/AkAssert.h>
33 #include <AK/Tools/Common/AkPlatformFuncs.h>
34 
35 /// Can be used to track individual parameter changes to avoid costly computations when they remain constant
36 /// This class is designed to use only the lower bit information of the parameter IDs
37 namespace AK
38 {
39 
40  template <AkUInt32 T_MAXNUMPARAMS>
41  class AkFXParameterChangeHandler
42  {
43  public:
44 
46  {
48  }
49 
50  inline void SetParamChange( AkPluginParamID in_ID )
51  {
52  AKASSERT( in_ID <= T_MAXNUMPARAMS );
53  const AkUInt32 uByteIndex = in_ID/8;
54  const AkUInt32 uBitMask = 1<<(in_ID-uByteIndex*8);
55  m_uParamBitArray[uByteIndex] |= uBitMask;
56  }
57 
58  inline bool HasChanged( AkPluginParamID in_ID )
59  {
60  AKASSERT( in_ID <= T_MAXNUMPARAMS );
61  const AkUInt32 uByteIndex = in_ID/8;
62  const AkUInt32 uBitMask = 1<<(in_ID-uByteIndex*8);
63  return (m_uParamBitArray[uByteIndex] & uBitMask) > 0;
64  }
65 
66  inline bool HasAnyChanged()
67  {
68  AkUInt32 uByteIndex = 0;
69  do
70  {
71  if ( m_uParamBitArray[uByteIndex] > 0 )
72  return true;
73  ++uByteIndex;
74  } while (uByteIndex < (((T_MAXNUMPARAMS) + ((8)-1)) & ~((8)-1))/8 );
75  return false;
76  }
77 
78  inline void ResetParamChange( AkPluginParamID in_ID )
79  {
80  AKASSERT( in_ID <= T_MAXNUMPARAMS );
81  const AkUInt32 uByteIndex = in_ID/8;
82  const AkUInt32 uBitMask = 1<<(in_ID-uByteIndex*8);
83  m_uParamBitArray[uByteIndex] &= ~uBitMask;
84  }
85 
86  inline void ResetAllParamChanges( )
87  {
88  AkZeroMemSmall( m_uParamBitArray, sizeof(m_uParamBitArray) );
89  }
90 
91  inline void SetAllParamChanges( )
92  {
94  }
95 
96  protected:
97 
98  // Minimum storage in bits aligned to next byte boundary
99  AkUInt8 m_uParamBitArray[(((T_MAXNUMPARAMS) + ((8)-1)) & ~((8)-1))/8];
100 
101  };
102 
103 } // namespace AK
104 
105 #endif // _AKFXPARAMETERCHANGEHANDLER_H_
Audiokinetic namespace.
AkUInt8 m_uParamBitArray[(((T_MAXNUMPARAMS)+((8) -1)) &~((8) -1))/8]
bool HasChanged(AkPluginParamID in_ID)
AkForceInline void AkMemSet(void *pDest, AkInt32 iVal, AkUInt32 uSize)
Platform Independent Helper.
Definition: AkPlatformFuncs.h:339
void ResetParamChange(AkPluginParamID in_ID)
void SetParamChange(AkPluginParamID in_ID)