mirror of
https://github.com/onyx-and-iris/voicemeeter-api-powershell.git
synced 2025-01-18 21:30:46 +00:00
62c65e1c08
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.
133 lines
3.5 KiB
PowerShell
133 lines
3.5 KiB
PowerShell
function AddBoolMembers () {
|
|
param(
|
|
[String[]]$PARAMS
|
|
)
|
|
[hashtable]$Signatures = @{}
|
|
foreach ($param in $PARAMS) {
|
|
# Define getter
|
|
$Signatures["Getter"] = "[bool]`$this.Getter(`$this.cmd('{0}'))" -f $param
|
|
# Define setter
|
|
$Signatures["Setter"] = "param ( [Single]`$arg )`n`$this.Setter(`$this.cmd('{0}'), `$arg)" `
|
|
-f $param
|
|
|
|
Addmember
|
|
}
|
|
}
|
|
|
|
function AddFloatMembers () {
|
|
param(
|
|
[String[]]$PARAMS
|
|
)
|
|
[hashtable]$Signatures = @{}
|
|
foreach ($param in $PARAMS) {
|
|
# Define getter
|
|
$Signatures["Getter"] = "[math]::Round(`$this.Getter(`$this.cmd('{0}')), 1)" -f $param
|
|
# Define setter
|
|
$Signatures["Setter"] = "param ( [Single]`$arg )`n`$this.Setter(`$this.cmd('{0}'), `$arg)" `
|
|
-f $param
|
|
|
|
Addmember
|
|
}
|
|
}
|
|
|
|
function AddIntMembers () {
|
|
param(
|
|
[String[]]$PARAMS
|
|
)
|
|
[hashtable]$Signatures = @{}
|
|
foreach ($param in $PARAMS) {
|
|
# Define getter
|
|
$Signatures["Getter"] = "[Int]`$this.Getter(`$this.cmd('{0}'))" -f $param
|
|
# Define setter
|
|
$Signatures["Setter"] = "param ( [Single]`$arg )`n`$this.Setter(`$this.cmd('{0}'), `$arg)" `
|
|
-f $param
|
|
|
|
Addmember
|
|
}
|
|
}
|
|
|
|
function AddStringMembers () {
|
|
param(
|
|
[String[]]$PARAMS
|
|
)
|
|
[hashtable]$Signatures = @{}
|
|
foreach ($param in $PARAMS) {
|
|
# Define getter
|
|
$Signatures["Getter"] = "[String]`$this.Getter_String(`$this.cmd('{0}'))" -f $param
|
|
# Define setter
|
|
$Signatures["Setter"] = "param ( [String]`$arg )`n`$this.Setter(`$this.cmd('{0}'), `$arg)" `
|
|
-f $param
|
|
|
|
Addmember
|
|
}
|
|
}
|
|
|
|
function AddActionMembers () {
|
|
param(
|
|
[String[]]$PARAMS
|
|
)
|
|
[hashtable]$Signatures = @{}
|
|
foreach ($param in $PARAMS) {
|
|
# Define getter
|
|
$Signatures["Getter"] = "`$this.Setter(`$this.cmd('{0}'), `$true)" -f $param
|
|
# Define setter
|
|
$Signatures["Setter"] = ""
|
|
|
|
Addmember
|
|
}
|
|
}
|
|
|
|
function AddChannelMembers () {
|
|
$num_A = $this.remote.kind.p_out
|
|
$num_B = $this.remote.kind.v_out
|
|
|
|
[System.Collections.ArrayList]$channels = @()
|
|
1..$($num_A + $num_B) | ForEach-Object {
|
|
if ($_ -le $num_A) { $channels.Add("A{0}" -f $_) } else { $channels.Add("B{0}" -f $($_ - $num_A)) }
|
|
}
|
|
|
|
AddBoolMembers -PARAMS $channels
|
|
}
|
|
|
|
function AddGainlayerMembers () {
|
|
[hashtable]$Signatures = @{}
|
|
0..7 | ForEach-Object {
|
|
# Define getter
|
|
$Signatures["Getter"] = "`$this.Getter(`$this.cmd('gainlayer[{0}]'))" -f $_
|
|
# Define setter
|
|
$Signatures["Setter"] = "param ( [Single]`$arg )`n`$this.Setter(`$this.cmd('gainlayer[{0}]'), `$arg)" `
|
|
-f $_
|
|
$param = "gainlayer{0}" -f $_
|
|
$null = $param
|
|
|
|
Addmember
|
|
}
|
|
}
|
|
|
|
function AddBusModeMembers () {
|
|
param(
|
|
[String[]]$PARAMS
|
|
)
|
|
[hashtable]$Signatures = @{}
|
|
foreach ($param in $PARAMS) {
|
|
# Define getter
|
|
$Signatures["Getter"] = "[bool]`$this.Getter(`$this.cmd('mode.{0}'))" -f $param
|
|
# Define setter
|
|
$Signatures["Setter"] = "param ( [Single]`$arg )`n`$this.Setter(`$this.cmd('mode.{0}'), `$arg)" `
|
|
-f $param
|
|
$param = "mode_{0}" -f $param
|
|
|
|
Addmember
|
|
}
|
|
}
|
|
|
|
function Addmember {
|
|
$AddMemberParams = @{
|
|
Name = $param
|
|
MemberType = 'ScriptProperty'
|
|
Value = [scriptblock]::Create($Signatures["Getter"])
|
|
SecondValue = [scriptblock]::Create($Signatures["Setter"])
|
|
}
|
|
$this | Add-Member @AddMemberParams
|
|
}
|