From 7e0dc6a8dd660651a2183a3267cdd34da1d4bcef Mon Sep 17 00:00:00 2001 From: babali42 Date: Thu, 18 Jan 2024 22:24:48 +0100 Subject: [PATCH] Correction linter --- src/app/components/sequencer/sequencer.component.ts | 2 +- src/app/services/sound.service.ts | 11 ++++++----- 2 files changed, 7 insertions(+), 6 deletions(-) diff --git a/src/app/components/sequencer/sequencer.component.ts b/src/app/components/sequencer/sequencer.component.ts index c5b1aa9..eb89b29 100644 --- a/src/app/components/sequencer/sequencer.component.ts +++ b/src/app/components/sequencer/sequencer.component.ts @@ -27,7 +27,7 @@ export class SequencerComponent implements OnInit { } toggleIsPlaying(): void{ - this.soundService.playPause().then(); + this.soundService.playPause().then(() => {}); } } diff --git a/src/app/services/sound.service.ts b/src/app/services/sound.service.ts index ac76dce..a2b7e55 100644 --- a/src/app/services/sound.service.ts +++ b/src/app/services/sound.service.ts @@ -22,7 +22,7 @@ export class SoundService { this.playbackSource = new AudioBufferSourceNode(this.context); } - async playPause() { + async playPause() : Promise { this.isPlaying = !this.isPlaying; if (this.isPlaying) { const loopBuffer = await this.getRenderedBuffer(); @@ -45,7 +45,8 @@ export class SoundService { } private getMillisStepFromBpm(): number { - let beat = 60000 / this.bpm, quaterBeat = beat / 4; + const beat = 60000 / this.bpm; + let quaterBeat = beat / 4; quaterBeat = Math.min(quaterBeat, 1000); quaterBeat = Math.max(quaterBeat, 10); return quaterBeat; @@ -59,8 +60,8 @@ export class SoundService { if (!beat) return; - let audioBuffer = this.samples.find(x => x.fileName === track.fileName)!.sample!; - let audioBufferSourceNode = offlineContext.createBufferSource(); + const audioBuffer = this.samples.find(x => x.fileName === track.fileName)!.sample!; + const audioBufferSourceNode = offlineContext.createBufferSource(); audioBufferSourceNode.buffer = audioBuffer; audioBufferSourceNode.connect(offlineContext.destination); @@ -94,7 +95,7 @@ export class SoundService { private loadTracks(trackNames: string[]) { trackNames.forEach(x => this.samples.push(new Sample(x))) for (const sample of this.samples) { - this.getAudioBuffer(sample.fileName).then(arrayBuffer => sample.sample = arrayBuffer); + this.getAudioBuffer(sample.fileName).then(arrayBuffer => sample.sample = arrayBuffer).then(() => {}); } }