public override void Run(PersonalityManager manager, Dictionary<string, string> arguments) { foreach (PersonalityAction action in Actions) { action.Run(manager, arguments); } }
protected void RaisePersonalityManagerCreated(PersonalityManager manager) { PersonalityManagerCreatedHandler temp = PersonalityManagerCreated; if (temp != null) { temp(manager); } }
public override void Run(PersonalityManager manager, Dictionary<string, string> arguments) { foreach (PersonalityMode mode in manager.ActivePersonality.Modes) { if (mode.Name == Name) { mode.Activate(); } } }
public override void Run(PersonalityManager manager, Dictionary<string, string> arguments) { if (m_player == null) { m_player = new SoundPlayer(); string directory = Path.GetDirectoryName(manager.ActivePersonality.SourceFile); m_player.SoundLocation = Path.Combine(directory, m_soundFile); m_player.Load(); } m_player.Play(); }
public override void Run(PersonalityManager manager, Dictionary<string, string> arguments) { if (m_sameArtist) { manager.Mp3Player.PreviousByArtist(); } else { manager.Mp3Player.Previous(); } }
public override void Run(PersonalityManager manager, Dictionary<string, string> arguments) { string percent = m_percent; if (arguments.ContainsKey("percent")) { percent = arguments["percent"]; } if (Mode == VolumeMode.RestoreLast) { manager.Mp3Player.Volume = s_lastVolume; } else { int percentNum; if (Int32.TryParse(percent, out percentNum)) { switch (Mode) { case VolumeMode.IncreaseByAbsolute: percentNum += manager.Mp3Player.Volume; break; case VolumeMode.ReduceByAbsolute: percentNum = manager.Mp3Player.Volume - percentNum; break; case VolumeMode.AdjustByPercent: percentNum = manager.Mp3Player.Volume * percentNum / 100; break; } if (percentNum < 0) { percentNum = 0; } else if (percentNum > 100) { percentNum = 100; } s_lastVolume = manager.Mp3Player.Volume; manager.Mp3Player.Volume = percentNum; } } }
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"); } }
private void PersonalityManagerCreated(PersonalityManager manager) { if (InvokeRequired) { // Switch to the UI thread Invoke(new VoodooVoice.PersonalityManagerCreatedHandler(PersonalityManagerCreated), manager); return; } m_personalityManager = manager; m_personalityManager.Mp3Player.Mp3PlayerClosed += new EventHandler(Mp3PlayerClosed); m_personalityManager.NewPersonalityLoaded += new PersonalityManager.NewPersonalityLoadedHandler(NewPersonalityLoaded); m_personalityManager.PlaylistLoadProgressChanged += new EventHandler<PlaylistProgressEventArgs>(PlaylistLoadPercentCompleted); }
public override void Run(PersonalityManager manager, Dictionary<string, string> arguments) { manager.Mp3Player.Play(); }
public override void Run(PersonalityManager manager, Dictionary<string, string> arguments) { int actionIndex = m_random.Next(Actions.Count); Actions[actionIndex].Run(manager, arguments); }
public override void Run(PersonalityManager manager, Dictionary<string, string> arguments) { manager.Mp3Player.ShuffleEnabled = Enable; }