Wwise SDK 2024.1.1
|
When creating the interactive music for your game, you may need information about the music's beat. You can request this information from the sound engine using music notifications. The beat is determined by the main music segment currently playing. Since segments can have different time signatures, the beat will change based on the music currently playing. When no music is playing, there will be no notifications.
There are two types of music callbacks:
If you want to receive marker notifications about your music, there are specific things you need to be aware of when designing your application:
If you also want to receive a notification at the end of an event, you should use AK_EndOfEvent
| AK_MusicSyncBeat
since the flags are bitwise exclusive.
AK_MusicSyncBar
notifications, you should return when any other event type is received.in_pCallbackInfo
into the appropriate information structure type. For music notifications, it is AkMusicSyncCallbackInfo.AK_MusicSyncBeat
and AK_MusicSyncBar
in a 4/4 time signature, you will receive 4 beat notifications per bar + one notification for the bar itself. Time "0" also counts for a beat and a bar and in most cases so does the AK_MusicSyncEntry
. This means that if you register for bars, beats and entry points, you will receive three callbacks back to back when the music starts.AK_MusicSyncExit
will only be sent if the end of the body of the current segment is reached. If the music switches to another segment before finishing the current one, the AK_MusicSyncExit
nofification will not be sent.The callback function described above may also be used to manually manage a music playlist's next item selection. This is done by adding the following flag.
Upon reception of this type of event, the callback function must typecast the parameter in_pCallbackInfo
to type AkMusicPlaylistCallbackInfo.
The active playlist node is indicated by the member playlistID
. The sound engine selects the next item in the playlist node to play prior to the callback function call. The selection is contained in the members uPlaylistSelection
and uPlaylistItemDone
. If uPlaylistItemDone
is set to 0 then uPlaylistSelection
determines the next item to play in the playlist node. If uPlaylistItemDone
is not set to 0 then the current playlist node is to end (the parent node will then become the active node). Both members uPlaylistSelection
and uPlaylistItemDone
may be changed by the callback function.
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 moment it actually gets played. 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.
The callbacks 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 after 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.
Des questions ? Des problèmes ? Besoin de plus d'informations ? Contactez-nous, nous pouvons vous aider !
Visitez notre page d'AideEnregistrez votre projet et nous vous aiderons à démarrer sans aucune obligation !
Partir du bon pied avec Wwise