コード例 #1
0
        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);
            }
        }
コード例 #2
0
 public ISonicArrangerSongInfo GetSongInfo(Enumerations.Song index) => GetSongInternal(index);
コード例 #3
0
 public ISong GetSong(Enumerations.Song index) => GetSongInternal(index);
コード例 #4
0
 Song GetSongInternal(Enumerations.Song index) => songs.TryGetValue(index, out var song) ? song : null;
コード例 #5
0
 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));
 }