# HG changeset patch # User Chris Cannam # Date 1495208452 -3600 # Node ID 46435d5208e91a55d8f91ed28ea9e78fde9764d8 # Parent f986426870d0266b6449ec125c1f448780b2fa73# Parent 2b374217d8a0d3434f76134c534a1dfb89ce6101 Merge branch 'master' of ssh://github.com:/piper-audio/ugly-duckling diff -r f986426870d0 -r 46435d5208e9 src/app/waveform/waveform.component.ts --- a/src/app/waveform/waveform.component.ts Fri May 19 16:37:08 2017 +0100 +++ b/src/app/waveform/waveform.component.ts Fri May 19 16:40:52 2017 +0100 @@ -145,22 +145,18 @@ } this.seekedSubscription = this.audioService.seeked$.subscribe(() => { - if (!this.isPlaying) { + if (!this.audioService.isPlaying()) { this.animate(); } }); this.playingStateSubscription = this.audioService.playingStateChange$.subscribe( isPlaying => { - this.isPlaying = isPlaying; - if (this.isPlaying) { + if (isPlaying) { this.animate(); } }); } else { - if (this.isPlaying) { - this.isPlaying = false; - } if (this.playingStateSubscription) { this.playingStateSubscription.unsubscribe(); } @@ -197,7 +193,6 @@ private playingStateSubscription: Subscription; private seekedSubscription: Subscription; private onAudioDataSubscription: Subscription; - private isPlaying: boolean; private zoomOnMouseDown: number; private offsetOnMouseDown: number; private hasShot: boolean; @@ -227,7 +222,6 @@ this.timeline = undefined; this.cursorLayer = undefined; this.highlightLayer = undefined; - this.isPlaying = false; this.isLoading = true; } @@ -846,7 +840,7 @@ const startTime = collected.startTime; // !!! + make use of const stepDuration = collected.stepDuration; const matrixData = collected.data; - + if (matrixData.length === 0) { return; } @@ -883,6 +877,7 @@ this.isLoading = false; this.ref.markForCheck(); this.timeline.tracks.update(); + this.animate(); } private animate(): void { @@ -929,7 +924,7 @@ this.timeline.tracks.update(); } - if (this.isPlaying) { + if (this.audioService.isPlaying()) { requestAnimationFrame(updateSeekingCursor); } }; @@ -1103,13 +1098,13 @@ if (isRegion) { return 'regions'; } - throw 'No shape could be deduced'; + throw new Error('No shape could be deduced'); } function getCanonicalNoteLikeUnit(unit: string): NoteLikeUnit | null { const canonicalUnits: NoteLikeUnit[] = ['midi', 'hz']; return canonicalUnits.find(canonicalUnit => { - return unit.toLowerCase().indexOf(canonicalUnit) >= 0 + return unit.toLowerCase().indexOf(canonicalUnit) >= 0; }); }