Skip to content

ChartPlaybackStream

namespace Griff.Modules.Rhythm;
public sealed class ChartPlaybackStream : IAudioStream

What a chart editor plays: a song from part way in, after a lead-in, with a metronome’s clicks on its beats (always in the lead-in, and through the song when Metronome is on) and a tick on each of the notes of Ticks as it’s reached, each starting on its very sample. Seconds of song are counted from the song’s start (SongSecondsAt), so what a Voice playing it has had heard says where in the song the player is. Without a song it’s the clicks alone, for as long as it plays.

public int Channels { get; }
public long Frames { get; }

A song’s stream ends a moment after the song; clicks alone go on until stopped.

public bool Metronome { get; set; }

Clicks on every beat through the song (a higher one on each bar’s first). They always count the lead-in.

public int SampleRate { get; }
public double SongSeconds { get; }

How many seconds the song lasts (0 without one).

public double[] Ticks { get; set; }

The beats to tick on (the notes of the chart), earliest first; set from any thread.

public float Volume { get; set; }

How loud the song plays, 0 to 1.

public void Dispose()
public int Read(Span<float> buffer)
public void Rewind()
public double SongSecondsAt(double seconds)

Where in the song (seconds from its start) the stream is seconds after it started.