Exemplo n.º 1
0
        private void Play(Song song, double fadeTime = 0)
        {
            if (fadeTime <= 0)
            {
                StopInternal();

                _currentSong = song;

                _playing = _backend.OpenAudioOutput();

                ReadInitial(_currentSong, _playing);

                _playing.BufferProcessed += PlayingBufferProcessed;

                _playing.Play();
            }
            else
            {
                _fade     = 0;
                _fadeTime = fadeTime;

                if (_next != null)
                {
                    _playing?.Dispose();
                    _currentSong?.Dispose();
                    _currentSong = _nextSong;
                    _playing     = _next;
                }

                _nextSong = song;
                _next     = _backend.OpenAudioOutput();

                ReadInitial(_nextSong, _next);
                _next.BufferProcessed += PlayingBufferProcessed;

                _next.Play();
            }
        }
Exemplo n.º 2
0
        private void StopInternal()
        {
            _nextSong?.Dispose();
            _currentSong?.Dispose();
            _next?.Dispose();
            _playing?.Dispose();

            _fade     = 0;
            _fadeTime = 0;

            _playing     = null;
            _next        = null;
            _currentSong = null;
            _nextSong    = null;
        }