public Song(Enumerations.Song song, int songIndex, SongPlayer songPlayer, DataReader reader, Stream.ChannelMode channelMode, bool hardwareLPF, bool pal, bool waitForLoading = false, Action loadFinishedHandler = null) { this.song = song; this.songPlayer = songPlayer; reader.Position = 0; sonicArrangerFile = new SonicArrangerFile(reader); sonicArrangerSong = sonicArrangerFile.Songs[songIndex]; void Load() { buffer = new Stream(sonicArrangerFile, songIndex, 44100, channelMode, hardwareLPF, pal).ToUnsignedArray(); loadFinishedHandler?.Invoke(); } if (waitForLoading) { Load(); } else { loadTask = Task.Run(Load); } }
public ISonicArrangerSongInfo GetSongInfo(Enumerations.Song index) => GetSongInternal(index);
public ISong GetSong(Enumerations.Song index) => GetSongInternal(index);
Song GetSongInternal(Enumerations.Song index) => songs.TryGetValue(index, out var song) ? song : null;
Song CreateSong(Enumerations.Song song, int songIndex, IDataReader dataReader, bool waitForLoading) { return(new Song(song, songIndex, songPlayer, dataReader as DataReader, SonicArranger.Stream.ChannelMode.Mono, true, true, waitForLoading, () => ++ numSongsLoaded)); }