()
| 59 | } |
| 60 | |
| 61 | private async refresh(): Promise<void> { |
| 62 | const score = this.api.score; |
| 63 | const player = this.api.player; |
| 64 | if (!score || !player || !score.backingTrack || this.api.actualPlayerMode !== alphaTab.PlayerMode.EnabledBackingTrack) { |
| 65 | this.hide(); |
| 66 | return; |
| 67 | } |
| 68 | |
| 69 | const output = player.output as alphaTab.synth.IAudioElementBackingTrackSynthOutput; |
| 70 | if (typeof output.audioElement === 'undefined') { |
| 71 | this.hide(); |
| 72 | return; |
| 73 | } |
| 74 | this.bindAudio(output.audioElement); |
| 75 | |
| 76 | if (score === this.currentScore) { |
| 77 | return; |
| 78 | } |
| 79 | this.currentScore = score; |
| 80 | this.root.classList.remove('hidden'); |
| 81 | await this.draw(score.backingTrack); |
| 82 | } |
| 83 | |
| 84 | private bindAudio(audio: HTMLAudioElement): void { |
| 85 | if (this.audioElement === audio) { |
no test coverage detected