add quick.ps1 to gitignore

run formatter on files
This commit is contained in:
onyx-and-iris
2022-06-25 15:20:36 +01:00
parent 4417075330
commit 8429fed8b4
12 changed files with 122 additions and 122 deletions

View File

@@ -13,13 +13,13 @@ Function Setup_DLL {
try {
$vb_path = Get_VBPath
if([string]::IsNullOrWhiteSpace($vb_path)) {
if ([string]::IsNullOrWhiteSpace($vb_path)) {
throw [VMRemoteErrors]::new("ERROR: Couldn't get Voicemeeter path")
}
else {
$dll = Join-Path -Path $vb_path -ChildPath ("VoicemeeterRemote" + `
(&{If([Environment]::Is64BitOperatingSystem) {"64"} Else {""}}) + `
".dll")
(& { If ([Environment]::Is64BitOperatingSystem) { "64" } Else { "" } }) + `
".dll")
}
}
catch [VMRemoteErrors] {
@@ -27,7 +27,7 @@ Function Setup_DLL {
return $false
}
$Signature = @"
$Signature = @"
[DllImport(@"$dll")]
public static extern int VBVMR_Login();
[DllImport(@"$dll")]
@@ -66,16 +66,16 @@ $Signature = @"
Function Param_Get {
param(
[String]$PARAM, [bool]$IS_STRING=$false
[String]$PARAM, [bool]$IS_STRING = $false
)
Start-Sleep -m 50
while(P_Dirty) { Start-Sleep -m 1 }
while (P_Dirty) { Start-Sleep -m 1 }
if($IS_STRING) {
if ($IS_STRING) {
$BYTES = [System.Byte[]]::new(512)
try {
$retval = [Int][Voicemeeter.Remote]::VBVMR_GetParameterStringA($PARAM, $BYTES)
if($retval) { Throw [CAPIError]::new($retval, $MyInvocation.MyCommand) }
if ($retval) { Throw [CAPIError]::new($retval, $MyInvocation.MyCommand) }
}
catch [CAPIError] {
Write-Warning $_.Exception.ErrorMessage()
@@ -86,7 +86,7 @@ Function Param_Get {
New-Variable -Name ptr -Value 0.0
try {
$retval = [Int][Voicemeeter.Remote]::VBVMR_GetParameterFloat($PARAM, [ref]$ptr)
if($retval) { Throw [CAPIError]::new($retval, $MyInvocation.MyCommand) }
if ($retval) { Throw [CAPIError]::new($retval, $MyInvocation.MyCommand) }
}
catch [CAPIError] {
Write-Warning $_.Exception.ErrorMessage()
@@ -100,13 +100,13 @@ Function Param_Set {
[String]$PARAM, [Object]$VALUE
)
try {
if($VALUE -is [String]) {
if ($VALUE -is [String]) {
$retval = [Int][Voicemeeter.Remote]::VBVMR_SetParameterStringA($PARAM, $VALUE)
}
else {
$retval = [Int][Voicemeeter.Remote]::VBVMR_SetParameterFloat($PARAM, $VALUE)
}
if($retval) { Throw [CAPIError]::new($retval, $MyInvocation.MyCommand) }
if ($retval) { Throw [CAPIError]::new($retval, $MyInvocation.MyCommand) }
}
catch [CAPIError] {
Write-Warning $_.Exception.ErrorMessage()
@@ -119,7 +119,7 @@ Function MB_Set {
)
try {
$retval = [Int][Voicemeeter.Remote]::VBVMR_MacroButton_SetStatus($ID, $SET, $MODE)
if($retval) { Throw [CAPIError]::new($retval, $MyInvocation.MyCommand) }
if ($retval) { Throw [CAPIError]::new($retval, $MyInvocation.MyCommand) }
}
catch [CAPIError] {
Write-Warning $_.Exception.ErrorMessage()
@@ -131,12 +131,12 @@ Function MB_Get {
[Int64]$ID, [Int64]$MODE
)
Start-Sleep -m 50
while(M_Dirty) { Start-Sleep -m 1 }
while (M_Dirty) { Start-Sleep -m 1 }
New-Variable -Name ptr -Value 0.0
try {
$retval = [Int][Voicemeeter.Remote]::VBVMR_MacroButton_GetStatus($ID, [ref]$ptr, $MODE)
if($retval) { Throw [CAPIError]::new($retval, $MyInvocation.MyCommand) }
if ($retval) { Throw [CAPIError]::new($retval, $MyInvocation.MyCommand) }
}
catch [CAPIError] {
Write-Warning $_.Exception.ErrorMessage()
@@ -150,17 +150,17 @@ Function Param_Set_Multi {
)
ForEach ($key in $HASH.keys) {
$classobj , $m2, $m3 = $key.Split("_")
if ($m2 -match "^\d+$") {$index = [int]$m2} else {$index = [int]$m3}
if ($m2 -match "^\d+$") { $index = [int]$m2 } else { $index = [int]$m3 }
ForEach ($h in $HASH[$key].GetEnumerator()) {
$property = $h.Name
$value = $h.Value
if ($value -in ('False', 'True')) { [System.Convert]::ToBoolean($value) }
Switch($classobj) {
Switch ($classobj) {
'strip' { $this.strip[$index].$property = $value }
'bus' { $this.bus[$index].$property = $value }
{($_ -eq 'button') -or ($_ -eq 'mb')} { $this.button[$index].$property = $value }
{ ($_ -eq 'button') -or ($_ -eq 'mb') } { $this.button[$index].$property = $value }
'vban' { $this.vban.$m2[$index].$property = $value }
}
}
@@ -173,36 +173,36 @@ Function DefineVersion {
)
$layout = @{}
if($TYPE -eq 1) {
if ($TYPE -eq 1) {
$layout = @{
"name" = "basic"
"p_in" = 2
"v_in" = 1
"p_out" = 1
"v_out" = 1
"vban_in" = 4
"name" = "basic"
"p_in" = 2
"v_in" = 1
"p_out" = 1
"v_out" = 1
"vban_in" = 4
"vban_out" = 4
}
}
elseif($TYPE -eq 2) {
elseif ($TYPE -eq 2) {
$layout = @{
"name" = "banana"
"p_in" = 3
"v_in" = 2
"p_out" = 3
"v_out" = 2
"vban_in" = 8
"name" = "banana"
"p_in" = 3
"v_in" = 2
"p_out" = 3
"v_out" = 2
"vban_in" = 8
"vban_out" = 8
}
}
elseif($TYPE -eq 3) {
elseif ($TYPE -eq 3) {
$layout = @{
"name" = "potato"
"p_in" = 5
"v_in" = 3
"p_out" = 5
"v_out" = 3
"vban_in" = 8
"name" = "potato"
"p_in" = 5
"v_in" = 3
"p_out" = 5
"v_out" = 3
"vban_in" = 8
"vban_out" = 8
}
}
@@ -213,10 +213,11 @@ Function Get_Profiles {
$basepath = Join-Path -Path $(Split-Path -Path $PSScriptRoot) -ChildPath "profiles"
if (Test-Path $basepath) {
$fullpath = Join-Path -Path $basepath -ChildPath $layout.name
} else {return $null}
}
else { return $null }
$filenames = @(Get-ChildItem -Path $fullpath -Filter *.psd1 -Recurse -File)
if($filenames) {
if ($filenames) {
[System.Collections.ArrayList]$configfiles = @()
$filenames | ForEach-Object {
$file = (Join-Path -Path $fullpath -ChildPath $_)
@@ -239,7 +240,7 @@ Function Set_Profile {
[Object]$DATA, [String]$CONF
)
try {
if($null -eq $DATA -or -not $DATA.$CONF) {
if ($null -eq $DATA -or -not $DATA.$CONF) {
throw [VMRemoteErrors]::new("No profile named $CONF was loaded")
}
Param_Set_Multi -HASH $DATA.$CONF
@@ -252,47 +253,50 @@ Function Set_Profile {
Function Login {
param(
[String]$KIND=$null
[String]$KIND = $null
)
try {
$retval = [Int][Voicemeeter.Remote]::VBVMR_Login()
if(-not $retval) { Write-Host("LOGGED IN") }
elseif($retval -eq 1) {
if (-not $retval) { Write-Host("LOGGED IN") }
elseif ($retval -eq 1) {
Write-Host("VM NOT RUNNING")
New-Variable -Name vm_exe -Value 0
Switch($KIND) {
'basic' { $vm_exe = 1; Break}
'banana' { $vm_exe = 2; Break}
Switch ($KIND) {
'basic' { $vm_exe = 1; Break }
'banana' { $vm_exe = 2; Break }
'potato' {
if ([Environment]::Is64BitOperatingSystem) {
$vm_exe = 6
} else { $vm_exe = 3 }
$vm_exe = 6
}
else { $vm_exe = 3 }
Break
}
Default { throw [LoginError]::new('Unknown Voicemeeter type') }
}
$retval = [Int][Voicemeeter.Remote]::VBVMR_RunVoicemeeter([Int64]$vm_exe)
if(-not $retval) { Write-Host("STARTING VOICEMEETER") }
if (-not $retval) { Write-Host("STARTING VOICEMEETER") }
else { Throw [CAPIError]::new($retval, $MyInvocation.MyCommand) }
Start-Sleep -s 1
} elseif ($retval -eq -2) {
}
elseif ($retval -eq -2) {
throw [LoginError]::new('Login may only be called once per session')
} else { Exit }
}
else { Exit }
}
catch [LoginError], [CAPIError] {
Write-Warning $_.Exception.ErrorMessage()
}
while(P_Dirty -or M_Dirty) { Start-Sleep -m 1 }
while (P_Dirty -or M_Dirty) { Start-Sleep -m 1 }
New-Variable -Name ptr -Value 0
$retval = [Int][Voicemeeter.Remote]::VBVMR_GetVoicemeeterType([ref]$ptr)
if(-not $retval) {
if($ptr -eq 1) { Write-Host("VERSION:[BASIC]") }
elseif($ptr -eq 2) { Write-Host("VERSION:[BANANA]") }
elseif($ptr -eq 3) { Write-Host("VERSION:[POTATO]") }
if (-not $retval) {
if ($ptr -eq 1) { Write-Host("VERSION:[BASIC]") }
elseif ($ptr -eq 2) { Write-Host("VERSION:[BANANA]") }
elseif ($ptr -eq 3) { Write-Host("VERSION:[POTATO]") }
}
DefineVersion -TYPE $ptr
@@ -301,7 +305,7 @@ Function Login {
Function Logout {
Start-Sleep -m 20
$retval = [Int][Voicemeeter.Remote]::VBVMR_Logout()
if(-not $retval) { Write-Host("LOGGED OUT") }
if (-not $retval) { Write-Host("LOGGED OUT") }
}
Function P_Dirty {