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

RB.SoundPitchGet

Method  -  Static

public static float SoundPitchGet(SoundReference soundReference)

Parameters

soundReference SoundReference Sound reference

Returns

float

Pitch

Description

Get the pitch 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.SoundVolumeSet
RB.SoundPitchGet
RB.SoundLoopSet

See Docs

Features - Sound