Example #1
0
        public PersonalityManager(CommandRecognizer recognizer, Talker talker, IMp3Player mp3Player)
        {
            m_recognizer = recognizer;
            m_talker = talker;
            m_mp3Player = mp3Player;

            Mp3Player.ActivePlaylistChanged += new EventHandler(AddCurrentPlaylistToRecognizer);
            Mp3Player.ActivePlaylistContentsChanged += new EventHandler(AddCurrentPlaylistToRecognizer);
            Mp3Player.ListOfPlaylistsChanged += new EventHandler(AddPlaylistsToRecognizer);
        }
Example #2
0
        private IEnumerable<string> Initialize()
        {
            yield return "Loading MP3 player plugin...";
            IMp3PlayerPlugin mp3PlayerPlugin = LoadMp3PlayerPlugin();
            if (mp3PlayerPlugin == null)
            {
                yield return "The MP3 player plugin specified in the configuration file, " + Properties.Settings.Default.Mp3PlayerPlugin + ", could not be found.";
                yield return "Try reinstalling Voodoo Voice.";
                yield break;
            }

            yield return "Initializing Speech Recognition...";
            CommandRecognizer recognizer = null;
            try
            {
                recognizer = new CommandRecognizer();
            }
            catch (Exception)
            {
            }
            if (recognizer == null)
            {
                yield return "Speech recognition could not be initialized.  Try reinstalling Voodoo Voice.";
                yield break;
            }

            yield return "Initializing Speech Synthesis...";
            Talker talker = new Talker();

            yield return "Initializing " + mp3PlayerPlugin.Name + "...";
            IMp3Player mp3Player = mp3PlayerPlugin.LoadMp3Player();
            if (mp3Player == null)
            {
                foreach (string line in mp3PlayerPlugin.Mp3PlayerUnavailableMessage)
                {
                    yield return line;
                }
                yield break;
            }

            yield return "Initializing Voodoo Voice Personality Manager...";
            m_personalityManager = new PersonalityManager(recognizer, talker, mp3Player);
            m_personalityManager.PlaylistLoadProgressChanged += new EventHandler<PlaylistProgressEventArgs>(PlaylistLoadPercentCompleted);
            RaisePersonalityManagerCreated(m_personalityManager);

            yield return "Loading personality...";
            try
            {
                m_personality = m_personalityManager.LoadPersonality(Properties.Settings.Default.Personality);
            }
            catch (FileNotFoundException)
            {
                // Specified personality not found, so attempt to load the default personality instead.
                m_personality = m_personalityManager.LoadPersonality("DefaultPersonality.psn3");
            }
        }