Skip to content

Commit c9e922e

Browse files
committed
Amélioration interface suite
1 parent 77e3ccf commit c9e922e

File tree

3 files changed

+13
-9
lines changed

3 files changed

+13
-9
lines changed

src/app/app.component.ts

+10-6
Original file line numberDiff line numberDiff line change
@@ -44,22 +44,26 @@ export class AppComponent implements OnInit {
4444
.subscribe(result => {
4545
this.isMobileDisplay = !result.matches;
4646
});
47+
this.navigate();
4748
}
4849

4950
selectGenre(i: number) {
5051
this.selectedGenreIndex = i;
5152
this.selectedSubGenreIndex = 0;
53+
this.navigate();
54+
}
55+
56+
private navigate() {
5257
this.router.navigate([this.musicGenres[this.selectedGenreIndex].subGenres[this.selectedSubGenreIndex].link]).then(
53-
() => {},
54-
() => {},
58+
() => {
59+
},
60+
() => {
61+
},
5562
);
5663
}
5764

5865
selectSubGenre(i: number) {
5966
this.selectedSubGenreIndex = i;
60-
this.router.navigate([this.musicGenres[this.selectedGenreIndex].subGenres[this.selectedSubGenreIndex].link]).then(
61-
() => {},
62-
() => {},
63-
);
67+
this.navigate();
6468
}
6569
}

src/app/components/sequencer/sequencer.component.ts

+2-1
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,8 @@ export class SequencerComponent implements OnInit {
2020
ngOnInit(): void {
2121
this.dataService.getData(this.fileName).subscribe((result: JsonBeat) => {
2222
this.beat = Convert.toBeat(result);
23-
this.soundService.pause();
23+
if(this.soundService.isPlaying)
24+
this.soundService.pause();
2425
this.soundService.reset();
2526
this.soundService.setBpm(this.beat.bpm);
2627
this.soundService.setTracks(this.beat.tracks);

src/app/services/sound.service.ts

+1-2
Original file line numberDiff line numberDiff line change
@@ -30,9 +30,8 @@ export class SoundService {
3030
}
3131

3232
pause(){
33-
if(!this.isPlaying)
34-
return;
3533
this.playbackSource.stop(this.context.currentTime);
34+
this.reset();
3635
}
3736

3837
private playSound(loopBuffer: AudioBuffer) {

0 commit comments

Comments
 (0)