Version
menu_open
link
Wwise SDK 2018.1.11
AkFXParameterChangeHandler.h
Go to the documentation of this file.
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 
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>
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  {
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_
AkInt16 AkPluginParamID
Source or effect plug-in parameter ID.
Definition: AkTypes.h:76
uint8_t AkUInt8
Unsigned 8-bit integer.
Definition: AkTypes.h:77
#define AkZeroMemSmall(___Dest, ___Size)
Definition: AkPlatformFuncs.h:87
Audiokinetic namespace.
#define AKASSERT(Condition)
Definition: AkAssert.h:69
AkForceInline void AkMemSet(void *pDest, AkInt32 iVal, AkUInt32 uSize)
Platform Independent Helper.
Definition: AkPlatformFuncs.h:336
bool HasChanged(AkPluginParamID in_ID)
AkUInt8 m_uParamBitArray[(((T_MAXNUMPARAMS)+((8) -1)) &~((8) -1))/8]
void SetParamChange(AkPluginParamID in_ID)
void ResetParamChange(AkPluginParamID in_ID)
uint32_t AkUInt32
Unsigned 32-bit integer.
Definition: AkTypes.h:79

Was this page helpful?

Need Support?

Questions? Problems? Need more info? Contact us, and we can help!

Visit our Support page

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