SetMusicVolume

From ZDoom Wiki
Jump to: navigation, search

void SetMusicVolume (fixed volume);

Usage

Sets the sound volume of the music currently playing, as a multiplier.

Parameters

  • volume: The volume multiplier to set. This ranges from 0 to 2.0, with values higher than 1.0 only working if the global volume is low enough so that the end result is not more than 1.0.

Examples

This script fades the current music out, and when it is finished fading it, it changes the music and fades that music in.

int musicVolume = 1.0;

Script 1 (void)
{
    while(musicVolume > 0)
    {
        musicVolume -= 0.025;
        SetMusicVolume(musicVolume);
        Delay(1);
    }

    SetMusic("D_Shawn");

    while(musicVolume < 1.0)
    {
        musicVolume += 0.025;
        SetMusicVolume(musicVolume);
        Delay(1);
    }
}