バージョン

menu_open
Wwise SDK 2019.1.11
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  Version: <VERSION> Build: <BUILDNUMBER>
25  Copyright (c) <COPYRIGHTYEAR> Audiokinetic Inc.
26 *******************************************************************************/
27 
28 #ifndef _AK_SOUNDENGINE_AKDYNAMICSEQUENCE_H
29 #define _AK_SOUNDENGINE_AKDYNAMICSEQUENCE_H
30 
31 #include <AK/SoundEngine/Common/AkSoundEngine.h>
32 #include <AK/Tools/Common/AkArray.h>
33 
34 class AkExternalSourceArray;
35 
36 namespace AK
37 {
38  namespace SoundEngine
39  {
40  /// Dynamic Sequence namespace
41  /// \remarks The functions in this namespace are thread-safe, unless stated otherwise.
42  namespace DynamicSequence
43  {
44  /// Playlist Item for Dynamic Sequence Playlist.
45  /// \sa
46  /// - AK::SoundEngine::DynamicSequence::Playlist
47  /// - AK::SoundEngine::PostEvent
48  /// - \ref integrating_external_sources
49  class PlaylistItem
50  {
51  public:
53  PlaylistItem(const PlaylistItem& in_rCopy);
55 
56  PlaylistItem& operator=(const PlaylistItem& in_rCopy);
57  bool operator==(const PlaylistItem& in_rCopy)
58  {
59  AKASSERT(pExternalSrcs == NULL);
60  return audioNodeID == in_rCopy.audioNodeID &&
61  msDelay == in_rCopy.msDelay &&
62  pCustomInfo == in_rCopy.pCustomInfo;
63  };
64 
65  /// Sets the external sources used by this item.
66  /// \sa
67  /// \ref integrating_external_sources
68  AKRESULT SetExternalSources(AkUInt32 in_nExternalSrc, AkExternalSourceInfo* in_pExternalSrc);
69 
70  /// Get the external source array. Internal use only.
71  AkExternalSourceArray* GetExternalSources(){return pExternalSrcs;}
72 
73  AkUniqueID audioNodeID; ///< Unique ID of Audio Node
74  AkTimeMs msDelay; ///< Delay before playing this item, in milliseconds
75  void * pCustomInfo; ///< Optional user data
76 
77  private:
78  AkExternalSourceArray *pExternalSrcs;
79  };
80 
81  /// List of items to play in a Dynamic Sequence.
82  /// \sa
83  /// - AK::SoundEngine::DynamicSequence::LockPlaylist
84  /// - AK::SoundEngine::DynamicSequence::UnlockPlaylist
85  class Playlist
86  : public AkArray<PlaylistItem, const PlaylistItem&, ArrayPoolDefault, 4>
87  {
88  public:
89  /// Enqueue an Audio Node.
90  /// \return AK_Success if successful, AK_Fail otherwise
91  AkForceInline AKRESULT Enqueue(
92  AkUniqueID in_audioNodeID, ///< Unique ID of Audio Node
93  AkTimeMs in_msDelay = 0, ///< Delay before playing this item, in milliseconds
94  void * in_pCustomInfo = NULL, ///< Optional user data
95  AkUInt32 in_cExternals = 0, ///< Optional count of external source structures
96  AkExternalSourceInfo *in_pExternalSources = NULL///< Optional array of external source resolution information
97  )
98  {
99  PlaylistItem * pItem = AddLast();
100  if ( !pItem )
101  return AK_Fail;
102 
103  pItem->audioNodeID = in_audioNodeID;
104  pItem->msDelay = in_msDelay;
105  pItem->pCustomInfo = in_pCustomInfo;
106  return pItem->SetExternalSources(in_cExternals, in_pExternalSources);
107  }
108  };
109 
110  /// The DynamicSequenceType is specified when creating a new dynamic sequence.\n
111  /// \n
112  /// The default option is DynamicSequenceType_SampleAccurate. \n
113  /// \n
114  /// In sample accurate mode, when a dynamic sequence item finishes playing and there is another item\n
115  /// pending in its playlist, the next sound will be stitched to the end of the ending sound. In this \n
116  /// mode, if there are one or more pending items in the playlist while the dynamic sequence is playing,\n
117  /// or if something is added to the playlist during the playback, the dynamic sequence\n
118  /// can remove the next item to be played from the playlist and prepare it for sample accurate playback before\n
119  /// the first sound is finished playing. This mechanism helps keep sounds sample accurate, but then\n
120  /// you might not be able to remove that next item from the playlist if required.\n
121  /// \n
122  /// If your game requires the capability of removing the next to be played item from the\n
123  /// playlist at any time, then you should use the DynamicSequenceType_NormalTransition option instead.\n
124  /// In this mode, you cannot ensure sample accuracy between sounds.\n
125  /// \n
126  /// Note that a Stop or a Break will always prevent the next to be played sound from actually being played.
127  ///
128  /// \sa
129  /// - AK::SoundEngine::DynamicSequence::Open
131  {
132  DynamicSequenceType_SampleAccurate, ///< Sample accurate mode
133  DynamicSequenceType_NormalTransition ///< Normal transition mode, allows the entire playlist to be edited at all times.
134  };
135 
136  /// Open a new Dynamic Sequence.
137  /// \return Playing ID of the dynamic sequence, or AK_INVALID_PLAYING_ID in failure case
138  ///
139  /// \sa
140  /// - AK::SoundEngine::DynamicSequence::DynamicSequenceType
141  AK_EXTERNAPIFUNC( AkPlayingID, Open )(
142  AkGameObjectID in_gameObjectID, ///< Associated game object ID
143  AkUInt32 in_uFlags = 0, ///< Bitmask: see \ref AkCallbackType
144  AkCallbackFunc in_pfnCallback = NULL, ///< Callback function
145  void* in_pCookie = NULL, ///< Callback cookie that will be sent to the callback function along with additional information;
146  DynamicSequenceType in_eDynamicSequenceType = DynamicSequenceType_SampleAccurate ///< See : \ref AK::SoundEngine::DynamicSequence::DynamicSequenceType
147  );
148 
149  /// Close specified Dynamic Sequence. The Dynamic Sequence will play until finished and then
150  /// deallocate itself.
151  AK_EXTERNAPIFUNC( AKRESULT, Close )(
152  AkPlayingID in_playingID ///< AkPlayingID returned by DynamicSequence::Open
153  );
154 
155  /// Play specified Dynamic Sequence.
156  AK_EXTERNAPIFUNC( AKRESULT, Play )(
157  AkPlayingID in_playingID, ///< AkPlayingID returned by DynamicSequence::Open
158  AkTimeMs in_uTransitionDuration = 0, ///< Fade duration
159  AkCurveInterpolation in_eFadeCurve = AkCurveInterpolation_Linear ///< Curve type to be used for the transition
160  );
161 
162  /// Pause specified Dynamic Sequence.
163  /// To restart the sequence, call Resume. The item paused will resume its playback, followed by the rest of the sequence.
164  AK_EXTERNAPIFUNC( AKRESULT, Pause )(
165  AkPlayingID in_playingID, ///< AkPlayingID returned by DynamicSequence::Open
166  AkTimeMs in_uTransitionDuration = 0, ///< Fade duration
167  AkCurveInterpolation in_eFadeCurve = AkCurveInterpolation_Linear ///< Curve type to be used for the transition
168  );
169 
170  /// Resume specified Dynamic Sequence.
171  AK_EXTERNAPIFUNC( AKRESULT, Resume )(
172  AkPlayingID in_playingID, ///< AkPlayingID returned by DynamicSequence::Open
173  AkTimeMs in_uTransitionDuration = 0, ///< Fade duration
174  AkCurveInterpolation in_eFadeCurve = AkCurveInterpolation_Linear ///< Curve type to be used for the transition
175  );
176 
177  /// Stop specified Dynamic Sequence immediately.
178  /// To restart the sequence, call Play. The sequence will restart with the item that was in the
179  /// playlist after the item that was stopped.
180  AK_EXTERNAPIFUNC( AKRESULT, Stop )(
181  AkPlayingID in_playingID, ///< AkPlayingID returned by DynamicSequence::Open
182  AkTimeMs in_uTransitionDuration = 0, ///< Fade duration
183  AkCurveInterpolation in_eFadeCurve = AkCurveInterpolation_Linear ///< Curve type to be used for the transition
184  );
185 
186  /// Break specified Dynamic Sequence. The sequence will stop after the current item.
187  AK_EXTERNAPIFUNC( AKRESULT, Break )(
188  AkPlayingID in_playingID ///< AkPlayingID returned by DynamicSequence::Open
189  );
190 
191  /// Get pause times.
192  AK_EXTERNAPIFUNC(AKRESULT, GetPauseTimes)(
193  AkPlayingID in_playingID, ///< AkPlayingID returned by DynamicSequence::Open
194  AkUInt32 &out_uTime, ///< If sequence is currently paused, returns time when pause started, else 0.
195  AkUInt32 &out_uDuration ///< Returns total pause duration since last call to GetPauseTimes, excluding the time elapsed in the current pause.
196  );
197 
198  /// Get currently playing item. Note that this may be different from the currently heard item
199  /// when sequence is in sample-accurate mode.
200  AK_EXTERNAPIFUNC(AKRESULT, GetPlayingItem)(
201  AkPlayingID in_playingID, ///< AkPlayingID returned by DynamicSequence::Open
202  AkUniqueID & out_audioNodeID, ///< Returned audio node ID of playing item.
203  void *& out_pCustomInfo ///< Returned user data of playing item.
204  );
205 
206  /// Lock the Playlist for editing. Needs a corresponding UnlockPlaylist call.
207  /// \return Pointer to locked Playlist if successful, NULL otherwise
208  /// \sa
209  /// - AK::SoundEngine::DynamicSequence::UnlockPlaylist
210  AK_EXTERNAPIFUNC( Playlist *, LockPlaylist )(
211  AkPlayingID in_playingID ///< AkPlayingID returned by DynamicSequence::Open
212  );
213 
214  /// Unlock the playlist.
215  /// \sa
216  /// - AK::SoundEngine::DynamicSequence::LockPlaylist
217  AK_EXTERNAPIFUNC( AKRESULT, UnlockPlaylist )(
218  AkPlayingID in_playingID ///< AkPlayingID returned by DynamicSequence::Open
219  );
220  }
221  }
222 }
223 
224 #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)
AKSOUNDENGINE_API AKRESULT GetPlayingItem(AkPlayingID in_playingID, AkUniqueID &out_audioNodeID, void *&out_pCustomInfo)
Audiokinetic namespace
AkUniqueID audioNodeID
Unique ID of Audio Node
AkTimeMs msDelay
Delay before playing this item, in milliseconds
PlaylistItem & operator=(const PlaylistItem &in_rCopy)
AKSOUNDENGINE_API AKRESULT Resume(AkPlayingID in_playingID, AkTimeMs in_uTransitionDuration=0, AkCurveInterpolation in_eFadeCurve=AkCurveInterpolation_Linear)
Resume specified Dynamic Sequence.
Specific implementation of array
Definition: AkArray.h:190
AKSOUNDENGINE_API AKRESULT Pause(AkPlayingID in_playingID, AkTimeMs in_uTransitionDuration=0, AkCurveInterpolation in_eFadeCurve=AkCurveInterpolation_Linear)
PlaylistItem(const PlaylistItem &in_rCopy)
AKSOUNDENGINE_API Playlist * LockPlaylist(AkPlayingID in_playingID)
AKSOUNDENGINE_API AKRESULT Play(AkPlayingID in_playingID, AkTimeMs in_uTransitionDuration=0, AkCurveInterpolation in_eFadeCurve=AkCurveInterpolation_Linear)
Play specified Dynamic Sequence.
@ DynamicSequenceType_SampleAccurate
Sample accurate mode
AkForceInline AKRESULT Enqueue(AkUniqueID in_audioNodeID, AkTimeMs in_msDelay=0, void *in_pCustomInfo=NULL, AkUInt32 in_cExternals=0, AkExternalSourceInfo *in_pExternalSources=NULL)
AkExternalSourceArray * GetExternalSources()
Get the external source array. Internal use only.
AKSOUNDENGINE_API AKRESULT UnlockPlaylist(AkPlayingID in_playingID)
AKSOUNDENGINE_API AkPlayingID Open(AkGameObjectID in_gameObjectID, AkUInt32 in_uFlags=0, AkCallbackFunc in_pfnCallback=NULL, void *in_pCookie=NULL, DynamicSequenceType in_eDynamicSequenceType=DynamicSequenceType_SampleAccurate)
@ DynamicSequenceType_NormalTransition
Normal transition mode, allows the entire playlist to be edited at all times.
AKSOUNDENGINE_API AKRESULT GetPauseTimes(AkPlayingID in_playingID, AkUInt32 &out_uTime, AkUInt32 &out_uDuration)
Get pause times.
bool operator==(const PlaylistItem &in_rCopy)
AKSOUNDENGINE_API AKRESULT Close(AkPlayingID in_playingID)
AKSOUNDENGINE_API AKRESULT Break(AkPlayingID in_playingID)
Break specified Dynamic Sequence. The sequence will stop after the current item.

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

サポートは必要ですか?

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

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

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

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

Wwiseからはじめよう