Skip to content

Commit

Permalink
Merge pull request #8 from zxeltor/feature/adv_keystrokes
Browse files Browse the repository at this point in the history
Feature/adv keystrokes
  • Loading branch information
zxeltor authored Feb 1, 2022
2 parents 61c6750 + 4f3093a commit 62d6442
Show file tree
Hide file tree
Showing 26 changed files with 429 additions and 174 deletions.
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# Voice Command Interface ![GitHub release (latest by date)](https://img.shields.io/github/v/release/zxeltor/voice_command_interface)
# Voice Command Interface v4.2.0

![VCILogo](OrcYell.png?v17-10-2021)

Expand Down Expand Up @@ -83,7 +83,7 @@ With this enabled, the software will check for the latest version of Voice Comma
## Use with World of Warcraft
I started by adding spells and abilities to my actions bars, then setting keybinds to those spells and abilities. I used SHIFT+F1, CTRL+F1, and etc. I then created a voice recognition profile for WOW, and added voice commands to send keystrokes like SHIFT+F1, CTRL+F1, and etc to WOW.

![ProfileTab](ScreenShots/ProfilesTab.png?v17-10-2021)
![ProfileTab](ScreenShots/ProfileTab_WOW.png?v17-10-2021)
As an example from the above profile tab. When I say "engage bull rush", the SHIFT+F1 key combination is sent to WOW, and WOW responds by clicking the actionbar button I keybinded with SHIFT-F1.
## Disclaimer
This software and any related documentation is provided “as is” without warranty of any kind, either express or implied, including, without limitation, the implied warranties of merchantability, fitness for a particular purpose, or non-infringement. Licensee accepts any and all risk arising out of use or performance of Software.
Binary file modified ScreenShots/LogTab.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified ScreenShots/OptionsTab.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added ScreenShots/ProfileTab_WOW.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified ScreenShots/ProfilesTab.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified ScreenShots/StatusBar.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
12 changes: 6 additions & 6 deletions StarTrekNut.Setup/StarTrekNut.Setup.vdproj
Original file line number Diff line number Diff line change
Expand Up @@ -360,7 +360,7 @@
{
"AssemblyRegister" = "3:1"
"AssemblyIsInGAC" = "11:FALSE"
"AssemblyAsmDisplayName" = "8:StarTrekNut.VoiceCom.Lib, Version=3.4.0.0, Culture=neutral, processorArchitecture=MSIL"
"AssemblyAsmDisplayName" = "8:StarTrekNut.VoiceCom.Lib, Version=4.1.1.0, Culture=neutral, processorArchitecture=MSIL"
"ScatterAssemblies"
{
"_355AFC468F740E8EE23FFF77E182C093"
Expand Down Expand Up @@ -422,7 +422,7 @@
{
"AssemblyRegister" = "3:1"
"AssemblyIsInGAC" = "11:FALSE"
"AssemblyAsmDisplayName" = "8:StarTrekNut.Utils, Version=3.4.0.0, Culture=neutral, processorArchitecture=MSIL"
"AssemblyAsmDisplayName" = "8:StarTrekNut.Utils, Version=4.1.1.0, Culture=neutral, processorArchitecture=MSIL"
"ScatterAssemblies"
{
"_4773F708DAB9158916D4540A964D32F3"
Expand Down Expand Up @@ -742,15 +742,15 @@
{
"Name" = "8:Microsoft Visual Studio"
"ProductName" = "8:Voice Command Interface"
"ProductCode" = "8:{EBEAA4B1-58CA-411F-9CC0-40E30DFD6F4C}"
"PackageCode" = "8:{FC272ABD-734D-4EC5-90FD-6840BBBD297A}"
"ProductCode" = "8:{DD59695C-8AE2-4669-8C57-CF6087EB8947}"
"PackageCode" = "8:{F17848AD-0AAC-4F9C-A761-D78112B731E0}"
"UpgradeCode" = "8:{24F84DF6-EB76-4D4E-B0B1-DFAAF96671FD}"
"AspNetVersion" = "8:4.0.30319.0"
"RestartWWWService" = "11:FALSE"
"RemovePreviousVersions" = "11:TRUE"
"DetectNewerInstalledVersion" = "11:TRUE"
"InstallAllUsers" = "11:TRUE"
"ProductVersion" = "8:4.0.2"
"ProductVersion" = "8:4.2.0"
"Manufacturer" = "8:Zxeltor"
"ARPHELPTELEPHONE" = "8:"
"ARPHELPLINK" = "8:http://www.starfleet.engineer/projects"
Expand Down Expand Up @@ -1444,7 +1444,7 @@
{
"{5259A561-127C-4D43-A0A1-72F10C7B3BF8}:_5EF5CA91836A4F4FBA14487BE2A48F66"
{
"SourcePath" = "8:..\\StarTrekNut.VoiceCom.UI\\obj\\Release\\VoiceComInterface.exe"
"SourcePath" = "8:..\\StarTrekNut.VoiceCom.UI\\obj\\Debug\\VoiceComInterface.exe"
"TargetName" = "8:"
"Tag" = "8:"
"Folder" = "8:_0D1B3D90478B44C194D3973FE0002223"
Expand Down
4 changes: 2 additions & 2 deletions StarTrekNut.Utils/Properties/AssemblyInfo.cs
Original file line number Diff line number Diff line change
Expand Up @@ -32,5 +32,5 @@
// You can specify all the values or you can default the Build and Revision Numbers
// by using the '*' as shown below:
// [assembly: AssemblyVersion("1.0.*")]
[assembly: AssemblyVersion("4.0.2.0")]
[assembly: AssemblyFileVersion("4.0.2.0")]
[assembly: AssemblyVersion("4.2.0.0")]
[assembly: AssemblyFileVersion("4.2.0.0")]
20 changes: 20 additions & 0 deletions StarTrekNut.VoiceCom.Lib/Classes/SpeechProcRecognitionEventArgs.cs
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,8 @@ public class SpeechProcRecognitionEventArgs
{
#region Constructors and Destructors

private Model.LogEntryType _entryType = Model.LogEntryType.Info;

public SpeechProcRecognitionEventArgs()
{
}
Expand All @@ -20,10 +22,28 @@ public SpeechProcRecognitionEventArgs(string recognitionResult)
this.RecognitionResultText = recognitionResult;
}

public SpeechProcRecognitionEventArgs(string recognitionResult, Model.LogEntryType logEntryType)
{
this.RecognitionResultText = recognitionResult;
this.LogEntryType = logEntryType;
}

#endregion

#region Public Properties

public Model.LogEntryType LogEntryType
{
get
{
return this._entryType;
}
set
{
this._entryType = value;
}
}

/// <summary>
/// Message sent to the user window.
/// </summary>
Expand Down
30 changes: 30 additions & 0 deletions StarTrekNut.VoiceCom.Lib/Model/VoiceComSettings/KeyTainer.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace StarTrekNut.VoiceCom.Lib.Model.VoiceComSettings
{
public class KeyTainer : IEquatable<KeyTainer>
{
public System.Windows.Input.Key WindowsKey { get; private set; }
public Guid Id { get; set; }

public KeyTainer(System.Windows.Input.Key windowsKey)
{
this.WindowsKey = windowsKey;
Id = Guid.NewGuid();
}

public override string ToString()
{
return WindowsKey.ToString();
}

public bool Equals(KeyTainer other)
{
return this.Id.Equals(other.Id);
}
}
}
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
using System.Collections.Generic;
using System.Linq;
using System.Collections.Generic;
using System.ComponentModel;

namespace StarTrekNut.VoiceCom.Lib.Model.VoiceComSettings
Expand Down Expand Up @@ -66,5 +67,10 @@ private void NotifyPropertyChange(string propertyName)
}

#endregion

public override string ToString()
{
return $"{this.Enabled}|{this.Grammer}|{string.Join("+", this.KeyStrokes.ToList())}";
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,9 @@ public List<User> UserList
this.NotifyPropertyChange("UserList");
}
}

[XmlAttribute]
public string Version => "4.0.0.0";

[XmlIgnore]
public bool IsNewFile { get; set; }
Expand Down
4 changes: 2 additions & 2 deletions StarTrekNut.VoiceCom.Lib/Properties/AssemblyInfo.cs
Original file line number Diff line number Diff line change
Expand Up @@ -32,5 +32,5 @@
// You can specify all the values or you can default the Build and Revision Numbers
// by using the '*' as shown below:
// [assembly: AssemblyVersion("1.0.*")]
[assembly: AssemblyVersion("4.0.2.0")]
[assembly: AssemblyFileVersion("4.0.2.0")]
[assembly: AssemblyVersion("4.2.0.0")]
[assembly: AssemblyFileVersion("4.2.0.0")]
12 changes: 4 additions & 8 deletions StarTrekNut.VoiceCom.Lib/SpeechProcessor.cs
Original file line number Diff line number Diff line change
Expand Up @@ -531,13 +531,13 @@ private void RecognizerOnSpeechRecognized(object sender, SpeechRecognizedEventAr
else if (this.RunningProcess == null)
{
this.SendTtsAcknowledge("Command received but application is not running");
this.SendCommandToUserInterfaceLog(sender, new SpeechProcRecognitionEventArgs($"Command received: \"{e.Result.Text}\". Result=AppNotRunning"));
this.SendCommandToUserInterfaceLog(sender, new SpeechProcRecognitionEventArgs($"Command received: \"{e.Result.Text}\". Result=AppNotRunning", Model.LogEntryType.Warning));
}
else if (gramerKeystroke.KeyStrokes == null || !gramerKeystroke.KeyStrokes.Any())
{
// If there's any trouble sending the key, then let's log it.
this.SendTtsAcknowledge("Command received but no key strokes defined.");
this.SendCommandToUserInterfaceLog(sender, new SpeechProcRecognitionEventArgs($"Command received: \"{e.Result.Text}\". Result=NoKeyStrokes"));
this.SendCommandToUserInterfaceLog(sender, new SpeechProcRecognitionEventArgs($"Command received: \"{e.Result.Text}\". Result=NoKeyStrokes", Model.LogEntryType.Warning));
}
else
{
Expand All @@ -554,14 +554,14 @@ private void RecognizerOnSpeechRecognized(object sender, SpeechRecognizedEventAr
{
// If there's any trouble sending the key, then let's log it.
this.SendTtsAcknowledge("Command received but not processed");
this.SendCommandToUserInterfaceLog(sender, new SpeechProcRecognitionEventArgs($"Command received: \"{e.Result.Text}\". Result=Failed"));
this.SendCommandToUserInterfaceLog(sender, new SpeechProcRecognitionEventArgs($"Command received: \"{e.Result.Text}\". Result=Failed", Model.LogEntryType.Error));
}
}
catch(System.Exception exception)
{
// If there's any trouble sending the key, then let's log it.
this.SendTtsAcknowledge("Command received but not processed");
this.SendCommandToUserInterfaceLog(sender, new SpeechProcRecognitionEventArgs($"Command received: \"{e.Result.Text}\". Result=Failed Reason=\"{exception.Message}\""));
this.SendCommandToUserInterfaceLog(sender, new SpeechProcRecognitionEventArgs($"Command received: \"{e.Result.Text}\". Result=Failed Reason=\"{exception.Message}\"", Model.LogEntryType.Error));
}
}
}
Expand Down Expand Up @@ -636,8 +636,6 @@ private void Start()

if (this._profileCommands != null)
this.SetUserProfileCommandGrammerKeyStrokes(this._profileCommands);

this.NotifyPropertyChange("IsRunning");
}

/// <summary>
Expand Down Expand Up @@ -683,8 +681,6 @@ private void Stop()
this._recognizer.RecognizeAsyncCancel();
this._recognizer.Dispose();
this._recognizer = null;

this.NotifyPropertyChange("IsRunning");
}
}

Expand Down
2 changes: 1 addition & 1 deletion StarTrekNut.VoiceCom.UI/Classes/IsEnabledConverter.cs
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ public class IsEnabledConverter : IValueConverter

public object Convert(object value, Type targetType, object parameter, CultureInfo culture)
{
return value != null && !(bool)value ? "Disable the speech recognition engine" : "You must save settings before enabling speech recognition";
return value != null && !(bool)value ? "Disable speech recognition" : "Enable speech recognition";
}

public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture)
Expand Down
23 changes: 23 additions & 0 deletions StarTrekNut.VoiceCom.UI/Classes/ObjectNullToBoolConverter.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
using System;
using System.Globalization;
using System.Windows.Data;

namespace StarTrekNut.VoiceCom.UI.Classes
{
public class ObjectNullToBoolConverter : IValueConverter
{
#region Public Methods and Operators

public object Convert(object value, Type targetType, object parameter, CultureInfo culture)
{
return value == null ? false : true;
}

public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture)
{
throw new NotImplementedException();
}

#endregion
}
}
86 changes: 70 additions & 16 deletions StarTrekNut.VoiceCom.UI/Dialogs/VoiceCommandEditor.xaml
Original file line number Diff line number Diff line change
Expand Up @@ -4,25 +4,33 @@
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
xmlns:local="clr-namespace:StarTrekNut.VoiceCom.UI.Dialogs"
xmlns:classes="clr-namespace:StarTrekNut.VoiceCom.UI.Classes"
mc:Ignorable="d"
Title="Voice Command Editor" Height="309.039" Width="648.034" WindowStartupLocation="CenterScreen" WindowStyle="ToolWindow">
<Window.Resources>
<classes:KeyConverter x:Key="KeyConverter" />
</Window.Resources>
<Grid Background="#FFE5E5E5">
<Grid.RowDefinitions>
<RowDefinition Height="50*" />
<RowDefinition Height="30*" />
<RowDefinition Height="34*" />
<RowDefinition Height="56" />
<RowDefinition Height="34" />
<RowDefinition Height="30" />
</Grid.RowDefinitions>
<RichTextBox Grid.Row="0" Margin="10,10,10,11" IsReadOnly="True" VerticalScrollBarVisibility="Auto">
<Grid.ColumnDefinitions>
<ColumnDefinition Width="50*" />
<ColumnDefinition Width="50*" />
</Grid.ColumnDefinitions>
<RichTextBox Grid.Row="0" Grid.Column="1" Margin="10,10,10,11" IsReadOnly="True" VerticalScrollBarVisibility="Auto">
<FlowDocument>
<Paragraph>
<Bold>
<Run Text="Info:" FontSize="12"/>
<Run Text="Info:" FontSize="11"/>
</Bold>
<Run FontSize="12" Text="You can send multiple keystrokes to a windows application. Click the 'Record Keystrokes' button"/>
<Run FontSize="12" Foreground="Red" Text="(It will turn red)"/>
<Run FontSize="12" Text="and start clicking the keys you want to add."/>
<Run FontSize="12" Text="As you're typing the keystrokes, they'll appear in the 'Keystrokes' box below. "/>
<Run FontSize="11" Text="You can send multiple keystrokes to a windows application. Click the 'Record Keystrokes' button"/>
<Run FontSize="11" Foreground="Red" Text="(It will turn red)"/>
<Run FontSize="11" Text="and start clicking the keys you want to add."/>
<Run FontSize="11" Text="As you're typing the keystrokes, they'll appear in the 'Keystrokes' box below. "/>
</Paragraph>
<Paragraph>
<Bold>
Expand All @@ -32,13 +40,59 @@
</Paragraph>
</FlowDocument>
</RichTextBox>
<Label Content="Voice Command" Grid.Row="1" HorizontalAlignment="Left" VerticalAlignment="Top" Height="26" Width="97" Margin="10,0,0,0"/>
<TextBox Name="uiTextBoxGrammer" Grid.Row="1" Height="22" Margin="10,26,10,0" TextWrapping="Wrap" VerticalAlignment="Top"/>
<Label Content="Keystrokes" Grid.Row="2" HorizontalAlignment="Left" Height="25" VerticalAlignment="Top" Width="82" Margin="10,0.429,0,0"/>
<Button Name="uiButRecord" Grid.Row="2" Content="Record" Margin="92,5.857,446.286,46.286" Click="uiButRecord_Click" ToolTip="Click to START recording keystrokes." />
<Button x:Name="uiButClearKeyStrokes" Grid.Row="2" Content="Clear" Margin="220,5.857,365.286,46.286" Click="uiButClearKeyStrokes_Click" ToolTip="Click to clear recorded keystrokes." />
<TextBox IsReadOnly="True" Name="uiTextBoxKeyStrokes" Grid.Row="2" Margin="10,40,10,0" TextWrapping="Wrap" TextAlignment="Left" VerticalAlignment="Top" MinWidth="100" Height="22"/>
<Button Name="uiButApply" Grid.Row="3" Content="Apply" Margin="0,0,107.286,5.857" HorizontalAlignment="Right" Width="75" Height="24" VerticalAlignment="Bottom" Click="uiButApply_Click" />
<Button Name="uiButCancel" Grid.Row="3" Content="Cancel" Margin="0,0,10.286,5.857" Height="24" VerticalAlignment="Bottom" HorizontalAlignment="Right" Width="75" Click="uiButCancel_Click" />
<Label Content="Voice Command" Grid.Row="1" Grid.Column="1" HorizontalAlignment="Left" VerticalAlignment="Top" Height="26" Width="97" Margin="10,0,0,0"/>
<TextBox Name="uiTextBoxGrammer" Grid.Row="1" Grid.Column="1" Height="22" Margin="10,26,10,0" TextWrapping="Wrap" VerticalAlignment="Top"/>


