Example #1
0
        public void NowPlayingShouldBeSilence(string title)
        {
            musicPlayer = new MusicPlayer(mediaDb, soundMaker);
            musicPlayer.Stop();
            string actual = musicPlayer.NowPlaying();

            Assert.AreEqual(defaultSong, actual, "Tystnad Råder?");
        }
 private void StopSongAction()
 {
     _player.Stop();
     StopTimers();
     PlayingProgress = 0;
     _seconds        = 0;
     ElapsedTime     = "00:00 / " + PlayingSong.DisplayDuration;
 }
Example #3
0
 private void _engine_PropertyChanged(object sender, System.ComponentModel.PropertyChangedEventArgs e)
 {
     if (e.PropertyName == nameof(_engine.Phase))
     {
         _musicPlayer.Stop();
         Play();
     }
 }
 public IEnumerable <PathDescription> Add(IEnumerable <PathDescription> paths)
 {
     _player.Stop();
     foreach (var path in paths)
     {
         _player.Add(path);
     }
     return(_player.Playlist);
 }
Example #5
0
        public void PostControl(PlayerControl control)
        {
            Trace.WriteLine("PostControl: " + control);
            switch (control.Action)
            {
            case PlayerControlAction.Next:
                _player.PlayNextSong();
                break;

            case PlayerControlAction.Stop:
                _player.Stop();
                break;

            case PlayerControlAction.Pause:
                _player.Pause();
                break;
            }
        }
Example #6
0
        public void NowPlayingShouldBeCurrentSong()
        {
            player = new MusicPlayer(mediaDb, soundDb);
            mediaDb.OpenConnection();

            player.LoadSongs("to");

            mediaDb.CloseConnection();
            player.Play();

            //Jag hade tänkt att hämta defaultSong från musicplayer, men det gick ej då det strider mot Interfacet.
            //Antog att det inte var okej att lägga till en property där, därav upprepningen.

            string actual = player.NowPlaying();

            player.Stop();
            Assert.AreNotEqual(defaultSong, actual, "Tystnad ska ej råda");
        }
Example #7
0
        public void StopThePlayingOfSongButKeepSongList(string search)
        {
            musicPlayer = new MusicPlayer(mediaDb, soundMaker);
            mediaDb.OpenConnection();
            musicPlayer.LoadSongs("Mustasch");
            mediaDb.CloseConnection();

            int presentSongsInQueue = musicPlayer.NumSongsInQueue;

            musicPlayer.Play();
            string actual = musicPlayer.NowPlaying();

            musicPlayer.Stop();
            Assert.AreNotEqual(defaultSong, actual, "Tystnad ska inte råda");

            string newActual = musicPlayer.NowPlaying();

            //}
            Assert.Greater(presentSongsInQueue, 0, "No more songs in Playlist");
        }
        public override void Execute(IExecutionEnvironment environment, MessageReceivedEvent e, string commandArgs)
        {
            IMusicPlayer musicPlayer = environment.GetService <IMusicPlayer>();

            //EmbedBuilder builder = new EmbedBuilder();
            try {
                musicPlayer.Stop(e.Channel, e.GuildId);

                /*builder.WithTitle("Stopped");
                 * builder.WithColor(Color.LighterGrey);*/
                //e.Channel.SendMessageAsync(null, false, builder.Build()).RunSync();
                e.Message.AddReactionAsync(new Emoji("\u23F9\uFE0F")).RunSync();
            }
            catch (ArgumentException) {
                /*builder.WithTitle("Но ведь я ничего и не играл");
                 * builder.WithColor(Color.Red);
                 * e.Channel.SendMessageAsync(null, false, builder.Build()).RunSync();*/
                e.Channel.SendMessageAsync("Но ведь я ничего и не играл").RunSync();
            }
        }
Example #9
0
 public void ManualUpdate()
 {
     if (fadeDelayCountdown > 0)
     {
         fadeDelayCountdown -= Time.unscaledDeltaTime;
     }
     else
     {
         if (isPlaying && !player.isPlaying)
         {
             player.Play();
         }
         if (!isPlaying && player.isPlaying && player.volume <= 0)
         {
             player.Stop();
         }
         float volumeDelta = fadeSpeed.HasValue ? Time.unscaledDeltaTime * fadeSpeed.Value : 1000f;
         player.volume = Mathf.MoveTowards(player.volume, destinationVolume, volumeDelta);
     }
 }
