AudioAsset
Ease
FastString
FontAsset
NineSlice
PackedSprite
PackedSpriteID
RB
   HardwareSettings
   IRetroBlitGame
RBAsset
Rect2i
ShaderAsset
SoundReference
SpriteGrid
SpriteSheetAsset
TMXMapAsset
   TMXLayer
   TMXLayerLoadState
   TMXObject
   TMXObjectGroup
   TMXProperties
Vector2i

RB.SoundVolumeSet

Method  -  Static

public static void SoundVolumeSet(SoundReference soundReference, float volume)

Parameters

soundReference SoundReference Sound reference
volume float Volume to play at where 0 is silent, 1 is the original clip volume, and values greater than 1 indicate amplification beyond the recorded volume. Defaults to 1

Returns

Nothing.

Description

Set the volume of a currently playing sound with its SoundReference.

Example

List<SoundAsset> soundCar = new List<SoundAsset>();
SoundReference carSoundRef;

void Initialize() {
    AudioAsset sound = new AudioAsset();
    sound.Load("sounds/car_driving1");
    soundCar.Add(sound);

    sound = new AudioAsset();
    sound.Load("sounds/car_driving2");
    soundCar.Add(sound);

    sound = new AudioAsset();
    sound.Load("sounds/car_driving3");
    soundCar.Add(sound);
}

void Update()
{
    if (!RB.SoundIsPlaying(carSoundRef) {
        // Car sound is done, pick a new random car sound
        carSoundRef = RB.SoundPlay(soundCar[Random.Range(03)]);
    } else {
        // Decrease volume and pitch with time
        RB.SoundVolumeSet(carSoundRef, RB.SoundVolumeGet(carSoundRef) * 0.9f);
        RB.SoundPitchSet(carSoundRef, RB.SoundPitchGet(carSoundRef) * 0.9f);
    }
}

See Also

AudioAsset
RB.SoundPlay
RB.SoundStop
RB.SoundIsPlaying
RB.SoundPitchSet
RB.SoundVolumeGet
RB.SoundPitchGet
RB.SoundLoopSet

See Docs

Features - Sound