Beispiel #1
0
        public void LoadMusic(MusicPack musicPack, string trackName = null)
        {
            try
            {
                lock (_updateLock)
                {
                    bool play = _isPlaying;
                    Stop();

                    _musicPack = musicPack;

                    if (trackName != null)
                    {
                        _musicEntry = _musicPack.FindByName(trackName);
                    }

                    if (trackName == null || _musicEntry.Value == null)
                    {
                        if (_playMode.HasFlag(PlaybackMode.Random))
                        {
                            _musicEntry = _musicPack.Random();
                        }
                        else if (_playMode.HasFlag(PlaybackMode.Sequential))
                        {
                            _musicEntry = _musicPack.Next();
                        }
                    }

                    if (play && _musicEntry.Value != null)
                    {
                        GameLog.Client.Audio.DebugFormat("called! Trackname: {0}, {1}, playMode={2}", _musicPack.Name, _musicEntry.Value.FileName, _playMode.ToString());
                        Play();
                    }
                }
            }
            catch (Exception e)
            {
                GameLog.Client.Audio.Error(e);
            }
        }
Beispiel #2
0
 public void PlaybackModeChanged(PlaybackMode newPlaybackMode)
 {
     PlaybackModeChanged("Playback mode changed", newPlaybackMode.ToString());
 }