Beispiel #1
0
        void Play(object sender, RoutedEventArgs args)
        {
            ToggleButton tb = (ToggleButton)sender;

            Console.WriteLine((bool)tb.IsChecked);
            if ((bool)tb.IsChecked)
            {
                if (m_firstPlay)
                {
                    m_firstPlay = false;
                    DetectedResult emotion = getBestValue(m_averageEmotion);
                    Mood           mood    = emotion.toMood();
                    m_currentMood = mood;
                    ResetPlaylist(mood);
                    Track  track = m_songQueue.Dequeue();
                    String uri   = m_videoPath + track.id + ".mp3";
                    Log("First song: " + uri);
                    m_player.URL = uri;
                    m_player.controls.play();
                    m_songQueue.Enqueue(track);
                }
                m_player.controls.play();
            }
            else
            {
                m_player.controls.pause();
            }
        }
Beispiel #2
0
        // Called every 5 seconds
        private void Timer_handle(object sender, EventArgs e)
        {
            IWMPControls controls = m_player.controls;

            WebcamCtrl.TakeSnapshot();
            m_imagePath = m_picturesDefaultPath;
            scan();

            // We need to check if the mood needs to be switched
            if (controls.currentItem != null &&
                controls.currentItem.duration - controls.currentPosition < 10.0)
            {
                DetectedResult emotion = getBestValue(m_averageEmotion);
                Mood           mood    = emotion.toMood();

                if (mood != m_currentMood)
                {
                    m_currentMood = mood;
                    ResetPlaylist(mood);
                }
            }

            if (controls.currentItem != null &&
                controls.currentItem.duration - controls.currentPosition < 2.0)
            {
                Track  track = m_songQueue.Dequeue();
                String uri   = m_videoPath + track.id + ".mp3";
                Log("Playing song: " + uri);
                m_player.URL = uri;
                controls.play();
                m_songQueue.Enqueue(track);
                // Box with artist and title track.artist and track.sonh
            }
        }