5 Commits
Author SHA1 Message Date
pblivingston 7a6150bf6e Get-Remote 2026-08-06 19:43:15 -04:00
pblivingston d05b46b899 Command.Launch 2026-08-06 19:42:35 -04:00
pblivingston b978f5aa3f RunVoicemeeter, RunApplication 2026-08-06 19:40:54 -04:00
pblivingston 5c5932e7d3 base functions
- Login
- WaitForConnection
- Run
- RunVm
- RunApp
2026-08-06 19:37:46 -04:00
pblivingston 3e5a61eff3 kind 'none' 2026-08-06 19:30:15 -04:00
4 changed files with 86 additions and 9 deletions
+34 -1
View File
@@ -40,6 +40,15 @@ class Remote {
Logout
}
[Remote] RunVoicemeeter([String]$kindId) {
RunVm -kindId $kindId
return Make_Remote -kindId $kindId
}
[void] RunApplication([String]$appId) {
RunApp -appId $appId
}
[string] GetType() {
return VmType
}
@@ -159,6 +168,30 @@ class RemotePotato : Remote {
}
}
function Make_Remote {
param(
[String]$kindId
)
switch ($kindId) {
'basic' {
[RemoteBasic]::new()
}
'banana' {
[RemoteBanana]::new()
}
'potato' {
[RemotePotato]::new()
}
default {
throw [VMRemoteError]::new("Unknown Voicemeeter kind `"$kindId`"")
}
}
}
Function Get-Remote {
[Remote]::new('none').Login()
}
Function Get-RemoteBasic {
[RemoteBasic]::new().Login()
}
@@ -193,4 +226,4 @@ Function Disconnect-Voicemeeter {
Logout
}
Export-ModuleMember -Function Get-RemoteBasic, Get-RemoteBanana, Get-RemotePotato, Connect-Voicemeeter, Disconnect-Voicemeeter
Export-ModuleMember -Function Get-Remote, Get-RemoteBasic, Get-RemoteBanana, Get-RemotePotato, Connect-Voicemeeter, Disconnect-Voicemeeter
+44 -8
View File
@@ -11,22 +11,32 @@ function Login {
}
switch ($retval) {
0 {
WaitForConnection
}
1 {
'Voicemeeter Engine running but GUI not launched. Launching GUI now.' | Write-Verbose
RunVoicemeeter -kindId $kindId
if ($kindId -eq 'none') {
'Logged in to Voicemeeter Remote.' | Write-Verbose
}
else {
'Logged in to Voicemeeter Remote but audio engine and GUI not launched. Launching engine now.' | Write-Verbose
RunVm -kindId $kindId
}
}
-2 {
throw [LoginError]::new('Login may only be called once per session.')
}
}
}
function WaitForConnection {
$timeout = New-TimeSpan -Seconds 2
$sw = [diagnostics.stopwatch]::StartNew()
$exception = $null
do {
Start-Sleep -m 100
try {
'Successfully logged into Voicemeeter [' + $(VmType).ToUpper() + '] Version ' + $(VmVersion) | Write-Verbose
'Successfully connected to Voicemeeter [' + $(VmType).ToUpper() + '] Version ' + $(VmVersion) | Write-Verbose
$exception = $null
break
}
@@ -37,7 +47,7 @@ function Login {
} while ($sw.elapsed -lt $timeout)
if ($null -ne $exception) {
throw [VMRemoteError]::new('Timeout logging into the API.')
throw [VMRemoteError]::new('Timeout waiting to connect to Voicemeeter.')
}
while (P_Dirty -or M_Dirty) { Start-Sleep -m 1 }
@@ -52,7 +62,17 @@ function Logout {
if ($retval -eq 0) { 'Sucessfully logged out' | Write-Verbose }
}
function RunVoicemeeter {
function Run {
param(
[int]$id
)
$retval = [int][Voicemeeter.Remote]::VBVMR_RunVoicemeeter([Int64]$id)
if ($retval -notin @(0)) {
throw [CAPIError]::new($retval, 'VBVMR_RunVoicemeeter')
}
}
function RunVm {
param(
[string]$kindId
)
@@ -61,11 +81,27 @@ function RunVoicemeeter {
'banana' = $(if ([Environment]::Is64BitOperatingSystem) { 5 } else { 2 })
'potato' = $(if ([Environment]::Is64BitOperatingSystem) { 6 } else { 3 })
}
Run -id $kinds[$kindId]
WaitForConnection
}
$retval = [int][Voicemeeter.Remote]::VBVMR_RunVoicemeeter([int64]$kinds[$kindId])
if ($retval -notin @(0)) {
throw [CAPIError]::new($retval, 'VBVMR_RunVoicemeeter')
function RunApp {
param(
[string]$appId
)
$apps = @{
'devicecheck' = 10
'macrobuttons' = 11
'streamerview' = 12
'busmatrix8' = 13
'busgeq15' = 14
'vban2midi' = 15
'cablecontrolpanel' = 20
'auxcontrolpanel' = 21
'vaio3controlpanel' = 22
'vaiocontrolpanel' = 23
}
Run -id $apps[$appId]
}
function P_Dirty {
+5
View File
@@ -7,6 +7,11 @@ class Special : IRemote {
return 'Command'
}
[void] Launch() {
'Launching Voicemeeter audio engine and GUI' | Write-Verbose
RunVm -kindId $this.kind.name
}
[void] RunMacrobuttons() {
'Launching the MacroButtons app' | Write-Verbose
Start-Process -FilePath $(Join-Path -Path $this.remote.vmpath -ChildPath 'VoicemeeterMacroButtons.exe')
+3
View File
@@ -1,4 +1,7 @@
$KindMap = @{
'none' = @{
'name' = 'none'
}
'basic' = @{
'name' = 'basic'
'p_in' = 2