Version

menu_open
Wwise SDK 2023.1.2

◆ GetPlayingSegmentInfo()

AKSOUNDENGINE_API AKRESULT AK::MusicEngine::GetPlayingSegmentInfo ( AkPlayingID  in_PlayingID,
AkSegmentInfo out_segmentInfo,
bool  in_bExtrapolate = true 
)

Query information on the active segment of a music object that is playing. Use the playing ID that was returned from AK::SoundEngine::PostEvent(), provided that the event contained a play action that was targetting a music object. For any configuration of interactive music hierarchy, there is only one segment that is active at a time. To be able to query segment information, you must pass the AK_EnableGetMusicPlayPosition flag to the AK::SoundEngine::PostEvent() method. This informs the sound engine that the source associated with this event should be given special consideration because GetPlayingSegmentInfo() can be called at any time for this AkPlayingID. Notes:

  • If the music object is a single segment, you will get negative values for AkSegmentInfo::iCurrentPosition during the pre-entry. This will never occur with other types of music objects because the pre-entry of a segment always overlaps another active segment.
  • The active segment during the pre-entry of the first segment of a Playlist Container or a Music Switch Container is "nothing", as well as during the post-exit of the last segment of a Playlist (and beyond).
  • When the active segment is "nothing", out_uSegmentInfo is filled with zeros.
  • If in_bExtrapolate is true (default), AkSegmentInfo::iCurrentPosition is corrected by the amount of time elapsed since the beginning of the audio frame. It is thus possible that it slightly overshoots the total segment length.
    Returns
    AK_Success if there is a playing music structure associated with the specified playing ID.
    See also
  • AK::SoundEngine::PostEvent
  • AkSegmentInfo
Parameters
in_PlayingIDPlaying ID returned by AK::SoundEngine::PostEvent().
out_segmentInfoStructure containing information about the active segment of the music structure that is playing.
in_bExtrapolatePosition is extrapolated based on time elapsed since last sound engine update.

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