Module veloren_voxygen::audio::music

source ·
Expand description

Handles music playback and transitions

Game music is controlled though a configuration file found in the source at /assets/voxygen/audio/soundtrack.ron. Each track enabled in game has a configuration corresponding to the SoundtrackItem format, as well as the corresponding .ogg file in the /assets/voxygen/audio/soundtrack/ directory.

If there are errors while reading or deserialising the configuration file, a warning is logged and music will be disabled.

§Adding new music

To add a new item, append the details to the audio configuration file, and add the audio file (in .ogg format) to the assets directory.

The length should be provided in seconds. This allows us to know when to transition to another track, without having to spend time determining track length programmatically.

An example of a new night time track:

(
    title: "Sleepy Song",
    path: "voxygen.audio.soundtrack.sleepy",
    length: 400.0,
    timing: Some(Night),
    biomes: [
        (Forest, 1),
        (Grassland, 2),
    ],
    site: None,
    activity: Explore,
    artist: "Elvis",
),

Before sending an MR for your new track item:

  • Be conscious of the file size for your new track. Assets contribute to download sizes
  • Ensure that the track is mastered to a volume proportionate to other music tracks
  • If you are not the author of the track, ensure that the song’s licensing permits usage of the track for non-commercial use

Structs§

Enums§

Functions§