mirror of
https://github.com/onyx-and-iris/voicemeeter-api-powershell.git
synced 2026-04-18 05:23:32 +00:00
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:
@@ -1,84 +1,90 @@
|
||||
. $PSScriptRoot\meta.ps1
|
||||
|
||||
class Strip {
|
||||
[Int]$id
|
||||
[int]$index
|
||||
[Object]$remote
|
||||
|
||||
Strip ([Int]$id, [Object]$remote) {
|
||||
$this.id = $id
|
||||
Strip ([int]$index, [Object]$remote) {
|
||||
$this.index = $index
|
||||
$this.remote = $remote
|
||||
|
||||
AddBoolMembers -PARAMS @('mono', 'solo', 'mute')
|
||||
AddIntMembers -PARAMS @('limit')
|
||||
AddFloatMembers -PARAMS @('gain')
|
||||
AddFloatMembers -PARAMS @('gain', 'pan_x', 'pan_y')
|
||||
AddStringMembers -PARAMS @('label')
|
||||
|
||||
AddChannelMembers
|
||||
AddGainlayerMembers
|
||||
}
|
||||
|
||||
[Single] Getter($cmd) {
|
||||
[string] ToString() {
|
||||
return $this.GetType().Name + $this.index
|
||||
}
|
||||
|
||||
[single] Getter ($cmd) {
|
||||
return Param_Get -PARAM $cmd -IS_STRING $false
|
||||
}
|
||||
|
||||
[String] Getter_String($cmd) {
|
||||
[string] Getter_String ($cmd) {
|
||||
return Param_Get -PARAM $cmd -IS_STRING $true
|
||||
}
|
||||
|
||||
[void] Setter($cmd, $val) {
|
||||
Param_Set -PARAM $cmd -VALUE $val
|
||||
[void] Setter ($cmd, $val) {
|
||||
Param_Set -PARAM $cmd -Value $val
|
||||
}
|
||||
|
||||
[String] cmd ($arg) {
|
||||
return "Strip[" + $this.id + "].$arg"
|
||||
[string] cmd ($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)")
|
||||
}
|
||||
|
||||
[void] FadeBy([Single]$target, [int]$time) {
|
||||
[void] FadeBy ([single]$target, [int]$time) {
|
||||
$this.Setter($this.cmd('FadeBy'), "($target, $time)")
|
||||
}
|
||||
}
|
||||
|
||||
class PhysicalStrip : Strip {
|
||||
PhysicalStrip ([Int]$id, [Object]$remote) : base ($id, $remote) {
|
||||
AddFloatMembers -PARAMS @('comp', 'gate')
|
||||
PhysicalStrip ([int]$index, [Object]$remote) : base ($index, $remote) {
|
||||
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' `
|
||||
{
|
||||
$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' `
|
||||
{
|
||||
$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 {
|
||||
VirtualStrip ([Int]$id, [Object]$remote) : base ($id, $remote) {
|
||||
VirtualStrip ([int]$index, [Object]$remote) : base ($index, $remote) {
|
||||
AddBoolMembers -PARAMS @('mc')
|
||||
AddIntMembers -PARAMS @('k')
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Function Make_Strips([Object]$remote) {
|
||||
function Make_Strips ([Object]$remote) {
|
||||
[System.Collections.ArrayList]$strip = @()
|
||||
0..$($remote.kind.p_in + $remote.kind.v_in - 1) | ForEach-Object {
|
||||
if ($_ -lt $remote.kind.p_in) {
|
||||
[void]$strip.Add([PhysicalStrip]::new($_, $remote))
|
||||
if ($_ -lt $remote.kind.p_in) {
|
||||
[void]$strip.Add([PhysicalStrip]::new($_, $remote))
|
||||
}
|
||||
else { [void]$strip.Add([VirtualStrip]::new($_, $remote)) }
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user