Skip to content

Commit

Permalink
Correction linter
Browse files Browse the repository at this point in the history
  • Loading branch information
Babali42 committed Jan 18, 2024
1 parent ec32288 commit 7e0dc6a
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 6 deletions.
2 changes: 1 addition & 1 deletion src/app/components/sequencer/sequencer.component.ts
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ export class SequencerComponent implements OnInit {
}

toggleIsPlaying(): void{
this.soundService.playPause().then();
this.soundService.playPause().then(() => {});
}
}

11 changes: 6 additions & 5 deletions src/app/services/sound.service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ export class SoundService {
this.playbackSource = new AudioBufferSourceNode(this.context);
}

async playPause() {
async playPause() : Promise<void> {
this.isPlaying = !this.isPlaying;
if (this.isPlaying) {
const loopBuffer = await this.getRenderedBuffer();
Expand All @@ -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;
Expand All @@ -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);

Expand Down Expand Up @@ -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(() => {});
}
}

Expand Down

0 comments on commit 7e0dc6a

Please sign in to comment.