├── Vocals ├── Vocals.ico ├── Icon │ └── Vocals.ico ├── bin │ └── Release │ │ └── Vocals.exe ├── App.config ├── Properties │ ├── Settings.settings │ ├── Settings.Designer.cs │ ├── AssemblyInfo.cs │ ├── Resources.Designer.cs │ └── Resources.resx ├── InternalClasses │ ├── Profile.cs │ ├── Program.cs │ ├── GlobalHotkey.cs │ ├── Actions.cs │ ├── Options.cs │ ├── VirtualKeyboard.cs │ └── Command.cs ├── ClassDiagram1.cd ├── Vocals.sln ├── FormNewProfile.cs ├── FormOptions.cs ├── FormNewProfile.Designer.cs ├── FormAction.cs ├── FormCommand.resx ├── FormNewProfile.resx ├── FormOptions.resx ├── FormAction.resx ├── FormCommand.cs ├── Vocals.csproj ├── FormAction.Designer.cs ├── FormOptions.Designer.cs ├── FormCommand.Designer.cs ├── Form1.Designer.cs └── Form1.cs ├── README.md ├── .gitattributes └── .gitignore /Vocals/Vocals.ico: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Al-th/Vocals/HEAD/Vocals/Vocals.ico -------------------------------------------------------------------------------- /Vocals/Icon/Vocals.ico: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Al-th/Vocals/HEAD/Vocals/Icon/Vocals.ico -------------------------------------------------------------------------------- /Vocals/bin/Release/Vocals.exe: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Al-th/Vocals/HEAD/Vocals/bin/Release/Vocals.exe -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | Vocals 2 | ====== 3 | 4 | Vocals is a voice recognition software that let you send any keyboard commands to the application of your choice. 5 | 6 | 7 | 8 | Official website : http://vocals.alth.fr 9 | -------------------------------------------------------------------------------- /Vocals/App.config: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | -------------------------------------------------------------------------------- /Vocals/Properties/Settings.settings: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | -------------------------------------------------------------------------------- /.gitattributes: -------------------------------------------------------------------------------- 1 | # Auto detect text files and perform LF normalization 2 | * text=auto 3 | 4 | # Custom for Visual Studio 5 | *.cs diff=csharp 6 | *.sln merge=union 7 | *.csproj merge=union 8 | *.vbproj merge=union 9 | *.fsproj merge=union 10 | *.dbproj merge=union 11 | 12 | # Standard to msysgit 13 | *.doc diff=astextplain 14 | *.DOC diff=astextplain 15 | *.docx diff=astextplain 16 | *.DOCX diff=astextplain 17 | *.dot diff=astextplain 18 | *.DOT diff=astextplain 19 | *.pdf diff=astextplain 20 | *.PDF diff=astextplain 21 | *.rtf diff=astextplain 22 | *.RTF diff=astextplain 23 | -------------------------------------------------------------------------------- /Vocals/InternalClasses/Profile.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Text; 5 | 6 | namespace Vocals 7 | { 8 | [Serializable] 9 | public class Profile 10 | { 11 | public string name; 12 | public List commandList; 13 | 14 | public Profile() { 15 | } 16 | 17 | public Profile(string name){ 18 | this.name = name; 19 | commandList = new List(); 20 | } 21 | 22 | public void addCommand(Command c){ 23 | commandList.Add(c); 24 | } 25 | 26 | ~Profile(){ 27 | } 28 | 29 | public override string ToString() 30 | { 31 | return this.name; 32 | } 33 | 34 | 35 | } 36 | } 37 | -------------------------------------------------------------------------------- /Vocals/ClassDiagram1.cd: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | AAAAJAAAICABABASAACgIAASAAAagBAAEGQIAAAgAAA= 7 | Form1.cs 8 | 9 | 10 | 11 | 12 | 13 | AAAAAAAAAAIAAAAAAAAAAAAAAAAEAAAAAAAAAAAAAAg= 14 | InternalClasses\Profile.cs 15 | 16 | 17 | 18 | 19 | 20 | AAAAAAAAAAAACAAAAAACAAAAAAAAAAAAAAAAAAAAAAA= 21 | InternalClasses\Command.cs 22 | 23 | 24 | 25 | -------------------------------------------------------------------------------- /Vocals/Vocals.sln: -------------------------------------------------------------------------------- 1 | 2 | Microsoft Visual Studio Solution File, Format Version 12.00 3 | # Visual Studio 2013 4 | VisualStudioVersion = 12.0.30501.0 5 | MinimumVisualStudioVersion = 10.0.40219.1 6 | Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Vocals", "Vocals.csproj", "{0BA8881B-1EF7-497D-ADBE-2AE4EC35BC75}" 7 | EndProject 8 | Global 9 | GlobalSection(SolutionConfigurationPlatforms) = preSolution 10 | Debug|Any CPU = Debug|Any CPU 11 | Release|Any CPU = Release|Any CPU 12 | EndGlobalSection 13 | GlobalSection(ProjectConfigurationPlatforms) = postSolution 14 | {0BA8881B-1EF7-497D-ADBE-2AE4EC35BC75}.Debug|Any CPU.ActiveCfg = Debug|Any CPU 15 | {0BA8881B-1EF7-497D-ADBE-2AE4EC35BC75}.Debug|Any CPU.Build.0 = Debug|Any CPU 16 | {0BA8881B-1EF7-497D-ADBE-2AE4EC35BC75}.Release|Any CPU.ActiveCfg = Release|Any CPU 17 | {0BA8881B-1EF7-497D-ADBE-2AE4EC35BC75}.Release|Any CPU.Build.0 = Release|Any CPU 18 | EndGlobalSection 19 | GlobalSection(SolutionProperties) = preSolution 20 | HideSolutionNode = FALSE 21 | EndGlobalSection 22 | EndGlobal 23 | -------------------------------------------------------------------------------- /Vocals/FormNewProfile.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.ComponentModel; 4 | using System.Data; 5 | using System.Drawing; 6 | using System.Linq; 7 | using System.Text; 8 | using System.Windows.Forms; 9 | 10 | namespace Vocals { 11 | public partial class FormNewProfile : Form { 12 | public string profileName { get; set; } 13 | 14 | public FormNewProfile() { 15 | InitializeComponent(); 16 | profileName = ""; 17 | } 18 | 19 | private void label1_Click(object sender, EventArgs e) { 20 | 21 | } 22 | 23 | private void button1_Click(object sender, EventArgs e) { 24 | this.Close(); 25 | } 26 | 27 | private void FormNewProfile_Load(object sender, EventArgs e) { 28 | 29 | } 30 | 31 | private void textBox1_TextChanged(object sender, EventArgs e) { 32 | profileName = textBox1.Text; 33 | } 34 | 35 | private void button2_Click(object sender, EventArgs e) { 36 | this.profileName = ""; 37 | this.Close(); 38 | } 39 | } 40 | } 41 | -------------------------------------------------------------------------------- /Vocals/InternalClasses/Program.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Deployment.Application; 4 | using System.Linq; 5 | using System.Runtime.InteropServices; 6 | using System.Speech.Synthesis; 7 | using System.Threading.Tasks; 8 | using System.Windows.Forms; 9 | 10 | namespace Vocals { 11 | static class Program { 12 | [DllImport("winmm.dll")] 13 | public static extern int waveInGetNumDevs(); 14 | 15 | 16 | /// 17 | /// Point d'entrée principal de l'application. 18 | /// 19 | /// 20 | /// 21 | [STAThread] 22 | static void Main() { 23 | Application.EnableVisualStyles(); 24 | Application.SetCompatibleTextRenderingDefault(false); 25 | 26 | 27 | 28 | 29 | if (waveInGetNumDevs() == 0) { 30 | MessageBox.Show("Please plug a valid microphone before launching the application", "No microphone found", MessageBoxButtons.OK, MessageBoxIcon.Error); 31 | } 32 | else { 33 | Application.Run(new Form1()); 34 | } 35 | } 36 | } 37 | } 38 | -------------------------------------------------------------------------------- /Vocals/Properties/Settings.Designer.cs: -------------------------------------------------------------------------------- 1 | //------------------------------------------------------------------------------ 2 | // 3 | // Ce code a été généré par un outil. 4 | // Version du runtime :4.0.30319.18444 5 | // 6 | // Les modifications apportées à ce fichier peuvent provoquer un comportement incorrect et seront perdues si 7 | // le code est régénéré. 8 | // 9 | //------------------------------------------------------------------------------ 10 | 11 | namespace Vocals.Properties { 12 | 13 | 14 | [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] 15 | [global::System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.VisualStudio.Editors.SettingsDesigner.SettingsSingleFileGenerator", "12.0.0.0")] 16 | internal sealed partial class Settings : global::System.Configuration.ApplicationSettingsBase { 17 | 18 | private static Settings defaultInstance = ((Settings)(global::System.Configuration.ApplicationSettingsBase.Synchronized(new Settings()))); 19 | 20 | public static Settings Default { 21 | get { 22 | return defaultInstance; 23 | } 24 | } 25 | } 26 | } 27 | -------------------------------------------------------------------------------- /Vocals/InternalClasses/GlobalHotkey.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Runtime.InteropServices; 5 | using System.Text; 6 | using System.Threading.Tasks; 7 | using System.Windows.Forms; 8 | 9 | namespace Vocals.InternalClasses { 10 | class GlobalHotkey { 11 | private int modifier; 12 | private int key; 13 | private IntPtr hWnd; 14 | private int id; 15 | 16 | [DllImport("user32.dll")] 17 | private static extern bool RegisterHotKey(IntPtr hWnd, int id, int fsModifiers, int vk); 18 | 19 | [DllImport("user32.dll")] 20 | private static extern bool UnregisterHotKey(IntPtr hWnd, int id); 21 | 22 | public GlobalHotkey(int mod, Keys k, Form1 hw) { 23 | this.modifier = mod; 24 | this.key = (int)k; 25 | this.hWnd = hw.Handle; 26 | this.id = this.GetHashCode(); 27 | } 28 | 29 | public void modifyKey(int mod, Keys k) { 30 | this.modifier = mod; 31 | this.key = (int)k; 32 | } 33 | 34 | public override int GetHashCode() { 35 | return modifier ^ key ^ hWnd.ToInt32(); 36 | } 37 | 38 | public bool register() { 39 | return RegisterHotKey(hWnd, id, modifier, key); 40 | } 41 | 42 | public bool unregister() { 43 | return UnregisterHotKey(hWnd, id); 44 | } 45 | } 46 | } 47 | -------------------------------------------------------------------------------- /Vocals/Properties/AssemblyInfo.cs: -------------------------------------------------------------------------------- 1 | using System.Reflection; 2 | using System.Runtime.CompilerServices; 3 | using System.Runtime.InteropServices; 4 | 5 | // Les informations générales relatives à un assembly dépendent de 6 | // l'ensemble d'attributs suivant. Changez les valeurs de ces attributs pour modifier les informations 7 | // associées à un assembly. 8 | [assembly: AssemblyTitle("Vocals")] 9 | [assembly: AssemblyDescription("Vocals : Voice recognition software to bind keys to your voice")] 10 | [assembly: AssemblyConfiguration("")] 11 | [assembly: AssemblyCompany("Al_th")] 12 | [assembly: AssemblyProduct("Vocals")] 13 | [assembly: AssemblyCopyright("Copyright © 2014")] 14 | [assembly: AssemblyTrademark("")] 15 | [assembly: AssemblyCulture("")] 16 | 17 | // L'affectation de la valeur false à ComVisible rend les types invisibles dans cet assembly 18 | // aux composants COM. Si vous devez accéder à un type dans cet assembly à partir de 19 | // COM, affectez la valeur true à l'attribut ComVisible sur ce type. 20 | [assembly: ComVisible(false)] 21 | 22 | // Le GUID suivant est pour l'ID de la typelib si ce projet est exposé à COM 23 | [assembly: Guid("e34a77b6-3381-49b7-b2e0-de219b3e36c2")] 24 | 25 | // Les informations de version pour un assembly se composent des quatre valeurs suivantes : 26 | // 27 | // Version principale 28 | // Version secondaire 29 | // Numéro de build 30 | // Révision 31 | // 32 | // Vous pouvez spécifier toutes les valeurs ou indiquer les numéros de build et de révision par défaut 33 | // en utilisant '*', comme indiqué ci-dessous : 34 | // [assembly: AssemblyVersion("1.0.*")] 35 | [assembly: AssemblyVersion("1.0.*")] 36 | [assembly: AssemblyFileVersion("1.0.*")] 37 | -------------------------------------------------------------------------------- /Vocals/InternalClasses/Actions.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Runtime.InteropServices; 5 | using System.Text; 6 | using System.Windows.Forms; 7 | using System.Windows.Input; 8 | 9 | namespace Vocals 10 | { 11 | [Serializable] 12 | public class Actions 13 | { 14 | public string type; 15 | public System.Windows.Forms.Keys keys; 16 | public float timer; 17 | public System.Windows.Forms.Keys keyModifier; 18 | 19 | public Actions() { 20 | 21 | } 22 | public Actions(string type, System.Windows.Forms.Keys keys, System.Windows.Forms.Keys modifier, float timer) { 23 | // TODO: Complete member initialization 24 | this.type = type; 25 | this.keys = keys; 26 | this.timer = timer; 27 | this.keyModifier = modifier; 28 | } 29 | 30 | 31 | public override string ToString() { 32 | switch (type) { 33 | case "Key press": 34 | return "Key press : " + keys.ToString(); 35 | case "Timer": 36 | return "Timer : " + timer.ToString() + " secs"; 37 | default: 38 | return "Error : Unknown event"; 39 | } 40 | } 41 | 42 | 43 | public void perform() { 44 | switch (type) { 45 | case "Key press": 46 | VirtualKeyboard.PressKey(keys, keyModifier); 47 | break; 48 | case "Timer": 49 | System.Threading.Thread.Sleep((int)(timer*1000)); 50 | break; 51 | } 52 | } 53 | } 54 | } 55 | -------------------------------------------------------------------------------- /Vocals/InternalClasses/Options.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.IO; 4 | using System.Linq; 5 | using System.Text; 6 | using System.Threading.Tasks; 7 | using System.Windows.Forms; 8 | using System.Xml.Serialization; 9 | 10 | namespace Vocals.InternalClasses { 11 | [Serializable] 12 | public class Options { 13 | 14 | public bool toggleListening; 15 | public Keys key; 16 | public string answer; 17 | public int threshold; 18 | public string language; 19 | 20 | public Options() { 21 | try { 22 | load(); 23 | } 24 | catch(Exception e){ 25 | toggleListening = false; 26 | key = Keys.ShiftKey; 27 | answer = "Toggle listening"; 28 | threshold = 0; 29 | language = null; 30 | } 31 | } 32 | 33 | public Options(Options o) { 34 | this.toggleListening = o.toggleListening; 35 | this.key = o.key; 36 | this.answer = o.answer; 37 | this.threshold = o.threshold; 38 | this.language = o.language; 39 | } 40 | 41 | public void save() { 42 | string dir = @""; 43 | string xmlSerializationFile = Path.Combine(dir, "options_xml.vc"); 44 | try { 45 | Stream xmlStream = File.Open(xmlSerializationFile, FileMode.Create); 46 | XmlSerializer writer = new XmlSerializer(typeof(Options)); 47 | writer.Serialize(xmlStream, this); 48 | xmlStream.Close(); 49 | } 50 | catch (Exception e) { 51 | throw e; 52 | } 53 | } 54 | 55 | public void load() { 56 | string dir = @""; 57 | string xmlSerializationFile = Path.Combine(dir, "options_xml.vc"); 58 | try { 59 | Stream xmlStream = File.Open(xmlSerializationFile, FileMode.Open); 60 | XmlSerializer reader = new XmlSerializer(typeof(Options)); 61 | Options opt = (Options)reader.Deserialize(xmlStream); 62 | this.toggleListening = opt.toggleListening; 63 | this.answer = opt.answer; 64 | this.threshold = opt.threshold; 65 | this.key = opt.key; 66 | this.language = opt.language; 67 | 68 | xmlStream.Close(); 69 | } 70 | catch (Exception e) { 71 | throw e; 72 | } 73 | } 74 | } 75 | } 76 | -------------------------------------------------------------------------------- /Vocals/Properties/Resources.Designer.cs: -------------------------------------------------------------------------------- 1 | //------------------------------------------------------------------------------ 2 | // 3 | // Ce code a été généré par un outil. 4 | // Version du runtime :4.0.30319.18444 5 | // 6 | // Les modifications apportées à ce fichier peuvent provoquer un comportement incorrect et seront perdues si 7 | // le code est régénéré. 8 | // 9 | //------------------------------------------------------------------------------ 10 | 11 | namespace Vocals.Properties { 12 | using System; 13 | 14 | 15 | /// 16 | /// Une classe de ressource fortement typée destinée, entre autres, à la consultation des chaînes localisées. 17 | /// 18 | // Cette classe a été générée automatiquement par la classe StronglyTypedResourceBuilder 19 | // à l'aide d'un outil, tel que ResGen ou Visual Studio. 20 | // Pour ajouter ou supprimer un membre, modifiez votre fichier .ResX, puis réexécutez ResGen 21 | // avec l'option /str ou régénérez votre projet VS. 22 | [global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Resources.Tools.StronglyTypedResourceBuilder", "4.0.0.0")] 23 | [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] 24 | [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] 25 | internal class Resources { 26 | 27 | private static global::System.Resources.ResourceManager resourceMan; 28 | 29 | private static global::System.Globalization.CultureInfo resourceCulture; 30 | 31 | [global::System.Diagnostics.CodeAnalysis.SuppressMessageAttribute("Microsoft.Performance", "CA1811:AvoidUncalledPrivateCode")] 32 | internal Resources() { 33 | } 34 | 35 | /// 36 | /// Retourne l'instance ResourceManager mise en cache utilisée par cette classe. 37 | /// 38 | [global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)] 39 | internal static global::System.Resources.ResourceManager ResourceManager { 40 | get { 41 | if (object.ReferenceEquals(resourceMan, null)) { 42 | global::System.Resources.ResourceManager temp = new global::System.Resources.ResourceManager("Vocals.Properties.Resources", typeof(Resources).Assembly); 43 | resourceMan = temp; 44 | } 45 | return resourceMan; 46 | } 47 | } 48 | 49 | /// 50 | /// Remplace la propriété CurrentUICulture du thread actuel pour toutes 51 | /// les recherches de ressources à l'aide de cette classe de ressource fortement typée. 52 | /// 53 | [global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)] 54 | internal static global::System.Globalization.CultureInfo Culture { 55 | get { 56 | return resourceCulture; 57 | } 58 | set { 59 | resourceCulture = value; 60 | } 61 | } 62 | } 63 | } 64 | -------------------------------------------------------------------------------- /Vocals/InternalClasses/VirtualKeyboard.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Runtime.InteropServices; 5 | using System.Text; 6 | using System.Threading.Tasks; 7 | using System.Windows.Forms; 8 | 9 | namespace Vocals { 10 | public static class VirtualKeyboard { 11 | [StructLayout(LayoutKind.Sequential)] 12 | internal struct KEYBOARDINPUT { 13 | public uint type; 14 | public ushort vk; 15 | public ushort scanCode; 16 | public uint flags; 17 | public uint time; 18 | public uint extrainfo; 19 | public uint padding1; 20 | public uint padding2; 21 | } 22 | 23 | [StructLayout(LayoutKind.Sequential)] 24 | internal struct MOUSEINPUT { 25 | public uint dx; 26 | public uint dy; 27 | public uint mouseData; 28 | public uint dwFlags; 29 | public uint time; 30 | public IntPtr dwExtraInfo; 31 | } 32 | 33 | [StructLayout(LayoutKind.Sequential)] 34 | internal struct HARDWAREINPUT { 35 | public int uMsg; 36 | public short wParamL; 37 | public short wParamH; 38 | } 39 | 40 | [StructLayout(LayoutKind.Explicit)] 41 | internal struct INPUT { 42 | [FieldOffset(0)] 43 | public int type; 44 | [FieldOffset(4)] 45 | public MOUSEINPUT mi; 46 | [FieldOffset(4)] 47 | public KEYBOARDINPUT ki; 48 | [FieldOffset(4)] 49 | public HARDWAREINPUT hi; 50 | } 51 | 52 | [DllImport("User32.dll")] 53 | private static extern uint SendInput(uint numberOfInputs, ref INPUT input, 54 | int structSize); 55 | 56 | 57 | [Flags] 58 | public enum KeyFlag { 59 | KeyDown = 0x0000, 60 | KeyUp = 0x0002, 61 | Scancode = 0x0008 62 | } 63 | 64 | public static void SendKey(uint keyCode, KeyFlag keyFlag) { 65 | INPUT InputData = new INPUT(); 66 | 67 | InputData.type = 1; 68 | InputData.ki.scanCode = (ushort)keyCode; 69 | InputData.ki.flags = (uint)keyFlag; 70 | Console.WriteLine(InputData.ki.scanCode); 71 | Console.WriteLine(keyCode); 72 | 73 | SendInput((uint)1, ref InputData, (int)Marshal.SizeOf(typeof(INPUT))); 74 | } 75 | 76 | [DllImport("User32.dll")] 77 | private static extern uint MapVirtualKey(uint uCode, uint uMapType); 78 | 79 | public static void PressKey(Keys key, Keys modifier) { 80 | 81 | uint keyCodeModifier = (uint)modifier; 82 | uint scanCodeModifier = MapVirtualKey(keyCodeModifier, 0); 83 | VirtualKeyboard.SendKey(scanCodeModifier, KeyFlag.KeyDown | KeyFlag.Scancode); 84 | 85 | uint keyCode = (uint)key; 86 | uint scanCode = MapVirtualKey(keyCode, 0); 87 | VirtualKeyboard.SendKey(scanCode, KeyFlag.KeyDown | KeyFlag.Scancode); 88 | System.Threading.Thread.Sleep((int)(100)); 89 | VirtualKeyboard.SendKey(scanCode, KeyFlag.KeyUp | KeyFlag.Scancode); 90 | VirtualKeyboard.SendKey(scanCodeModifier, KeyFlag.KeyUp | KeyFlag.Scancode); 91 | 92 | 93 | } 94 | 95 | } 96 | } 97 | -------------------------------------------------------------------------------- /Vocals/InternalClasses/Command.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Runtime.InteropServices; 5 | using System.Speech.Synthesis; 6 | using System.Text; 7 | using WMPLib; 8 | 9 | namespace Vocals { 10 | [Serializable] 11 | public class Command { 12 | 13 | public string commandString; 14 | public List actionList; 15 | 16 | 17 | public bool answering { get; set; } 18 | 19 | public string answeringString { get; set; } 20 | 21 | public bool answeringSound { get; set; } 22 | 23 | public string answeringSoundPath { get; set; } 24 | 25 | public Command() { 26 | 27 | } 28 | 29 | public Command(string commandString, List actionList) { 30 | this.commandString = commandString; 31 | this.actionList = actionList; 32 | this.answering = false; 33 | this.answeringString = ""; 34 | } 35 | 36 | public Command(string commandString, List actionList, bool answering, string answeringString, bool answeringSound, string answeringSoundPath) { 37 | this.commandString = commandString; 38 | this.actionList = actionList; 39 | this.answering = answering; 40 | this.answeringString = answeringString; 41 | if (answeringString == null) { 42 | answeringString = ""; 43 | } 44 | this.answeringSound = answeringSound; 45 | this.answeringSoundPath = answeringSoundPath; 46 | if(answeringSoundPath == null){ 47 | answeringSoundPath = ""; 48 | } 49 | } 50 | 51 | ~Command() { 52 | 53 | } 54 | 55 | public override string ToString() { 56 | string returnString = commandString + " : " + actionList.Count.ToString(); 57 | if (actionList.Count > 1) { 58 | returnString += " actions"; 59 | } 60 | else { 61 | returnString += " action"; 62 | } 63 | 64 | return returnString; 65 | } 66 | 67 | [DllImport("User32.dll")] 68 | static extern int SetForegroundWindow(IntPtr point); 69 | 70 | [DllImport("User32.dll")] 71 | static extern bool ShowWindow(IntPtr hWnd, int nCmdShow); 72 | 73 | public void perform(IntPtr winPointer) { 74 | SetForegroundWindow(winPointer); 75 | ShowWindow(winPointer, 5); 76 | foreach (Actions a in actionList) { 77 | a.perform(); 78 | } 79 | if (answering && answeringString != null) { 80 | try { 81 | SpeechSynthesizer synth = new SpeechSynthesizer(); 82 | if (synth != null) { 83 | synth.SpeakAsync(answeringString); 84 | } 85 | } 86 | catch(Exception e){ 87 | 88 | } 89 | } 90 | 91 | if (answeringSound && answeringSoundPath != null) { 92 | if (answeringSoundPath.IndexOf(".wav") == answeringSoundPath.Length-4) { 93 | System.Media.SoundPlayer player = new System.Media.SoundPlayer(); 94 | player.SoundLocation = answeringSoundPath; 95 | player.Play(); 96 | } 97 | else if (answeringSoundPath.IndexOf(".mp3") == answeringSoundPath.Length - 4) { 98 | WMPLib.WindowsMediaPlayer wplayer = new WMPLib.WindowsMediaPlayer(); 99 | 100 | wplayer.URL = answeringSoundPath; 101 | wplayer.controls.play(); 102 | } 103 | } 104 | } 105 | } 106 | } 107 | -------------------------------------------------------------------------------- /Vocals/FormOptions.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.ComponentModel; 4 | using System.Data; 5 | using System.Drawing; 6 | using System.Linq; 7 | using System.Speech.Recognition; 8 | using System.Text; 9 | using System.Threading.Tasks; 10 | using System.Windows.Forms; 11 | using Vocals.InternalClasses; 12 | 13 | namespace Vocals { 14 | public partial class FormOptions : Form { 15 | public Options opt; 16 | public Options saveOptions; 17 | 18 | 19 | public FormOptions() { 20 | InitializeComponent(); 21 | 22 | 23 | 24 | } 25 | 26 | 27 | private void FormOptions_Load(object sender, EventArgs e) { 28 | 29 | Keys[] keyDataSource = (Keys[])Enum.GetValues(typeof(Keys)).Cast(); 30 | comboBox2.DataSource = keyDataSource; 31 | 32 | recognitionLanguageComboBox.DataSource = getInstalledRecognitionLanguages(); 33 | 34 | opt = new Options(); 35 | saveOptions = new Options(opt); 36 | 37 | checkBox1.Checked = opt.toggleListening; 38 | comboBox2.SelectedItem = opt.key; 39 | richTextBox1.Text = opt.answer; 40 | trackBar1.Value = opt.threshold; 41 | label5.Text = Convert.ToString(opt.threshold); 42 | recognitionLanguageComboBox.SelectedItem = opt.language; 43 | recognitionLanguageWarning.Visible = false; 44 | 45 | if (checkBox1.Checked) { 46 | comboBox2.Enabled = true; 47 | richTextBox1.Enabled = true; 48 | } 49 | else { 50 | comboBox2.Enabled = false; 51 | richTextBox1.Enabled = false; 52 | } 53 | 54 | } 55 | 56 | private string[] getInstalledRecognitionLanguages() { 57 | return SpeechRecognitionEngine.InstalledRecognizers().Select(ri => ri.Culture.DisplayName).ToArray(); 58 | } 59 | 60 | private void checkBox1_CheckedChanged(object sender, EventArgs e) { 61 | if (opt != null) { 62 | if (checkBox1.Checked) { 63 | comboBox2.Enabled = true; 64 | richTextBox1.Enabled = true; 65 | opt.toggleListening = true; 66 | } 67 | else { 68 | comboBox2.Enabled = false; 69 | richTextBox1.Enabled = false; 70 | opt.toggleListening = false; 71 | } 72 | } 73 | } 74 | 75 | private void label2_Click(object sender, EventArgs e) { 76 | 77 | } 78 | 79 | private void trackBar1_Scroll(object sender, EventArgs e) { 80 | if (opt != null) { 81 | opt.threshold = trackBar1.Value; 82 | label5.Text = Convert.ToString(trackBar1.Value); 83 | } 84 | } 85 | 86 | private void comboBox2_SelectedIndexChanged(object sender, EventArgs e) { 87 | if (opt != null) { 88 | opt.key = (Keys)comboBox2.SelectedItem; 89 | } 90 | } 91 | 92 | private void richTextBox1_TextChanged(object sender, EventArgs e) { 93 | if (opt != null) { 94 | opt.answer = richTextBox1.Text; 95 | } 96 | } 97 | 98 | private void button1_Click(object sender, EventArgs e) { 99 | this.Close(); 100 | } 101 | 102 | private void button2_Click(object sender, EventArgs e) { 103 | opt = saveOptions; 104 | this.Close(); 105 | } 106 | 107 | private void recognitionLanguageComboBox_SelectedIndexChanged(object sender, EventArgs e) { 108 | if (opt != null) { 109 | opt.language = (String) recognitionLanguageComboBox.SelectedItem; 110 | recognitionLanguageWarning.Visible = true; 111 | } 112 | } 113 | 114 | } 115 | } 116 | -------------------------------------------------------------------------------- /Vocals/FormNewProfile.Designer.cs: -------------------------------------------------------------------------------- 1 | namespace Vocals { 2 | partial class FormNewProfile { 3 | /// 4 | /// Required designer variable. 5 | /// 6 | private System.ComponentModel.IContainer components = null; 7 | 8 | /// 9 | /// Clean up any resources being used. 10 | /// 11 | /// true if managed resources should be disposed; otherwise, false. 12 | protected override void Dispose(bool disposing) { 13 | if (disposing && (components != null)) { 14 | components.Dispose(); 15 | } 16 | base.Dispose(disposing); 17 | } 18 | 19 | #region Windows Form Designer generated code 20 | 21 | /// 22 | /// Required method for Designer support - do not modify 23 | /// the contents of this method with the code editor. 24 | /// 25 | private void InitializeComponent() { 26 | this.textBox1 = new System.Windows.Forms.TextBox(); 27 | this.label1 = new System.Windows.Forms.Label(); 28 | this.button1 = new System.Windows.Forms.Button(); 29 | this.button2 = new System.Windows.Forms.Button(); 30 | this.SuspendLayout(); 31 | // 32 | // textBox1 33 | // 34 | this.textBox1.Location = new System.Drawing.Point(96, 12); 35 | this.textBox1.Name = "textBox1"; 36 | this.textBox1.Size = new System.Drawing.Size(176, 20); 37 | this.textBox1.TabIndex = 0; 38 | this.textBox1.TextChanged += new System.EventHandler(this.textBox1_TextChanged); 39 | // 40 | // label1 41 | // 42 | this.label1.AutoSize = true; 43 | this.label1.Location = new System.Drawing.Point(12, 15); 44 | this.label1.Name = "label1"; 45 | this.label1.Size = new System.Drawing.Size(67, 13); 46 | this.label1.TabIndex = 1; 47 | this.label1.Text = "Profile Name"; 48 | this.label1.Click += new System.EventHandler(this.label1_Click); 49 | // 50 | // button1 51 | // 52 | this.button1.Location = new System.Drawing.Point(197, 50); 53 | this.button1.Name = "button1"; 54 | this.button1.Size = new System.Drawing.Size(75, 23); 55 | this.button1.TabIndex = 2; 56 | this.button1.Text = "Valider"; 57 | this.button1.UseVisualStyleBackColor = true; 58 | this.button1.Click += new System.EventHandler(this.button1_Click); 59 | // 60 | // button2 61 | // 62 | this.button2.Location = new System.Drawing.Point(15, 49); 63 | this.button2.Name = "button2"; 64 | this.button2.Size = new System.Drawing.Size(75, 23); 65 | this.button2.TabIndex = 3; 66 | this.button2.Text = "Cancel"; 67 | this.button2.UseVisualStyleBackColor = true; 68 | this.button2.Click += new System.EventHandler(this.button2_Click); 69 | // 70 | // FormNewProfile 71 | // 72 | this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F); 73 | this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; 74 | this.ClientSize = new System.Drawing.Size(285, 84); 75 | this.Controls.Add(this.button2); 76 | this.Controls.Add(this.button1); 77 | this.Controls.Add(this.label1); 78 | this.Controls.Add(this.textBox1); 79 | this.Name = "FormNewProfile"; 80 | this.Text = "New Profile"; 81 | this.Load += new System.EventHandler(this.FormNewProfile_Load); 82 | this.ResumeLayout(false); 83 | this.PerformLayout(); 84 | 85 | } 86 | 87 | #endregion 88 | 89 | private System.Windows.Forms.TextBox textBox1; 90 | private System.Windows.Forms.Label label1; 91 | private System.Windows.Forms.Button button1; 92 | private System.Windows.Forms.Button button2; 93 | } 94 | } -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | ## Ignore Visual Studio temporary files, build results, and 2 | ## files generated by popular Visual Studio add-ons. 3 | 4 | # User-specific files 5 | *.suo 6 | *.user 7 | *.sln.docstates 8 | 9 | # Build results 10 | [Dd]ebug/ 11 | [Dd]ebugPublic/ 12 | [Rr]elease/ 13 | x64/ 14 | build/ 15 | bld/ 16 | [Bb]in/ 17 | [Oo]bj/ 18 | 19 | # MSTest test Results 20 | [Tt]est[Rr]esult*/ 21 | [Bb]uild[Ll]og.* 22 | 23 | #NUNIT 24 | *.VisualState.xml 25 | TestResult.xml 26 | 27 | # Build Results of an ATL Project 28 | [Dd]ebugPS/ 29 | [Rr]eleasePS/ 30 | dlldata.c 31 | 32 | *_i.c 33 | *_p.c 34 | *_i.h 35 | *.ilk 36 | *.meta 37 | *.obj 38 | *.pch 39 | *.pdb 40 | *.pgc 41 | *.pgd 42 | *.rsp 43 | *.sbr 44 | *.tlb 45 | *.tli 46 | *.tlh 47 | *.tmp 48 | *.tmp_proj 49 | *.log 50 | *.vspscc 51 | *.vssscc 52 | .builds 53 | *.pidb 54 | *.svclog 55 | *.scc 56 | 57 | # Chutzpah Test files 58 | _Chutzpah* 59 | 60 | # Visual C++ cache files 61 | ipch/ 62 | *.aps 63 | *.ncb 64 | *.opensdf 65 | *.sdf 66 | *.cachefile 67 | 68 | # Visual Studio profiler 69 | *.psess 70 | *.vsp 71 | *.vspx 72 | 73 | # TFS 2012 Local Workspace 74 | $tf/ 75 | 76 | # Guidance Automation Toolkit 77 | *.gpState 78 | 79 | # ReSharper is a .NET coding add-in 80 | _ReSharper*/ 81 | *.[Rr]e[Ss]harper 82 | *.DotSettings.user 83 | 84 | # JustCode is a .NET coding addin-in 85 | .JustCode 86 | 87 | # TeamCity is a build add-in 88 | _TeamCity* 89 | 90 | # DotCover is a Code Coverage Tool 91 | *.dotCover 92 | 93 | # NCrunch 94 | *.ncrunch* 95 | _NCrunch_* 96 | .*crunch*.local.xml 97 | 98 | # MightyMoose 99 | *.mm.* 100 | AutoTest.Net/ 101 | 102 | # Web workbench (sass) 103 | .sass-cache/ 104 | 105 | # Installshield output folder 106 | [Ee]xpress/ 107 | 108 | # DocProject is a documentation generator add-in 109 | DocProject/buildhelp/ 110 | DocProject/Help/*.HxT 111 | DocProject/Help/*.HxC 112 | DocProject/Help/*.hhc 113 | DocProject/Help/*.hhk 114 | DocProject/Help/*.hhp 115 | DocProject/Help/Html2 116 | DocProject/Help/html 117 | 118 | # Click-Once directory 119 | publish/ 120 | 121 | # Publish Web Output 122 | *.[Pp]ublish.xml 123 | *.azurePubxml 124 | 125 | # NuGet Packages Directory 126 | packages/ 127 | ## TODO: If the tool you use requires repositories.config uncomment the next line 128 | #!packages/repositories.config 129 | 130 | # Enable "build/" folder in the NuGet Packages folder since NuGet packages use it for MSBuild targets 131 | # This line needs to be after the ignore of the build folder (and the packages folder if the line above has been uncommented) 132 | !packages/build/ 133 | 134 | # Windows Azure Build Output 135 | csx/ 136 | *.build.csdef 137 | 138 | # Windows Store app package directory 139 | AppPackages/ 140 | 141 | # Others 142 | sql/ 143 | *.Cache 144 | ClientBin/ 145 | [Ss]tyle[Cc]op.* 146 | ~$* 147 | *~ 148 | *.dbmdl 149 | *.dbproj.schemaview 150 | *.pfx 151 | *.publishsettings 152 | node_modules/ 153 | 154 | # RIA/Silverlight projects 155 | Generated_Code/ 156 | 157 | # Backup & report files from converting an old project file to a newer 158 | # Visual Studio version. Backup files are not needed, because we have git ;-) 159 | _UpgradeReport_Files/ 160 | Backup*/ 161 | UpgradeLog*.XML 162 | UpgradeLog*.htm 163 | 164 | # SQL Server files 165 | *.mdf 166 | *.ldf 167 | 168 | # Business Intelligence projects 169 | *.rdl.data 170 | *.bim.layout 171 | *.bim_*.settings 172 | 173 | # Microsoft Fakes 174 | FakesAssemblies/ 175 | 176 | # ========================= 177 | # Operating System Files 178 | # ========================= 179 | 180 | # OSX 181 | # ========================= 182 | 183 | .DS_Store 184 | .AppleDouble 185 | .LSOverride 186 | 187 | # Icon must ends with two \r. 188 | Icon 189 | 190 | # Thumbnails 191 | ._* 192 | 193 | # Files that might appear on external disk 194 | .Spotlight-V100 195 | .Trashes 196 | 197 | # Windows 198 | # ========================= 199 | 200 | # Windows image file caches 201 | Thumbs.db 202 | ehthumbs.db 203 | 204 | # Folder config file 205 | Desktop.ini 206 | 207 | # Recycle Bin used on file shares 208 | $RECYCLE.BIN/ 209 | 210 | # Windows Installer files 211 | *.cab 212 | *.msi 213 | *.msm 214 | *.msp 215 | -------------------------------------------------------------------------------- /Vocals/FormAction.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.ComponentModel; 4 | using System.Data; 5 | using System.Drawing; 6 | using System.Linq; 7 | using System.Runtime.InteropServices; 8 | using System.Text; 9 | using System.Windows.Forms; 10 | 11 | namespace Vocals { 12 | public partial class FormAction : Form { 13 | Keys[] keyDataSource; 14 | 15 | public float selectedTimer { get; set; } 16 | 17 | public Keys selectedKey { get; set; } 18 | 19 | public string selectedType { get; set; } 20 | 21 | public Keys modifier { get; set; } 22 | 23 | public FormAction() { 24 | 25 | InitializeComponent(); 26 | 27 | keyDataSource = (Keys[])Enum.GetValues(typeof(Keys)).Cast(); 28 | 29 | comboBox2.DataSource = keyDataSource; 30 | 31 | comboBox1.DataSource = new string[]{"Key press","Timer"}; 32 | 33 | numericUpDown1.DecimalPlaces = 2; 34 | numericUpDown1.Increment = 0.1M; 35 | } 36 | 37 | public FormAction(Actions a) { 38 | InitializeComponent(); 39 | keyDataSource = (Keys[])Enum.GetValues(typeof(Keys)).Cast(); 40 | 41 | 42 | comboBox2.DataSource = keyDataSource; 43 | 44 | comboBox1.DataSource = new string[] { "Key press", "Timer" }; 45 | 46 | numericUpDown1.DecimalPlaces = 2; 47 | numericUpDown1.Increment = 0.1M; 48 | 49 | comboBox2.SelectedItem = a.keys; 50 | numericUpDown1.Value = Convert.ToDecimal(a.timer); 51 | comboBox1.SelectedItem = a.type; 52 | 53 | switch (a.keyModifier) { 54 | case Keys.ControlKey: 55 | checkBox1.Checked = true; 56 | break; 57 | case Keys.ShiftKey: 58 | checkBox2.Checked = true; 59 | break; 60 | case Keys.Alt: 61 | checkBox3.Checked = true; 62 | break; 63 | default : 64 | break; 65 | } 66 | } 67 | 68 | private void FormAction_Load(object sender, System.EventArgs e) { 69 | } 70 | 71 | 72 | private void comboBox1_SelectedIndexChanged(object sender, EventArgs e) { 73 | selectedType = (string)comboBox1.SelectedItem; 74 | switch (selectedType) { 75 | case "Key press" : 76 | numericUpDown1.Enabled = false; 77 | comboBox2.Enabled = true; 78 | checkBox1.Enabled = true; 79 | checkBox2.Enabled = true; 80 | checkBox3.Enabled = true; 81 | break; 82 | case "Timer": 83 | numericUpDown1.Enabled = true; 84 | comboBox2.Enabled = false; 85 | checkBox1.Enabled = false; 86 | checkBox2.Enabled = false; 87 | checkBox3.Enabled = false; 88 | break; 89 | default : 90 | break; 91 | } 92 | } 93 | 94 | private void numericUpDown1_ValueChanged(object sender, EventArgs e) { 95 | selectedTimer = (float)numericUpDown1.Value; 96 | } 97 | 98 | private void comboBox2_SelectedIndexChanged(object sender, EventArgs e) { 99 | selectedKey = (Keys)comboBox2.SelectedItem; 100 | } 101 | 102 | private void button1_Click(object sender, EventArgs e) { 103 | this.Close(); 104 | } 105 | 106 | private void button2_Click(object sender, EventArgs e) { 107 | selectedType = ""; 108 | selectedTimer = 0; 109 | selectedKey = Keys.None; 110 | this.Close(); 111 | } 112 | 113 | private void checkBox1_CheckedChanged(object sender, EventArgs e) { 114 | if (checkBox1.Checked) { 115 | checkBox2.Checked = false; 116 | checkBox3.Checked = false; 117 | modifier = Keys.ControlKey; 118 | } 119 | else { 120 | modifier = Keys.None; 121 | } 122 | } 123 | 124 | private void checkBox2_CheckedChanged(object sender, EventArgs e) { 125 | if (checkBox2.Checked) { 126 | checkBox1.Checked = false; 127 | checkBox3.Checked = false; 128 | modifier = Keys.ShiftKey; 129 | } 130 | else { 131 | modifier = Keys.None; 132 | } 133 | } 134 | 135 | private void checkBox3_CheckedChanged(object sender, EventArgs e) { 136 | if (checkBox3.Checked) { 137 | checkBox1.Checked = false; 138 | checkBox2.Checked = false; 139 | modifier = Keys.Alt; 140 | } 141 | else { 142 | modifier = Keys.None; 143 | } 144 | } 145 | 146 | 147 | 148 | 149 | 150 | } 151 | } 152 | -------------------------------------------------------------------------------- /Vocals/Properties/Resources.resx: -------------------------------------------------------------------------------- 1 | 2 | 3 | 62 | 63 | 64 | 65 | 66 | 67 | 68 | 69 | 70 | 71 | 72 | 73 | 74 | 75 | 76 | 77 | 78 | 79 | 80 | 81 | 82 | 83 | 84 | 85 | 86 | 87 | 88 | 89 | 90 | 91 | 92 | 93 | 94 | 95 | 96 | 97 | 98 | 99 | 100 | 101 | 102 | 103 | 104 | 105 | 106 | text/microsoft-resx 107 | 108 | 109 | 2.0 110 | 111 | 112 | System.Resources.ResXResourceReader, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 113 | 114 | 115 | System.Resources.ResXResourceWriter, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 116 | 117 | -------------------------------------------------------------------------------- /Vocals/FormCommand.resx: -------------------------------------------------------------------------------- 1 | 2 | 3 | 62 | 63 | 64 | 65 | 66 | 67 | 68 | 69 | 70 | 71 | 72 | 73 | 74 | 75 | 76 | 77 | 78 | 79 | 80 | 81 | 82 | 83 | 84 | 85 | 86 | 87 | 88 | 89 | 90 | 91 | 92 | 93 | 94 | 95 | 96 | 97 | 98 | 99 | 100 | 101 | 102 | 103 | 104 | 105 | 106 | 107 | 108 | 109 | text/microsoft-resx 110 | 111 | 112 | 2.0 113 | 114 | 115 | System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 116 | 117 | 118 | System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 119 | 120 | -------------------------------------------------------------------------------- /Vocals/FormNewProfile.resx: -------------------------------------------------------------------------------- 1 | 2 | 3 | 62 | 63 | 64 | 65 | 66 | 67 | 68 | 69 | 70 | 71 | 72 | 73 | 74 | 75 | 76 | 77 | 78 | 79 | 80 | 81 | 82 | 83 | 84 | 85 | 86 | 87 | 88 | 89 | 90 | 91 | 92 | 93 | 94 | 95 | 96 | 97 | 98 | 99 | 100 | 101 | 102 | 103 | 104 | 105 | 106 | 107 | 108 | 109 | text/microsoft-resx 110 | 111 | 112 | 2.0 113 | 114 | 115 | System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 116 | 117 | 118 | System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 119 | 120 | -------------------------------------------------------------------------------- /Vocals/FormOptions.resx: -------------------------------------------------------------------------------- 1 | 2 | 3 | 62 | 63 | 64 | 65 | 66 | 67 | 68 | 69 | 70 | 71 | 72 | 73 | 74 | 75 | 76 | 77 | 78 | 79 | 80 | 81 | 82 | 83 | 84 | 85 | 86 | 87 | 88 | 89 | 90 | 91 | 92 | 93 | 94 | 95 | 96 | 97 | 98 | 99 | 100 | 101 | 102 | 103 | 104 | 105 | 106 | 107 | 108 | 109 | text/microsoft-resx 110 | 111 | 112 | 2.0 113 | 114 | 115 | System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 116 | 117 | 118 | System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 119 | 120 | -------------------------------------------------------------------------------- /Vocals/FormAction.resx: -------------------------------------------------------------------------------- 1 | 2 | 3 | 62 | 63 | 64 | 65 | 66 | 67 | 68 | 69 | 70 | 71 | 72 | 73 | 74 | 75 | 76 | 77 | 78 | 79 | 80 | 81 | 82 | 83 | 84 | 85 | 86 | 87 | 88 | 89 | 90 | 91 | 92 | 93 | 94 | 95 | 96 | 97 | 98 | 99 | 100 | 101 | 102 | 103 | 104 | 105 | 106 | 107 | 108 | 109 | text/microsoft-resx 110 | 111 | 112 | 2.0 113 | 114 | 115 | System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 116 | 117 | 118 | System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 119 | 120 | 121 | 17, 17 122 | 123 | 124 | 104, 17 125 | 126 | -------------------------------------------------------------------------------- /Vocals/FormCommand.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.ComponentModel; 4 | using System.Data; 5 | using System.Drawing; 6 | using System.Linq; 7 | using System.Text; 8 | using System.Windows.Forms; 9 | 10 | namespace Vocals { 11 | public partial class FormCommand : Form { 12 | public List actionList { get; set; } 13 | public string commandString { get; set; } 14 | 15 | public bool answering { get; set; } 16 | public string answeringString { get; set; } 17 | 18 | public bool answeringSound { get; set; } 19 | public string answeringSoundPath { get; set; } 20 | 21 | public FormCommand() { 22 | InitializeComponent(); 23 | actionList = new List(); 24 | commandString = ""; 25 | 26 | answering = false; 27 | answeringString = ""; 28 | 29 | listBox1.DataSource = actionList; 30 | } 31 | 32 | public FormCommand(Command c) { 33 | InitializeComponent(); 34 | actionList = c.actionList; 35 | commandString = c.commandString; 36 | 37 | answering = c.answering; 38 | checkBox1.Checked = answering; 39 | 40 | answeringString = c.answeringString; 41 | richTextBox1.Text = answeringString; 42 | 43 | answeringSound = c.answeringSound; 44 | checkBox2.Checked = answeringSound; 45 | 46 | answeringSoundPath = c.answeringSoundPath; 47 | textBox2.Text = answeringSoundPath; 48 | 49 | listBox1.DataSource = actionList; 50 | textBox1.Text = commandString; 51 | } 52 | 53 | 54 | private void textBox1_TextChanged(object sender, EventArgs e) { 55 | this.commandString = textBox1.Text; 56 | } 57 | 58 | private void button3_Click(object sender, EventArgs e) { 59 | if (listBox1.SelectedItem != null) { 60 | actionList.RemoveAt(listBox1.SelectedIndex); 61 | listBox1.DataSource = null; 62 | listBox1.DataSource = actionList; 63 | } 64 | } 65 | 66 | private void button1_Click(object sender, EventArgs e) { 67 | FormAction newActionForm = new FormAction(); 68 | newActionForm.ShowDialog(); 69 | 70 | if (newActionForm.selectedType != "") { 71 | if (newActionForm.selectedType == "Key press" && newActionForm.selectedKey != Keys.None 72 | || newActionForm.selectedType == "Timer" && newActionForm.selectedTimer != 0) { 73 | 74 | Actions myNewAction = new Actions(newActionForm.selectedType, newActionForm.selectedKey, newActionForm.modifier, newActionForm.selectedTimer); 75 | 76 | 77 | actionList.Add(myNewAction); 78 | 79 | listBox1.DataSource = null; 80 | listBox1.DataSource = actionList; 81 | } 82 | } 83 | 84 | 85 | } 86 | 87 | private void FormPopup_Load(object sender, EventArgs e) { 88 | 89 | } 90 | 91 | private void listBox1_SelectedIndexChanged(object sender, EventArgs e) { 92 | 93 | } 94 | 95 | private void button4_Click(object sender, EventArgs e) { 96 | this.Close(); 97 | } 98 | 99 | private void button5_Click(object sender, EventArgs e) { 100 | commandString = ""; 101 | actionList.Clear(); 102 | this.Close(); 103 | } 104 | 105 | private void button2_Click(object sender, EventArgs e) { 106 | Actions a = (Actions)listBox1.SelectedItem; 107 | if (a != null) { 108 | FormAction formEditAction = new FormAction(a); 109 | formEditAction.ShowDialog(); 110 | 111 | a.keys = formEditAction.selectedKey; 112 | a.type = formEditAction.selectedType; 113 | a.keyModifier = formEditAction.modifier; 114 | a.timer = (float)formEditAction.selectedTimer; 115 | 116 | listBox1.DataSource = null; 117 | listBox1.DataSource = actionList; 118 | 119 | 120 | } 121 | } 122 | 123 | private void groupBox2_Enter(object sender, EventArgs e) { 124 | 125 | } 126 | 127 | private void button6_Click(object sender, EventArgs e) { 128 | int selectedIndex = listBox1.SelectedIndex; 129 | if (selectedIndex > 0) { 130 | Actions actionToMoveDown = actionList.ElementAt(selectedIndex - 1); 131 | actionList.RemoveAt(selectedIndex - 1); 132 | actionList.Insert(selectedIndex, actionToMoveDown); 133 | 134 | listBox1.DataSource = null; 135 | listBox1.DataSource = actionList; 136 | listBox1.SelectedIndex = selectedIndex - 1; 137 | } 138 | } 139 | 140 | private void button7_Click(object sender, EventArgs e) { 141 | int selectedIndex = listBox1.SelectedIndex; 142 | if (selectedIndex < actionList.Count - 1) { 143 | Actions actionToMoveUp = actionList.ElementAt(selectedIndex + 1); 144 | actionList.RemoveAt(selectedIndex + 1); 145 | actionList.Insert(selectedIndex, actionToMoveUp); 146 | 147 | listBox1.DataSource = null; 148 | listBox1.DataSource = actionList; 149 | listBox1.SelectedIndex = selectedIndex + 1; 150 | } 151 | } 152 | 153 | private void richTextBox1_TextChanged(object sender, EventArgs e) { 154 | answeringString = richTextBox1.Text; 155 | } 156 | 157 | private void checkBox1_CheckedChanged(object sender, EventArgs e) { 158 | if (checkBox1.Checked) { 159 | checkBox2.Checked = false; 160 | answeringSound = false; 161 | } 162 | answering = checkBox1.Checked; 163 | 164 | } 165 | 166 | private void groupBox4_Enter(object sender, EventArgs e) { 167 | 168 | } 169 | 170 | private void richTextBox2_TextChanged(object sender, EventArgs e) { 171 | 172 | } 173 | 174 | private void button9_Click(object sender, EventArgs e) { 175 | OpenFileDialog ofd = new OpenFileDialog(); 176 | 177 | ofd.Filter = "Sound file (*.wav,*.mp3)|*.wav;*.mp3"; 178 | 179 | if (ofd.ShowDialog() == DialogResult.OK && ofd.CheckPathExists) { 180 | textBox2.Text = ofd.InitialDirectory + ofd.FileName; 181 | answeringSoundPath = textBox2.Text ; 182 | } 183 | 184 | } 185 | 186 | private void openFileDialog1_FileOk(object sender, CancelEventArgs e) { 187 | 188 | } 189 | 190 | private void textBox2_TextChanged(object sender, EventArgs e) { 191 | 192 | } 193 | 194 | private void checkBox2_CheckedChanged(object sender, EventArgs e) { 195 | if (checkBox2.Checked) { 196 | checkBox1.Checked = false; 197 | answering = false; 198 | } 199 | answeringSound = true; 200 | } 201 | 202 | 203 | 204 | 205 | } 206 | } 207 | -------------------------------------------------------------------------------- /Vocals/Vocals.csproj: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | Debug 6 | AnyCPU 7 | {0BA8881B-1EF7-497D-ADBE-2AE4EC35BC75} 8 | WinExe 9 | Properties 10 | Vocals 11 | Vocals 12 | v4.5 13 | 512 14 | 15 | publier\ 16 | true 17 | Disk 18 | false 19 | Foreground 20 | 7 21 | Days 22 | false 23 | false 24 | true 25 | 0 26 | 1.0.0.%2a 27 | false 28 | false 29 | true 30 | 31 | 32 | AnyCPU 33 | true 34 | full 35 | false 36 | bin\Debug\ 37 | DEBUG;TRACE 38 | prompt 39 | 4 40 | false 41 | 42 | 43 | AnyCPU 44 | pdbonly 45 | true 46 | bin\Release\ 47 | TRACE 48 | prompt 49 | 4 50 | false 51 | 52 | 53 | 54 | 55 | 56 | false 57 | 58 | 59 | Vocals.ico 60 | 61 | 62 | 63 | 64 | 65 | 66 | 67 | 68 | 69 | 70 | 71 | 72 | 73 | 74 | 75 | 76 | 77 | 78 | 79 | Form 80 | 81 | 82 | FormOptions.cs 83 | 84 | 85 | 86 | 87 | 88 | Form 89 | 90 | 91 | FormNewProfile.cs 92 | 93 | 94 | Form 95 | 96 | 97 | FormAction.cs 98 | 99 | 100 | Form 101 | 102 | 103 | FormCommand.cs 104 | 105 | 106 | 107 | 108 | Form 109 | 110 | 111 | Form1.cs 112 | 113 | 114 | 115 | 116 | 117 | Form1.cs 118 | 119 | 120 | FormOptions.cs 121 | 122 | 123 | FormNewProfile.cs 124 | 125 | 126 | FormAction.cs 127 | 128 | 129 | FormCommand.cs 130 | 131 | 132 | ResXFileCodeGenerator 133 | Resources.Designer.cs 134 | Designer 135 | 136 | 137 | True 138 | Resources.resx 139 | True 140 | 141 | 142 | 143 | SettingsSingleFileGenerator 144 | Settings.Designer.cs 145 | 146 | 147 | True 148 | Settings.settings 149 | True 150 | 151 | 152 | 153 | 154 | 155 | 156 | 157 | False 158 | Microsoft .NET Framework 4.5 %28x86 et x64%29 159 | true 160 | 161 | 162 | False 163 | .NET Framework 3.5 SP1 Client Profile 164 | false 165 | 166 | 167 | False 168 | .NET Framework 3.5 SP1 169 | false 170 | 171 | 172 | 173 | 174 | {6BF52A50-394A-11D3-B153-00C04F79FAA6} 175 | 1 176 | 0 177 | 0 178 | tlbimp 179 | False 180 | True 181 | 182 | 183 | 184 | 185 | 186 | 187 | 194 | -------------------------------------------------------------------------------- /Vocals/FormAction.Designer.cs: -------------------------------------------------------------------------------- 1 | namespace Vocals { 2 | partial class FormAction { 3 | /// 4 | /// Required designer variable. 5 | /// 6 | private System.ComponentModel.IContainer components = null; 7 | 8 | /// 9 | /// Clean up any resources being used. 10 | /// 11 | /// true if managed resources should be disposed; otherwise, false. 12 | protected override void Dispose(bool disposing) { 13 | if (disposing && (components != null)) { 14 | components.Dispose(); 15 | } 16 | base.Dispose(disposing); 17 | } 18 | 19 | #region Windows Form Designer generated code 20 | 21 | /// 22 | /// Required method for Designer support - do not modify 23 | /// the contents of this method with the code editor. 24 | /// 25 | private void InitializeComponent() { 26 | this.components = new System.ComponentModel.Container(); 27 | this.comboBox1 = new System.Windows.Forms.ComboBox(); 28 | this.label1 = new System.Windows.Forms.Label(); 29 | this.label2 = new System.Windows.Forms.Label(); 30 | this.comboBox2 = new System.Windows.Forms.ComboBox(); 31 | this.timer1 = new System.Windows.Forms.Timer(this.components); 32 | this.timer2 = new System.Windows.Forms.Timer(this.components); 33 | this.numericUpDown1 = new System.Windows.Forms.NumericUpDown(); 34 | this.label3 = new System.Windows.Forms.Label(); 35 | this.button1 = new System.Windows.Forms.Button(); 36 | this.button2 = new System.Windows.Forms.Button(); 37 | this.checkBox1 = new System.Windows.Forms.CheckBox(); 38 | this.checkBox2 = new System.Windows.Forms.CheckBox(); 39 | this.checkBox3 = new System.Windows.Forms.CheckBox(); 40 | ((System.ComponentModel.ISupportInitialize)(this.numericUpDown1)).BeginInit(); 41 | this.SuspendLayout(); 42 | // 43 | // comboBox1 44 | // 45 | this.comboBox1.DropDownStyle = System.Windows.Forms.ComboBoxStyle.DropDownList; 46 | this.comboBox1.FormattingEnabled = true; 47 | this.comboBox1.Location = new System.Drawing.Point(126, 12); 48 | this.comboBox1.Name = "comboBox1"; 49 | this.comboBox1.Size = new System.Drawing.Size(121, 21); 50 | this.comboBox1.TabIndex = 0; 51 | this.comboBox1.SelectedIndexChanged += new System.EventHandler(this.comboBox1_SelectedIndexChanged); 52 | // 53 | // label1 54 | // 55 | this.label1.AutoSize = true; 56 | this.label1.Location = new System.Drawing.Point(61, 15); 57 | this.label1.Name = "label1"; 58 | this.label1.Size = new System.Drawing.Size(31, 13); 59 | this.label1.TabIndex = 1; 60 | this.label1.Text = "Type"; 61 | // 62 | // label2 63 | // 64 | this.label2.AutoSize = true; 65 | this.label2.Location = new System.Drawing.Point(61, 42); 66 | this.label2.Name = "label2"; 67 | this.label2.Size = new System.Drawing.Size(25, 13); 68 | this.label2.TabIndex = 2; 69 | this.label2.Text = "Key"; 70 | // 71 | // comboBox2 72 | // 73 | this.comboBox2.DropDownStyle = System.Windows.Forms.ComboBoxStyle.DropDownList; 74 | this.comboBox2.FormattingEnabled = true; 75 | this.comboBox2.Location = new System.Drawing.Point(126, 39); 76 | this.comboBox2.Name = "comboBox2"; 77 | this.comboBox2.Size = new System.Drawing.Size(121, 21); 78 | this.comboBox2.TabIndex = 3; 79 | this.comboBox2.SelectedIndexChanged += new System.EventHandler(this.comboBox2_SelectedIndexChanged); 80 | // 81 | // numericUpDown1 82 | // 83 | this.numericUpDown1.Location = new System.Drawing.Point(127, 161); 84 | this.numericUpDown1.Name = "numericUpDown1"; 85 | this.numericUpDown1.Size = new System.Drawing.Size(120, 20); 86 | this.numericUpDown1.TabIndex = 4; 87 | this.numericUpDown1.ValueChanged += new System.EventHandler(this.numericUpDown1_ValueChanged); 88 | // 89 | // label3 90 | // 91 | this.label3.AutoSize = true; 92 | this.label3.Location = new System.Drawing.Point(55, 163); 93 | this.label3.Name = "label3"; 94 | this.label3.Size = new System.Drawing.Size(66, 13); 95 | this.label3.TabIndex = 5; 96 | this.label3.Text = "Timer (Secs)"; 97 | // 98 | // button1 99 | // 100 | this.button1.Location = new System.Drawing.Point(172, 215); 101 | this.button1.Name = "button1"; 102 | this.button1.Size = new System.Drawing.Size(75, 23); 103 | this.button1.TabIndex = 6; 104 | this.button1.Text = "Validate"; 105 | this.button1.UseVisualStyleBackColor = true; 106 | this.button1.Click += new System.EventHandler(this.button1_Click); 107 | // 108 | // button2 109 | // 110 | this.button2.Location = new System.Drawing.Point(11, 215); 111 | this.button2.Name = "button2"; 112 | this.button2.Size = new System.Drawing.Size(75, 23); 113 | this.button2.TabIndex = 7; 114 | this.button2.Text = "Cancel"; 115 | this.button2.UseVisualStyleBackColor = true; 116 | this.button2.Click += new System.EventHandler(this.button2_Click); 117 | // 118 | // checkBox1 119 | // 120 | this.checkBox1.AutoSize = true; 121 | this.checkBox1.Location = new System.Drawing.Point(127, 67); 122 | this.checkBox1.Name = "checkBox1"; 123 | this.checkBox1.Size = new System.Drawing.Size(41, 17); 124 | this.checkBox1.TabIndex = 8; 125 | this.checkBox1.Text = "Ctrl"; 126 | this.checkBox1.UseVisualStyleBackColor = true; 127 | this.checkBox1.CheckedChanged += new System.EventHandler(this.checkBox1_CheckedChanged); 128 | // 129 | // checkBox2 130 | // 131 | this.checkBox2.AutoSize = true; 132 | this.checkBox2.Location = new System.Drawing.Point(126, 90); 133 | this.checkBox2.Name = "checkBox2"; 134 | this.checkBox2.Size = new System.Drawing.Size(47, 17); 135 | this.checkBox2.TabIndex = 8; 136 | this.checkBox2.Text = "Shift"; 137 | this.checkBox2.UseVisualStyleBackColor = true; 138 | this.checkBox2.CheckedChanged += new System.EventHandler(this.checkBox2_CheckedChanged); 139 | // 140 | // checkBox3 141 | // 142 | this.checkBox3.AutoSize = true; 143 | this.checkBox3.Location = new System.Drawing.Point(127, 113); 144 | this.checkBox3.Name = "checkBox3"; 145 | this.checkBox3.Size = new System.Drawing.Size(38, 17); 146 | this.checkBox3.TabIndex = 8; 147 | this.checkBox3.Text = "Alt"; 148 | this.checkBox3.UseVisualStyleBackColor = true; 149 | this.checkBox3.CheckedChanged += new System.EventHandler(this.checkBox3_CheckedChanged); 150 | // 151 | // FormAction 152 | // 153 | this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F); 154 | this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; 155 | this.ClientSize = new System.Drawing.Size(257, 266); 156 | this.Controls.Add(this.checkBox3); 157 | this.Controls.Add(this.checkBox2); 158 | this.Controls.Add(this.checkBox1); 159 | this.Controls.Add(this.button2); 160 | this.Controls.Add(this.button1); 161 | this.Controls.Add(this.label3); 162 | this.Controls.Add(this.numericUpDown1); 163 | this.Controls.Add(this.comboBox2); 164 | this.Controls.Add(this.label2); 165 | this.Controls.Add(this.label1); 166 | this.Controls.Add(this.comboBox1); 167 | this.Name = "FormAction"; 168 | this.Text = "New action"; 169 | this.Load += new System.EventHandler(this.FormAction_Load); 170 | ((System.ComponentModel.ISupportInitialize)(this.numericUpDown1)).EndInit(); 171 | this.ResumeLayout(false); 172 | this.PerformLayout(); 173 | 174 | } 175 | 176 | 177 | 178 | #endregion 179 | 180 | private System.Windows.Forms.ComboBox comboBox1; 181 | private System.Windows.Forms.Label label1; 182 | private System.Windows.Forms.Label label2; 183 | private System.Windows.Forms.ComboBox comboBox2; 184 | private System.Windows.Forms.Timer timer1; 185 | private System.Windows.Forms.Timer timer2; 186 | private System.Windows.Forms.NumericUpDown numericUpDown1; 187 | private System.Windows.Forms.Label label3; 188 | private System.Windows.Forms.Button button1; 189 | private System.Windows.Forms.Button button2; 190 | private System.Windows.Forms.CheckBox checkBox1; 191 | private System.Windows.Forms.CheckBox checkBox2; 192 | private System.Windows.Forms.CheckBox checkBox3; 193 | } 194 | } -------------------------------------------------------------------------------- /Vocals/FormOptions.Designer.cs: -------------------------------------------------------------------------------- 1 | namespace Vocals { 2 | partial class FormOptions { 3 | /// 4 | /// Required designer variable. 5 | /// 6 | private System.ComponentModel.IContainer components = null; 7 | 8 | /// 9 | /// Clean up any resources being used. 10 | /// 11 | /// true if managed resources should be disposed; otherwise, false. 12 | protected override void Dispose(bool disposing) { 13 | if (disposing && (components != null)) { 14 | components.Dispose(); 15 | } 16 | base.Dispose(disposing); 17 | } 18 | 19 | #region Windows Form Designer generated code 20 | 21 | /// 22 | /// Required method for Designer support - do not modify 23 | /// the contents of this method with the code editor. 24 | /// 25 | private void InitializeComponent() { 26 | this.checkBox1 = new System.Windows.Forms.CheckBox(); 27 | this.trackBar1 = new System.Windows.Forms.TrackBar(); 28 | this.comboBox2 = new System.Windows.Forms.ComboBox(); 29 | this.label2 = new System.Windows.Forms.Label(); 30 | this.richTextBox1 = new System.Windows.Forms.RichTextBox(); 31 | this.label3 = new System.Windows.Forms.Label(); 32 | this.label4 = new System.Windows.Forms.Label(); 33 | this.label5 = new System.Windows.Forms.Label(); 34 | this.button1 = new System.Windows.Forms.Button(); 35 | this.button2 = new System.Windows.Forms.Button(); 36 | this.label1 = new System.Windows.Forms.Label(); 37 | this.recognitionLanguageComboBox = new System.Windows.Forms.ComboBox(); 38 | this.recognitionLanguageWarning = new System.Windows.Forms.Label(); 39 | ((System.ComponentModel.ISupportInitialize)(this.trackBar1)).BeginInit(); 40 | this.SuspendLayout(); 41 | // 42 | // checkBox1 43 | // 44 | this.checkBox1.AutoSize = true; 45 | this.checkBox1.Location = new System.Drawing.Point(16, 12); 46 | this.checkBox1.Name = "checkBox1"; 47 | this.checkBox1.RightToLeft = System.Windows.Forms.RightToLeft.No; 48 | this.checkBox1.Size = new System.Drawing.Size(138, 17); 49 | this.checkBox1.TabIndex = 3; 50 | this.checkBox1.Text = "Toggle listening on key "; 51 | this.checkBox1.UseVisualStyleBackColor = true; 52 | this.checkBox1.CheckedChanged += new System.EventHandler(this.checkBox1_CheckedChanged); 53 | // 54 | // trackBar1 55 | // 56 | this.trackBar1.BackColor = System.Drawing.SystemColors.Control; 57 | this.trackBar1.LargeChange = 10; 58 | this.trackBar1.Location = new System.Drawing.Point(162, 153); 59 | this.trackBar1.Maximum = 100; 60 | this.trackBar1.Name = "trackBar1"; 61 | this.trackBar1.Size = new System.Drawing.Size(179, 45); 62 | this.trackBar1.TabIndex = 0; 63 | this.trackBar1.Scroll += new System.EventHandler(this.trackBar1_Scroll); 64 | // 65 | // comboBox2 66 | // 67 | this.comboBox2.DropDownStyle = System.Windows.Forms.ComboBoxStyle.DropDownList; 68 | this.comboBox2.Enabled = false; 69 | this.comboBox2.FormattingEnabled = true; 70 | this.comboBox2.Location = new System.Drawing.Point(162, 35); 71 | this.comboBox2.Name = "comboBox2"; 72 | this.comboBox2.Size = new System.Drawing.Size(179, 21); 73 | this.comboBox2.TabIndex = 6; 74 | this.comboBox2.SelectedIndexChanged += new System.EventHandler(this.comboBox2_SelectedIndexChanged); 75 | // 76 | // label2 77 | // 78 | this.label2.AutoSize = true; 79 | this.label2.Location = new System.Drawing.Point(117, 38); 80 | this.label2.Name = "label2"; 81 | this.label2.Size = new System.Drawing.Size(31, 13); 82 | this.label2.TabIndex = 5; 83 | this.label2.Text = "Key :"; 84 | this.label2.Click += new System.EventHandler(this.label2_Click); 85 | // 86 | // richTextBox1 87 | // 88 | this.richTextBox1.Location = new System.Drawing.Point(162, 62); 89 | this.richTextBox1.Name = "richTextBox1"; 90 | this.richTextBox1.Size = new System.Drawing.Size(179, 71); 91 | this.richTextBox1.TabIndex = 8; 92 | this.richTextBox1.Text = ""; 93 | this.richTextBox1.TextChanged += new System.EventHandler(this.richTextBox1_TextChanged); 94 | // 95 | // label3 96 | // 97 | this.label3.AutoSize = true; 98 | this.label3.Location = new System.Drawing.Point(13, 153); 99 | this.label3.Name = "label3"; 100 | this.label3.Size = new System.Drawing.Size(116, 13); 101 | this.label3.TabIndex = 9; 102 | this.label3.Text = "Recognition threshold :"; 103 | // 104 | // label4 105 | // 106 | this.label4.AutoSize = true; 107 | this.label4.Location = new System.Drawing.Point(71, 62); 108 | this.label4.Name = "label4"; 109 | this.label4.Size = new System.Drawing.Size(77, 13); 110 | this.label4.TabIndex = 10; 111 | this.label4.Text = "Synth answer :"; 112 | // 113 | // label5 114 | // 115 | this.label5.AutoSize = true; 116 | this.label5.Location = new System.Drawing.Point(347, 162); 117 | this.label5.Name = "label5"; 118 | this.label5.Size = new System.Drawing.Size(0, 13); 119 | this.label5.TabIndex = 12; 120 | // 121 | // button1 122 | // 123 | this.button1.Location = new System.Drawing.Point(312, 243); 124 | this.button1.Name = "button1"; 125 | this.button1.Size = new System.Drawing.Size(75, 23); 126 | this.button1.TabIndex = 13; 127 | this.button1.Text = "Validate"; 128 | this.button1.UseVisualStyleBackColor = true; 129 | this.button1.Click += new System.EventHandler(this.button1_Click); 130 | // 131 | // button2 132 | // 133 | this.button2.Location = new System.Drawing.Point(12, 243); 134 | this.button2.Name = "button2"; 135 | this.button2.Size = new System.Drawing.Size(75, 23); 136 | this.button2.TabIndex = 14; 137 | this.button2.Text = "Cancel"; 138 | this.button2.UseVisualStyleBackColor = true; 139 | this.button2.Click += new System.EventHandler(this.button2_Click); 140 | // 141 | // label1 142 | // 143 | this.label1.AutoSize = true; 144 | this.label1.Location = new System.Drawing.Point(16, 193); 145 | this.label1.Name = "label1"; 146 | this.label1.Size = new System.Drawing.Size(111, 13); 147 | this.label1.TabIndex = 15; 148 | this.label1.Text = "Recognition language"; 149 | // 150 | // recognitionLanguageComboBox 151 | // 152 | this.recognitionLanguageComboBox.DropDownStyle = System.Windows.Forms.ComboBoxStyle.DropDownList; 153 | this.recognitionLanguageComboBox.FormattingEnabled = true; 154 | this.recognitionLanguageComboBox.Location = new System.Drawing.Point(162, 193); 155 | this.recognitionLanguageComboBox.Name = "recognitionLanguageComboBox"; 156 | this.recognitionLanguageComboBox.Size = new System.Drawing.Size(179, 21); 157 | this.recognitionLanguageComboBox.TabIndex = 16; 158 | this.recognitionLanguageComboBox.SelectedIndexChanged += new System.EventHandler(this.recognitionLanguageComboBox_SelectedIndexChanged); 159 | // 160 | // recognitionLanguageWarning 161 | // 162 | this.recognitionLanguageWarning.AutoSize = true; 163 | this.recognitionLanguageWarning.Font = new System.Drawing.Font("Microsoft Sans Serif", 8.25F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0))); 164 | this.recognitionLanguageWarning.ForeColor = System.Drawing.Color.Red; 165 | this.recognitionLanguageWarning.Location = new System.Drawing.Point(51, 217); 166 | this.recognitionLanguageWarning.Name = "recognitionLanguageWarning"; 167 | this.recognitionLanguageWarning.Size = new System.Drawing.Size(296, 13); 168 | this.recognitionLanguageWarning.TabIndex = 17; 169 | this.recognitionLanguageWarning.Text = " You need to restart Vocals to apply language moditication"; 170 | // 171 | // FormOptions 172 | // 173 | this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F); 174 | this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; 175 | this.ClientSize = new System.Drawing.Size(399, 278); 176 | this.Controls.Add(this.recognitionLanguageWarning); 177 | this.Controls.Add(this.recognitionLanguageComboBox); 178 | this.Controls.Add(this.label1); 179 | this.Controls.Add(this.button2); 180 | this.Controls.Add(this.button1); 181 | this.Controls.Add(this.label5); 182 | this.Controls.Add(this.label4); 183 | this.Controls.Add(this.label3); 184 | this.Controls.Add(this.richTextBox1); 185 | this.Controls.Add(this.comboBox2); 186 | this.Controls.Add(this.label2); 187 | this.Controls.Add(this.checkBox1); 188 | this.Controls.Add(this.trackBar1); 189 | this.Name = "FormOptions"; 190 | this.Text = "Advanced options"; 191 | this.Load += new System.EventHandler(this.FormOptions_Load); 192 | ((System.ComponentModel.ISupportInitialize)(this.trackBar1)).EndInit(); 193 | this.ResumeLayout(false); 194 | this.PerformLayout(); 195 | 196 | } 197 | 198 | #endregion 199 | 200 | private System.Windows.Forms.CheckBox checkBox1; 201 | private System.Windows.Forms.TrackBar trackBar1; 202 | private System.Windows.Forms.ComboBox comboBox2; 203 | private System.Windows.Forms.Label label2; 204 | private System.Windows.Forms.RichTextBox richTextBox1; 205 | private System.Windows.Forms.Label label3; 206 | private System.Windows.Forms.Label label4; 207 | private System.Windows.Forms.Label label5; 208 | private System.Windows.Forms.Button button1; 209 | private System.Windows.Forms.Button button2; 210 | private System.Windows.Forms.Label label1; 211 | private System.Windows.Forms.ComboBox recognitionLanguageComboBox; 212 | private System.Windows.Forms.Label recognitionLanguageWarning; 213 | } 214 | } -------------------------------------------------------------------------------- /Vocals/FormCommand.Designer.cs: -------------------------------------------------------------------------------- 1 | namespace Vocals 2 | { 3 | partial class FormCommand 4 | { 5 | /// 6 | /// Required designer variable. 7 | /// 8 | private System.ComponentModel.IContainer components = null; 9 | 10 | /// 11 | /// Clean up any resources being used. 12 | /// 13 | /// true if managed resources should be disposed; otherwise, false. 14 | protected override void Dispose(bool disposing) 15 | { 16 | if (disposing && (components != null)) 17 | { 18 | components.Dispose(); 19 | } 20 | base.Dispose(disposing); 21 | } 22 | 23 | #region Windows Form Designer generated code 24 | 25 | /// 26 | /// Required method for Designer support - do not modify 27 | /// the contents of this method with the code editor. 28 | /// 29 | private void InitializeComponent() 30 | { 31 | this.textBox1 = new System.Windows.Forms.TextBox(); 32 | this.listBox1 = new System.Windows.Forms.ListBox(); 33 | this.button1 = new System.Windows.Forms.Button(); 34 | this.button3 = new System.Windows.Forms.Button(); 35 | this.button4 = new System.Windows.Forms.Button(); 36 | this.button5 = new System.Windows.Forms.Button(); 37 | this.groupBox1 = new System.Windows.Forms.GroupBox(); 38 | this.groupBox2 = new System.Windows.Forms.GroupBox(); 39 | this.button7 = new System.Windows.Forms.Button(); 40 | this.button6 = new System.Windows.Forms.Button(); 41 | this.button2 = new System.Windows.Forms.Button(); 42 | this.checkBox1 = new System.Windows.Forms.CheckBox(); 43 | this.richTextBox1 = new System.Windows.Forms.RichTextBox(); 44 | this.groupBox4 = new System.Windows.Forms.GroupBox(); 45 | this.textBox2 = new System.Windows.Forms.TextBox(); 46 | this.button9 = new System.Windows.Forms.Button(); 47 | this.checkBox2 = new System.Windows.Forms.CheckBox(); 48 | this.groupBox1.SuspendLayout(); 49 | this.groupBox2.SuspendLayout(); 50 | this.groupBox4.SuspendLayout(); 51 | this.SuspendLayout(); 52 | // 53 | // textBox1 54 | // 55 | this.textBox1.Location = new System.Drawing.Point(6, 30); 56 | this.textBox1.Name = "textBox1"; 57 | this.textBox1.Size = new System.Drawing.Size(267, 20); 58 | this.textBox1.TabIndex = 0; 59 | this.textBox1.TextChanged += new System.EventHandler(this.textBox1_TextChanged); 60 | // 61 | // listBox1 62 | // 63 | this.listBox1.FormattingEnabled = true; 64 | this.listBox1.Location = new System.Drawing.Point(15, 74); 65 | this.listBox1.Name = "listBox1"; 66 | this.listBox1.Size = new System.Drawing.Size(195, 134); 67 | this.listBox1.TabIndex = 4; 68 | this.listBox1.SelectedIndexChanged += new System.EventHandler(this.listBox1_SelectedIndexChanged); 69 | // 70 | // button1 71 | // 72 | this.button1.Location = new System.Drawing.Point(15, 34); 73 | this.button1.Name = "button1"; 74 | this.button1.Size = new System.Drawing.Size(60, 23); 75 | this.button1.TabIndex = 5; 76 | this.button1.Text = "Add action"; 77 | this.button1.UseVisualStyleBackColor = true; 78 | this.button1.Click += new System.EventHandler(this.button1_Click); 79 | // 80 | // button3 81 | // 82 | this.button3.Location = new System.Drawing.Point(150, 34); 83 | this.button3.Name = "button3"; 84 | this.button3.Size = new System.Drawing.Size(60, 23); 85 | this.button3.TabIndex = 7; 86 | this.button3.Text = "Delete action"; 87 | this.button3.UseVisualStyleBackColor = true; 88 | this.button3.Click += new System.EventHandler(this.button3_Click); 89 | // 90 | // button4 91 | // 92 | this.button4.Location = new System.Drawing.Point(511, 316); 93 | this.button4.Name = "button4"; 94 | this.button4.Size = new System.Drawing.Size(75, 23); 95 | this.button4.TabIndex = 8; 96 | this.button4.Text = "Validate"; 97 | this.button4.UseVisualStyleBackColor = true; 98 | this.button4.Click += new System.EventHandler(this.button4_Click); 99 | // 100 | // button5 101 | // 102 | this.button5.Location = new System.Drawing.Point(12, 316); 103 | this.button5.Name = "button5"; 104 | this.button5.Size = new System.Drawing.Size(75, 23); 105 | this.button5.TabIndex = 9; 106 | this.button5.Text = "Cancel"; 107 | this.button5.UseVisualStyleBackColor = true; 108 | this.button5.Click += new System.EventHandler(this.button5_Click); 109 | // 110 | // groupBox1 111 | // 112 | this.groupBox1.Controls.Add(this.textBox1); 113 | this.groupBox1.Location = new System.Drawing.Point(12, 12); 114 | this.groupBox1.Name = "groupBox1"; 115 | this.groupBox1.Size = new System.Drawing.Size(280, 71); 116 | this.groupBox1.TabIndex = 10; 117 | this.groupBox1.TabStop = false; 118 | this.groupBox1.Text = "Command text"; 119 | // 120 | // groupBox2 121 | // 122 | this.groupBox2.Controls.Add(this.button7); 123 | this.groupBox2.Controls.Add(this.button6); 124 | this.groupBox2.Controls.Add(this.button2); 125 | this.groupBox2.Controls.Add(this.listBox1); 126 | this.groupBox2.Controls.Add(this.button1); 127 | this.groupBox2.Controls.Add(this.button3); 128 | this.groupBox2.Location = new System.Drawing.Point(12, 89); 129 | this.groupBox2.Name = "groupBox2"; 130 | this.groupBox2.Size = new System.Drawing.Size(280, 221); 131 | this.groupBox2.TabIndex = 11; 132 | this.groupBox2.TabStop = false; 133 | this.groupBox2.Text = "Actions"; 134 | this.groupBox2.Enter += new System.EventHandler(this.groupBox2_Enter); 135 | // 136 | // button7 137 | // 138 | this.button7.Location = new System.Drawing.Point(216, 140); 139 | this.button7.Name = "button7"; 140 | this.button7.Size = new System.Drawing.Size(57, 23); 141 | this.button7.TabIndex = 10; 142 | this.button7.Text = "Down"; 143 | this.button7.UseVisualStyleBackColor = true; 144 | this.button7.Click += new System.EventHandler(this.button7_Click); 145 | // 146 | // button6 147 | // 148 | this.button6.Location = new System.Drawing.Point(216, 111); 149 | this.button6.Name = "button6"; 150 | this.button6.Size = new System.Drawing.Size(57, 23); 151 | this.button6.TabIndex = 9; 152 | this.button6.Text = "Up"; 153 | this.button6.UseVisualStyleBackColor = true; 154 | this.button6.Click += new System.EventHandler(this.button6_Click); 155 | // 156 | // button2 157 | // 158 | this.button2.Location = new System.Drawing.Point(84, 34); 159 | this.button2.Name = "button2"; 160 | this.button2.Size = new System.Drawing.Size(60, 23); 161 | this.button2.TabIndex = 8; 162 | this.button2.Text = "Edit"; 163 | this.button2.UseVisualStyleBackColor = true; 164 | this.button2.Click += new System.EventHandler(this.button2_Click); 165 | // 166 | // checkBox1 167 | // 168 | this.checkBox1.AutoSize = true; 169 | this.checkBox1.Location = new System.Drawing.Point(6, 19); 170 | this.checkBox1.Name = "checkBox1"; 171 | this.checkBox1.Size = new System.Drawing.Size(127, 17); 172 | this.checkBox1.TabIndex = 12; 173 | this.checkBox1.Text = "Use voice synthetizer"; 174 | this.checkBox1.UseVisualStyleBackColor = true; 175 | this.checkBox1.CheckedChanged += new System.EventHandler(this.checkBox1_CheckedChanged); 176 | // 177 | // richTextBox1 178 | // 179 | this.richTextBox1.Location = new System.Drawing.Point(6, 42); 180 | this.richTextBox1.Name = "richTextBox1"; 181 | this.richTextBox1.Size = new System.Drawing.Size(276, 92); 182 | this.richTextBox1.TabIndex = 13; 183 | this.richTextBox1.Text = ""; 184 | this.richTextBox1.TextChanged += new System.EventHandler(this.richTextBox1_TextChanged); 185 | // 186 | // groupBox4 187 | // 188 | this.groupBox4.Controls.Add(this.textBox2); 189 | this.groupBox4.Controls.Add(this.button9); 190 | this.groupBox4.Controls.Add(this.checkBox2); 191 | this.groupBox4.Controls.Add(this.checkBox1); 192 | this.groupBox4.Controls.Add(this.richTextBox1); 193 | this.groupBox4.Location = new System.Drawing.Point(298, 12); 194 | this.groupBox4.Name = "groupBox4"; 195 | this.groupBox4.Size = new System.Drawing.Size(288, 298); 196 | this.groupBox4.TabIndex = 14; 197 | this.groupBox4.TabStop = false; 198 | this.groupBox4.Text = "Command answering"; 199 | this.groupBox4.Enter += new System.EventHandler(this.groupBox4_Enter); 200 | // 201 | // textBox2 202 | // 203 | this.textBox2.Location = new System.Drawing.Point(7, 195); 204 | this.textBox2.Name = "textBox2"; 205 | this.textBox2.Size = new System.Drawing.Size(275, 20); 206 | this.textBox2.TabIndex = 17; 207 | this.textBox2.TextChanged += new System.EventHandler(this.textBox2_TextChanged); 208 | // 209 | // button9 210 | // 211 | this.button9.Location = new System.Drawing.Point(7, 165); 212 | this.button9.Name = "button9"; 213 | this.button9.Size = new System.Drawing.Size(71, 23); 214 | this.button9.TabIndex = 16; 215 | this.button9.Text = "Rechercher"; 216 | this.button9.UseVisualStyleBackColor = true; 217 | this.button9.Click += new System.EventHandler(this.button9_Click); 218 | // 219 | // checkBox2 220 | // 221 | this.checkBox2.AutoSize = true; 222 | this.checkBox2.Location = new System.Drawing.Point(7, 141); 223 | this.checkBox2.Name = "checkBox2"; 224 | this.checkBox2.Size = new System.Drawing.Size(122, 17); 225 | this.checkBox2.TabIndex = 14; 226 | this.checkBox2.Text = "Use sound file (wav)"; 227 | this.checkBox2.UseVisualStyleBackColor = true; 228 | this.checkBox2.CheckedChanged += new System.EventHandler(this.checkBox2_CheckedChanged); 229 | // 230 | // FormCommand 231 | // 232 | this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F); 233 | this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; 234 | this.ClientSize = new System.Drawing.Size(598, 349); 235 | this.Controls.Add(this.groupBox4); 236 | this.Controls.Add(this.groupBox2); 237 | this.Controls.Add(this.groupBox1); 238 | this.Controls.Add(this.button5); 239 | this.Controls.Add(this.button4); 240 | this.Name = "FormCommand"; 241 | this.Text = "New Command"; 242 | this.Load += new System.EventHandler(this.FormPopup_Load); 243 | this.groupBox1.ResumeLayout(false); 244 | this.groupBox1.PerformLayout(); 245 | this.groupBox2.ResumeLayout(false); 246 | this.groupBox4.ResumeLayout(false); 247 | this.groupBox4.PerformLayout(); 248 | this.ResumeLayout(false); 249 | 250 | } 251 | 252 | #endregion 253 | 254 | private System.Windows.Forms.TextBox textBox1; 255 | private System.Windows.Forms.ListBox listBox1; 256 | private System.Windows.Forms.Button button1; 257 | private System.Windows.Forms.Button button3; 258 | private System.Windows.Forms.Button button4; 259 | private System.Windows.Forms.Button button5; 260 | private System.Windows.Forms.GroupBox groupBox1; 261 | private System.Windows.Forms.GroupBox groupBox2; 262 | private System.Windows.Forms.Button button2; 263 | private System.Windows.Forms.Button button7; 264 | private System.Windows.Forms.Button button6; 265 | private System.Windows.Forms.CheckBox checkBox1; 266 | private System.Windows.Forms.RichTextBox richTextBox1; 267 | private System.Windows.Forms.GroupBox groupBox4; 268 | private System.Windows.Forms.CheckBox checkBox2; 269 | private System.Windows.Forms.TextBox textBox2; 270 | private System.Windows.Forms.Button button9; 271 | } 272 | } -------------------------------------------------------------------------------- /Vocals/Form1.Designer.cs: -------------------------------------------------------------------------------- 1 | namespace Vocals 2 | { 3 | partial class Form1 4 | { 5 | /// 6 | /// Variable nécessaire au concepteur. 7 | /// 8 | private System.ComponentModel.IContainer components = null; 9 | 10 | /// 11 | /// Nettoyage des ressources utilisées. 12 | /// 13 | /// true si les ressources managées doivent être supprimées ; sinon, false. 14 | protected override void Dispose(bool disposing) 15 | { 16 | if (disposing && (components != null)) 17 | { 18 | components.Dispose(); 19 | } 20 | base.Dispose(disposing); 21 | } 22 | 23 | #region Code généré par le Concepteur Windows Form 24 | 25 | /// 26 | /// Méthode requise pour la prise en charge du concepteur - ne modifiez pas 27 | /// le contenu de cette méthode avec l'éditeur de code. 28 | /// 29 | private void InitializeComponent() 30 | { 31 | this.components = new System.ComponentModel.Container(); 32 | System.ComponentModel.ComponentResourceManager resources = new System.ComponentModel.ComponentResourceManager(typeof(Form1)); 33 | this.imageList1 = new System.Windows.Forms.ImageList(this.components); 34 | this.comboBox1 = new System.Windows.Forms.ComboBox(); 35 | this.button1 = new System.Windows.Forms.Button(); 36 | this.comboBox2 = new System.Windows.Forms.ComboBox(); 37 | this.button2 = new System.Windows.Forms.Button(); 38 | this.listBox1 = new System.Windows.Forms.ListBox(); 39 | this.button3 = new System.Windows.Forms.Button(); 40 | this.button4 = new System.Windows.Forms.Button(); 41 | this.groupBox1 = new System.Windows.Forms.GroupBox(); 42 | this.groupBox2 = new System.Windows.Forms.GroupBox(); 43 | this.button5 = new System.Windows.Forms.Button(); 44 | this.groupBox4 = new System.Windows.Forms.GroupBox(); 45 | this.button6 = new System.Windows.Forms.Button(); 46 | this.groupBox3 = new System.Windows.Forms.GroupBox(); 47 | this.progressBar1 = new System.Windows.Forms.ProgressBar(); 48 | this.richTextBox1 = new System.Windows.Forms.RichTextBox(); 49 | this.advancedSettingsToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem(); 50 | this.menuStrip1 = new System.Windows.Forms.MenuStrip(); 51 | this.groupBox1.SuspendLayout(); 52 | this.groupBox2.SuspendLayout(); 53 | this.groupBox4.SuspendLayout(); 54 | this.groupBox3.SuspendLayout(); 55 | this.menuStrip1.SuspendLayout(); 56 | this.SuspendLayout(); 57 | // 58 | // imageList1 59 | // 60 | this.imageList1.ColorDepth = System.Windows.Forms.ColorDepth.Depth8Bit; 61 | this.imageList1.ImageSize = new System.Drawing.Size(16, 16); 62 | this.imageList1.TransparentColor = System.Drawing.Color.Transparent; 63 | // 64 | // comboBox1 65 | // 66 | this.comboBox1.DropDownStyle = System.Windows.Forms.ComboBoxStyle.DropDownList; 67 | this.comboBox1.FormattingEnabled = true; 68 | this.comboBox1.Location = new System.Drawing.Point(29, 38); 69 | this.comboBox1.Name = "comboBox1"; 70 | this.comboBox1.Size = new System.Drawing.Size(187, 21); 71 | this.comboBox1.TabIndex = 1; 72 | this.comboBox1.SelectedIndexChanged += new System.EventHandler(this.comboBox1_SelectedIndexChanged); 73 | // 74 | // button1 75 | // 76 | this.button1.Location = new System.Drawing.Point(29, 19); 77 | this.button1.Name = "button1"; 78 | this.button1.Size = new System.Drawing.Size(70, 23); 79 | this.button1.TabIndex = 4; 80 | this.button1.Text = "Add"; 81 | this.button1.UseVisualStyleBackColor = true; 82 | this.button1.Click += new System.EventHandler(this.button1_Click); 83 | // 84 | // comboBox2 85 | // 86 | this.comboBox2.DropDownStyle = System.Windows.Forms.ComboBoxStyle.DropDownList; 87 | this.comboBox2.FormattingEnabled = true; 88 | this.comboBox2.Location = new System.Drawing.Point(29, 52); 89 | this.comboBox2.Name = "comboBox2"; 90 | this.comboBox2.Size = new System.Drawing.Size(226, 21); 91 | this.comboBox2.TabIndex = 5; 92 | this.comboBox2.SelectedIndexChanged += new System.EventHandler(this.comboBox2_SelectedIndexChanged); 93 | // 94 | // button2 95 | // 96 | this.button2.Location = new System.Drawing.Point(29, 23); 97 | this.button2.Name = "button2"; 98 | this.button2.Size = new System.Drawing.Size(98, 23); 99 | this.button2.TabIndex = 7; 100 | this.button2.Text = "Add profile"; 101 | this.button2.UseVisualStyleBackColor = true; 102 | this.button2.Click += new System.EventHandler(this.button2_Click); 103 | // 104 | // listBox1 105 | // 106 | this.listBox1.FormattingEnabled = true; 107 | this.listBox1.Location = new System.Drawing.Point(29, 48); 108 | this.listBox1.Name = "listBox1"; 109 | this.listBox1.Size = new System.Drawing.Size(226, 134); 110 | this.listBox1.TabIndex = 8; 111 | this.listBox1.SelectedIndexChanged += new System.EventHandler(this.listBox1_SelectedIndexChanged); 112 | // 113 | // button3 114 | // 115 | this.button3.Location = new System.Drawing.Point(151, 23); 116 | this.button3.Name = "button3"; 117 | this.button3.Size = new System.Drawing.Size(104, 23); 118 | this.button3.TabIndex = 10; 119 | this.button3.Text = "Delete profile"; 120 | this.button3.UseVisualStyleBackColor = true; 121 | this.button3.Click += new System.EventHandler(this.button3_Click); 122 | // 123 | // button4 124 | // 125 | this.button4.Location = new System.Drawing.Point(185, 19); 126 | this.button4.Name = "button4"; 127 | this.button4.Size = new System.Drawing.Size(70, 23); 128 | this.button4.TabIndex = 11; 129 | this.button4.Text = "Delete"; 130 | this.button4.UseVisualStyleBackColor = true; 131 | this.button4.Click += new System.EventHandler(this.button4_Click); 132 | // 133 | // groupBox1 134 | // 135 | this.groupBox1.Controls.Add(this.button2); 136 | this.groupBox1.Controls.Add(this.button3); 137 | this.groupBox1.Controls.Add(this.comboBox2); 138 | this.groupBox1.Location = new System.Drawing.Point(12, 27); 139 | this.groupBox1.Name = "groupBox1"; 140 | this.groupBox1.Size = new System.Drawing.Size(277, 83); 141 | this.groupBox1.TabIndex = 12; 142 | this.groupBox1.TabStop = false; 143 | this.groupBox1.Text = "Profiles"; 144 | // 145 | // groupBox2 146 | // 147 | this.groupBox2.Controls.Add(this.button5); 148 | this.groupBox2.Controls.Add(this.listBox1); 149 | this.groupBox2.Controls.Add(this.button4); 150 | this.groupBox2.Controls.Add(this.button1); 151 | this.groupBox2.Location = new System.Drawing.Point(307, 27); 152 | this.groupBox2.Name = "groupBox2"; 153 | this.groupBox2.Size = new System.Drawing.Size(277, 190); 154 | this.groupBox2.TabIndex = 13; 155 | this.groupBox2.TabStop = false; 156 | this.groupBox2.Text = "Commands "; 157 | this.groupBox2.Enter += new System.EventHandler(this.groupBox2_Enter); 158 | // 159 | // button5 160 | // 161 | this.button5.Location = new System.Drawing.Point(107, 19); 162 | this.button5.Name = "button5"; 163 | this.button5.Size = new System.Drawing.Size(70, 23); 164 | this.button5.TabIndex = 12; 165 | this.button5.Text = "Edit"; 166 | this.button5.UseVisualStyleBackColor = true; 167 | this.button5.Click += new System.EventHandler(this.button5_Click_1); 168 | // 169 | // groupBox4 170 | // 171 | this.groupBox4.Controls.Add(this.button6); 172 | this.groupBox4.Controls.Add(this.comboBox1); 173 | this.groupBox4.Location = new System.Drawing.Point(12, 123); 174 | this.groupBox4.Name = "groupBox4"; 175 | this.groupBox4.Size = new System.Drawing.Size(277, 94); 176 | this.groupBox4.TabIndex = 15; 177 | this.groupBox4.TabStop = false; 178 | this.groupBox4.Text = "Application"; 179 | this.groupBox4.Enter += new System.EventHandler(this.groupBox4_Enter); 180 | // 181 | // button6 182 | // 183 | this.button6.Location = new System.Drawing.Point(222, 38); 184 | this.button6.Name = "button6"; 185 | this.button6.Size = new System.Drawing.Size(33, 23); 186 | this.button6.TabIndex = 2; 187 | this.button6.Text = "#"; 188 | this.button6.UseVisualStyleBackColor = true; 189 | this.button6.Click += new System.EventHandler(this.button6_Click); 190 | // 191 | // groupBox3 192 | // 193 | this.groupBox3.Controls.Add(this.progressBar1); 194 | this.groupBox3.Controls.Add(this.richTextBox1); 195 | this.groupBox3.Location = new System.Drawing.Point(12, 223); 196 | this.groupBox3.Name = "groupBox3"; 197 | this.groupBox3.Size = new System.Drawing.Size(572, 217); 198 | this.groupBox3.TabIndex = 16; 199 | this.groupBox3.TabStop = false; 200 | this.groupBox3.Text = "logs"; 201 | this.groupBox3.Enter += new System.EventHandler(this.groupBox3_Enter); 202 | // 203 | // progressBar1 204 | // 205 | this.progressBar1.Location = new System.Drawing.Point(7, 19); 206 | this.progressBar1.Name = "progressBar1"; 207 | this.progressBar1.Size = new System.Drawing.Size(543, 11); 208 | this.progressBar1.Step = 11; 209 | this.progressBar1.TabIndex = 1; 210 | // 211 | // richTextBox1 212 | // 213 | this.richTextBox1.Location = new System.Drawing.Point(6, 36); 214 | this.richTextBox1.Name = "richTextBox1"; 215 | this.richTextBox1.ReadOnly = true; 216 | this.richTextBox1.Size = new System.Drawing.Size(544, 175); 217 | this.richTextBox1.TabIndex = 0; 218 | this.richTextBox1.Text = ""; 219 | // 220 | // advancedSettingsToolStripMenuItem 221 | // 222 | this.advancedSettingsToolStripMenuItem.Name = "advancedSettingsToolStripMenuItem"; 223 | this.advancedSettingsToolStripMenuItem.Size = new System.Drawing.Size(117, 20); 224 | this.advancedSettingsToolStripMenuItem.Text = "Advanced Settings"; 225 | this.advancedSettingsToolStripMenuItem.Click += new System.EventHandler(this.advancedSettingsToolStripMenuItem_Click); 226 | // 227 | // menuStrip1 228 | // 229 | this.menuStrip1.Items.AddRange(new System.Windows.Forms.ToolStripItem[] { 230 | this.advancedSettingsToolStripMenuItem}); 231 | this.menuStrip1.Location = new System.Drawing.Point(0, 0); 232 | this.menuStrip1.Name = "menuStrip1"; 233 | this.menuStrip1.Size = new System.Drawing.Size(597, 24); 234 | this.menuStrip1.TabIndex = 17; 235 | this.menuStrip1.Text = "menuStrip1"; 236 | this.menuStrip1.ItemClicked += new System.Windows.Forms.ToolStripItemClickedEventHandler(this.menuStrip1_ItemClicked); 237 | // 238 | // Form1 239 | // 240 | this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F); 241 | this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; 242 | this.ClientSize = new System.Drawing.Size(597, 454); 243 | this.Controls.Add(this.groupBox3); 244 | this.Controls.Add(this.groupBox4); 245 | this.Controls.Add(this.groupBox2); 246 | this.Controls.Add(this.groupBox1); 247 | this.Controls.Add(this.menuStrip1); 248 | this.Icon = ((System.Drawing.Icon)(resources.GetObject("$this.Icon"))); 249 | this.MainMenuStrip = this.menuStrip1; 250 | this.Name = "Form1"; 251 | this.Text = "Vocals"; 252 | this.FormClosing += new System.Windows.Forms.FormClosingEventHandler(this.Form1_FormClosing); 253 | this.Load += new System.EventHandler(this.Form1_Load); 254 | this.groupBox1.ResumeLayout(false); 255 | this.groupBox2.ResumeLayout(false); 256 | this.groupBox4.ResumeLayout(false); 257 | this.groupBox3.ResumeLayout(false); 258 | this.menuStrip1.ResumeLayout(false); 259 | this.menuStrip1.PerformLayout(); 260 | this.ResumeLayout(false); 261 | this.PerformLayout(); 262 | 263 | } 264 | 265 | #endregion 266 | 267 | private System.Windows.Forms.ImageList imageList1; 268 | private System.Windows.Forms.ComboBox comboBox1; 269 | private System.Windows.Forms.Button button1; 270 | private System.Windows.Forms.ComboBox comboBox2; 271 | private System.Windows.Forms.Button button2; 272 | private System.Windows.Forms.ListBox listBox1; 273 | private System.Windows.Forms.Button button3; 274 | private System.Windows.Forms.Button button4; 275 | private System.Windows.Forms.GroupBox groupBox1; 276 | private System.Windows.Forms.GroupBox groupBox2; 277 | private System.Windows.Forms.GroupBox groupBox4; 278 | private System.Windows.Forms.GroupBox groupBox3; 279 | private System.Windows.Forms.RichTextBox richTextBox1; 280 | private System.Windows.Forms.Button button5; 281 | private System.Windows.Forms.ToolStripMenuItem advancedSettingsToolStripMenuItem; 282 | private System.Windows.Forms.MenuStrip menuStrip1; 283 | private System.Windows.Forms.ProgressBar progressBar1; 284 | private System.Windows.Forms.Button button6; 285 | } 286 | } 287 | 288 | -------------------------------------------------------------------------------- /Vocals/Form1.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.ComponentModel; 4 | using System.Data; 5 | using System.Drawing; 6 | using System.Linq; 7 | using System.Text; 8 | using System.Threading.Tasks; 9 | using System.Windows.Forms; 10 | using System.Management; 11 | using System.Speech.Recognition; 12 | using System.Speech.Synthesis; 13 | using System.Runtime.InteropServices; 14 | using System.Diagnostics; 15 | using System.IO; 16 | using Microsoft.Win32; 17 | using Vocals.InternalClasses; 18 | using System.Xml.Serialization; 19 | 20 | 21 | //TODO Corriger 9/PGUP 22 | //TODO : Retour mp3 23 | //TODO : Resize 24 | //TODO : Add random phrases 25 | //TODO : Add listen to worda 26 | 27 | namespace Vocals { 28 | public partial class Form1 : Form { 29 | 30 | protected delegate bool EnumWindowsProc(IntPtr hWnd, IntPtr lParam); 31 | [DllImport("user32.dll", CharSet = CharSet.Unicode)] 32 | protected static extern int GetWindowText(IntPtr hWnd, StringBuilder strText, int maxCount); 33 | [DllImport("user32.dll", CharSet = CharSet.Unicode)] 34 | protected static extern int GetWindowTextLength(IntPtr hWnd); 35 | [DllImport("user32.dll")] 36 | protected static extern bool EnumWindows(EnumWindowsProc enumProc, IntPtr lParam); 37 | [DllImport("user32.dll")] 38 | protected static extern bool IsWindowVisible(IntPtr hWnd); 39 | 40 | List myWindows; 41 | List profileList; 42 | IntPtr winPointer; 43 | 44 | SpeechRecognitionEngine speechEngine; 45 | 46 | Options currentOptions; 47 | 48 | private GlobalHotkey ghk; 49 | 50 | bool listening = false; 51 | 52 | public Form1() { 53 | currentOptions = new Options(); 54 | 55 | InitializeComponent(); 56 | initialyzeSpeechEngine(); 57 | 58 | myWindows = new List(); 59 | refreshProcessesList(); 60 | 61 | 62 | fetchProfiles(); 63 | 64 | 65 | 66 | ghk = new GlobalHotkey(0x0004, Keys.None, this); 67 | 68 | System.Reflection.Assembly assembly = System.Reflection.Assembly.GetExecutingAssembly(); 69 | System.Reflection.AssemblyName assemblyName = assembly.GetName(); 70 | Version version = assemblyName.Version; 71 | this.Text += " version : " + version.ToString(); 72 | 73 | refreshSettings(); 74 | 75 | } 76 | 77 | public void handleHookedKeypress() { 78 | if (listening == false) { 79 | if (speechEngine.Grammars.Count > 0) { 80 | speechEngine.RecognizeAsync(RecognizeMode.Multiple); 81 | SpeechSynthesizer synth = new SpeechSynthesizer(); 82 | synth.SpeakAsync(currentOptions.answer); 83 | listening = !listening; 84 | } 85 | 86 | } 87 | else { 88 | if (speechEngine.Grammars.Count > 0) { 89 | speechEngine.RecognizeAsyncCancel(); 90 | SpeechSynthesizer synth = new SpeechSynthesizer(); 91 | synth.SpeakAsync(currentOptions.answer); 92 | listening = !listening; 93 | } 94 | } 95 | } 96 | 97 | protected override void WndProc(ref Message m) { 98 | if (m.Msg == 0x0312) { 99 | handleHookedKeypress(); 100 | } 101 | base.WndProc(ref m); 102 | } 103 | 104 | public void refreshProcessesList() { 105 | EnumWindows(new EnumWindowsProc(EnumTheWindows), IntPtr.Zero); 106 | comboBox1.DataSource = null; 107 | comboBox1.DataSource = myWindows; 108 | 109 | } 110 | 111 | void fetchProfiles() { 112 | string dir = @""; 113 | string serializationFile = Path.Combine(dir, "profiles.vd"); 114 | string xmlSerializationFile = Path.Combine(dir, "profiles_xml.vc"); 115 | try { 116 | Stream xmlStream = File.Open(xmlSerializationFile, FileMode.Open); 117 | XmlSerializer reader = new XmlSerializer(typeof(List)); 118 | profileList = (List)reader.Deserialize(xmlStream); 119 | xmlStream.Close(); 120 | } 121 | catch { 122 | try { 123 | Stream stream = File.Open(serializationFile, FileMode.Open); 124 | var bformatter = new System.Runtime.Serialization.Formatters.Binary.BinaryFormatter(); 125 | profileList = (List)(bformatter.Deserialize(stream)); 126 | stream.Close(); 127 | 128 | 129 | } 130 | catch { 131 | profileList = new List(); 132 | } 133 | } 134 | comboBox2.DataSource = profileList; 135 | } 136 | 137 | private static void Get45or451FromRegistry() { 138 | using (RegistryKey ndpKey = RegistryKey.OpenBaseKey(RegistryHive.LocalMachine, 139 | RegistryView.Registry32).OpenSubKey(@"SOFTWARE\Microsoft\NET Framework Setup\NDP\v4\Full\")) { 140 | int releaseKey = (int)ndpKey.GetValue("Release"); 141 | { 142 | if (releaseKey == 378389) 143 | 144 | Console.WriteLine("The .NET Framework version 4.5 is installed"); 145 | 146 | if (releaseKey == 378758) 147 | 148 | Console.WriteLine("The .NET Framework version 4.5.1 is installed"); 149 | 150 | } 151 | } 152 | } 153 | 154 | private void Form1_Load(object sender, EventArgs e) { 155 | Get45or451FromRegistry(); 156 | 157 | } 158 | 159 | void initialyzeSpeechEngine() { 160 | richTextBox1.AppendText("Starting Speech Recognition Engine \n"); 161 | RecognizerInfo info = null; 162 | 163 | //Use system locale language if no language option can be retrieved 164 | if (currentOptions.language == null) { 165 | currentOptions.language = System.Globalization.CultureInfo.CurrentUICulture.DisplayName; 166 | } 167 | 168 | foreach (RecognizerInfo ri in SpeechRecognitionEngine.InstalledRecognizers()) { 169 | if(ri.Culture.DisplayName.Equals(currentOptions.language)) { 170 | info = ri; 171 | break; 172 | } 173 | } 174 | 175 | if (info == null && SpeechRecognitionEngine.InstalledRecognizers().Count != 0) { 176 | RecognizerInfo ri = SpeechRecognitionEngine.InstalledRecognizers()[0]; 177 | info = ri; 178 | } 179 | 180 | if (info != null){ 181 | richTextBox1.AppendText("Setting VR engine language to " + info.Culture.DisplayName + "\n"); 182 | } else { 183 | richTextBox1.AppendText("Could not find any installed recognizers\n"); 184 | richTextBox1.AppendText("Trying to find a fix right now for this specific error\n"); 185 | return; 186 | } 187 | speechEngine = new SpeechRecognitionEngine(info); 188 | speechEngine.SpeechRecognized += new EventHandler(sr_speechRecognized); 189 | speechEngine.AudioLevelUpdated += new EventHandler(sr_audioLevelUpdated); 190 | 191 | try { 192 | speechEngine.SetInputToDefaultAudioDevice(); 193 | } 194 | catch (InvalidOperationException ioe) { 195 | richTextBox1.AppendText("No microphone were found\n"); 196 | } 197 | 198 | speechEngine.MaxAlternates = 3; 199 | 200 | 201 | } 202 | 203 | void sr_audioLevelUpdated(object sender, AudioLevelUpdatedEventArgs e) { 204 | if (speechEngine != null) { 205 | int val = (int)(10*Math.Sqrt(e.AudioLevel)); 206 | this.progressBar1.Value = val; 207 | } 208 | } 209 | 210 | 211 | 212 | void sr_speechRecognized(object sender, SpeechRecognizedEventArgs e) { 213 | 214 | richTextBox1.AppendText("Commande reconnue \"" + e.Result.Text + "\" with confidence of : " + e.Result.Confidence + "\n"); 215 | 216 | Profile p = (Profile)comboBox2.SelectedItem; 217 | 218 | if (p != null) { 219 | foreach (Command c in p.commandList) { 220 | string[] multiCommands = c.commandString.Split(';'); 221 | foreach (string s in multiCommands) { 222 | string correctedWord = s.Trim().ToLower(); 223 | if (correctedWord.Equals(e.Result.Text)) { 224 | c.perform(winPointer); 225 | break; 226 | } 227 | } 228 | } 229 | } 230 | 231 | } 232 | 233 | 234 | 235 | protected bool EnumTheWindows(IntPtr hWnd, IntPtr lParam) { 236 | int size = GetWindowTextLength(hWnd); 237 | if (size++ > 0 && IsWindowVisible(hWnd)) { 238 | StringBuilder sb = new StringBuilder(size); 239 | GetWindowText(hWnd, sb, size); 240 | myWindows.Add(sb.ToString()); 241 | } 242 | return true; 243 | } 244 | 245 | 246 | private void textBox1_TextChanged(object sender, EventArgs e) { 247 | 248 | } 249 | 250 | void createNewProfile() { 251 | FormNewProfile formNewProfile = new FormNewProfile(); 252 | formNewProfile.ShowDialog(); 253 | string profileName = formNewProfile.profileName; 254 | if (profileName != "") { 255 | Profile p = new Profile(profileName); 256 | profileList.Add(p); 257 | comboBox2.DataSource = null; 258 | comboBox2.DataSource = profileList; 259 | comboBox2.SelectedItem = p; 260 | } 261 | } 262 | 263 | private void button2_Click(object sender, EventArgs e) { 264 | createNewProfile(); 265 | } 266 | 267 | private void comboBox2_SelectedIndexChanged(object sender, EventArgs e) { 268 | if (speechEngine != null) { 269 | speechEngine.RecognizeAsyncCancel(); 270 | listening = false; 271 | } 272 | 273 | Profile p = (Profile)comboBox2.SelectedItem; 274 | if (p != null) { 275 | refreshProfile(p); 276 | 277 | listBox1.DataSource = null; 278 | listBox1.DataSource = p.commandList; 279 | 280 | if (speechEngine.Grammars.Count != 0) { 281 | speechEngine.RecognizeAsync(RecognizeMode.Multiple); 282 | listening = true; 283 | } 284 | } 285 | } 286 | 287 | void refreshProfile(Profile p) { 288 | if (p.commandList.Count != 0) { 289 | Choices myWordChoices = new Choices(); 290 | 291 | foreach (Command c in p.commandList) { 292 | string[] commandList = c.commandString.Split(';'); 293 | foreach (string s in commandList) { 294 | string correctedWord; 295 | correctedWord = s.Trim().ToLower(); 296 | if (correctedWord != null && correctedWord != "") { 297 | myWordChoices.Add(correctedWord); 298 | } 299 | } 300 | } 301 | 302 | GrammarBuilder builder = new GrammarBuilder(); 303 | builder.Append(myWordChoices); 304 | Grammar mygram = new Grammar(builder); 305 | 306 | 307 | speechEngine.UnloadAllGrammars(); 308 | speechEngine.LoadGrammar(mygram); 309 | 310 | } 311 | else { 312 | speechEngine.UnloadAllGrammars(); 313 | } 314 | 315 | } 316 | 317 | private void button1_Click(object sender, EventArgs e) { 318 | try { 319 | if (speechEngine != null) { 320 | speechEngine.RecognizeAsyncCancel(); 321 | listening = false; 322 | 323 | FormCommand formCommand = new FormCommand(); 324 | formCommand.ShowDialog(); 325 | 326 | Profile p = (Profile)comboBox2.SelectedItem; 327 | 328 | if (p != null) { 329 | if (formCommand.commandString != null && formCommand.commandString != "" && formCommand.actionList.Count != 0) { 330 | Command c; 331 | c = new Command(formCommand.commandString, formCommand.actionList, formCommand.answering, formCommand.answeringString, formCommand.answeringSound, formCommand.answeringSoundPath); 332 | p.addCommand(c); 333 | listBox1.DataSource = null; 334 | listBox1.DataSource = p.commandList; 335 | } 336 | refreshProfile(p); 337 | } 338 | 339 | if (speechEngine.Grammars.Count != 0) { 340 | speechEngine.RecognizeAsync(RecognizeMode.Multiple); 341 | listening = true; 342 | } 343 | } 344 | } 345 | catch (Exception ex) { 346 | Console.WriteLine(ex.Message); 347 | } 348 | } 349 | 350 | private void comboBox1_SelectedIndexChanged(object sender, EventArgs e) { 351 | Process[] pTab = Process.GetProcesses(); 352 | for (int i = 0; i < pTab.Length; i++) { 353 | if (pTab[i] != null && comboBox1.SelectedItem != null) { 354 | if (pTab[i].MainWindowTitle.Equals(comboBox1.SelectedItem.ToString())) { 355 | winPointer = pTab[i].MainWindowHandle; 356 | } 357 | } 358 | } 359 | } 360 | 361 | private void label1_Click(object sender, EventArgs e) { 362 | 363 | } 364 | 365 | private void listBox1_SelectedIndexChanged(object sender, EventArgs e) { 366 | 367 | } 368 | 369 | private void button3_Click(object sender, EventArgs e) { 370 | Profile p = (Profile)(comboBox2.SelectedItem); 371 | profileList.Remove(p); 372 | comboBox2.DataSource = null; 373 | comboBox2.DataSource = profileList; 374 | 375 | if (profileList.Count == 0) { 376 | listBox1.DataSource = null; 377 | } 378 | else { 379 | comboBox2.SelectedItem = profileList[0]; 380 | refreshProfile((Profile)comboBox2.SelectedItem); 381 | } 382 | } 383 | 384 | 385 | 386 | private void Form1_FormClosing(object sender, FormClosingEventArgs e) { 387 | speechEngine.AudioLevelUpdated -= new EventHandler(sr_audioLevelUpdated); 388 | speechEngine.SpeechRecognized -= new EventHandler(sr_speechRecognized); 389 | 390 | string dir = @""; 391 | string serializationFile = Path.Combine(dir, "profiles.vd"); 392 | string xmlSerializationFile = Path.Combine(dir, "profiles_xml.vc"); 393 | try { 394 | Stream stream = File.Open(serializationFile, FileMode.Create); 395 | var bformatter = new System.Runtime.Serialization.Formatters.Binary.BinaryFormatter(); 396 | bformatter.Serialize(stream, profileList); 397 | stream.Close(); 398 | 399 | try { 400 | Stream xmlStream = File.Open(xmlSerializationFile, FileMode.Create); 401 | System.Xml.Serialization.XmlSerializer writer = new System.Xml.Serialization.XmlSerializer(typeof(List)); 402 | writer.Serialize(xmlStream, profileList); 403 | xmlStream.Close(); 404 | } 405 | catch (Exception ex) { 406 | DialogResult res = MessageBox.Show("Le fichier profiles_xml.vc est en cours d'utilisation par un autre processus. Voulez vous quitter sans sauvegarder ?", "Impossible de sauvegarder", MessageBoxButtons.YesNo, MessageBoxIcon.Question, MessageBoxDefaultButton.Button1); 407 | if (res == DialogResult.No) { 408 | e.Cancel = true; 409 | } 410 | } 411 | 412 | } 413 | catch (Exception exception) { 414 | DialogResult res = MessageBox.Show("Le fichier profiles.vd est en cours d'utilisation par un autre processus. Voulez vous quitter sans sauvegarder ?", "Impossible de sauvegarder", MessageBoxButtons.YesNo, MessageBoxIcon.Question, MessageBoxDefaultButton.Button1); 415 | if (res == DialogResult.No) { 416 | e.Cancel = true; 417 | } 418 | } 419 | 420 | 421 | } 422 | 423 | private void button4_Click(object sender, EventArgs e) { 424 | Profile p = (Profile)(comboBox2.SelectedItem); 425 | if (p != null) { 426 | Command c = (Command)listBox1.SelectedItem; 427 | if (c != null) { 428 | if (speechEngine != null) { 429 | speechEngine.RecognizeAsyncCancel(); 430 | listening = false; 431 | p.commandList.Remove(c); 432 | listBox1.DataSource = null; 433 | listBox1.DataSource = p.commandList; 434 | 435 | refreshProfile(p); 436 | 437 | if (speechEngine.Grammars.Count != 0) { 438 | speechEngine.RecognizeAsync(RecognizeMode.Multiple); 439 | listening = true; 440 | } 441 | } 442 | 443 | } 444 | } 445 | } 446 | 447 | private void button5_Click(object sender, EventArgs e) { 448 | myWindows.Clear(); 449 | } 450 | 451 | private void groupBox2_Enter(object sender, EventArgs e) { 452 | 453 | } 454 | 455 | private void groupBox4_Enter(object sender, EventArgs e) { 456 | 457 | } 458 | 459 | private void button5_Click_1(object sender, EventArgs e) { 460 | try { 461 | if (speechEngine != null) { 462 | speechEngine.RecognizeAsyncCancel(); 463 | listening = false; 464 | 465 | 466 | Command c = (Command)listBox1.SelectedItem; 467 | if (c != null) { 468 | FormCommand formCommand = new FormCommand(c); 469 | formCommand.ShowDialog(); 470 | 471 | Profile p = (Profile)comboBox2.SelectedItem; 472 | 473 | 474 | if (p != null) { 475 | if (formCommand.commandString != "" && formCommand.actionList.Count != 0) { 476 | 477 | c.commandString = formCommand.commandString; 478 | c.actionList = formCommand.actionList; 479 | c.answering = formCommand.answering; 480 | c.answeringString = formCommand.answeringString; 481 | c.answeringSound = formCommand.answeringSound; 482 | c.answeringSoundPath = formCommand.answeringSoundPath; 483 | 484 | if (c.answeringSoundPath == null) { 485 | c.answeringSoundPath = ""; 486 | } 487 | if (c.answeringString == null) { 488 | c.answeringString = ""; 489 | } 490 | 491 | 492 | listBox1.DataSource = null; 493 | listBox1.DataSource = p.commandList; 494 | } 495 | refreshProfile(p); 496 | } 497 | 498 | if (speechEngine.Grammars.Count != 0) { 499 | speechEngine.RecognizeAsync(RecognizeMode.Multiple); 500 | listening = true; 501 | } 502 | } 503 | 504 | } 505 | } 506 | catch (Exception ex) { 507 | Console.WriteLine(ex.Message); 508 | } 509 | 510 | } 511 | 512 | private void groupBox3_Enter(object sender, EventArgs e) { 513 | 514 | } 515 | 516 | 517 | 518 | private void advancedSettingsToolStripMenuItem_Click(object sender, EventArgs e) { 519 | FormOptions formOptions = new FormOptions(); 520 | formOptions.ShowDialog(); 521 | 522 | currentOptions = formOptions.opt; 523 | refreshSettings(); 524 | } 525 | 526 | private void refreshSettings() { 527 | applyModificationToGlobalHotKey(); 528 | applyToggleListening(); 529 | applyRecognitionSensibility(); 530 | currentOptions.save(); 531 | } 532 | 533 | private void applyModificationToGlobalHotKey() { 534 | if(currentOptions.key == Keys.Shift || 535 | currentOptions.key == Keys.ShiftKey || 536 | currentOptions.key == Keys.LShiftKey || 537 | currentOptions.key == Keys.RShiftKey) { 538 | ghk.modifyKey(0x0004, Keys.None); 539 | } 540 | else if(currentOptions.key == Keys.Control || 541 | currentOptions.key == Keys.ControlKey || 542 | currentOptions.key == Keys.LControlKey || 543 | currentOptions.key == Keys.RControlKey) { 544 | ghk.modifyKey(0x0002,Keys.None); 545 | 546 | } 547 | else if (currentOptions.key == Keys.Alt) { 548 | ghk.modifyKey(0x0002, Keys.None); 549 | } 550 | else { 551 | ghk.modifyKey(0x0000, currentOptions.key); 552 | } 553 | } 554 | 555 | private void applyToggleListening() { 556 | if (currentOptions.toggleListening) { 557 | try { 558 | ghk.register(); 559 | } 560 | catch { 561 | Console.WriteLine("Couldn't register key properly"); 562 | } 563 | } 564 | else { 565 | try { 566 | ghk.unregister(); 567 | } 568 | catch { 569 | Console.WriteLine("Couldn't unregister key properly"); 570 | } 571 | 572 | } 573 | } 574 | 575 | private void applyRecognitionSensibility() { 576 | if (speechEngine != null) { 577 | speechEngine.UpdateRecognizerSetting("CFGConfidenceRejectionThreshold", currentOptions.threshold ); 578 | } 579 | 580 | } 581 | 582 | private void checkBox1_CheckedChanged(object sender, EventArgs e) { 583 | 584 | } 585 | 586 | private void menuStrip1_ItemClicked(object sender, ToolStripItemClickedEventArgs e) { 587 | 588 | } 589 | 590 | private void button6_Click(object sender, EventArgs e) { 591 | myWindows.Clear(); 592 | refreshProcessesList(); 593 | } 594 | 595 | 596 | 597 | 598 | } 599 | } 600 | --------------------------------------------------------------------------------