版本

menu_open
Wwise SDK 2022.1.18
AkVectorValueRamp.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  Copyright (c) 2024 Audiokinetic Inc.
25 *******************************************************************************/
26 
27 #ifndef _AK_VECTORVALUERAMP_H_
28 #define _AK_VECTORVALUERAMP_H_
29 
31 
32 /// Tool for computing a ramp using SIMD types.
33 /// Implementation using AKSIMD_V4F32
35 {
36 public:
37 
38  AkForceInline AKSIMD_V4F32 Setup( AkReal32 in_fStartValue, AkReal32 in_fStopValue, AkUInt32 in_uNumFrames )
39  {
40  const AkReal32 fIncrement = (in_fStopValue-in_fStartValue)/in_uNumFrames;
41  const AkReal32 f4xInc = 4.f*fIncrement;
42  vIncrement = AKSIMD_LOAD1_V4F32( f4xInc);
43  AK_ALIGN_SIMD( AkReal32 fVal[4] );
44  fVal[0] = in_fStartValue;
45  fVal[1] = fVal[0] + fIncrement;
46  fVal[2] = fVal[1] + fIncrement;
47  fVal[3] = fVal[2] + fIncrement;
48  vValueRamp = AKSIMD_LOAD_V4F32( fVal );
49  return vValueRamp;
50  }
51 
53  {
54  vValueRamp = AKSIMD_ADD_V4F32( vValueRamp, vIncrement );
55  return vValueRamp;
56  }
57 
58 private:
59  AKSIMD_V4F32 vIncrement;
60  AKSIMD_V4F32 vValueRamp;
61 };
62 
63 
64 #ifdef AKSIMD_V2F32_SUPPORTED
65 /// Tool for computing a ramp using SIMD types.
66 /// Implementation using AKSIMD_V2F32
67 class CAkVectorValueRampV2
68 {
69 public:
70 
71  AkForceInline AKSIMD_V2F32 Setup( AkReal32 in_fStartValue, AkReal32 in_fStopValue, AkUInt32 in_uNumFrames )
72  {
73  const AkReal32 fIncrement = (in_fStopValue-in_fStartValue)/in_uNumFrames;
74  const AkReal32 f2xInc = 2.f*fIncrement;
75  vIncrement = AKSIMD_SET_V2F32( f2xInc );
76  AKSIMD_BUILD_V2F32( const AKSIMD_V2F32 vStartOffset, 0.f, fIncrement );
77  AKSIMD_V2F32 l_vValueRamp = AKSIMD_SET_V2F32( in_fStartValue );
78  l_vValueRamp = AKSIMD_ADD_V2F32( l_vValueRamp, vStartOffset );
79  vValueRamp = l_vValueRamp;
80  return l_vValueRamp;
81  }
82 
84  {
85  vValueRamp = AKSIMD_ADD_V2F32( vValueRamp, vIncrement );
86  return vValueRamp;
87  }
88 
89 private:
90  AKSIMD_V2F32 vIncrement;
91  AKSIMD_V2F32 vValueRamp;
92 };
93 #endif
94 
95 // By default, CAkVectorValueRamp uses the V4 implementation.
97 
98 #endif //_AK_VECTORVALUERAMP_H_
#define AKSIMD_ADD_V2F32(__a__, __b__)
Definition: AkSimd.h:630
CAkVectorValueRampV4 CAkVectorValueRamp
float32x4_t AKSIMD_V4F32
Vector of 4 32-bit floats
Definition: AkSimd.h:72
#define AKSIMD_SET_V2F32(__scalar__)
Sets the two single-precision, floating-point values to scalar
Definition: AkSimd.h:201
AkForceInline AKSIMD_V4F32 Setup(AkReal32 in_fStartValue, AkReal32 in_fStopValue, AkUInt32 in_uNumFrames)
#define AKSIMD_LOAD_V4F32(__addr__)
Definition: AkSimd.h:96
float AkReal32
32-bit floating point
#define AKSIMD_LOAD1_V4F32(__scalar__)
Definition: AkSimd.h:104
float32x2_t AKSIMD_V2F32
Vector of 2 32-bit floats
Definition: AkSimd.h:71
#define AKSIMD_ADD_V4F32(__a__, __b__)
Definition: AkSimd.h:626
uint32_t AkUInt32
Unsigned 32-bit integer
#define AK_ALIGN_SIMD(_declaration_)
Platform-specific alignment requirement for SIMD data
Definition: AkTypes.h:53
#define AkForceInline
Definition: AkTypes.h:63
AkForceInline AKSIMD_V4F32 Tick()

此页面对您是否有帮助?

需要技术支持?

仍有疑问?或者问题?需要更多信息?欢迎联系我们,我们可以提供帮助!

查看我们的“技术支持”页面

介绍一下自己的项目。我们会竭力为您提供帮助。

来注册自己的项目,我们帮您快速入门,不带任何附加条件!

开始 Wwise 之旅