Esempio n. 1
0
        void TempUpPlayer_OnStartPlay(StreamPlayer obj)
        {
            lock (LockObject) {
                if (VolumeDownPlayer == null)
                {
                    if (VolumeUpPlayer != null)
                    {
                        VolumeDownPlayer = VolumeUpPlayer;
                        VolumeDownPlayer.VolumeDown();
                    }
                }
                else
                {
                    if (VolumeUpPlayer != null)
                    {
                        VolumeUpPlayer.Stop();
                        //VolumeUpPlayer.Dispose();
                        VolumeUpPlayer = null;
                    }
                }

                VolumeUpPlayer = obj;
                VolumeUpPlayer.VolumeUp();
                TempUpPlayer = null;
            }

            if (OnStart != null)
            {
                OnStart();
            }
        }
Esempio n. 2
0
        void TempUpPlayer_OnError(StreamPlayer obj)
        {
            lock (LockObject) {
                if (VolumeDownPlayer == null)
                {
                    if (VolumeUpPlayer != null)
                    {
                        VolumeDownPlayer = VolumeUpPlayer;
                        VolumeDownPlayer.VolumeDown();
                    }
                }
                else
                {
                    if (VolumeUpPlayer != null)
                    {
                        VolumeUpPlayer.Stop();
                        //VolumeUpPlayer.Dispose();
                        VolumeUpPlayer = null;
                    }
                }

                VolumeUpPlayer = null;
                TempUpPlayer   = null;
            }

            IsPlaying = false;

            if (OnError != null)
            {
                OnError();
            }
        }
Esempio n. 3
0
        public void Stop()
        {
            lock (LockObject) {
                if (TempUpPlayer != null)
                {
                    lock (TempUpPlayer) {
                        TempUpPlayer.OnStartPlay     -= TempUpPlayer_OnStartPlay;
                        TempUpPlayer.OnStoped        -= TempUpPlayer_OnStoped;
                        TempUpPlayer.OnNewTrack      -= TempUpPlayer_OnNewTrack;
                        TempUpPlayer.OnError         -= TempUpPlayer_OnError;
                        TempUpPlayer.OnFftCalculated -= TempUpPlayer_OnFftCalculated;
                        TempUpPlayer.Stop();
                        TempUpPlayer = null;
                    }
                }

                if (VolumeUpPlayer != null)
                {
                    VolumeUpPlayer.VolumeDown();
                }

                IsPlaying = false;
            }
        }