버전
menu_open
link
Wwise SDK 2023.1.3
AkFXTailHandler.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 _AKFXTAILHANDLER_H_
28 #define _AKFXTAILHANDLER_H_
29 
33 
34 /// Default value when effect has not enterred tail mode yet.
35 #define AKFXTAILHANDLER_NOTINTAIL 0xFFFFFFFF
36 
37 /// Effect tail handling utility class.
38 /// Handles varying number of tail frames from frame to frame (i.e. based on RTPC parameters).
39 /// Handles effect revived (quit tail) and reenters etc.
41 {
42 public:
43  /// Constructor
44  inline AkFXTailHandler()
46  , uTotalTailFrames(0) {}
47 
48  /// Handle FX tail and zero pads AkAudioBuffer if necessary
49  inline void HandleTail(
50  AkAudioBuffer * io_pBuffer,
51  AkUInt32 in_uTotalTailFrames )
52  {
53  bool bPreStop = io_pBuffer->eState == AK_NoMoreData;
54  if ( bPreStop )
55  {
56  // Tail not yet finished processing
57  if ( uTailFramesRemaining > 0
58  || io_pBuffer->uValidFrames > 0 // <-- there are valid frames, so last (maybe partially filled) buffer.
59  )
60  {
61  // Not previously in tail, compute tail time
63  || io_pBuffer->uValidFrames > 0 // <- ANY valid frames in the buffer should reset the tail.
64  )
65  {
66  uTailFramesRemaining = in_uTotalTailFrames;
67  uTotalTailFrames = in_uTotalTailFrames;
68  }
69  // Tail time changed, augment if necessary but preserve where we are so that effect will
70  // still finish when constantly changing this based on RTPC parameters
71  else if ( in_uTotalTailFrames > uTotalTailFrames )
72  {
74  uTailFramesRemaining = in_uTotalTailFrames - uFramesElapsed;
75  uTotalTailFrames = in_uTotalTailFrames;
76  }
77  // Always full buffers while in tail
78  AkUInt32 uNumTailFrames = (AkUInt32)(io_pBuffer->MaxFrames()-io_pBuffer->uValidFrames);
79  uTailFramesRemaining -= AkMin( uTailFramesRemaining, uNumTailFrames );
80  io_pBuffer->ZeroPadToMaxFrames();
81  if ( uTailFramesRemaining > 0 )
82  io_pBuffer->eState = AK_DataReady;
83  }
84  }
85  else
86  {
87  // Reset tail mode for next time if exits tail mode (on bus only)
89  }
90  }
91 
92  inline bool HasTailRemaining() { return uTailFramesRemaining > 0; } // Also true when AKFXTAILHANDLER_NOTINTAIL
93 
94 protected:
95 
96  AkUInt32 uTailFramesRemaining; // AKFXTAILHANDLER_NOTINTAIL, otherwise value represents number of frames remaining in tail
98 
99 };
100 
101 
102 
103 
104 
105 #endif // _AKFXTAILHANDLER_H_
#define AkMin(x1, x2)
#define AKFXTAILHANDLER_NOTINTAIL
Default value when effect has not enterred tail mode yet.
@ AK_DataReady
The provider has available data.
Definition: AkTypes.h:241
@ AK_NoMoreData
No more data is available from the source.
Definition: AkTypes.h:226
AkUInt32 uTailFramesRemaining
AkUInt32 uTotalTailFrames
AKRESULT eState
Execution status
Definition: AkCommonDefs.h:650
void HandleTail(AkAudioBuffer *io_pBuffer, AkUInt32 in_uTotalTailFrames)
Handle FX tail and zero pads AkAudioBuffer if necessary
AkUInt16 uValidFrames
Number of valid sample frames in the audio buffer
Definition: AkCommonDefs.h:656
void ZeroPadToMaxFrames()
Definition: AkCommonDefs.h:597
AkFXTailHandler()
Constructor
uint32_t AkUInt32
Unsigned 32-bit integer
AkForceInline AkUInt16 MaxFrames() const
Definition: AkCommonDefs.h:643

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

지원이 필요하신가요?

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

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

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

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

Wwise를 시작해 보세요