<Button Name="uiButApply" Grid.Row="2" Grid.Column="1" Content="Apply" Margin="0,0,106.286,6.143" HorizontalAlignment="Right" Width="75" Height="24" VerticalAlignment="Bottom" Click="uiButApply_Click" Grid.RowSpan="2" />
<Button Name="uiButCancel" Grid.Row="2" Grid.Column="1" Content="Cancel" Margin="0,0,10.286,6.143" Height="24" VerticalAlignment="Bottom" HorizontalAlignment="Right" Width="75" Click="uiButCancel_Click" Grid.RowSpan="2" />
<ListView Name="uiListViewKeystrokes" Margin="10,10,10.143,10.429" Grid.RowSpan="3" ItemsSource="{Binding}" AllowDrop="True">
<ListView.View>
<GridView>
<GridViewColumn Width="140" Header="KeyStroke">
<GridViewColumn.CellTemplate>
<DataTemplate>
<TextBlock DataContext="{Binding Path=WindowsKey, Mode=OneWay}" Text="{Binding Mode=OneWay, Converter={StaticResource KeyConverter}}" Width="140"
Margin="0" />
</DataTemplate>
</GridViewColumn.CellTemplate>
</GridViewColumn>
<GridViewColumn Width="100">
<GridViewColumn.HeaderTemplate>
<DataTemplate>
<DockPanel>
<Button Tag="RecordKeyStrokesCommand" ToolTip="Record key strokes" Width="20" Height="20" BorderThickness="0" Background="Transparent"
Click="uiButRecord_Click">
<Image Source="/VoiceComInterface;component/Icons/glyphicons-170-record.png" Width="15" Height="15"/>
</Button>
<Button Tag="DeleteKeyStrokesCommand" ToolTip="Delet key strokes" Width="20" Height="20" Margin="20,0,0,0" BorderThickness="0" Background="Transparent"
Click="uiButClearKeyStrokes_Click">
<Image Source="/VoiceComInterface;component/Icons/glyphicons-257-delete.png" Width="20" Height="20"/>
</Button>
</DockPanel>
</DataTemplate>
</GridViewColumn.HeaderTemplate>
<GridViewColumn.CellTemplate>
<DataTemplate>
<DockPanel>
<Button Tag="DeleteKeyStrokeCommand" DataContext="{Binding}" ToolTip="Delete key stroke" Width="20" Height="20" BorderThickness="0" Background="Transparent"
Click="DeleteKeyButton_Click">
<Image Source="/VoiceComInterface;component/Icons/glyphicons-257-delete.png" Width="20" Height="20"/>
</Button>
<Button Tag="MoveKeyStrokeUpCommand" DataContext="{Binding}" ToolTip="Move key stroke up" Width="20" Height="20" Margin="20,0,0,0" BorderThickness="0" Background="Transparent"
Click="MoveKeyUpButton_Click">
<Image Source="/VoiceComInterface;component/Icons/glyphicons-214-arrow-up.png" Width="20" Height="20"/>
</Button>
<Button Tag="MoveKeyStrokeDownCommand" DataContext="{Binding}" ToolTip="Move key stroke down" Width="20" Height="20" Margin="5,0,0,0" BorderThickness="0"
Background="Transparent" Click="MoveKeyDownButton_Click">
<Image Source="/VoiceComInterface;component/Icons/glyphicons-213-arrow-down.png" Width="20" Height="20"/>
</Button>
</DockPanel>
</DataTemplate>
</GridViewColumn.CellTemplate>
</GridViewColumn>
</GridView>
</ListView.View>
</ListView>
</Grid>
</Window>
Loading

0 comments on commit 62d6442

Please sign in to comment.