mirror of
https://github.com/onyx-and-iris/voicemeeter-api-powershell.git
synced 2025-01-18 05:10:48 +00:00
update RunVoicemeeter to launch x64 bit GUIs for all kinds
Keep testing login for up to 2 seconds. If timeout exceeded throw VMRemoteError
This commit is contained in:
parent
907ee3e63b
commit
c8abc6964a
@ -9,6 +9,9 @@ Before any major/minor/patch is released all test units will be run to verify th
|
||||
|
||||
## [Unreleased] These changes have not been added to PSGallery yet
|
||||
|
||||
[x] Launch x64 bit GUIs for all kinds if on 64 bit system.
|
||||
[x] Add a timeout to the login function.
|
||||
|
||||
## [3.2.0]
|
||||
|
||||
### Added
|
||||
@ -21,7 +24,7 @@ Before any major/minor/patch is released all test units will be run to verify th
|
||||
|
||||
- All CAPIErrors are now exposed to the consumer.
|
||||
- The function name and error code can be retrieved using [CAPIError].function and [CAPIError].code
|
||||
- Set_By_Script now throws [VMError] if script length exceeds 48kB.
|
||||
- Set_By_Script now throws [VMRemoteError] if script length exceeds 48kB.
|
||||
- parameter range checks in Vban class.
|
||||
|
||||
## [3.1.0]
|
||||
|
26
lib/base.ps1
26
lib/base.ps1
@ -20,8 +20,26 @@ function Login {
|
||||
}
|
||||
}
|
||||
|
||||
$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
|
||||
$exception = $null
|
||||
break
|
||||
}
|
||||
catch [CAPIError] {
|
||||
$exception = $_.Exception
|
||||
}
|
||||
} while ($sw.elapsed -lt $timeout)
|
||||
|
||||
if ($null -ne $exception) {
|
||||
throw [VMRemoteError]::new("Timeout logging into the API.")
|
||||
}
|
||||
|
||||
while (P_Dirty -or M_Dirty) { Start-Sleep -m 1 }
|
||||
"Successfully logged into Voicemeeter [" + $(VmType).ToUpper() + "] Version " + $(VmVersion) | Write-Verbose
|
||||
}
|
||||
|
||||
function Logout {
|
||||
@ -38,8 +56,8 @@ function RunVoicemeeter {
|
||||
[string]$kindId
|
||||
)
|
||||
$kinds = @{
|
||||
"basic" = 1
|
||||
"banana" = 2
|
||||
"basic" = $(if ([Environment]::Is64BitOperatingSystem) { 4 } else { 1 })
|
||||
"banana" = $(if ([Environment]::Is64BitOperatingSystem) { 5 } else { 2 })
|
||||
"potato" = $(if ([Environment]::Is64BitOperatingSystem) { 6 } else { 3 })
|
||||
}
|
||||
|
||||
@ -189,7 +207,7 @@ function Set_By_Script {
|
||||
[string]$script
|
||||
)
|
||||
if ($script.Length -gt 48000) {
|
||||
throw [VMError]::new("Script size cannot be larger than 48kB")
|
||||
throw [VMRemoteError]::new("Script size cannot be larger than 48kB")
|
||||
}
|
||||
$retval = [int][Voicemeeter.Remote]::VBVMR_SetParameters($script)
|
||||
if ($retval -notin @(0)) {
|
||||
|
Loading…
Reference in New Issue
Block a user