Version
menu_open
link
Wwise SDK 2019.2.15
AkVectorValueRamp.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 _AK_VECTORVALUERAMP_H_
29 #define _AK_VECTORVALUERAMP_H_
30 
32 
33 /// Tool for computing a ramp using SIMD types.
34 /// Implementation using AKSIMD_V4F32
36 {
37 public:
38 
39  AkForceInline AKSIMD_V4F32 Setup( AkReal32 in_fStartValue, AkReal32 in_fStopValue, AkUInt32 in_uNumFrames )
40  {
41  const AkReal32 fIncrement = (in_fStopValue-in_fStartValue)/in_uNumFrames;
42  const AkReal32 f4xInc = 4.f*fIncrement;
43  vIncrement = AKSIMD_LOAD1_V4F32( f4xInc);
44  AK_ALIGN_SIMD( AkReal32 fVal[4] );
45  fVal[0] = in_fStartValue;
46  fVal[1] = fVal[0] + fIncrement;
47  fVal[2] = fVal[1] + fIncrement;
48  fVal[3] = fVal[2] + fIncrement;
49  vValueRamp = AKSIMD_LOAD_V4F32( fVal );
50  return vValueRamp;
51  }
52 
54  {
55  vValueRamp = AKSIMD_ADD_V4F32( vValueRamp, vIncrement );
56  return vValueRamp;
57  }
58 
59 private:
60  AKSIMD_V4F32 vIncrement;
61  AKSIMD_V4F32 vValueRamp;
62 };
63 
64 
65 #ifdef AKSIMD_V2F32_SUPPORTED
66 /// Tool for computing a ramp using SIMD types.
67 /// Implementation using AKSIMD_V2F32
68 class CAkVectorValueRampV2
69 {
70 public:
71 
72  AkForceInline AKSIMD_V2F32 Setup( AkReal32 in_fStartValue, AkReal32 in_fStopValue, AkUInt32 in_uNumFrames )
73  {
74  const AkReal32 fIncrement = (in_fStopValue-in_fStartValue)/in_uNumFrames;
75  const AkReal32 f2xInc = 2.f*fIncrement;
76  vIncrement = AKSIMD_SET_V2F32( f2xInc );
77  AKSIMD_BUILD_V2F32( const AKSIMD_V2F32 vStartOffset, 0.f, fIncrement );
78  AKSIMD_V2F32 l_vValueRamp = AKSIMD_SET_V2F32( in_fStartValue );
79  l_vValueRamp = AKSIMD_ADD_V2F32( l_vValueRamp, vStartOffset );
80  vValueRamp = l_vValueRamp;
81  return l_vValueRamp;
82  }
83 
85  {
86  vValueRamp = AKSIMD_ADD_V2F32( vValueRamp, vIncrement );
87  return vValueRamp;
88  }
89 
90 private:
91  AKSIMD_V2F32 vIncrement;
92  AKSIMD_V2F32 vValueRamp;
93 };
94 #endif
95 
96 // By default, CAkVectorValueRamp uses the V4 implementation.
98 
99 #endif //_AK_VECTORVALUERAMP_H_
CAkVectorValueRampV4 CAkVectorValueRamp
AkForceInline AKSIMD_V2F32 AKSIMD_SET_V2F32(AKSIMD_F32 in_value)
Definition: AkSimd.h:126
AkForceInline AKSIMD_V4F32 Setup(AkReal32 in_fStartValue, AkReal32 in_fStopValue, AkUInt32 in_uNumFrames)
AkForceInline AKSIMD_V2F32 AKSIMD_ADD_V2F32(const AKSIMD_V2F32 &in_vec1, const AKSIMD_V2F32 &in_vec2)
Definition: AkSimd.h:454
#define AKSIMD_LOAD_V4F32(__addr__)
Loads four single-precision, floating-point values (see _mm_load_ps)
Definition: AkSimd.h:96
#define AK_ALIGN_SIMD(__Declaration__)
Platform-specific alignment requirement for SIMD data.
Definition: AkTypes.h:70
AkForceInline AKSIMD_V4F32 AKSIMD_ADD_V4F32(const AKSIMD_V4F32 &in_vec1, const AKSIMD_V4F32 &in_vec2)
Definition: AkSimd.h:430
float AkReal32
32-bit floating point
Definition: AkTypes.h:103
AkForceInline AKSIMD_V4F32 AKSIMD_LOAD1_V4F32(AKSIMD_F32 in_value)
Definition: AkSimd.h:102
uint32_t AkUInt32
Unsigned 32-bit integer.
Definition: AkTypes.h:85
#define AkForceInline
Definition: AkTypes.h:62
AkForceInline AKSIMD_V4F32 Tick()

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