xy and fx parameters added to strip/bus classes.

GetType, GetVersion, SendText added to Remote class.

Console output now written to Debug stream.

ToString() method overriden for higher classes.

formatter run through all files.
This commit is contained in:
onyx-and-iris 2022-10-27 21:20:03 +01:00
parent 7c60f564b2
commit 62c65e1c08
14 changed files with 331 additions and 258 deletions

View File

@ -18,7 +18,9 @@ class Remote {
} }
[void] Setup() { [void] Setup() {
if (Setup_DLL) { if (!(Setup_DLL)) {
Exit
}
Login -KIND $this.kind.name Login -KIND $this.kind.name
$this.profiles = Get_Profiles($this.kind.name) $this.profiles = Get_Profiles($this.kind.name)
$this.strip = Make_Strips($this) $this.strip = Make_Strips($this)
@ -28,13 +30,23 @@ class Remote {
$this.command = Make_Command $this.command = Make_Command
$this.recorder = Make_Recorder($this) $this.recorder = Make_Recorder($this)
} }
else { Exit }
[string] ToString() {
return "Voicemeeter " + $this.kind.name.substring(0,1).toupper() + $this.kind.name.substring(1)
} }
[void] Logout() { [void] Logout() {
Logout Logout
} }
[void] GetType() {
VmType
}
[String] GetVersion() {
return Version
}
[void] Set_Profile([String]$config) { [void] Set_Profile([String]$config) {
Set_Profile -DATA $this.profiles -CONF $config Set_Profile -DATA $this.profiles -CONF $config
} }
@ -55,6 +67,10 @@ class Remote {
Param_Set_Multi -HASH $hash Param_Set_Multi -HASH $hash
} }
[void] SendText([String]$script) {
Set_By_Script -SCRIPT $script
}
[void] PDirty() { P_Dirty } [void] PDirty() { P_Dirty }
[void] MDirty() { M_Dirty } [void] MDirty() { M_Dirty }

View File

