{BA078535-BB58-45F0-9225-D2F6DF1197E4}.Debug|Any CPU.ActiveCfg = Debug|Any CPU\r
{BA078535-BB58-45F0-9225-D2F6DF1197E4}.Debug|Any CPU.Build.0 = Debug|Any CPU\r
{BA078535-BB58-45F0-9225-D2F6DF1197E4}.Debug|x86.ActiveCfg = Debug|x86\r
+ {BA078535-BB58-45F0-9225-D2F6DF1197E4}.Debug|x86.Build.0 = Debug|x86\r
{BA078535-BB58-45F0-9225-D2F6DF1197E4}.Release|Any CPU.ActiveCfg = Release|Any CPU\r
{BA078535-BB58-45F0-9225-D2F6DF1197E4}.Release|Any CPU.Build.0 = Release|Any CPU\r
{BA078535-BB58-45F0-9225-D2F6DF1197E4}.Release|x86.ActiveCfg = Release|x86\r
+ {BA078535-BB58-45F0-9225-D2F6DF1197E4}.Release|x86.Build.0 = Release|x86\r
{D19A654B-FE91-4010-A654-FC88AE62F7CC}.Debug|Any CPU.ActiveCfg = Debug|Any CPU\r
{D19A654B-FE91-4010-A654-FC88AE62F7CC}.Debug|Any CPU.Build.0 = Debug|Any CPU\r
{D19A654B-FE91-4010-A654-FC88AE62F7CC}.Debug|x86.ActiveCfg = Debug|x86\r
+ {D19A654B-FE91-4010-A654-FC88AE62F7CC}.Debug|x86.Build.0 = Debug|x86\r
{D19A654B-FE91-4010-A654-FC88AE62F7CC}.Release|Any CPU.ActiveCfg = Release|Any CPU\r
{D19A654B-FE91-4010-A654-FC88AE62F7CC}.Release|Any CPU.Build.0 = Release|Any CPU\r
{D19A654B-FE91-4010-A654-FC88AE62F7CC}.Release|x86.ActiveCfg = Release|x86\r
+ {D19A654B-FE91-4010-A654-FC88AE62F7CC}.Release|x86.Build.0 = Release|x86\r
{33B46397-BA1C-490A-A0A6-81C409884CE2}.Debug|Any CPU.ActiveCfg = Debug|Any CPU\r
{33B46397-BA1C-490A-A0A6-81C409884CE2}.Debug|Any CPU.Build.0 = Debug|Any CPU\r
{33B46397-BA1C-490A-A0A6-81C409884CE2}.Debug|x86.ActiveCfg = Debug|x86\r
+ {33B46397-BA1C-490A-A0A6-81C409884CE2}.Debug|x86.Build.0 = Debug|x86\r
{33B46397-BA1C-490A-A0A6-81C409884CE2}.Release|Any CPU.ActiveCfg = Release|Any CPU\r
{33B46397-BA1C-490A-A0A6-81C409884CE2}.Release|Any CPU.Build.0 = Release|Any CPU\r
{33B46397-BA1C-490A-A0A6-81C409884CE2}.Release|x86.ActiveCfg = Release|x86\r
+ {33B46397-BA1C-490A-A0A6-81C409884CE2}.Release|x86.Build.0 = Release|x86\r
{DDFA3357-938D-41A3-881E-152105641A3D}.Debug|Any CPU.ActiveCfg = Debug|Any CPU\r
{DDFA3357-938D-41A3-881E-152105641A3D}.Debug|Any CPU.Build.0 = Debug|Any CPU\r
{DDFA3357-938D-41A3-881E-152105641A3D}.Debug|x86.ActiveCfg = Debug|x86\r
+ {DDFA3357-938D-41A3-881E-152105641A3D}.Debug|x86.Build.0 = Debug|x86\r
{DDFA3357-938D-41A3-881E-152105641A3D}.Release|Any CPU.ActiveCfg = Release|Any CPU\r
{DDFA3357-938D-41A3-881E-152105641A3D}.Release|Any CPU.Build.0 = Release|Any CPU\r
{DDFA3357-938D-41A3-881E-152105641A3D}.Release|x86.ActiveCfg = Release|x86\r
+ {DDFA3357-938D-41A3-881E-152105641A3D}.Release|x86.Build.0 = Release|x86\r
EndGlobalSection\r
GlobalSection(SolutionProperties) = preSolution\r
HideSolutionNode = FALSE\r
this.cleanCacheToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();\r
this.setAppearanceToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();\r
this.rebakeTexturesToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();\r
- this.toolStripMenuItem1 = new System.Windows.Forms.ToolStripSeparator();\r
this.tbnPlugins = new System.Windows.Forms.ToolStripDropDownButton();\r
this.toolStripSeparator1 = new System.Windows.Forms.ToolStripSeparator();\r
this.tbtnFriends = new System.Windows.Forms.ToolStripButton();\r
this.autopilotToolStripMenuItem,\r
this.cleanCacheToolStripMenuItem,\r
this.setAppearanceToolStripMenuItem,\r
- this.rebakeTexturesToolStripMenuItem,\r
- this.toolStripMenuItem1});\r
+ this.rebakeTexturesToolStripMenuItem});\r
this.tbnTools.Enabled = false;\r
this.tbnTools.Image = ((System.Drawing.Image)(resources.GetObject("tbnTools.Image")));\r
this.tbnTools.ImageTransparentColor = System.Drawing.Color.Magenta;\r
this.rebakeTexturesToolStripMenuItem.Text = "Rebake textures";\r
this.rebakeTexturesToolStripMenuItem.Click += new System.EventHandler(this.rebakeTexturesToolStripMenuItem_Click);\r
// \r
- // toolStripMenuItem1\r
- // \r
- this.toolStripMenuItem1.Name = "toolStripMenuItem1";\r
- this.toolStripMenuItem1.Size = new System.Drawing.Size(153, 6);\r
- // \r
// tbnPlugins\r
// \r
this.tbnPlugins.DisplayStyle = System.Windows.Forms.ToolStripItemDisplayStyle.Text;\r
public System.Windows.Forms.ToolStripButton tbtnGroups;\r
public System.Windows.Forms.ToolStripMenuItem scriptEditorToolStripMenuItem;\r
public System.Windows.Forms.ToolStripDropDownButton tbnPlugins;\r
- public System.Windows.Forms.ToolStripSeparator toolStripMenuItem1;\r
public System.Windows.Forms.ToolStripSeparator toolStripMenuItem4;\r
public System.Windows.Forms.ToolStripMenuItem tmnuCreateLandmark;\r
public System.Windows.Forms.ToolStripMenuItem tmnuSetHome;\r
Enabled = Instance.GlobalSettings["plugin.alice.enabled"].AsBoolean();\r
}\r
\r
- MenuButton = new ToolStripMenuItem("A.L.I.C.E. chatbot", null, OnALICEMenuButtonClicked);\r
- Instance.MainForm.ToolsMenu.DropDownItems.Add(MenuButton);\r
+ MenuButton = new ToolStripMenuItem("ALICE chatbot", null, OnALICEMenuButtonClicked);\r
+ Instance.MainForm.PluginsMenu.DropDownItems.Add(MenuButton);\r
+ Instance.MainForm.PluginsMenu.Visible = true;\r
MenuButton.Checked = Enabled;\r
\r
try\r
private ToolStripMenuItem SpeechButton;\r
internal IRadSpeech osLayer;\r
public OSDMap config;\r
+ private bool started;\r
\r
/// <summary>\r
/// Plugin start-up entry.\r
\r
// Get configuration settings, and initialize if not found.\r
config = instance.GlobalSettings["plugin.speech"] as OSDMap;\r
+ \r
if (config == null)\r
{\r
config = new OSDMap();\r
instance.GlobalSettings.Save();\r
}\r
\r
+ // Add our enable/disable item to the Plugin Menu.\r
+ ToolsMenu = instance.MainForm.PluginsMenu;\r
+\r
+ SpeechButton = new ToolStripMenuItem("Speech", null, OnSpeechMenuButtonClicked);\r
+ ToolsMenu.DropDownItems.Add(SpeechButton);\r
+\r
+ SpeechButton.Checked = config["enabled"].AsBoolean();\r
+\r
+ ToolsMenu.Visible = true;\r
+\r
+ if (SpeechButton.Checked)\r
+ {\r
+ Initialize();\r
+ }\r
+ }\r
+\r
+ /// <summary>\r
+ /// Startup code (executed only when needed)\r
+ /// </summary>\r
+ private void Initialize()\r
+ {\r
+ // Never initialize twice\r
+ if (started) return;\r
+\r
// Do the one-time only initializations.\r
try\r
{\r
listener = new Listen.Control(this);\r
converse = new Conversation.Control(this);\r
sound = new Sound.FmodSound(this);\r
+ StartControls();\r
+ talker.SayMore("Press enter to connect.");\r
+ started = true;\r
}\r
catch (Exception e)\r
{\r
+ SpeechButton.Checked = false;\r
+ config["enabled"] = OSD.FromBoolean(false);\r
+ SaveSpeechSettings();\r
System.Windows.Forms.MessageBox.Show("Speech failed initialization: " + e.Message);\r
return;\r
-\r
}\r
+ }\r
\r
- // Add our enable/disable item to the Plugin Menu.\r
- ToolsMenu = instance.MainForm.PluginsMenu;\r
-\r
- SpeechButton = new ToolStripMenuItem("Speech", null, OnSpeechMenuButtonClicked);\r
- ToolsMenu.DropDownItems.Add(SpeechButton);\r
-\r
- SpeechButton.Checked = config["enabled"].AsBoolean();\r
-\r
- ToolsMenu.Visible = true;\r
-\r
- if (SpeechButton.Checked)\r
+ /// <summary>\r
+ /// Shutdown speech module\r
+ /// </summary>\r
+ private void Shutdown()\r
+ {\r
+ if (!started) return;\r
+ try\r
{\r
- StartControls();\r
- talker.SayMore("Press enter to connect.");\r
+ converse.Shutdown();\r
+ listener.Shutdown();\r
+ talker.Shutdown();\r
+ env.Shutdown();\r
+ sound.Shutdown();\r
+ }\r
+ catch (Exception e)\r
+ {\r
+ Logger.Log("Failed to shutdown speech modules: ", Helpers.LogLevel.Warning, e);\r
+ }\r
+ finally\r
+ {\r
+ started = false;\r
}\r
-\r
- // Announce our version in the main chat window.\r
- // TODO remove this once debugging is complete.\r
- instance.MainForm.TabConsole.DisplayNotificationInChat(\r
- "Speech Plugin version " + VERSION + " loaded");\r
}\r
\r
/// <summary>\r
return;\r
}\r
\r
- instance.Client.Settings.MULTIPLE_SIMS = false;\r
-\r
// Register the speech-related actions for context menus.\r
// Editing voice assignments to avatars.\r
instance.ContextActionManager.RegisterContextAction(\r
/// We use this to release system resources.</remarks>\r
public void StopPlugin(RadegastInstance inst)\r
{\r
- converse.Shutdown();\r
- listener.Shutdown();\r
- talker.Shutdown();\r
- env.Shutdown();\r
- sound.Shutdown();\r
+ Shutdown();\r
}\r
\r
/// <summary>\r
{\r
SpeechButton.Checked = !SpeechButton.Checked;\r
\r
- if (SpeechButton.Enabled)\r
+ if (SpeechButton.Checked)\r
{\r
- StartControls();\r
+ Initialize();\r
}\r
else\r
{\r
- StopPlugin(instance);\r
+ Shutdown();\r
}\r
\r
// Save this into the INI file.\r
if (control.osLayer == null) return;\r
control.osLayer.Speak(q, outputfile);\r
}\r
+\r
internal void Shutdown()\r
{\r
if (control.osLayer == null) return;\r
\r
public void SpeechStop()\r
{\r
- synth.SpeechStop();\r
- recog.Stop();\r
+ if (synth != null)\r
+ {\r
+ synth.SpeechStop();\r
+ synth = null;\r
+ }\r
+\r
+ if (recog != null)\r
+ {\r
+ recog.Stop();\r
+ recog = null;\r
+ }\r
}\r
+\r
public void SpeechHalt()\r
{\r
synth.Halt();\r
}\r
+\r
public Dictionary<string, AvailableVoice> GetVoices()\r
{\r
return synth.GetVoices();\r