Skip to content

SoundSource

namespace Griff.Scenes;
public sealed class SoundSource : Component

A sound that plays over and over where its entity is: a waterfall, a crackling fire, a humming machine. It’s loudest close to the middle of the screen and fades out by Range, and comes from the left or the right speaker as it’s to that side. A Switch turns it on and off.

This is a component: its saved properties are on its component page.

public float Loudness { get; }

How loud it is right now, from 0 (unheard) to its Volume; set by the game.

public float Pitch { get; set; }

1 as recorded, 2 an octave up, 0.5 an octave down. Scripts can change it as it plays: an engine revving.

public bool Playing { get; set; }

True while it plays. Untick it to start silent; switches and scripts can set it.

public float Range { get; set; }

How far away it can be heard, in world units. 0 plays it at full volume everywhere (rain, wind).

public string? Sound { get; set; }

The sound to loop, e.g. “Sounds/waterfall.wav”.

public float Volume { get; set; }

How loud it is up close, 0 to 1, on top of the game’s sound volume.