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:
52
lib/bus.ps1
52
lib/bus.ps1
@@ -1,44 +1,48 @@
|
||||
. $PSScriptRoot\meta.ps1
|
||||
|
||||
class Bus {
|
||||
[Int]$id
|
||||
[int]$index
|
||||
[Object]$remote
|
||||
|
||||
# Constructor
|
||||
Bus ([Int]$id, [Object]$remote) {
|
||||
$this.id = $id
|
||||
Bus ([int]$index, [Object]$remote) {
|
||||
$this.index = $index
|
||||
$this.remote = $remote
|
||||
|
||||
AddBoolMembers -PARAMS @('mono', 'mute')
|
||||
AddStringMembers -PARAMS @('label')
|
||||
AddFloatMembers -PARAMS @('gain')
|
||||
AddFloatMembers -PARAMS @('gain', 'returnreverb', 'returndelay', 'returnfx1', 'returnfx2')
|
||||
|
||||
AddBusModeMembers -PARAMS @('normal', 'amix', 'bmix', 'repeat', 'composite', 'tvmix', 'upmix21',
|
||||
'upmix41', 'upmix61', 'centeronly', 'lfeonly', 'rearonly')
|
||||
AddBusModeMembers -PARAMS @('normal', 'amix', 'bmix', 'repeat', 'composite', 'tvmix', 'upmix21')
|
||||
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
|
||||
}
|
||||
|
||||
[String] Getter_String($cmd) {
|
||||
[string] Getter_String ($cmd) {
|
||||
return Param_Get -PARAM $cmd -IS_STRING $true
|
||||
}
|
||||
|
||||
[void] Setter($cmd, $set) {
|
||||
Param_Set -PARAM $cmd -VALUE $set
|
||||
[void] Setter ($cmd, $set) {
|
||||
Param_Set -PARAM $cmd -Value $set
|
||||
}
|
||||
|
||||
[string] cmd ($arg) {
|
||||
return "Bus[" + $this.id + "].$arg"
|
||||
return "Bus[" + $this.index + "].$arg"
|
||||
}
|
||||
|
||||
hidden $_eq = $($this | Add-Member ScriptProperty 'eq' `
|
||||
{
|
||||
[bool]$this.Getter($this.cmd('EQ.on'))
|
||||
}`
|
||||
} `
|
||||
{
|
||||
param ( $arg )
|
||||
param($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' `
|
||||
{
|
||||
[bool]$this.Getter($this.cmd('eq.ab'))
|
||||
}`
|
||||
} `
|
||||
{
|
||||
param ( $arg )
|
||||
param($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)")
|
||||
}
|
||||
|
||||
[void] FadeBy([Single]$target, [int]$time) {
|
||||
[void] FadeBy ([single]$target, [int]$time) {
|
||||
$this.Setter($this.cmd('FadeBy'), "($target, $time)")
|
||||
}
|
||||
}
|
||||
|
||||
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' `
|
||||
{
|
||||
$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 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 = @()
|
||||
0..$($remote.kind.p_out + $remote.kind.v_out - 1) | ForEach-Object {
|
||||
if ($_ -lt $remote.kind.p_out) { [void]$bus.Add([PhysicalBus]::new($_, $remote)) }
|
||||
|
||||
Reference in New Issue
Block a user