MCPcopy Create free account
hub / github.com/CoderLine/alphaTab / AlphaSynthBase

Class AlphaSynthBase

packages/alphatab/src/synth/AlphaSynth.ts:42–697  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

40 * @public
41 */
42export class AlphaSynthBase implements IAlphaSynth {
43 /**
44 * @internal
45 */
46 protected sequencer: MidiFileSequencer;
47 /**
48 * @internal
49 */
50 protected synthesizer: IAudioSampleSynthesizer;
51 protected isSoundFontLoaded: boolean = false;
52 private _isMidiLoaded: boolean = false;
53 private _tickPosition: number = 0;
54 private _timePosition: number = 0;
55 private _metronomeVolume: number = 0;
56 private _countInVolume: number = 0;
57
58 /**
59 * @internal
60 */
61 protected playedEventsQueue: Queue<SynthEvent> = new Queue<SynthEvent>();
62 protected midiEventsPlayedFilterSet: Set<MidiEventType> = new Set<MidiEventType>();
63 private _notPlayedSamples: number = 0;
64 private _synthStopping = false;
65 private _output: ISynthOutput;
66 private _loadedMidiInfo?: PositionChangedEventArgs;
67 private _currentPosition: PositionChangedEventArgs = new PositionChangedEventArgs(0, 0, 0, 0, false, 120, 120);
68
69 public get output(): ISynthOutput {
70 return this._output;
71 }
72
73 public isReady: boolean = false;
74
75 public get isReadyForPlayback(): boolean {
76 return this.isReady && this.isSoundFontLoaded && this._isMidiLoaded;
77 }
78
79 public state: PlayerState = PlayerState.Paused;
80
81 public get logLevel(): LogLevel {
82 return Logger.logLevel;
83 }
84
85 public set logLevel(value: LogLevel) {
86 Logger.logLevel = value;
87 }
88
89 public get masterVolume(): number {
90 return this.synthesizer.masterVolume;
91 }
92
93 public set masterVolume(value: number) {
94 value = Math.max(value, SynthConstants.MinVolume);
95 this.updateMasterVolume(value);
96 }
97
98 protected updateMasterVolume(value: number) {
99 this.synthesizer.masterVolume = value;

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected