From 7f3c74898f7c4fa169989aa7db03d5cb9816e106 Mon Sep 17 00:00:00 2001 From: dank074 Date: Sun, 13 Nov 2022 18:51:29 -0600 Subject: [PATCH] load sample sounds in parallel --- src/nitro/sound/music/MusicController.ts | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/src/nitro/sound/music/MusicController.ts b/src/nitro/sound/music/MusicController.ts index 299aa6ab..2456d334 100644 --- a/src/nitro/sound/music/MusicController.ts +++ b/src/nitro/sound/music/MusicController.ts @@ -268,8 +268,7 @@ export class MusicController implements IMusicController const songId: number = this.getSongIdRequestedAtPriority(topRequestPriotityIndex); if(song.id === songId) { - this._musicPlayer.preloadSamplesForSong(song.data).then(() => this.onSongLoaded(song.id)); - //this.playSongObject(topRequestPriotityIndex, songId); + this.playSongObject(topRequestPriotityIndex, songId); } Nitro.instance.soundManager.events.dispatchEvent(new SongInfoReceivedEvent(SongInfoReceivedEvent.SIR_TRAX_SONG_INFO_RECEIVED, song.id)); while(this._diskInventoryMissingData.indexOf(song.id) != -1) @@ -441,7 +440,7 @@ export class MusicController implements IMusicController { this.notifySongPlaying(songData); } - this._musicPlayer.play(songData.songData, songData.id, startPos, playLength); + this._musicPlayer.preloadSamplesForSong(songData.songData).then(() => this._musicPlayer.play(songData.songData, songData.id, startPos, playLength)); if(priority > MusicPriorities.PRIORITY_ROOM_PLAYLIST) { Nitro.instance.soundManager.events.dispatchEvent(new NowPlayingEvent(NowPlayingEvent.NPE_USER_PLAY_SONG, priority, songData.id, -1));