Version

menu_open
Warning: you were redirected to the latest documentation corresponding to your major release ( 2023.1.8.8601 ). Should you wish to access your specific version's documentation, please download the offline documentation from the Audiokinetic Launcher and check the Offline Documentation option in Wwise Authoring.
Wwise SDK 2023.1.8
Integrating Markers

Introduction

Markers are identifiers that are inserted in a WAV file and used to tag a position in the waveform. These markers are usually created in a WAV editor application, such as SoundForge®, Adobe® Audition®, or CueTool.

An application can use these markers to be notified when a certain position is reached during playback. For example, you could use this information to synchronize content drawing with the audio being played, or to know which file is being played by a random container so that the correct subtitles can be displayed in your game.

Note: Using Wwise marker notifications is usually the most efficient way to integrate a lip-sync or subtitle solution.

Working with the.wav File Format

Chunks are data storage units used to store cue points, or data about cue points. Cue points are points of interest flagged in .wav format files.

Cue Chunks

The cue chunk format is used to store marker positions that indicate points of interest in a .wav file.

List Chunks

A list chunk is a container inside the .wav file which contains subchunks. The associated data list chunk (adtl) format is used to store labels, notes, and text associated to a cue point.

Label Sub-Chunks

The label sub-chunk format is used to store a string associated with a cue point. It should be inside the associated data list chunk.

Working with Source Plug-ins

Source plug-ins can also generate marker notifications.

Within a source plug-in, AK::IAkPluginServiceMarkers::CreateMarkerNotificationService() can be used to create an instance of AK::IAkPluginServiceMarkers::IAkMarkerNotificationService. AK::IAkPluginServiceMarkers::IAkMarkerNotificationService::SubmitMarkerNotifications() can then be used to send marker notifications to the game using the AkAudioMarker structure.

Marker Generator Source Plug-in Example

Below is an example of a source plug-in that generates marker notifications.

How to Use Marker Notifications

Here are instructions on how to design your application so that it receives the marker notifications:

  • When posting a play event, you should add the AK_Marker flag to in_uiFlags. If you also want to have the end of event notification, you should use AK_EndOfEvent | AK_Marker since the flags are bitwise exclusive.
  • Your callback function must have the following form:
  • When your callback function is called, you first need to check what type of notification is passed. For example, if you only want to process AK_Marker notifications, you should return when any other event type is received.
  • Based on the type of notification, you can typecast in_pCallbackInfo into the appropriate information structure type. For AK_Marker notification, it is AkMarkerCallbackInfo.
  • Make sure you copy the contents of the strLabel string member if you plan to reference it later, as the pointer can be invalidated after the callback returns.
See also
Quick Start Sample Integration - Events

Notification Latency

Currently, notification is sent when the buffer is passed down to the hardware. This means that there is a certain constant delay between when the notification is sent and the marker is encountered. This gives your application enough time to gather the information on the marker and process it before the sound associated with that marker is really played.

Note that this delay is platform-dependent.

Callback Thread

The callbacks for markers, as well as for the end of event notification, are done from the sound engine's main thread. This means that your application should gather all the information it needs from the notification and return immediately. If any processing needs to be done, it should be performed in a separate thread once the relevant information has been copied from the notification.

If the application holds the thread for too long, the sound engine might fall into an underrun state and the output might stop playing.

Note
The label string from the callback function should be copied because the referenced data will be released by the sound engine after the callback function returns.

Wwise Capture Log and Markers

The Wwise Profiler can display marker notifications from the sound engine. In order to do so, you must ensure that the Markers Notification Data option in the Profiler Settings dialog is enabled. When a marker is reached and a notification has been requested, a new line will appear in the Capture Log. Note that these notifications can be filtered out if needed by clearing the Markers Notification Data check box in the Capture Log Filter dialog.

See also
Integration Details - Events
Defines the parameters of a marker.
Definition: AkAudioMarker.h:16
const char * strLabel
Label of the marker (null-terminated)
Definition: AkCallback.h:119
AkUInt32 dwIdentifier
Identifier.
Definition: AkAudioMarker.h:17
AkUInt64 AkGameObjectID
Game object ID.
Definition: AkTypes.h:60
AKRESULT
Standard function call result.
Definition: AkTypes.h:131
AkUInt32 dwLabelSize
Length of label read the from the file + terminating null character.
Definition: AkAudioMarker.h:20
AkCallbackType
Type of callback. Used as a bitfield in methods AK::SoundEngine::PostEvent() and AK::SoundEngine::Dyn...
Definition: AkCallback.h:48
AKSOUNDENGINE_API AKRESULT Init(const AkCommSettings &in_settings)
#define NULL
Definition: AkTypes.h:46
@ AK_Success
The operation was successful.
Definition: AkTypes.h:133
AKSOUNDENGINE_API void Term()
AkUInt32 uIdentifier
Cue point identifier.
Definition: AkCallback.h:117
AkUInt32 AkUniqueID
Unique 32-bit ID.
Definition: AkTypes.h:52
AkUInt32 uLabelSize
Size of the label string (including the terminating null character)
Definition: AkCallback.h:120
AkUInt32 uPosition
Position in the cue point (unit: sample frames)
Definition: AkCallback.h:118
Type
IDs of temporary memory pools used by the sound engine.
Definition: AkMemoryMgr.h:336
void(* AkCallbackFunc)(AkCallbackType in_eType, AkCallbackInfo *in_pCallbackInfo)
Definition: AkCallback.h:266
const char * strLabel
Label of the marker taken from the file.
Definition: AkAudioMarker.h:19
#define AK_GET_PLUGIN_SERVICE_MARKERS(plugin_ctx)
Definition: IAkPlugin.h:1756
uint32_t AkUInt32
Unsigned 32-bit integer.
AkUInt32 dwPosition
Position in the audio data in sample frames.
Definition: AkAudioMarker.h:18
AKSOUNDENGINE_API AkPlayingID PostEvent(AkUniqueID in_eventID, AkGameObjectID in_gameObjectID, AkUInt32 in_uFlags=0, AkCallbackFunc in_pfnCallback=NULL, void *in_pCookie=NULL, AkUInt32 in_cExternals=0, AkExternalSourceInfo *in_pExternalSources=NULL, AkPlayingID in_PlayingID=AK_INVALID_PLAYING_ID)
Defines the parameters of an audio buffer format.
Definition: AkCommonDefs.h:63
AkUInt32 AkPlayingID
Playing ID.
Definition: AkTypes.h:55
AkForceInline AkUInt16 MaxFrames() const
Definition: AkCommonDefs.h:644

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