SoundPlayer
namespace Griff.Scenes;
public sealed class SoundPlayer : ComponentPlays its Sound when something happens, with no code: whenever its Message is sent (by a pickup, a switch, a counter, an enemy’s death message or Game.Send), and when it appears if OnStart is ticked. PitchVariation makes each play a little different, so a sound heard over and over doesn’t grate.
This is a component: its saved properties are on its component page.
Properties
Section titled “Properties”Message
Section titled “Message”public string? Message { get; set; }The message that plays it, e.g. “Score”. Empty plays it only on start.
OnStart
Section titled “OnStart”public bool OnStart { get; set; }Plays it as soon as it appears: a scene’s opening sting, a spawned explosion.
public float Pitch { get; set; }1 as recorded, 2 an octave up, 0.5 an octave down.
PitchVariation
Section titled “PitchVariation”public float PitchVariation { get; set; }How far each play’s pitch wanders at random either way: 0.1 is up to a tenth higher or lower.
Positional
Section titled “Positional”public bool Positional { get; set; }Heard from where it is (quieter off screen, from that side) rather than everywhere equally.
public string? Sound { get; set; }The sound to play, e.g. “Sounds/door.wav”. Make one with Audio > New Sound.
Volume
Section titled “Volume”public float Volume { get; set; }How loud, 0 to 1, on top of the player’s sound volume.