AkMusicEngine.h 5.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119
  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. Commercial License Usage
  5. Licensees holding valid commercial licenses to the AUDIOKINETIC Wwise Technology
  6. may use this file in accordance with the end user license agreement provided
  7. with the software or, alternatively, in accordance with the terms contained in a
  8. written agreement between you and Audiokinetic Inc.
  9. Apache License Usage
  10. Alternatively, this file may be used under the Apache License, Version 2.0 (the
  11. "Apache License"); you may not use this file except in compliance with the
  12. Apache License. You may obtain a copy of the Apache License at
  13. http://www.apache.org/licenses/LICENSE-2.0.
  14. Unless required by applicable law or agreed to in writing, software distributed
  15. under the Apache License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES
  16. OR CONDITIONS OF ANY KIND, either express or implied. See the Apache License for
  17. the specific language governing permissions and limitations under the License.
  18. Copyright (c) 2023 Audiokinetic Inc.
  19. *******************************************************************************/
  20. // AkMusicEngine.h
  21. /// \file
  22. /// The main music engine interface.
  23. #ifndef _AK_MUSICENGINE_H_
  24. #define _AK_MUSICENGINE_H_
  25. #include <AK/SoundEngine/Common/AkSoundEngineExport.h>
  26. #include <AK/SoundEngine/Common/AkTypes.h>
  27. #include <AK/SoundEngine/Common/AkCallback.h>
  28. /// Platform-independent initialization settings of the music engine
  29. /// \sa
  30. /// - AK::MusicEngine::Init()
  31. /// - \ref soundengine_integration_init_advanced
  32. struct AkMusicSettings
  33. {
  34. AkReal32 fStreamingLookAheadRatio; ///< Multiplication factor for all streaming look-ahead heuristic values.
  35. };
  36. // Audiokinetic namespace
  37. namespace AK
  38. {
  39. /// Music engine namespace
  40. /// \akwarning
  41. /// The functions in this namespace are not thread-safe, unless stated otherwise.
  42. /// \endakwarning
  43. namespace MusicEngine
  44. {
  45. ///////////////////////////////////////////////////////////////////////
  46. /// @name Initialization
  47. //@{
  48. /// Initialize the music engine.
  49. /// \warning This function must be called after the base sound engine has been properly initialized.
  50. /// There should be no AK API call between AK::SoundEngine::Init() and this call. Any call done in between is potentially unsafe.
  51. /// \return AK_Success if the Init was successful, AK_Fail otherwise.
  52. /// \sa
  53. /// - \ref workingwithsdks_initialization
  54. AK_EXTERNAPIFUNC( AKRESULT, Init )(
  55. AkMusicSettings * in_pSettings ///< Initialization settings (can be NULL, to use the default values)
  56. );
  57. /// Get the music engine's default initialization settings values
  58. /// \sa
  59. /// - \ref soundengine_integration_init_advanced
  60. /// - AK::MusicEngine::Init()
  61. AK_EXTERNAPIFUNC( void, GetDefaultInitSettings )(
  62. AkMusicSettings & out_settings ///< Returned default platform-independent music engine settings
  63. );
  64. /// Terminate the music engine.
  65. /// \warning This function must be called before calling Term() on the base sound engine.
  66. /// \sa
  67. /// - \ref workingwithsdks_termination
  68. AK_EXTERNAPIFUNC( void, Term )(
  69. );
  70. /// Query information on the active segment of a music object that is playing. Use the playing ID
  71. /// that was returned from AK::SoundEngine::PostEvent(), provided that the event contained a play
  72. /// action that was targetting a music object. For any configuration of interactive music hierarchy,
  73. /// there is only one segment that is active at a time.
  74. /// To be able to query segment information, you must pass the AK_EnableGetMusicPlayPosition flag
  75. /// to the AK::SoundEngine::PostEvent() method. This informs the sound engine that the source associated
  76. /// with this event should be given special consideration because GetPlayingSegmentInfo() can be called
  77. /// at any time for this AkPlayingID.
  78. /// Notes:
  79. /// - If the music object is a single segment, you will get negative values for AkSegmentInfo::iCurrentPosition
  80. /// during the pre-entry. This will never occur with other types of music objects because the
  81. /// pre-entry of a segment always overlaps another active segment.
  82. /// - The active segment during the pre-entry of the first segment of a Playlist Container or a Music Switch
  83. /// Container is "nothing", as well as during the post-exit of the last segment of a Playlist (and beyond).
  84. /// - When the active segment is "nothing", out_uSegmentInfo is filled with zeros.
  85. /// - If in_bExtrapolate is true (default), AkSegmentInfo::iCurrentPosition is corrected by the amount of time elapsed
  86. /// since the beginning of the audio frame. It is thus possible that it slightly overshoots the total segment length.
  87. /// \return AK_Success if there is a playing music structure associated with the specified playing ID.
  88. /// \sa
  89. /// - AK::SoundEngine::PostEvent
  90. /// - AkSegmentInfo
  91. AK_EXTERNAPIFUNC( AKRESULT, GetPlayingSegmentInfo )(
  92. AkPlayingID in_PlayingID, ///< Playing ID returned by AK::SoundEngine::PostEvent().
  93. AkSegmentInfo & out_segmentInfo, ///< Structure containing information about the active segment of the music structure that is playing.
  94. bool in_bExtrapolate = true ///< Position is extrapolated based on time elapsed since last sound engine update.
  95. );
  96. //@}
  97. }
  98. }
  99. #endif // _AK_MUSICENGINE_H_