top of page

Music Player

One requirement for the music was to have it be dynamically changing when walking around in a level. In order to make this work I designed a Musical Theme system where a composer (in this case me....!) can divide a theme into multiple intensity layers, with their own individual transition tracks. The composer can also mark multiple bars of the intensity layer track as "valid exit bars", so that a transition can trigger more rapidly rather than having to wait until the whole track loops back again.

Data asset for musical theme

In order to make this work without synchronization issues I used the built in Quartz Clock, operating on the audio thread with the callback function OnMetronomeTick being responsible for the realtime updates. The surrounding functionality in the music player class makes up a "producer-consumer" pattern where changes to the music are produced from the game thread to later on be consumed by the audio thread.

1

Music Player Interface

Music Player Implementation

Triggers

Making the music system more accessible to designers, I also created custom trigger classes. These can be placed in the level and will trigger changes to the soundtrack depending on their FTriggerSettings showed below.

Trigger Settings

The triggers can be of type ASoundTrackTrigger or AMusicControlTrigger, where both of them inherit from ASoundTrigger . The triggers have individual settings for their front and back side, making so you only need to place one single trigger at a boundary.

Soundtrack trigger

Music control trigger

bottom of page