Gondwana Game Engine Development (master) - 2.7.0
Gondwana is a cross-platform 2.5D game and rendering engine written in C#/.NET 8. It provides fine-grained control over rendering, timing, and scene composition, with built-in support for parallax, z-ordering, pixel overhang, collision detection, and particle effects. Gondwana targets desktop and web platforms using SkiaSharp for graphics and pluggable audio backends for desktop and browser targets.
Loading...
Searching...
No Matches
Gondwana.Audio.Midi.SynthesizerSampleProvider Class Reference

Renders a finite MIDI timeline to interleaved stereo samples, with optional looping and seeking. More...

Inheritance diagram for Gondwana.Audio.Midi.SynthesizerSampleProvider:

Public Member Functions

 SynthesizerSampleProvider (MidiFileSequencer sequencer, Synthesizer synth, MeltySynth.MidiFile midiFile, bool loop)
 Wraps a sequencer that has already started the supplied MIDI file at its beginning.
int Read (float[] buffer, int offset, int count)
 Reads complete stereo frames; returns zero at EOF, including on subsequent reads.
void Seek (TimeSpan time)
 Seeks within the timeline, retaining synthesizer state for forward seeks.

Properties

WaveFormat WaveFormat [get]
 Gets the synthesizer's sample rate as stereo IEEE float audio.

Detailed Description

Renders a finite MIDI timeline to interleaved stereo samples, with optional looping and seeking.

Definition at line 7 of file SynthesiserSampleProvider.cs.

Constructor & Destructor Documentation

◆ SynthesizerSampleProvider()

Gondwana.Audio.Midi.SynthesizerSampleProvider.SynthesizerSampleProvider ( MidiFileSequencer sequencer,
Synthesizer synth,
MeltySynth.MidiFile midiFile,
bool loop )

Wraps a sequencer that has already started the supplied MIDI file at its beginning.

Parameters
sequencerThe sequencer controlling MIDI event timing.
synthThe synthesizer used by the sequencer.
midiFileThe MIDI timeline to render.
loopWhether to restart at the end of the authored timeline.

Definition at line 24 of file SynthesiserSampleProvider.cs.

Member Function Documentation

◆ Read()

int Gondwana.Audio.Midi.SynthesizerSampleProvider.Read ( float[] buffer,
int offset,
int count )

Reads complete stereo frames; returns zero at EOF, including on subsequent reads.

Parameters
bufferDestination for interleaved stereo samples.
offsetFirst destination sample.
countMaximum individual samples, rounded down to complete frames.
Returns
The number of individual samples written.

Silence is music data, not an end marker. Leading and internal rests are preserved.

Definition at line 47 of file SynthesiserSampleProvider.cs.

◆ Seek()

void Gondwana.Audio.Midi.SynthesizerSampleProvider.Seek ( TimeSpan time)

Seeks within the timeline, retaining synthesizer state for forward seeks.

Parameters
timeTarget time, clamped to the authored duration.

MeltySynth must render intervening samples to reconstruct instrument state. Backward seeks restart the sequencer; forward seeks render only the remaining distance. Hosts should seek on a worker thread. Reads and seeks are serialized to protect the synthesizer.

Definition at line 90 of file SynthesiserSampleProvider.cs.

Property Documentation

◆ WaveFormat

WaveFormat Gondwana.Audio.Midi.SynthesizerSampleProvider.WaveFormat
get

Gets the synthesizer's sample rate as stereo IEEE float audio.

Definition at line 39 of file SynthesiserSampleProvider.cs.