-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
attempt to make shock for openshock through osc
- Loading branch information
Showing
37 changed files
with
1,583 additions
and
36 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
13 changes: 13 additions & 0 deletions
13
OpenShock.VoiceRecognizer.Common/Enums/BrowserProxyType.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
using OpenShock.VoiceRecognizer.Common.Utility; | ||
using System.Text.Json.Serialization; | ||
|
||
namespace OpenShock.VoiceRecognizer.Common.Enums; | ||
|
||
[JsonConverter(typeof(TypedStringEnumConverter<BrowserProxyType>))] | ||
public enum BrowserProxyType | ||
{ | ||
Chrome, | ||
Edge, | ||
Opera, | ||
Firefox, | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
29 changes: 29 additions & 0 deletions
29
OpenShock.VoiceRecognizer.Configuration/BrowserProxyConfigurationState.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
using OpenShock.VoiceRecognizer.Common; | ||
using OpenShock.VoiceRecognizer.Common.Audio; | ||
using OpenShock.VoiceRecognizer.Common.Enums; | ||
|
||
namespace OpenShock.VoiceRecognizer.Configuration; | ||
|
||
public class BrowserProxyConfigurationState | ||
{ | ||
public ReactiveObject<BrowserProxyType> Proxy { get; set; } | ||
public ReactiveObject<int> ProxyPort { get; set; } | ||
|
||
public BrowserProxyConfigurationState() | ||
{ | ||
Proxy = new(BrowserProxyType.Chrome); | ||
ProxyPort = new(0); | ||
} | ||
|
||
public void LoadFileConfiguration(ConfigurationFileFormat configurationFileFormat) | ||
{ | ||
Proxy.Value = configurationFileFormat.BrowserProxyType; | ||
ProxyPort.Value = configurationFileFormat.BrowserProxyPort; | ||
} | ||
|
||
public void LoadDefaultConfiguration() | ||
{ | ||
Proxy.Value = BrowserProxyType.Chrome; | ||
ProxyPort.Value = 0; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
48 changes: 48 additions & 0 deletions
48
OpenShock.VoiceRecognizer.Configuration/OpenShockConfigurationState.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,48 @@ | ||
using OpenShock.VoiceRecognizer.Common; | ||
|
||
namespace OpenShock.VoiceRecognizer.Configuration; | ||
|
||
public class OpenShockConfigurationState | ||
{ | ||
/*public ReactiveObject<string> APIKey { get; private set; } | ||
public ReactiveObject<string> GroupName { get; private set; }*/ | ||
public ReactiveObject<string> SendHost { get; private set; } | ||
public ReactiveObject<int> SendPort { get; private set; } | ||
|
||
public ReactiveObject<string> ExternalListenSetIntensityEndpoint { get; set; } | ||
public ReactiveObject<string> ExternalSendStartShockEndpoint { get; set; } | ||
public ReactiveObject<string> ExternalSendStartVibrationEndpoint { get; set; } | ||
|
||
public OpenShockConfigurationState() | ||
{ | ||
/*APIKey = new(string.Empty); | ||
GroupName = new(string.Empty);*/ | ||
SendHost = new(string.Empty); | ||
SendPort = new(9006); | ||
ExternalListenSetIntensityEndpoint = new(string.Empty); | ||
ExternalSendStartShockEndpoint = new(string.Empty); | ||
ExternalSendStartVibrationEndpoint = new(string.Empty); | ||
} | ||
|
||
public void LoadFileConfiguration(ConfigurationFileFormat configurationFileFormat) | ||
{ | ||
/*APIKey.Value = configurationFileFormat.OpenShockAPIKey; | ||
GroupName.Value = configurationFileFormat.OpenShockGroupName;*/ | ||
SendHost.Value = configurationFileFormat.OpenShockSendHost; | ||
SendPort.Value = configurationFileFormat.OpenShockSendPort; | ||
ExternalListenSetIntensityEndpoint.Value = configurationFileFormat.OpenShockOscListenIntensityEndpoint; | ||
ExternalSendStartShockEndpoint.Value = configurationFileFormat.OpenShockOscSendShockEndpoint; | ||
ExternalSendStartVibrationEndpoint.Value = configurationFileFormat.OpenShockOscSendVibrateEndpoint; | ||
} | ||
|
||
public void LoadDefaultConfiguration() | ||
{ | ||
/*APIKey.Value = string.Empty; | ||
GroupName.Value = string.Empty;*/ | ||
SendHost.Value = "127.0.0.1"; | ||
SendPort.Value = 0; | ||
ExternalListenSetIntensityEndpoint.Value = string.Empty; | ||
ExternalSendStartShockEndpoint.Value = string.Empty; | ||
ExternalSendStartVibrationEndpoint.Value = string.Empty; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
28 changes: 28 additions & 0 deletions
28
OpenShock.VoiceRecognizer.Integrations/BrowserProxy/BaseBrowserProxy.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
using System.Net; | ||
|
||
namespace OpenShock.VoiceRecognizer.Integrations.BrowserProxy; | ||
|
||
public abstract class BaseBrowserProxy | ||
{ | ||
protected HttpListener? _listener = null; | ||
protected Thread? _thread = null; | ||
protected bool _shouldExit = false; | ||
protected int _port = 0; | ||
protected List<string> _speechDetectionResults = []; | ||
protected List<string> _speechDetectionOnEnd = []; | ||
protected List<string> _pendingJavascript = []; | ||
|
||
public BaseBrowserProxy() { } | ||
|
||
public abstract void StartProxy(int port); | ||
|
||
public abstract void StopProxy(); | ||
|
||
public abstract void DetectBrowser(); | ||
|
||
public abstract void CloseBrowser(); | ||
|
||
public void AddJavascriptCommand(string command) => _pendingJavascript.Add(command); | ||
|
||
protected abstract void WorkerThread(); | ||
} |
Oops, something went wrong.