From 15bec82ec45be9e2831ccd9a2577180c18591b58 Mon Sep 17 00:00:00 2001 From: onyx-and-iris <75868496+onyx-and-iris@users.noreply.github.com> Date: Tue, 8 Mar 2022 22:55:11 +0000 Subject: [PATCH] gainlayer, busmodes + mc,k added gainlayers and busmodes added. mc, k added to virtual strips --- lib/bus.ps1 | 15 ++++++++++++++- lib/meta.ps1 | 37 ++++++++++++++++++++++++++++++++++--- lib/strip.ps1 | 4 +++- 3 files changed, 51 insertions(+), 5 deletions(-) diff --git a/lib/bus.ps1 b/lib/bus.ps1 index ee804c9..88e2861 100644 --- a/lib/bus.ps1 +++ b/lib/bus.ps1 @@ -11,6 +11,9 @@ class Bus { AddBoolMembers -PARAMS @('mono', 'mute') AddStringMembers -PARAMS @('label') AddFloatMembers -PARAMS @('gain') + + AddBusModeMembers -PARAMS @('normal', 'amix', 'bmix', 'repeat', 'composite', 'tvmix', 'upmix21', + 'upmix41', 'upmix61', 'centeronly', 'lfeonly', 'rearonly') } [Single] Getter($cmd) { @@ -31,13 +34,23 @@ class Bus { hidden $_eq = $($this | Add-Member ScriptProperty 'eq' ` { - $this.Getter($this.cmd('EQ.on')) + [bool]$this.Getter($this.cmd('EQ.on')) }` { param ( $arg ) $this._eq = $this.Setter($this.cmd('EQ.on'), $arg) } ) + + hidden $_eq_ab = $($this | Add-Member ScriptProperty 'eq_ab' ` + { + [bool]$this.Getter($this.cmd('eq.ab')) + }` + { + param ( $arg ) + $this._eq = $this.Setter($this.cmd('eq.ab'), $arg) + } + ) } class PhysicalBus : Bus { diff --git a/lib/meta.ps1 b/lib/meta.ps1 index e27351a..279c87f 100644 --- a/lib/meta.ps1 +++ b/lib/meta.ps1 @@ -62,16 +62,16 @@ Function AddStringMembers() { } } -Function AddCommandMembers() { +Function AddActionMembers() { param( [String[]]$PARAMS ) [HashTable]$Signatures = @{} ForEach($param in $PARAMS) { # Define getter - $Signatures["Getter"] = "`$this.Getter(`$this.cmd('{0}'))" -f $_ + $Signatures["Getter"] = "`$this.Setter(`$this.cmd('{0}'), `$true)" -f $param # Define setter - $Signatures["Setter"] = "`$this.Setter(`$this.cmd('{0}'))" -f $_ + $Signatures["Setter"] = "" Addmember } @@ -89,6 +89,37 @@ Function AddChannelMembers() { 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 $_ + + 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 diff --git a/lib/strip.ps1 b/lib/strip.ps1 index 2042dea..9bff5e4 100644 --- a/lib/strip.ps1 +++ b/lib/strip.ps1 @@ -3,7 +3,6 @@ class Strip { [Int]$id - # Constructor Strip ([Int]$id) { $this.id = $id @@ -14,6 +13,7 @@ class Strip { AddStringMembers -PARAMS @('label') AddChannelMembers + AddGainlayerMembers } [Single] Getter($cmd) { @@ -59,6 +59,8 @@ class PhysicalStrip : Strip { class VirtualStrip : Strip { VirtualStrip ([Int]$id) : base ($id) { + AddBoolMembers -PARAMS @('mc') + AddIntMembers -PARAMS @('k') } }