버전

menu_open
알림: 고객님의 주요 출시 버전( 2023.1.7.8574 )에 해당하는 최신 설명서로 이동했습니다. 특정 버전의 설명서를 보시려면 Audiokinetic 런처에서 오프라인 설명서를 다운로드하고 Wwise Authoring의 Offline Documentation을 확인하세요.
Wwise SDK 2023.1.7
AkValueRamp.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 // AkValueRamp.h
28 
29 /// \file
30 /// Linear interpolation services for plug-in parameters.
31 
32 #ifndef _AK_VALUERAMP_H_
33 #define _AK_VALUERAMP_H_
34 
37 #include <math.h>
38 
39 namespace AK
40 {
41 
42  /// Platform-independent parameter interpolation service for software plug-ins.
43  /// \aknote
44  /// Algorithm performs linear interpolation.
45  /// \endaknote
46  /// \sa
47  /// - \ref shared_parameter_interface
49  {
50  public:
51 
52  /// Constructor method.
54  m_fStepIncrement( 0.f ), // Step increment sign
55  m_fInc( 0.f ), // Signed increment
56  m_fTarget( 0.f ), // Target gain for ramping
57  m_fCurrent( 0.f ), // Current interpolated value
58  m_uRampCount( 0 ), // Position in interpolation ramp
59  m_uRampLength( 0 ) // Total duration of interpolation ramp
60  {
61  }
62 
63  /// Destructor method.
65  {
66  }
67 
68  /// Initial parameter interpolation ramp setup.
69  inline void RampSetup(
70  AkReal32 fStepIncrement, ///< Increment to add to the parameter at every Tick() call
71  AkReal32 fInitVal ///< Initial ramp value
72  )
73  {
74  AKASSERT( fStepIncrement > 0.f );
75  m_fStepIncrement = fStepIncrement;
76  m_fCurrent = fInitVal;
77  SetTarget( fInitVal );
78  }
79 
80  /// Set the ramp's target value.
82  AkReal32 fTarget ///< Target ramp value
83  )
84  {
85  m_fTarget = fTarget;
86  m_uRampCount = 0;
87  AkReal32 fDiff = m_fTarget - m_fCurrent;
88  m_uRampLength = static_cast<AkUInt32>( fabs(fDiff) / m_fStepIncrement );
89  m_fInc = fDiff > 0 ? m_fStepIncrement : -m_fStepIncrement;
90  }
91 
92  /// Process a single interpolation frame.
93  /// \return The current interpolated value
95  {
96  if ( m_uRampCount >= m_uRampLength )
97  m_fCurrent = m_fTarget;
98  else
99  {
100  ++m_uRampCount;
101  m_fCurrent += m_fInc;
102  }
103  return m_fCurrent;
104  }
105 
106  /// Retrieve the current interpolated value.
107  /// \return The current interpolated value
108  AkReal32 GetCurrent() { return m_fCurrent; }
109 
110  /// Set the current interpolated value.
111  void SetCurrent(AkReal32 in_fCurrent) { m_fCurrent = in_fCurrent; }
112 
113  /// Retrieve the current interpolation frame count.
114  /// \return The current interpolation frame count
115  AkUInt32 GetRampCount() { return m_uRampCount; }
116 
117  /// Set the current interpolation frame count.
118  void SetRampCount(AkUInt32 in_uRampCount) { m_uRampCount = in_uRampCount; }
119 
120  /// The ramp is no longer necessary; set to target
121  void StopRamp()
122  {
123  m_fCurrent = m_fTarget;
124  m_uRampCount = m_uRampLength;
125  }
126 
127  private:
128 
129  AkReal32 m_fStepIncrement; // Step increment size
130  AkReal32 m_fInc; // Signed increment
131  AkReal32 m_fTarget; // Target for interpolation ramp
132  AkReal32 m_fCurrent; // Current interpolated value
133  AkUInt32 m_uRampCount; // Position in interpolation ramp
134  AkUInt32 m_uRampLength; // Total duration of interpolation ramp
135  };
136 }
137 
138 #endif //_AK_VALUERAMP_H_
AkUInt32 GetRampCount()
Definition: AkValueRamp.h:115
Audiokinetic namespace
void StopRamp()
The ramp is no longer necessary; set to target
Definition: AkValueRamp.h:121
void SetCurrent(AkReal32 in_fCurrent)
Set the current interpolated value.
Definition: AkValueRamp.h:111
AkForceInline AkReal32 Tick()
Definition: AkValueRamp.h:94
CAkValueRamp()
Constructor method.
Definition: AkValueRamp.h:53
void RampSetup(AkReal32 fStepIncrement, AkReal32 fInitVal)
Initial parameter interpolation ramp setup.
Definition: AkValueRamp.h:69
float AkReal32
32-bit floating point
AkReal32 GetCurrent()
Definition: AkValueRamp.h:108
~CAkValueRamp()
Destructor method.
Definition: AkValueRamp.h:64
#define AKASSERT(Condition)
Definition: AkAssert.h:67
AkForceInline void SetTarget(AkReal32 fTarget)
Set the ramp's target value.
Definition: AkValueRamp.h:81
uint32_t AkUInt32
Unsigned 32-bit integer
void SetRampCount(AkUInt32 in_uRampCount)
Set the current interpolation frame count.
Definition: AkValueRamp.h:118
#define AkForceInline
Definition: AkTypes.h:63

이 페이지가 도움이 되었나요?

지원이 필요하신가요?

질문이 있으신가요? 문제를 겪고 계신가요? 더 많은 정보가 필요하신가요? 저희에게 문의해주시면 도와드리겠습니다!

지원 페이지를 방문해 주세요

작업하는 프로젝트에 대해 알려주세요. 언제든지 도와드릴 준비가 되어 있습니다.

프로젝트를 등록하세요. 아무런 조건이나 의무 사항 없이 빠른 시작을 도와드리겠습니다.

Wwise를 시작해 보세요