Version
menu_open
link
Wwise SDK 2023.1.3
AkMusicEngine.h
Go to the documentation of this file.
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 // AkMusicEngine.h
28 
29 /// \file
30 /// The main music engine interface.
31 
32 
33 #ifndef _AK_MUSICENGINE_H_
34 #define _AK_MUSICENGINE_H_
35 
39 
40 /// Platform-independent initialization settings of the music engine
41 /// \sa
42 /// - AK::MusicEngine::Init()
43 /// - \ref soundengine_integration_init_advanced
45 {
46  AkReal32 fStreamingLookAheadRatio; ///< Multiplication factor for all streaming look-ahead heuristic values.
47 };
48 
49 // Audiokinetic namespace
50 namespace AK
51 {
52  /// Music engine namespace
53  /// \akwarning
54  /// The functions in this namespace are not thread-safe, unless stated otherwise.
55  /// \endakwarning
56  namespace MusicEngine
57  {
58  ///////////////////////////////////////////////////////////////////////
59  /// @name Initialization
60  //@{
61 
62  /// Initialize the music engine.
63  /// \warning This function must be called after the base sound engine has been properly initialized.
64  /// There should be no AK API call between AK::SoundEngine::Init() and this call. Any call done in between is potentially unsafe.
65  /// \return AK_Success if the Init was successful, AK_Fail otherwise.
66  /// \sa
67  /// - \ref workingwithsdks_initialization
69  AkMusicSettings * in_pSettings ///< Initialization settings (can be NULL, to use the default values)
70  );
71 
72  /// Get the music engine's default initialization settings values
73  /// \sa
74  /// - \ref soundengine_integration_init_advanced
75  /// - AK::MusicEngine::Init()
77  AkMusicSettings & out_settings ///< Returned default platform-independent music engine settings
78  );
79 
80  /// Terminate the music engine.
81  /// \warning This function must be called before calling Term() on the base sound engine.
82  /// \sa
83  /// - \ref workingwithsdks_termination
85  );
86 
87  /// Query information on the active segment of a music object that is playing. Use the playing ID
88  /// that was returned from AK::SoundEngine::PostEvent(), provided that the event contained a play
89  /// action that was targetting a music object. For any configuration of interactive music hierarchy,
90  /// there is only one segment that is active at a time.
91  /// To be able to query segment information, you must pass the AK_EnableGetMusicPlayPosition flag
92  /// to the AK::SoundEngine::PostEvent() method. This informs the sound engine that the source associated
93  /// with this event should be given special consideration because GetPlayingSegmentInfo() can be called
94  /// at any time for this AkPlayingID.
95  /// Notes:
96  /// - If the music object is a single segment, you will get negative values for AkSegmentInfo::iCurrentPosition
97  /// during the pre-entry. This will never occur with other types of music objects because the
98  /// pre-entry of a segment always overlaps another active segment.
99  /// - The active segment during the pre-entry of the first segment of a Playlist Container or a Music Switch
100  /// Container is "nothing", as well as during the post-exit of the last segment of a Playlist (and beyond).
101  /// - When the active segment is "nothing", out_uSegmentInfo is filled with zeros.
102  /// - If in_bExtrapolate is true (default), AkSegmentInfo::iCurrentPosition is corrected by the amount of time elapsed
103  /// since the beginning of the audio frame. It is thus possible that it slightly overshoots the total segment length.
104  /// \return AK_Success if there is a playing music structure associated with the specified playing ID.
105  /// \sa
106  /// - AK::SoundEngine::PostEvent
107  /// - AkSegmentInfo
109  AkPlayingID in_PlayingID, ///< Playing ID returned by AK::SoundEngine::PostEvent().
110  AkSegmentInfo & out_segmentInfo, ///< Structure containing information about the active segment of the music structure that is playing.
111  bool in_bExtrapolate = true ///< Position is extrapolated based on time elapsed since last sound engine update.
112  );
113 
114  //@}
115  }
116 }
117 
118 #endif // _AK_MUSICENGINE_H_
119 
Audiokinetic namespace.
#define AK_EXTERNAPIFUNC(_type, _name)
AKRESULT
Standard function call result.
Definition: AkTypes.h:213
Structure used to query info on active playing segments.
Definition: AkCallback.h:215
AKSOUNDENGINE_API AKRESULT GetPlayingSegmentInfo(AkPlayingID in_PlayingID, AkSegmentInfo &out_segmentInfo, bool in_bExtrapolate=true)
AKSOUNDENGINE_API void GetDefaultInitSettings(AkMusicSettings &out_settings)
float AkReal32
32-bit floating point
AkReal32 fStreamingLookAheadRatio
Multiplication factor for all streaming look-ahead heuristic values.
Definition: AkMusicEngine.h:46
AKSOUNDENGINE_API AKRESULT Init(AkMusicSettings *in_pSettings)
AKSOUNDENGINE_API void Term()
AkUInt32 AkPlayingID
Playing ID.
Definition: AkTypes.h:137

Was this page helpful?

Need Support?

Questions? Problems? Need more info? Contact us, and we can help!

Visit our Support page

Tell us about your project. We're here to help.

Register your project and we'll help you get started with no strings attached!

Get started with Wwise