Example #10
0
        public void NowPlayingShouldNotChangeIfSongIsAlreadyPlaying(string songTitle1, string songTitle2)
        {
            player = new MusicPlayer(mediaDb, soundDb);
            mediaDb.OpenConnection();
            player.LoadSongs(songTitle1);
            player.LoadSongs(songTitle2);
            mediaDb.CloseConnection();

            // Spelar Stairway to heaven
            player.Play();

            var playing = player.NowPlaying();

            StringAssert.Contains(songTitle1, player.NowPlaying(), "Den borde ju spelas");


            player.Play();

            playing = player.NowPlaying();

            StringAssert.Contains(songTitle1, player.NowPlaying(), "Den borde ju spelas");

            player.Stop();
        }
Example #11
0
        /// <summary>
        ///     Stop playing the current track.
        ///     Remove any tracks remaining in the queue.
        ///     Disconnects from the voice channel.
        /// </summary>
        /// <exception cref="InvalidPlayerException">Thrown if not connected to a voice channel.</exception>
        /// <exception cref="InvalidTrackException">Thrown if there is no track playing.</exception>
        public async Task Stop()
        {
            await _player.Stop();

            await _player.Leave(_player.VoiceChannel);
        }
Example #12
0
        public SecondPageViewModel()
        {
            _musicPlayer = DependencyService.Get <IMusicPlayer>();

            _timer                 = new CountDownTimer(TimeSpan.FromSeconds(300));
            _timer.Interval        = TimeSpan.FromSeconds(1);
            _timer.IntervalPassed += _timer_IntervalPassed;

            Plus1MinCommand = new DelegateCommand(() => {
                _timer.CurrentTime.Add(TimeSpan.FromMinutes(1));
                UpdateTimer();
            });

            Plus10SecCommand = new DelegateCommand(() => {
                _timer.CurrentTime.Add(TimeSpan.FromSeconds(10));
                UpdateTimer();
            });

            Minus10SecCommand = new DelegateCommand(() => {
                _timer.CurrentTime.Subtract(TimeSpan.FromSeconds(10));
                UpdateTimer();
            });


            Minus1MinCommand = new DelegateCommand(() => {
                _timer.CurrentTime.Subtract(TimeSpan.FromMinutes(1));
                UpdateTimer();
            });


            StartTimerCommand = new DelegateCommand(() => {
                _timer.Start();
                UpdateTimer();
            });


            StopTimerCommand = new DelegateCommand(() => {
                _timer.Stop();
                UpdateTimer();
            });


            ResetTimerCommand = new DelegateCommand(() => {
                _timer.Reset();
                UpdateTimer();
            });

            BGMStopCommand = new DelegateCommand(() => {
                _musicPlayer.Stop();
            });

            BGMOpeningCommand = new DelegateCommand(() => {
                _musicPlayer.Stop();
                _musicPlayer.PlayAsync("openingBGM");
            });

            BGMRoleCommand = new DelegateCommand(() => {
                _musicPlayer.Stop();
                _musicPlayer.PlayAsync("confirmBGM");
            });

            BGMMorningCommand = new DelegateCommand(() => {
                _musicPlayer.Stop();
                _musicPlayer.PlayAsync("morningBGM");
            });
            BGMDayTimeCommand = new DelegateCommand(() => {
                _musicPlayer.Stop();
                _musicPlayer.PlayAsync("discussionBGM");
            });

            BGMVoteCommand = new DelegateCommand(() => {
                _musicPlayer.Stop();
                _musicPlayer.PlayAsync("voteBGM");
            });

            BGMExecuteCommand = new DelegateCommand(() => {
                _musicPlayer.Stop();
                _musicPlayer.PlayAsync("executionBGM");
            });

            BGMNightCommand = new DelegateCommand(() => {
                _musicPlayer.Stop();
                _musicPlayer.PlayAsync("nightBGM");
            });


            BGMVillagerWinCommand = new DelegateCommand(() => {
                _musicPlayer.Stop();
                _musicPlayer.PlayAsync("victoryBGM_villagers");
            });

            BGMWerewolfWinCommand = new DelegateCommand(() => {
                _musicPlayer.Stop();
                _musicPlayer.PlayAsync("victoryBGM_werewolf");
            });

            BGMThirdPartyWinCommand = new DelegateCommand(() => {
                _musicPlayer.Stop();
                _musicPlayer.PlayAsync("victoryBGM_3rdParty");
            });
        }