AlphaSynth Class

Summary

This is the main synthesizer component which can be used to play a MidiFile via a ISynthOutput.
Namespace
AlphaTab.Audio.Synth
Interfaces
Base Types
  • object
graph TD Base0["object"]-->Type Interface0["IAlphaSynth"]-.->Type click Interface0 "/master/api/AlphaTab.Audio.Synth/IAlphaSynth" Type["AlphaSynth"] class Type type-node

Syntax

public class AlphaSynth : IAlphaSynth

Constructors

Name Summary
AlphaSynth(ISynthOutput) Initializes a new instance of the AlphaSynth class.

Events

Name Type Summary
Finished Action<T>
Occurs when the playback of the whole midi file finished.
MidiLoaded Action
Occurs when the midi file was successfully loaded.
MidiLoadFailed Action<T>
Occurs when the midi failed to be loaded.
PlayerStateChanged Action<T>
Occurs when the playback state changes.
PositionChanged Action<T>
Occurs whenever the current time of the played audio changes.
ReadyForPlayback Action
Occurs when AlphaSynth is ready to start the playback. This is the case once the ISynthOutput is ready, a SoundFont was loaded and also a MidiFle is loaded.
SoundFontLoaded Action
Occurs when the soundfont was successfully loaded.
SoundFontLoadFailed Action<T>
Occurs when the soundfont failed to be loaded.

Properties

Name Value Summary
IsLooping bool
Gets or sets whether the playback should automatically restart after it finished.
IsReady bool
Gets or sets whether the synthesizer is ready for interaction. (output and worker are initialized)
IsReadyForPlayback bool
Gets or sets whether the synthesizer is ready for playback. (output, worker are initialized, soundfont and midi are loaded)
LogLevel LogLevel
Gets or sets the loging level.
MasterVolume float
Gets or sets the current master volume as percentage. (range: 0.0-3.0, default 1.0)
MetronomeVolume float
Gets or sets the metronome volume. (range: 0.0-3.0, default 0.0)
Output ISynthOutput
Gets the ISynthOutput used for playing the generated samples.
PlaybackRange PlaybackRange
Gets or sets the range of the song that should be played. Set this to null to play the whole song.
PlaybackSpeed double
Gets or sets the current playback speed as percentage. (range: 0.125-8.0, default: 1.0)
State PlayerState
Gets the current player state.
TickPosition int
Gets or sets the position within the song in midi ticks.
TimePosition double
Gets or sets the position within the song in milliseconds.

Methods

Name Value Summary
LoadMidi(MidiFile) void
Loads the given midi file for playback.
LoadSoundFont(byte[]) void
Loads a soundfont from the given data
Pause() void
Pauses the playback if was running
Play() void
Starts the playback if possible
PlayPause() void
Starts the playback if possible, pauses the playback if was running
ResetChannelStates() void
Resets the mute/solo state of all channels
SetChannelMute(int, bool) void
Gets the mute state of a channel.
SetChannelProgram(int, byte) void
Gets or sets the current and initial program of the given channel.
SetChannelSolo(int, bool) void
Gets the solo state of a channel.
SetChannelVolume(int, double) void
Gets or sets the current and initial volume of the given channel.
Stop() void
Stopps the playback