@ -9,73 +9,88 @@
. $PSScriptRoot\command.ps1 . $PSScriptRoot\command.ps1
. $PSScriptRoot\recorder.ps1 . $PSScriptRoot\recorder.ps1
Function Login { function Login {
param( param(
[String]$KIND = $null [string]$KIND = $null
) )
try { try {
$retval = [Int][Voicemeeter.Remote]::VBVMR_Login() $retval = [int][Voicemeeter.Remote]::VBVMR_Login()
if (-not $retval) { Write-Host("LOGGED IN") } if (-not $retval) { "LOGGED IN" | Write-Verbose }
elseif ($retval -eq 1) { elseif ($retval -eq 1) {
Write-Host("VM NOT RUNNING") "VM NOT RUNNING" | Write-Verbose
New-Variable -Name vm_exe -Value 0 New-Variable -Name vm_exe -Value 0
Switch ($KIND) { switch ($KIND) {
'basic' { $vm_exe = 1; Break } 'basic' { $vm_exe = 1; break }
'banana' { $vm_exe = 2; Break } 'banana' { $vm_exe = 2; break }
'potato' { 'potato' {
if ([Environment]::Is64BitOperatingSystem) { if ([Environment]::Is64BitOperatingSystem) {
$vm_exe = 6 $vm_exe = 6
} }
else { $vm_exe = 3 } else { $vm_exe = 3 }
Break break
} }
Default { throw [LoginError]::new('Unknown Voicemeeter type') } default { throw [LoginError]::new('Unknown Voicemeeter type') }
} }
$retval = [Int][Voicemeeter.Remote]::VBVMR_RunVoicemeeter([Int64]$vm_exe) $retval = [int][Voicemeeter.Remote]::VBVMR_RunVoicemeeter([int64]$vm_exe)
if (-not $retval) { Write-Host("STARTING VOICEMEETER") } if (-not $retval) { "STARTING VOICEMEETER" | Write-Verbose }
else { Throw [CAPIError]::new($retval, $MyInvocation.MyCommand) } else { throw [CAPIError]::new($retval, $MyInvocation.MyCommand) }
Start-Sleep -s 1 Start-Sleep -s 1
} }
elseif ($retval -eq -2) { elseif ($retval -eq -2) {
throw [LoginError]::new('Login may only be called once per session') throw [LoginError]::new('Login may only be called once per session')
} }
else { Exit } else { exit }
} }
catch [LoginError], [CAPIError] { catch [LoginError], [CAPIError] {
Write-Warning $_.Exception.ErrorMessage() Write-Warning $_.Exception.ErrorMessage()
} }
while (P_Dirty -or M_Dirty) { Start-Sleep -m 1 } while (P_Dirty -or M_Dirty) { Start-Sleep -m 1 }
"VERSION:[" + $(VmType).ToUpper() + "]" | Write-Verbose
}
function Logout {
Start-Sleep -m 20
$retval = [int][Voicemeeter.Remote]::VBVMR_Logout()
if (-not $retval) { "LOGGED OUT" | Write-Verbose }
}
function P_Dirty {
[bool][Voicemeeter.Remote]::VBVMR_IsParametersDirty()
}
function M_Dirty {
[bool][Voicemeeter.Remote]::VBVMR_MacroButton_IsDirty()
}
function VmType {
New-Variable -Name ptr -Value 0 New-Variable -Name ptr -Value 0
$retval = [Int][Voicemeeter.Remote]::VBVMR_GetVoicemeeterType([ref]$ptr) $retval = [int][Voicemeeter.Remote]::VBVMR_GetVoicemeeterType([ref]$ptr)
if (-not $retval) { if ($retval) { throw [CAPIError]::new($retval, $MyInvocation.MyCommand) }
if ($ptr -eq 1) { Write-Host("VERSION:[BASIC]") } switch ($ptr) {
elseif ($ptr -eq 2) { Write-Host("VERSION:[BANANA]") } 1 { return "basic" }
elseif ($ptr -eq 3) { Write-Host("VERSION:[POTATO]") } 2 { return "banana" }
3 { return "potato" }
} }
} }
Function Logout { function Version {
Start-Sleep -m 20 New-Variable -Name ptr -Value 0
$retval = [Int][Voicemeeter.Remote]::VBVMR_Logout() $retval = [int][Voicemeeter.Remote]::VBVMR_GetVoicemeeterVersion([ref]$ptr)
if (-not $retval) { Write-Host("LOGGED OUT") } if ($retval) { throw [CAPIError]::new($retval, $MyInvocation.MyCommand) }
} $v1 = ($ptr -band 0xFF000000) -shr 24
$v2 = ($ptr -band 0x00FF0000) -shr 16
Function P_Dirty { $v3 = ($ptr -band 0x0000FF00) -shr 8
[Bool][Voicemeeter.Remote]::VBVMR_IsParametersDirty() $v4 = $ptr -band 0x000000FF
} "$v1.$v2.$v3.$v4"
Function M_Dirty {
[Bool][Voicemeeter.Remote]::VBVMR_MacroButton_IsDirty()
} }
Function Param_Get { function Param_Get {
param( param(
[String]$PARAM, [bool]$IS_STRING = $false [string]$PARAM, [bool]$IS_STRING = $false
) )
Start-Sleep -m 50 Start-Sleep -m 50
while (P_Dirty) { Start-Sleep -m 1 } while (P_Dirty) { Start-Sleep -m 1 }
@ -83,8 +98,8 @@ Function Param_Get {
if ($IS_STRING) { if ($IS_STRING) {
$BYTES = [System.Byte[]]::new(512) $BYTES = [System.Byte[]]::new(512)
try { try {
$retval = [Int][Voicemeeter.Remote]::VBVMR_GetParameterStringA($PARAM, $BYTES) $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] { catch [CAPIError] {
Write-Warning $_.Exception.ErrorMessage() Write-Warning $_.Exception.ErrorMessage()
@ -94,79 +109,79 @@ Function Param_Get {
else { else {
New-Variable -Name ptr -Value 0.0 New-Variable -Name ptr -Value 0.0
try { try {
$retval = [Int][Voicemeeter.Remote]::VBVMR_GetParameterFloat($PARAM, [ref]$ptr) $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] { catch [CAPIError] {
Write-Warning $_.Exception.ErrorMessage() Write-Warning $_.Exception.ErrorMessage()
} }
[Single]$ptr [single]$ptr
} }
} }
Function Param_Set { function Param_Set {
param( param(
[String]$PARAM, [Object]$VALUE [string]$PARAM, [Object]$VALUE
) )
try { try {
if ($VALUE -is [String]) { if ($VALUE -is [string]) {
$retval = [Int][Voicemeeter.Remote]::VBVMR_SetParameterStringA($PARAM, $VALUE) $retval = [int][Voicemeeter.Remote]::VBVMR_SetParameterStringA($PARAM, $VALUE)
} }
else { else {
$retval = [Int][Voicemeeter.Remote]::VBVMR_SetParameterFloat($PARAM, $VALUE) $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] { catch [CAPIError] {
Write-Warning $_.Exception.ErrorMessage() Write-Warning $_.Exception.ErrorMessage()
} }
} }
Function MB_Set { function MB_Set {
param( param(
[Int64]$ID, [Single]$SET, [Int64]$MODE [int64]$ID, [single]$SET, [int64]$MODE
) )
try { try {
$retval = [Int][Voicemeeter.Remote]::VBVMR_MacroButton_SetStatus($ID, $SET, $MODE) $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] { catch [CAPIError] {
Write-Warning $_.Exception.ErrorMessage() Write-Warning $_.Exception.ErrorMessage()
} }
} }
Function MB_Get { function MB_Get {
param( param(
[Int64]$ID, [Int64]$MODE [int64]$ID, [int64]$MODE
) )
Start-Sleep -m 50 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 New-Variable -Name ptr -Value 0.0
try { try {
$retval = [Int][Voicemeeter.Remote]::VBVMR_MacroButton_GetStatus($ID, [ref]$ptr, $MODE) $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] { catch [CAPIError] {
Write-Warning $_.Exception.ErrorMessage() Write-Warning $_.Exception.ErrorMessage()
} }
[Int]$ptr [int]$ptr
} }
Function Param_Set_Multi { function Param_Set_Multi {
param( param(
[HashTable]$HASH [hashtable]$HASH
) )
ForEach ($key in $HASH.keys) { foreach ($key in $HASH.keys) {
$classobj , $m2, $m3 = $key.Split("_") $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()) { foreach ($h in $HASH[$key].GetEnumerator()) {
$property = $h.Name $property = $h.Name
$value = $h.Value $value = $h.Value
if ($value -in ('False', 'True')) { [System.Convert]::ToBoolean($value) } if ($value -in ('False', 'True')) { [System.Convert]::ToBoolean($value) }
Switch ($classobj) { switch ($classobj) {
'strip' { $this.strip[$index].$property = $value } 'strip' { $this.strip[$index].$property = $value }
'bus' { $this.bus[$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 }
@ -175,3 +190,16 @@ Function Param_Set_Multi {
} }
} }
} }
function Set_By_Script {
param(
[string]$script
)
try {
$retval = [int][Voicemeeter.Remote]::VBVMR_SetParameters($script)
if ($retval) { throw [CAPIError]::new($retval, $MyInvocation.MyCommand) }
}
catch [CAPIError] {
Write-Warning $_.Exception.ErrorMessage()
}
}

View File

@ -1,4 +1,4 @@
Function Setup_DLL { function Setup_DLL {
try { try {
$vb_path = Get_VBPath $vb_path = Get_VBPath
@ -7,7 +7,7 @@ Function Setup_DLL {
} }
else { else {
$dll = Join-Path -Path $vb_path -ChildPath ("VoicemeeterRemote" + ` $dll = Join-Path -Path $vb_path -ChildPath ("VoicemeeterRemote" + `
(& { If ([Environment]::Is64BitOperatingSystem) { "64" } Else { "" } }) + ` (& { if ([Environment]::Is64BitOperatingSystem) { "64" } else { "" } }) + `
".dll") ".dll")
} }
} }
@ -25,6 +25,8 @@ Function Setup_DLL {
public static extern int VBVMR_RunVoicemeeter(Int64 run); public static extern int VBVMR_RunVoicemeeter(Int64 run);
[DllImport(@"$dll")] [DllImport(@"$dll")]
public static extern int VBVMR_GetVoicemeeterType(ref int ptr); public static extern int VBVMR_GetVoicemeeterType(ref int ptr);
[DllImport(@"$dll")]
public static extern int VBVMR_GetVoicemeeterVersion(ref int ptr);
[DllImport(@"$dll")] [DllImport(@"$dll")]
public static extern int VBVMR_MacroButton_IsDirty(); public static extern int VBVMR_MacroButton_IsDirty();

View File

@ -1,44 +1,48 @@
. $PSScriptRoot\meta.ps1 . $PSScriptRoot\meta.ps1
class Bus { class Bus {
[Int]$id [int]$index
[Object]$remote [Object]$remote
# Constructor # Constructor
Bus ([Int]$id, [Object]$remote) { Bus ([int]$index, [Object]$remote) {
$this.id = $id $this.index = $index
$this.remote = $remote $this.remote = $remote
AddBoolMembers -PARAMS @('mono', 'mute') AddBoolMembers -PARAMS @('mono', 'mute')
AddStringMembers -PARAMS @('label') AddStringMembers -PARAMS @('label')
AddFloatMembers -PARAMS @('gain') AddFloatMembers -PARAMS @('gain', 'returnreverb', 'returndelay', 'returnfx1', 'returnfx2')
AddBusModeMembers -PARAMS @('normal', 'amix', 'bmix', 'repeat', 'composite', 'tvmix', 'upmix21', AddBusModeMembers -PARAMS @('normal', 'amix', 'bmix', 'repeat', 'composite', 'tvmix', 'upmix21')
'upmix41', 'upmix61', 'centeronly', 'lfeonly', 'rearonly') AddBusModeMembers -PARAMS @('upmix41', 'upmix61', 'centeronly', 'lfeonly', 'rearonly')
} }
[Single] Getter($cmd) { [string] ToString() {
return $this.GetType().Name + $this.index
}
[single] Getter ($cmd) {
return Param_Get -PARAM $cmd -IS_STRING $false return Param_Get -PARAM $cmd -IS_STRING $false
} }
[String] Getter_String($cmd) { [string] Getter_String ($cmd) {
return Param_Get -PARAM $cmd -IS_STRING $true return Param_Get -PARAM $cmd -IS_STRING $true
} }
[void] Setter($cmd, $set) { [void] Setter ($cmd, $set) {
Param_Set -PARAM $cmd -VALUE $set Param_Set -PARAM $cmd -Value $set
} }
[string] cmd ($arg) { [string] cmd ($arg) {
return "Bus[" + $this.id + "].$arg" return "Bus[" + $this.index + "].$arg"
} }
hidden $_eq = $($this | Add-Member ScriptProperty 'eq' ` hidden $_eq = $($this | Add-Member ScriptProperty 'eq' `
{ {
[bool]$this.Getter($this.cmd('EQ.on')) [bool]$this.Getter($this.cmd('EQ.on'))
}` } `
{ {
param ( $arg ) param($arg)
$this._eq = $this.Setter($this.cmd('EQ.on'), $arg) $this._eq = $this.Setter($this.cmd('EQ.on'), $arg)
} }
) )
@ -46,50 +50,50 @@ class Bus {
hidden $_eq_ab = $($this | Add-Member ScriptProperty 'eq_ab' ` hidden $_eq_ab = $($this | Add-Member ScriptProperty 'eq_ab' `
{ {
[bool]$this.Getter($this.cmd('eq.ab')) [bool]$this.Getter($this.cmd('eq.ab'))
}` } `
{ {
param ( $arg ) param($arg)
$this._eq = $this.Setter($this.cmd('eq.ab'), $arg) $this._eq = $this.Setter($this.cmd('eq.ab'), $arg)
} }
) )
[void] FadeTo([Single]$target, [int]$time) { [void] FadeTo ([single]$target, [int]$time) {
$this.Setter($this.cmd('FadeTo'), "($target, $time)") $this.Setter($this.cmd('FadeTo'), "($target, $time)")
} }
[void] FadeBy([Single]$target, [int]$time) { [void] FadeBy ([single]$target, [int]$time) {
$this.Setter($this.cmd('FadeBy'), "($target, $time)") $this.Setter($this.cmd('FadeBy'), "($target, $time)")
} }
} }
class PhysicalBus : Bus { class PhysicalBus : Bus {
PhysicalBus ([Int]$id, [Object]$remote) : base ($id, $remote) { PhysicalBus ([int]$index, [Object]$remote) : base ($index, $remote) {
} }
hidden $_device = $($this | Add-Member ScriptProperty 'device' ` hidden $_device = $($this | Add-Member ScriptProperty 'device' `
{ {
$this.Getter_String($this.cmd('device.name')) $this.Getter_String($this.cmd('device.name'))
}` } `
{ {
return Write-Warning("ERROR: " + $this.cmd('device.name') + " is read only") return Write-Warning ("ERROR: " + $this.cmd('device.name') + " is read only")
} }
) )
hidden $_sr = $($this | Add-Member ScriptProperty 'sr' ` hidden $_sr = $($this | Add-Member ScriptProperty 'sr' `
{ {
$this.Getter($this.cmd('device.sr')) $this.Getter($this.cmd('device.sr'))
}` } `
{ {
return Write-Warning("ERROR: " + $this.cmd('device.sr') + " is read only") return Write-Warning ("ERROR: " + $this.cmd('device.sr') + " is read only")
} }
) )
} }
class VirtualBus : Bus { class VirtualBus : Bus {
VirtualBus ([Int]$id, [Object]$remote) : base ($id, $remote) { VirtualBus ([int]$index, [Object]$remote) : base ($index, $remote) {
} }
} }
Function Make_Buses([Object]$remote) { function Make_Buses ([Object]$remote) {
[System.Collections.ArrayList]$bus = @() [System.Collections.ArrayList]$bus = @()
0..$($remote.kind.p_out + $remote.kind.v_out - 1) | ForEach-Object { 0..$($remote.kind.p_out + $remote.kind.v_out - 1) | ForEach-Object {
if ($_ -lt $remote.kind.p_out) { [void]$bus.Add([PhysicalBus]::new($_, $remote)) } if ($_ -lt $remote.kind.p_out) { [void]$bus.Add([PhysicalBus]::new($_, $remote)) }

View File

@ -2,40 +2,44 @@
class Special { class Special {
# Constructor # Constructor
Special() { Special () {
AddActionMembers -PARAMS @('restart', 'shutdown', 'show') AddActionMembers -PARAMS @('restart', 'shutdown', 'show')
} }
[Single] Getter($cmd) { [string] ToString() {
return $this.GetType().Name
}
[single] Getter ($cmd) {
return Param_Get -PARAM $cmd -IS_STRING $false return Param_Get -PARAM $cmd -IS_STRING $false
} }
[void] Setter($param, $val) { [void] Setter ($param, $val) {
if ($val -is [Boolean]) { if ($val -is [Boolean]) {
Param_Set -PARAM $param -VALUE $(if ($val) { 1 } else { 0 }) Param_Set -PARAM $param -Value $(if ($val) { 1 } else { 0 })
} }
else { else {
Param_Set -PARAM $param -VALUE $val Param_Set -PARAM $param -Value $val
} }
} }
[String] cmd ($arg) { [string] cmd ($arg) {
return "Command.$arg" return "Command.$arg"
} }
hidden $_hide = $($this | Add-Member ScriptProperty 'hide' ` hidden $_hide = $($this | Add-Member ScriptProperty 'hide' `
{ {
$this._hide = $this.Setter($this.cmd('show'), $false) $this._hide = $this.Setter($this.cmd('show'), $false)
}` } `
{} {}
) )
hidden $_showvbanchat = $($this | Add-Member ScriptProperty 'showvbanchat' ` hidden $_showvbanchat = $($this | Add-Member ScriptProperty 'showvbanchat' `
{ {
$this.Getter($this.cmd('DialogShow.VBANCHAT')) $this.Getter($this.cmd('DialogShow.VBANCHAT'))
}` } `
{ {
param( [bool]$arg ) param([bool]$arg)
$this._showvbanchat = $this.Setter($this.cmd('DialogShow.VBANCHAT'), $arg) $this._showvbanchat = $this.Setter($this.cmd('DialogShow.VBANCHAT'), $arg)
} }
) )
@ -43,14 +47,14 @@ class Special {
hidden $_lock = $($this | Add-Member ScriptProperty 'lock' ` hidden $_lock = $($this | Add-Member ScriptProperty 'lock' `
{ {
$this._lock = $this.Getter($this.cmd('lock')) $this._lock = $this.Getter($this.cmd('lock'))
}` } `
{ {
param( [bool]$arg ) param([bool]$arg)
$this._lock = $this.Setter($this.cmd('lock'), $arg) $this._lock = $this.Setter($this.cmd('lock'), $arg)
} }
) )
} }
Function Make_Command { function Make_Command {
return [Special]::new() return [Special]::new()
} }

View File

@ -1,30 +1,30 @@
class VMRemoteErrors : Exception { class VMRemoteErrors : Exception {
[String]$msg [string]$msg
VMRemoteErrors([String]$msg) { VMRemoteErrors ([string]$msg) {
$this.msg = $msg $this.msg = $msg
} }
[String] ErrorMessage() { [string] ErrorMessage () {
return $this.msg return $this.msg
} }
} }
class LoginError : VMRemoteErrors { class LoginError : VMRemoteErrors {
LoginError([String]$msg) : Base([String]$msg) { LoginError ([string]$msg) : base ([string]$msg) {
} }
} }
class CAPIError : VMRemoteErrors { class CAPIError : VMRemoteErrors {
[Int]$retval [int]$retval
[String]$caller [string]$caller
CAPIError([Int]$retval, [String]$caller) { CAPIError ([int]$retval, [string]$caller) {
$this.retval = $retval $this.retval = $retval
$this.caller = $caller $this.caller = $caller
} }
[String] ErrorMessage() { [string] ErrorMessage () {
return "ERROR: CAPI return value: {0} in {1}" -f $this.retval, $this.caller return "ERROR: CAPI return value: {0} in {1}" -f $this.retval, $this.caller
} }
} }

View File

@ -1,6 +1,6 @@
Function Get_VBPath { function Get_VBPath {
$reg_path = "Registry::HKEY_LOCAL_MACHINE\Software" + ` $reg_path = "Registry::HKEY_LOCAL_MACHINE\Software" + `
(& { If ([Environment]::Is64BitOperatingSystem) { "\WOW6432Node" } Else { "" } }) + ` (& { if ([Environment]::Is64BitOperatingSystem) { "\WOW6432Node" } else { "" } }) + `
"\Microsoft\Windows\CurrentVersion\Uninstall" "\Microsoft\Windows\CurrentVersion\Uninstall"
$vm_key = "\VB:Voicemeeter {17359A74-1236-5467}\" $vm_key = "\VB:Voicemeeter {17359A74-1236-5467}\"

View File

@ -28,6 +28,6 @@ $KindMap = @{
}; };
} }
Function GetKind([string]$kind_id) { function GetKind ([string]$kind_id) {
$KindMap[$kind_id] $KindMap[$kind_id]
} }

View File

@ -1,25 +1,29 @@
class MacroButton { class MacroButton {
[int32]$id [int32]$index
# Constructor # Constructor
MacroButton ([Int]$id) { MacroButton ([int]$index) {
$this.id = $id $this.index = $index
} }
[int] Getter($mode) { [string] ToString() {
return MB_Get -ID $this.id -MODE $mode return $this.GetType().Name + $this.index
} }
[void] Setter($set, $mode) { [int] Getter ($mode) {
MB_Set -ID $this.id -SET $set -MODE $mode return MB_Get -Id $this.index -Mode $mode
}
[void] Setter ($set, $mode) {
MB_Set -Id $this.index -SET $set -Mode $mode
} }
hidden $_state = $($this | Add-Member ScriptProperty 'state' ` hidden $_state = $($this | Add-Member ScriptProperty 'state' `
{ {
$this.Getter(1) $this.Getter(1)
}` } `
{ {
param ( $arg ) param($arg)
$this._state = $this.Setter($arg, 1) $this._state = $this.Setter($arg, 1)
} }
) )
@ -27,9 +31,9 @@ class MacroButton {
hidden $_stateonly = $($this | Add-Member ScriptProperty 'stateonly' ` hidden $_stateonly = $($this | Add-Member ScriptProperty 'stateonly' `
{ {
$this.Getter(2) $this.Getter(2)
}` } `
{ {
param ( $arg ) param($arg)
$this._stateonly = $this.Setter($arg, 2) $this._stateonly = $this.Setter($arg, 2)
} }
) )
@ -37,15 +41,15 @@ class MacroButton {
hidden $_trigger = $($this | Add-Member ScriptProperty 'trigger' ` hidden $_trigger = $($this | Add-Member ScriptProperty 'trigger' `
{ {
$this.Getter(3) $this.Getter(3)
}` } `
{ {
param ( $arg ) param($arg)
$this._trigger = $this.Setter($arg, 3) $this._trigger = $this.Setter($arg, 3)
} }
) )
} }
Function Make_Buttons { function Make_Buttons {
[System.Collections.ArrayList]$button = @() [System.Collections.ArrayList]$button = @()
0..79 | ForEach-Object { 0..79 | ForEach-Object {
[void]$button.Add([MacroButton]::new($_)) [void]$button.Add([MacroButton]::new($_))

View File

@ -1,9 +1,9 @@
Function AddBoolMembers() { function AddBoolMembers () {
param( param(
[String[]]$PARAMS [String[]]$PARAMS
) )
[HashTable]$Signatures = @{} [hashtable]$Signatures = @{}
ForEach ($param in $PARAMS) { foreach ($param in $PARAMS) {
# Define getter # Define getter
$Signatures["Getter"] = "[bool]`$this.Getter(`$this.cmd('{0}'))" -f $param $Signatures["Getter"] = "[bool]`$this.Getter(`$this.cmd('{0}'))" -f $param
# Define setter # Define setter
@ -14,12 +14,12 @@ Function AddBoolMembers() {
} }
} }
Function AddFloatMembers() { function AddFloatMembers () {
param( param(
[String[]]$PARAMS [String[]]$PARAMS
) )
[HashTable]$Signatures = @{} [hashtable]$Signatures = @{}
ForEach ($param in $PARAMS) { foreach ($param in $PARAMS) {
# Define getter # Define getter
$Signatures["Getter"] = "[math]::Round(`$this.Getter(`$this.cmd('{0}')), 1)" -f $param $Signatures["Getter"] = "[math]::Round(`$this.Getter(`$this.cmd('{0}')), 1)" -f $param
# Define setter # Define setter
@ -30,12 +30,12 @@ Function AddFloatMembers() {
} }
} }
Function AddIntMembers() { function AddIntMembers () {
param( param(
[String[]]$PARAMS [String[]]$PARAMS
) )
[HashTable]$Signatures = @{} [hashtable]$Signatures = @{}
ForEach ($param in $PARAMS) { foreach ($param in $PARAMS) {
# Define getter # Define getter
$Signatures["Getter"] = "[Int]`$this.Getter(`$this.cmd('{0}'))" -f $param $Signatures["Getter"] = "[Int]`$this.Getter(`$this.cmd('{0}'))" -f $param
# Define setter # Define setter
@ -46,12 +46,12 @@ Function AddIntMembers() {
} }
} }
Function AddStringMembers() { function AddStringMembers () {
param( param(
[String[]]$PARAMS [String[]]$PARAMS
) )
[HashTable]$Signatures = @{} [hashtable]$Signatures = @{}
ForEach ($param in $PARAMS) { foreach ($param in $PARAMS) {
# Define getter # Define getter
$Signatures["Getter"] = "[String]`$this.Getter_String(`$this.cmd('{0}'))" -f $param $Signatures["Getter"] = "[String]`$this.Getter_String(`$this.cmd('{0}'))" -f $param
# Define setter # Define setter
@ -62,12 +62,12 @@ Function AddStringMembers() {
} }
} }
Function AddActionMembers() { function AddActionMembers () {
param( param(
[String[]]$PARAMS [String[]]$PARAMS
) )
[HashTable]$Signatures = @{} [hashtable]$Signatures = @{}
ForEach ($param in $PARAMS) { foreach ($param in $PARAMS) {
# Define getter # Define getter
$Signatures["Getter"] = "`$this.Setter(`$this.cmd('{0}'), `$true)" -f $param $Signatures["Getter"] = "`$this.Setter(`$this.cmd('{0}'), `$true)" -f $param
# Define setter # Define setter
@ -77,7 +77,7 @@ Function AddActionMembers() {
} }
} }
Function AddChannelMembers() { function AddChannelMembers () {
$num_A = $this.remote.kind.p_out $num_A = $this.remote.kind.p_out
$num_B = $this.remote.kind.v_out $num_B = $this.remote.kind.v_out
@ -89,8 +89,8 @@ Function AddChannelMembers() {
AddBoolMembers -PARAMS $channels AddBoolMembers -PARAMS $channels
} }
Function AddGainlayerMembers() { function AddGainlayerMembers () {
[HashTable]$Signatures = @{} [hashtable]$Signatures = @{}
0..7 | ForEach-Object { 0..7 | ForEach-Object {
# Define getter # Define getter
$Signatures["Getter"] = "`$this.Getter(`$this.cmd('gainlayer[{0}]'))" -f $_ $Signatures["Getter"] = "`$this.Getter(`$this.cmd('gainlayer[{0}]'))" -f $_
@ -98,17 +98,18 @@ Function AddGainlayerMembers() {
$Signatures["Setter"] = "param ( [Single]`$arg )`n`$this.Setter(`$this.cmd('gainlayer[{0}]'), `$arg)" ` $Signatures["Setter"] = "param ( [Single]`$arg )`n`$this.Setter(`$this.cmd('gainlayer[{0}]'), `$arg)" `
-f $_ -f $_
$param = "gainlayer{0}" -f $_ $param = "gainlayer{0}" -f $_
$null = $param
Addmember Addmember
} }
} }
Function AddBusModeMembers() { function AddBusModeMembers () {
param( param(
[String[]]$PARAMS [String[]]$PARAMS
) )
[HashTable]$Signatures = @{} [hashtable]$Signatures = @{}
ForEach ($param in $PARAMS) { foreach ($param in $PARAMS) {
# Define getter # Define getter
$Signatures["Getter"] = "[bool]`$this.Getter(`$this.cmd('mode.{0}'))" -f $param $Signatures["Getter"] = "[bool]`$this.Getter(`$this.cmd('mode.{0}'))" -f $param
# Define setter # Define setter
@ -120,12 +121,12 @@ Function AddBusModeMembers() {
} }
} }
Function Addmember { function Addmember {
$AddMemberParams = @{ $AddMemberParams = @{
Name = $param Name = $param
MemberType = 'ScriptProperty' MemberType = 'ScriptProperty'
Value = [ScriptBlock]::Create($Signatures["Getter"]) Value = [scriptblock]::Create($Signatures["Getter"])
SecondValue = [ScriptBlock]::Create($Signatures["Setter"]) SecondValue = [scriptblock]::Create($Signatures["Setter"])
} }
$this | Add-Member @AddMemberParams $this | Add-Member @AddMemberParams
} }

View File

@ -1,4 +1,4 @@
Function Get_Profiles([String]$kind_id) { function Get_Profiles ([string]$kind_id) {
$basepath = Join-Path -Path $(Split-Path -Path $PSScriptRoot) -ChildPath "profiles" $basepath = Join-Path -Path $(Split-Path -Path $PSScriptRoot) -ChildPath "profiles"
if (Test-Path $basepath) { if (Test-Path $basepath) {
$fullpath = Join-Path -Path $basepath -ChildPath $kind_id $fullpath = Join-Path -Path $basepath -ChildPath $kind_id
@ -6,7 +6,7 @@ Function Get_Profiles([String]$kind_id) {
else { return $null } else { return $null }
$filenames = @(Get-ChildItem -Path $fullpath -Filter *.psd1 -Recurse -File) $filenames = @(Get-ChildItem -Path $fullpath -Filter *.psd1 -Recurse -File)
[HashTable]$data = @{} [hashtable]$data = @{}
if ($filenames) { if ($filenames) {
$filenames | ForEach-Object { $filenames | ForEach-Object {
(Join-Path -Path $fullpath -ChildPath $_) | ForEach-Object { (Join-Path -Path $fullpath -ChildPath $_) | ForEach-Object {
@ -20,9 +20,9 @@ Function Get_Profiles([String]$kind_id) {
return $null return $null
} }
Function Set_Profile { function Set_Profile {
param( param(
[Object]$DATA, [String]$CONF [Object]$DATA, [string]$CONF
) )
try { try {
if ($null -eq $DATA -or -not $DATA.$CONF) { if ($null -eq $DATA -or -not $DATA.$CONF) {

View File

@ -3,45 +3,49 @@
class Recorder { class Recorder {
[Object]$remote [Object]$remote
# Constructor # Constructor
Recorder([Object]$remote) { Recorder ([Object]$remote) {
$this.remote = $remote $this.remote = $remote
AddActionMembers -PARAMS @('play', 'stop', 'pause', 'replay', 'record', 'ff', 'rew') AddActionMembers -PARAMS @('play', 'stop', 'pause', 'replay', 'record', 'ff', 'rew')
AddChannelMembers AddChannelMembers
} }
[Single] Getter($cmd) { [string] ToString() {
return $this.GetType().Name
}
[single] Getter ($cmd) {
return Param_Get -PARAM $cmd -IS_STRING $false return Param_Get -PARAM $cmd -IS_STRING $false
} }
[void] Setter($param, $val) { [void] Setter ($param, $val) {
if ($val -is [Boolean]) { if ($val -is [Boolean]) {
Param_Set -PARAM $param -VALUE $(if ($val) { 1 } else { 0 }) Param_Set -PARAM $param -Value $(if ($val) { 1 } else { 0 })
} }
else { else {
Param_Set -PARAM $param -VALUE $val Param_Set -PARAM $param -Value $val
} }
} }
[String] cmd ($arg) { [string] cmd ($arg) {
return "Recorder.$arg" return "Recorder.$arg"
} }
hidden $_loop = $($this | Add-Member ScriptProperty 'loop' ` hidden $_loop = $($this | Add-Member ScriptProperty 'loop' `
{ {
return Write-Warning("ERROR: " + $this.cmd('mode.loop') + " is write only") return Write-Warning ("ERROR: " + $this.cmd('mode.loop') + " is write only")
}` } `
{ {
param( [bool]$arg ) param([bool]$arg)
$this._loop = $this.Setter($this.cmd('mode.loop'), $arg) $this._loop = $this.Setter($this.cmd('mode.loop'), $arg)
} }
) )
[void] Load([String]$filename) { [void] Load ([string]$filename) {
$this.Setter($this.cmd('load'), $filename) $this.Setter($this.cmd('load'), $filename)
} }
} }
Function Make_Recorder([Object]$remote) { function Make_Recorder ([Object]$remote) {
return [Recorder]::new($remote) return [Recorder]::new($remote)
} }

View File

@ -1,80 +1,86 @@
. $PSScriptRoot\meta.ps1 . $PSScriptRoot\meta.ps1
class Strip { class Strip {
[Int]$id [int]$index
[Object]$remote [Object]$remote
Strip ([Int]$id, [Object]$remote) { Strip ([int]$index, [Object]$remote) {
$this.id = $id $this.index = $index
$this.remote = $remote $this.remote = $remote
AddBoolMembers -PARAMS @('mono', 'solo', 'mute') AddBoolMembers -PARAMS @('mono', 'solo', 'mute')
AddIntMembers -PARAMS @('limit') AddIntMembers -PARAMS @('limit')
AddFloatMembers -PARAMS @('gain') AddFloatMembers -PARAMS @('gain', 'pan_x', 'pan_y')
AddStringMembers -PARAMS @('label') AddStringMembers -PARAMS @('label')
AddChannelMembers AddChannelMembers
AddGainlayerMembers AddGainlayerMembers
} }
[Single] Getter($cmd) { [string] ToString() {
return $this.GetType().Name + $this.index
}
[single] Getter ($cmd) {
return Param_Get -PARAM $cmd -IS_STRING $false return Param_Get -PARAM $cmd -IS_STRING $false
} }
[String] Getter_String($cmd) { [string] Getter_String ($cmd) {
return Param_Get -PARAM $cmd -IS_STRING $true return Param_Get -PARAM $cmd -IS_STRING $true
} }
[void] Setter($cmd, $val) { [void] Setter ($cmd, $val) {
Param_Set -PARAM $cmd -VALUE $val Param_Set -PARAM $cmd -Value $val
} }
[String] cmd ($arg) { [string] cmd ($arg) {
return "Strip[" + $this.id + "].$arg" return "Strip[" + $this.index + "].$arg"
} }
[void] FadeTo([Single]$target, [int]$time) { [void] FadeTo ([single]$target, [int]$time) {
$this.Setter($this.cmd('FadeTo'), "($target, $time)") $this.Setter($this.cmd('FadeTo'), "($target, $time)")
} }
[void] FadeBy([Single]$target, [int]$time) { [void] FadeBy ([single]$target, [int]$time) {
$this.Setter($this.cmd('FadeBy'), "($target, $time)") $this.Setter($this.cmd('FadeBy'), "($target, $time)")
} }
} }
class PhysicalStrip : Strip { class PhysicalStrip : Strip {
PhysicalStrip ([Int]$id, [Object]$remote) : base ($id, $remote) { PhysicalStrip ([int]$index, [Object]$remote) : base ($index, $remote) {
AddFloatMembers -PARAMS @('comp', 'gate') AddFloatMembers -PARAMS @('comp', 'gate', 'color_x', 'color_y', 'fx_x', 'fx_y')
AddFloatMembers -PARAMS @('reverb', 'delay', 'fx1', 'fx2')
AddBoolMembers -PARAMS @('postreverb', 'postdelay', 'postfx1', 'postfx2')
} }
hidden $_device = $($this | Add-Member ScriptProperty 'device' ` hidden $_device = $($this | Add-Member ScriptProperty 'device' `
{ {
$this.Getter_String($this.cmd('device.name')) $this.Getter_String($this.cmd('device.name'))
}` } `
{ {
return Write-Warning("ERROR: " + $this.cmd('device.name') + " is read only") return Write-Warning ("ERROR: " + $this.cmd('device.name') + " is read only")
} }
) )
hidden $_sr = $($this | Add-Member ScriptProperty 'sr' ` hidden $_sr = $($this | Add-Member ScriptProperty 'sr' `
{ {
$this.Getter($this.cmd('device.sr')) $this.Getter($this.cmd('device.sr'))
}` } `
{ {
return Write-Warning("ERROR: " + $this.cmd('device.sr') + " is read only") return Write-Warning ("ERROR: " + $this.cmd('device.sr') + " is read only")
} }
) )
} }
class VirtualStrip : Strip { class VirtualStrip : Strip {
VirtualStrip ([Int]$id, [Object]$remote) : base ($id, $remote) { VirtualStrip ([int]$index, [Object]$remote) : base ($index, $remote) {
AddBoolMembers -PARAMS @('mc') AddBoolMembers -PARAMS @('mc')
AddIntMembers -PARAMS @('k') AddIntMembers -PARAMS @('k')
} }
} }
Function Make_Strips([Object]$remote) { function Make_Strips ([Object]$remote) {
[System.Collections.ArrayList]$strip = @() [System.Collections.ArrayList]$strip = @()
0..$($remote.kind.p_in + $remote.kind.v_in - 1) | ForEach-Object { 0..$($remote.kind.p_in + $remote.kind.v_in - 1) | ForEach-Object {
if ($_ -lt $remote.kind.p_in) { if ($_ -lt $remote.kind.p_in) {

View File

@ -1,34 +1,38 @@
class Vban { class Vban {
[int32]$id [int32]$index
[String]$direction [string]$direction
# Constructor # Constructor
Vban([Int]$id) { Vban ([int]$index) {
$this.id = $id $this.index = $index
} }
[Single] Getter($cmd) { [string] ToString() {
return $this.GetType().Name + $this.index
}
[single] Getter ($cmd) {
return Param_Get -PARAM $cmd -IS_STRING $false return Param_Get -PARAM $cmd -IS_STRING $false
} }
[String] Getter_String($cmd) { [string] Getter_String ($cmd) {
return Param_Get -PARAM $cmd -IS_STRING $true return Param_Get -PARAM $cmd -IS_STRING $true
} }
[void] Setter($cmd, $set) { [void] Setter ($cmd, $set) {
Param_Set -PARAM $cmd -VALUE $set Param_Set -PARAM $cmd -Value $set
} }
[String] cmd ($arg) { [string] cmd ($arg) {
return "vban." + $this.direction + "stream[" + $this.id + "].$arg" return "vban." + $this.direction + "stream[" + $this.index + "].$arg"
} }
hidden $_on = $($this | Add-Member ScriptProperty 'on' ` hidden $_on = $($this | Add-Member ScriptProperty 'on' `
{ {
$this.Getter($this.cmd('on')) $this.Getter($this.cmd('on'))
}` } `
{ {
param ( [Bool]$arg ) param([bool]$arg)
$this._on = $this.Setter($this.cmd('on'), $arg) $this._on = $this.Setter($this.cmd('on'), $arg)
} }
) )
@ -36,9 +40,9 @@ class Vban {
hidden $_name = $($this | Add-Member ScriptProperty 'name' ` hidden $_name = $($this | Add-Member ScriptProperty 'name' `
{ {
$this.Getter_String($this.cmd('name')) $this.Getter_String($this.cmd('name'))
}` } `
{ {
param ( [String]$arg ) param([string]$arg)
$this._name = $this.Setter($this.cmd('name'), $arg) $this._name = $this.Setter($this.cmd('name'), $arg)
} }
) )
@ -46,9 +50,9 @@ class Vban {
hidden $_ip = $($this | Add-Member ScriptProperty 'ip' ` hidden $_ip = $($this | Add-Member ScriptProperty 'ip' `
{ {
$this.Getter_String($this.cmd('ip')) $this.Getter_String($this.cmd('ip'))
}` } `
{ {
param ( [String]$arg ) param([string]$arg)
$this._ip = $this.Setter($this.cmd('ip'), $arg) $this._ip = $this.Setter($this.cmd('ip'), $arg)
} }
) )
@ -56,14 +60,14 @@ class Vban {
hidden $_port = $($this | Add-Member ScriptProperty 'port' ` hidden $_port = $($this | Add-Member ScriptProperty 'port' `
{ {
$this.Getter($this.cmd('port')) $this.Getter($this.cmd('port'))
}` } `
{ {
param ( [String]$arg ) param([string]$arg)
if ($arg -In 1024..65535) { if ($arg -in 1024..65535) {
$this._port = $this.Setter($this.cmd('port'), $arg) $this._port = $this.Setter($this.cmd('port'), $arg)
} }
else { else {
Write-Warning('Expected value from 1024 to 65535') Write-Warning ('Expected value from 1024 to 65535')
} }
} }
) )
@ -71,17 +75,17 @@ class Vban {
hidden $_sr = $($this | Add-Member ScriptProperty 'sr' ` hidden $_sr = $($this | Add-Member ScriptProperty 'sr' `
{ {
$this.Getter($this.cmd('sr')) $this.Getter($this.cmd('sr'))
}` } `
{ {
param ( [Int]$arg ) param([int]$arg)
if ($this.direction -eq "in") { Write-Warning('Error, read only value') } if ($this.direction -eq "in") { Write-Warning ('Error, read only value') }
else { else {
$opts = @(11025, 16000, 22050, 24000, 32000, 44100, 48000, 64000, 88200, 96000) $opts = @(11025, 16000, 22050, 24000, 32000, 44100, 48000, 64000, 88200, 96000)
if ($opts.Contains($arg)) { if ($opts.Contains($arg)) {
$this._port = $this.Setter($this.cmd('sr'), $arg) $this._port = $this.Setter($this.cmd('sr'), $arg)
} }
else { else {
Write-Warning('Expected one of', $opts) Write-Warning ('Expected one of', $opts)
} }
} }
} }
@ -90,16 +94,16 @@ class Vban {
hidden $_channel = $($this | Add-Member ScriptProperty 'channel' ` hidden $_channel = $($this | Add-Member ScriptProperty 'channel' `
{ {
$this.Getter($this.cmd('channel')) $this.Getter($this.cmd('channel'))
}` } `
{ {
param ( [Int]$arg ) param([int]$arg)
if ($this.direction -eq "in") { Write-Warning('Error, read only value') } if ($this.direction -eq "in") { Write-Warning ('Error, read only value') }
else { else {
if ($arg -In 1..8) { if ($arg -in 1..8) {
$this._channel = $this.Setter($this.cmd('channel'), $arg) $this._channel = $this.Setter($this.cmd('channel'), $arg)
} }
else { else {
Write-Warning('Expected value from 1 to 8') Write-Warning ('Expected value from 1 to 8')
} }
} }
} }
@ -109,17 +113,17 @@ class Vban {
{ {
$val = if ($this.Getter($this.cmd('bit')) -eq 1) { 16 } else { 24 } $val = if ($this.Getter($this.cmd('bit')) -eq 1) { 16 } else { 24 }
return $val return $val
}` } `
{ {
param ( [Int]$arg ) param([int]$arg)
if ($this.direction -eq "in") { Write-Warning('Error, read only value') } if ($this.direction -eq "in") { Write-Warning ('Error, read only value') }
else { else {
if (@(16, 24).Contains($arg)) { if (@(16, 24).Contains($arg)) {
$val = if ($arg -eq 16) { 1 } else { 2 } $val = if ($arg -eq 16) { 1 } else { 2 }
$this._bit = $this.Setter($this.cmd('bit'), $val) $this._bit = $this.Setter($this.cmd('bit'), $val)
} }
else { else {
Write-Warning('Expected value 16 or 24') Write-Warning ('Expected value 16 or 24')
} }
} }
} }
@ -128,16 +132,16 @@ class Vban {
hidden $_quality = $($this | Add-Member ScriptProperty 'quality' ` hidden $_quality = $($this | Add-Member ScriptProperty 'quality' `
{ {
$this.Getter($this.cmd('quality')) $this.Getter($this.cmd('quality'))
}` } `
{ {
param ( [Int]$arg ) param([int]$arg)
if ($this.direction -eq "in") { Write-Warning('Error, read only value') } if ($this.direction -eq "in") { Write-Warning ('Error, read only value') }
else { else {
if ($arg -In 0..4) { if ($arg -in 0..4) {
$this._quality = $this.Setter($this.cmd('quality'), $arg) $this._quality = $this.Setter($this.cmd('quality'), $arg)
} }
else { else {
Write-Warning('Expected value from 0 to 4') Write-Warning ('Expected value from 0 to 4')
} }
} }
} }
@ -146,16 +150,16 @@ class Vban {
hidden $_route = $($this | Add-Member ScriptProperty 'route' ` hidden $_route = $($this | Add-Member ScriptProperty 'route' `
{ {
$this.Getter($this.cmd('route')) $this.Getter($this.cmd('route'))
}` } `
{ {
param ( [Int]$arg ) param([int]$arg)
if ($this.direction -eq "in") { Write-Warning('Error, read only value') } if ($this.direction -eq "in") { Write-Warning ('Error, read only value') }
else { else {
if ($arg -In 0..8) { if ($arg -in 0..8) {
$this._route = $this.Setter($this.cmd('route'), $arg) $this._route = $this.Setter($this.cmd('route'), $arg)
} }
else { else {
Write-Warning('Expected value from 0 to 8') Write-Warning ('Expected value from 0 to 8')
} }
} }
} }
@ -165,7 +169,7 @@ class Vban {
class VbanInstream : Vban { class VbanInstream : Vban {
# Constructor # Constructor
VbanInstream ([Int]$id) : base ($id) { VbanInstream ([int]$index) : base ($index) {
$this.direction = "in" $this.direction = "in"
} }
} }
@ -173,13 +177,13 @@ class VbanInstream : Vban {
class VbanOutstream : Vban { class VbanOutstream : Vban {
# Constructor # Constructor
VbanOutstream ([Int]$id) : base ($id) { VbanOutstream ([int]$index) : base ($index) {
$this.direction = "out" $this.direction = "out"
} }
} }
Function Make_Vban([Object]$remote) { function Make_Vban ([Object]$remote) {
[System.Collections.ArrayList]$instream = @() [System.Collections.ArrayList]$instream = @()
[System.Collections.ArrayList]$outstream = @() [System.Collections.ArrayList]$outstream = @()
@ -190,17 +194,17 @@ Function Make_Vban([Object]$remote) {
[void]$outstream.Add([VbanOutstream]::new($_)) [void]$outstream.Add([VbanOutstream]::new($_))
} }
$CustomObject = [PSCustomObject]@{ $CustomObject = [pscustomobject]@{
instream = $instream instream = $instream
outstream = $outstream outstream = $outstream
} }
$CustomObject | Add-Member ScriptProperty 'enable' ` $CustomObject | Add-Member ScriptProperty 'enable' `
{ {
return Write-Warning("ERROR: vban.enable is write only") return Write-Warning ("ERROR: vban.enable is write only")
}` } `
{ {
param( [bool]$arg ) param([bool]$arg)
Param_Set -PARAM 'vban.Enable' -Value $(if ($arg) { 1 } else { 0 }) Param_Set -PARAM 'vban.Enable' -Value $(if ($arg) { 1 } else { 0 })
} }