バージョン
menu

Wwise SDK 2025.1.4
AkDynamicSequence.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) 2025 Audiokinetic Inc.
25 *******************************************************************************/
26 
27 #ifndef _AK_SOUNDENGINE_AKDYNAMICSEQUENCE_H
28 #define _AK_SOUNDENGINE_AKDYNAMICSEQUENCE_H
29 
30 #include AK/SoundEngine/Common/AkSoundEngine.h>
31 #include AK/Tools/Common/AkArray.h>
32 
33 namespace AK
34 {
35  namespace SoundEngine
36  {
37  /// Dynamic Sequence namespace. Use the Dynamic Sequence API to play and sequence Dialogue Events dynamically, according to a set of rules and conditions. For more information, see \ref integrating_elements_dynamicdialogue and Understanding the Dynamic Dialogue System.
38  /// \remarks The functions in this namespace are thread-safe, unless stated otherwise.
39  namespace DynamicSequence
40  {
41  /// Playlist Item for Dynamic Sequence Playlist.
42  /// \sa
43  /// - AK::SoundEngine::DynamicSequence::Playlist
44  /// - AK::SoundEngine::PostEvent
45  /// - \ref integrating_external_sources
47  {
48  public:
50  PlaylistItem(const PlaylistItem& in_rCopy);
52 
53  PlaylistItem& operator=(const PlaylistItem& in_rCopy);
54  bool operator==(const PlaylistItem& in_rCopy)
55  {
56  AKASSERT(pExternalSrcs == NULL);
57  return audioNodeID == in_rCopy.audioNodeID &&
58  msDelay == in_rCopy.msDelay &&
59  pCustomInfo == in_rCopy.pCustomInfo;
60  };
61 
62  /// Sets the external sources used by this item.
63  /// \sa
64  /// \ref integrating_external_sources
65  AKRESULT SetExternalSources(AkUInt32 in_nExternalSrc, AkExternalSourceInfo* in_pExternalSrc);
66 
69  void * pCustomInfo; ///
71  };
72 
73  /// List of items to play in a Dynamic Sequence.
74  /// \sa
75  /// - AK::SoundEngine::DynamicSequence::LockPlaylist
76  /// - AK::SoundEngine::DynamicSequence::UnlockPlaylist
77  class Playlist
78  : public AkArray
79  {
80  public:
81  /// Enqueue an Audio Node.
82  /// \return AK_Success if successful, AK_Fail otherwise
84  AkUniqueID in_audioNodeID, ///
85  AkTimeMs in_msDelay = 0, ///
86  void * in_pCustomInfo = NULL, ///
87  AkUInt32 in_cExternals = 0, ///
88  AkExternalSourceInfo *in_pExternalSources = NULL///
89  )
90  {
91  PlaylistItem * pItem = AddLast();
92  if ( !pItem )
93  return AK_InsufficientMemory;
94 
95  pItem->audioNodeID = in_audioNodeID;
96  pItem->msDelay = in_msDelay;
97  pItem->pCustomInfo = in_pCustomInfo;
98  return pItem->SetExternalSources(in_cExternals, in_pExternalSources);
99  }
100  };
101 
102  // \deprecated Use AkDynamicSequenceType in the global scope.
107 
108  /// Open a new Dynamic Sequence.
109  /// \return Playing ID of the dynamic sequence, or AK_INVALID_PLAYING_ID in failure case and an error message in the debug console and Wwise Profiler
110  ///
111  /// If \c AK_DynamicSequenceSelect bit is set in \c in_uFlags, the dynamic sequence uses the callback for determining the next item to play.
112  /// If this bit is not set, then the dynamic sequence uses the Playlist to determine the next item to play.
113  ///
114  /// \sa
115  /// - AK::SoundEngine::DynamicSequence::DynamicSequenceType
117  AkGameObjectID in_gameObjectID, ///
118  AkUInt32 in_uFlags = 0, ///
119  AkCallbackFunc in_pfnCallback = NULL, ///
120  void* in_pCookie = NULL, ///
121  AkDynamicSequenceType in_eDynamicSequenceType = AkDynamicSequenceType_SampleAccurate ///
122  );
123 
124  /// Close specified Dynamic Sequence. The Dynamic Sequence will play until finished and then
125  /// deallocate itself.
126  /// \return
127  /// - AK_Success if the command was successfully queued
128  /// - AK_PlayingIDNotFound if the playing ID does not match to any open Dynamic Sequence
130  AkPlayingID in_playingID ///
131  );
132 
133  /// Play specified Dynamic Sequence.
134  /// \return
135  /// - AK_Success if the command was successfully queued
136  /// - AK_PlayingIDNotFound if the playing ID does not match to any open Dynamic Sequence
138  AkPlayingID in_playingID, ///
139  AkTimeMs in_uTransitionDuration = 0, ///
141  );
142 
143  /// Pause specified Dynamic Sequence.
144  /// To restart the sequence, call Resume. The item paused will resume its playback, followed by the rest of the sequence.
145  /// \return
146  /// - AK_Success if the command was successfully queued
147  /// - AK_PlayingIDNotFound if the playing ID does not match to any open Dynamic Sequence
149  AkPlayingID in_playingID, ///
150  AkTimeMs in_uTransitionDuration = 0, ///
152  );
153 
154  /// Resume specified Dynamic Sequence.
155  /// \return
156  /// - AK_Success if the command was successfully queued
157  /// - AK_PlayingIDNotFound if the playing ID does not match to any open Dynamic Sequence
159  AkPlayingID in_playingID, ///
160  AkTimeMs in_uTransitionDuration = 0, ///
162  );
163 
164  /// Stop specified Dynamic Sequence immediately.
165  /// To restart the sequence, call Play. The sequence will restart with the item that was in the
166  /// playlist after the item that was stopped.
167  /// \return
168  /// - AK_Success if the command was successfully queued
169  /// - AK_PlayingIDNotFound if the playing ID does not match to any open Dynamic Sequence
171  AkPlayingID in_playingID, ///
172  AkTimeMs in_uTransitionDuration = 0, ///
174  );
175 
176  /// Break specified Dynamic Sequence. The sequence will stop after the current item.
177  /// \return
178  /// - AK_Success if the command was successfully queued
179  /// - AK_PlayingIDNotFound if the playing ID does not match to any open Dynamic Sequence
181  AkPlayingID in_playingID ///
182  );
183 
184  /// Seek inside specified Dynamic Sequence.
185  /// It is only possible to seek in the first item of the sequence.
186  /// If you seek past the duration of the first item, it will be skipped and an error will reported in the Capture Log and debug output.
187  /// All the other items in the sequence will continue to play normally.
188  /// \return
189  /// - AK_Success if the command was successfully queued
190  /// - AK_PlayingIDNotFound if the playing ID does not match to any open Dynamic Sequence
192  AkPlayingID in_playingID, ///
193  AkTimeMs in_iPosition, ///
194  bool in_bSeekToNearestMarker ///
195  );
196 
197  /// Seek inside specified Dynamic Sequence.
198  /// It is only possible to seek in the first item of the sequence.
199  /// If you seek past the duration of the first item, it will be skipped and an error will reported in the Capture Log and debug output.
200  /// All the other items in the sequence will continue to play normally.
201  /// \return
202  /// - AK_Success if the command was successfully queued
203  /// - AK_PlayingIDNotFound if the playing ID does not match to any open Dynamic Sequence
205  AkPlayingID in_playingID, ///
206  AkReal32 in_fPercent, ///
207  bool in_bSeekToNearestMarker ///
208  );
209 
210  /// Get pause times.
211  /// \return
212  /// - AK_Success if successful
213  /// - AK_PlayingIDNotFound if the playing ID does not match to any open Dynamic Sequence
215  AkPlayingID in_playingID, ///
216  AkUInt32 &out_uTime, ///
217  AkUInt32 &out_uDuration ///
218  );
219 
220  /// Get currently playing item. Note that this may be different from the currently heard item
221  /// when sequence is in sample-accurate mode.
222  /// \return
223  /// - AK_Success if successful
224  /// - AK_PlayingIDNotFound if the playing ID does not match to any open Dynamic Sequence
226  AkPlayingID in_playingID, ///
227  AkUniqueID & out_audioNodeID, ///
228  void *& out_pCustomInfo ///
229  );
230 
231  /// Lock the Playlist for editing. Needs a corresponding UnlockPlaylist call.
232  /// \return Pointer to locked Playlist if successful, NULL otherwise (in_playingID not found)
233  ///
234  /// \akwarning
235  /// When opening a dynamic sequence with the callback flag \c AK_DynamicSequenceSelect, the callback is the ONLY way to determine the next item to play.
236  /// \c AK::SoundEngine::DynamicSequence::LockPlaylist always returns \c NULL for dynamic sequences opened with \c AK_DynamicSequenceSelect.
237  /// \endakwarning
238  ///
239  /// \sa
240  /// - AK::SoundEngine::DynamicSequence::UnlockPlaylist
242  AkPlayingID in_playingID ///
243  );
244 
245  /// Unlock the playlist.
246  /// \return
247  /// - AK_Success if successful
248  /// - AK_PlayingIDNotFound if the playing ID does not match to any open Dynamic Sequence
249  /// \sa
250  /// - AK::SoundEngine::DynamicSequence::LockPlaylist
252  AkPlayingID in_playingID ///
253  );
254  }
255  }
256 }
257 
258 #endif // _AK_SOUNDENGINE_AKDYNAMICSEQUENCE_H
AKSOUNDENGINE_API AKRESULT Stop(AkPlayingID in_playingID, AkTimeMs in_uTransitionDuration=0, AkCurveInterpolation in_eFadeCurve=AkCurveInterpolation_Linear)
AKRESULT SetExternalSources(AkUInt32 in_nExternalSrc, AkExternalSourceInfo *in_pExternalSrc)
AkEventCallbackFunc AkCallbackFunc
AKSOUNDENGINE_API AKRESULT GetPlayingItem(AkPlayingID in_playingID, AkUniqueID &out_audioNodeID, void *&out_pCustomInfo)
AkDynamicSequenceType
Definition: AkEnums.h:379
void * AkExternalSourceArray
Definition: AkTypedefs.h:87
Definition of data structures for AkAudioObject
AkUniqueID audioNodeID
Unique ID of Audio Node
AkUInt64 AkGameObjectID
Game object ID
Definition: AkTypedefs.h:39
#define AK_EXTERNAPIFUNC(_type, _name)
AkCurveInterpolation
Curve interpolation types
Definition: AkEnums.h:185
AkTimeMs msDelay
Delay before playing this item, in milliseconds
@ AkDynamicSequenceType_Last
End of enum, invalid value.
Definition: AkEnums.h:382
PlaylistItem & operator=(const PlaylistItem &in_rCopy)
AKSOUNDENGINE_API AKRESULT Resume(AkPlayingID in_playingID, AkTimeMs in_uTransitionDuration=0, AkCurveInterpolation in_eFadeCurve=AkCurveInterpolation_Linear)
AkUInt32 AkUniqueID
Unique 32-bit ID
Definition: AkTypedefs.h:31
const AkDynamicSequenceType DynamicSequenceType_NormalTransition
Specific implementation of array
Definition: AkArray.h:260
float AkReal32
32-bit floating point
AKSOUNDENGINE_API AKRESULT Pause(AkPlayingID in_playingID, AkTimeMs in_uTransitionDuration=0, AkCurveInterpolation in_eFadeCurve=AkCurveInterpolation_Linear)
const AkDynamicSequenceType DynamicSequenceType_Last
PlaylistItem(const PlaylistItem &in_rCopy)
AkInt32 AkTimeMs
Time in ms
Definition: AkTypedefs.h:35
AKSOUNDENGINE_API Playlist * LockPlaylist(AkPlayingID in_playingID)
AKSOUNDENGINE_API AKRESULT Play(AkPlayingID in_playingID, AkTimeMs in_uTransitionDuration=0, AkCurveInterpolation in_eFadeCurve=AkCurveInterpolation_Linear)
@ AkDynamicSequenceType_SampleAccurate
Sample accurate mode
Definition: AkEnums.h:380
#define AKASSERT(Condition)
Definition: AkAssert.h:69
@ AK_InsufficientMemory
Memory error.
Definition: AkEnums.h:62
AKSOUNDENGINE_API AkPlayingID Open(AkGameObjectID in_gameObjectID, AkUInt32 in_uFlags=0, AkCallbackFunc in_pfnCallback=NULL, void *in_pCookie=NULL, AkDynamicSequenceType in_eDynamicSequenceType=AkDynamicSequenceType_SampleAccurate)
AkForceInline AKRESULT Enqueue(AkUniqueID in_audioNodeID, AkTimeMs in_msDelay=0, void *in_pCustomInfo=NULL, AkUInt32 in_cExternals=0, AkExternalSourceInfo *in_pExternalSources=NULL)
AKRESULT
Definition: AkEnums.h:32
AKSOUNDENGINE_API AKRESULT Seek(AkPlayingID in_playingID, AkTimeMs in_iPosition, bool in_bSeekToNearestMarker)
@ AkCurveInterpolation_Linear
Linear (Default)
Definition: AkEnums.h:192
AkForceInline PlaylistItem * AddLast()
Definition: AkArray.h:594
AKSOUNDENGINE_API AKRESULT UnlockPlaylist(AkPlayingID in_playingID)
uint32_t AkUInt32
Unsigned 32-bit integer
const AkDynamicSequenceType DynamicSequenceType_SampleAccurate
#define AkForceInline
Definition: AkTypes.h:63
AKSOUNDENGINE_API AKRESULT GetPauseTimes(AkPlayingID in_playingID, AkUInt32 &out_uTime, AkUInt32 &out_uDuration)
AkUInt32 AkPlayingID
A unique identifier generated whenever a PostEvent is called (or when a Dynamic Sequence is created)....
Definition: AkTypedefs.h:34
@ AkDynamicSequenceType_NormalTransition
Normal transition mode, allows the entire playlist to be edited at all times.
Definition: AkEnums.h:381
bool operator==(const PlaylistItem &in_rCopy)
AKSOUNDENGINE_API AKRESULT Close(AkPlayingID in_playingID)
AKSOUNDENGINE_API AKRESULT Break(AkPlayingID in_playingID)

このページはお役に立ちましたか?

サポートは必要ですか?

ご質問や問題、ご不明点はございますか?お気軽にお問い合わせください。

サポートページをご確認ください

あなたのプロジェクトについて教えてください。ご不明な点はありませんか。

プロジェクトを登録していただくことで、ご利用開始のサポートをいたします。

Wwiseからはじめよう