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

Class TestBackingTrackOutput

packages/alphatab/test/audio/SyncPoint.test.ts:364–411  ·  view source on GitHub ↗

* @internal

Source from the content-addressed store, hash-verified

362 * @internal
363 */
364class TestBackingTrackOutput implements IBackingTrackSynthOutput {
365 public seekTimes: number[] = [];
366
367 public simulateSeek(time: number) {
368 (this.timeUpdate as EventEmitterOfT<number>).trigger(time);
369 }
370
371 public playThroughSong(startTime: number, endTime: number, step: number) {
372 let time = startTime;
373 while (time <= endTime) {
374 this.simulateSeek(time);
375 time += step;
376 }
377 }
378
379 public timeUpdate: IEventEmitterOfT<number> = new EventEmitterOfT<number>();
380 public backingTrackDuration: number = 0;
381 public playbackRate: number = 1;
382 public masterVolume: number = 1;
383
384 public seekTo(time: number): void {
385 this.seekTimes.push(time);
386 }
387 public loadBackingTrack(_backingTrack: BackingTrack): void {}
388 public sampleRate: number = 44100;
389
390 public open(_bufferTimeInMilliseconds: number): void {
391 (this.ready as EventEmitter).trigger();
392 }
393 public play(): void {}
394 public destroy(): void {}
395 public pause(): void {}
396 public addSamples(_samples: Float32Array): void {}
397 public resetSamples(): void {}
398 public activate(): void {}
399
400 public ready: IEventEmitter = new EventEmitter();
401 public samplesPlayed: IEventEmitterOfT<number> = new EventEmitterOfT<number>();
402 public sampleRequest: IEventEmitter = new EventEmitter();
403
404 public async enumerateOutputDevices(): Promise<ISynthOutputDevice[]> {
405 return [] as ISynthOutputDevice[];
406 }
407 public async setOutputDevice(_device: ISynthOutputDevice | null): Promise<void> {}
408 public async getOutputDevice(): Promise<ISynthOutputDevice | null> {
409 return null;
410 }
411}
412
413/**
414 * @internal

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected