diff --git a/lib/base.ps1 b/lib/base.ps1 index e10a305..eda2b10 100644 --- a/lib/base.ps1 +++ b/lib/base.ps1 @@ -1,3 +1,7 @@ +. $PSScriptRoot\strip.ps1 +. $PSScriptRoot\bus.ps1 +. $PSScriptRoot\macrobuttons.ps1 + $Handles = @' [DllImport(@"C:\Program Files (x86)\VB\Voicemeeter\VoicemeeterRemote64.dll")] public static extern int VBVMR_Login(); diff --git a/lib/bus.ps1 b/lib/bus.ps1 index 8c22a1a..47e25f7 100644 --- a/lib/bus.ps1 +++ b/lib/bus.ps1 @@ -11,7 +11,7 @@ class Bus { Param_Set -PARAM $cmd -VALUE $set } - [int] Getter($cmd) { + [Single] Getter($cmd) { return Param_Get -PARAM $cmd } @@ -42,6 +42,18 @@ class Bus { $this._mute = $this.Setter($this.cmd('Mute'), $arg) } ) + + hidden $_gain = $($this | Add-Member ScriptProperty 'gain' ` + { + # get + $this.Getter($this.cmd('gain')) + }` + { + # set + param ( [Single]$arg ) + $this._gain = $this.Setter($this.cmd('gain'), $arg) + } + ) } Function Buses { @@ -54,14 +66,21 @@ Function Buses { if ($MyInvocation.InvocationName -ne '.') { - Login + . .\voicemeeter.ps1 - $bus = Buses + $vmr = [Remote]::new('potato') - $bus[0].mono = 1 - $bus[0].mono - $bus[0].mono = 0 - $bus[0].mono + $vmr.Login() - Logout + $vmr.bus[0].mono = 1 + $vmr.bus[0].mono + $vmr.bus[0].mono = 0 + $vmr.bus[0].mono + + $vmr.bus[1].gain = 3.2 + $vmr.bus[1].gain + $vmr.bus[2].gain = -2.0 + $vmr.bus[2].gain + + $vmr.Logout() } diff --git a/lib/macrobuttons.ps1 b/lib/macrobuttons.ps1 index 4f266a3..8da86af 100644 --- a/lib/macrobuttons.ps1 +++ b/lib/macrobuttons.ps1 @@ -62,15 +62,18 @@ Function Buttons { if ($MyInvocation.InvocationName -ne '.') { + . .\voicemeeter.ps1 - Login + $vmr = [Remote]::new('potato') - $button = Buttons + $vmr.Login() - $button[0].state = 1 - $button[0].state - $button[0].state = 0 - $button[0].state + $vmr.button = Buttons - Logout + $vmr.button[0].state = 1 + $vmr.button[0].state + $vmr.button[0].state = 0 + $vmr.button[0].state + + $vmr.Logout() } diff --git a/lib/strip.ps1 b/lib/strip.ps1 index b64495d..bc9f338 100644 --- a/lib/strip.ps1 +++ b/lib/strip.ps1 @@ -11,7 +11,7 @@ class Strip { Param_Set -PARAM $cmd -VALUE $set } - [int] Getter($cmd) { + [Single] Getter($cmd) { return Param_Get -PARAM $cmd } @@ -150,6 +150,18 @@ class Strip { $this._B3 = $this.Setter($this.cmd('B3'), $arg) } ) + + hidden $_gain = $($this | Add-Member ScriptProperty 'gain' ` + { + # get + $this.Getter($this.cmd('gain')) + }` + { + # set + param ( [Single]$arg ) + $this._gain = $this.Setter($this.cmd('gain'), $arg) + } + ) } Function Strips { @@ -162,15 +174,22 @@ Function Strips { if ($MyInvocation.InvocationName -ne '.') { + . .\voicemeeter.ps1 - Login + $vmr = [Remote]::new('potato') - $strip = Strips + $vmr.Login() - $strip[1].A1 = 1 - $strip[1].A1 - $strip[2].A2 = 0 - $strip[2].A2 + $vmr.strip[1].A1 = 1 + $vmr.strip[1].A1 + $vmr.strip[2].A2 = 0 + $vmr.strip[2].A2 - Logout + + $vmr.strip[1].gain = 3.2 + $vmr.strip[1].gain + $vmr.strip[2].gain = -2.0 + $vmr.strip[2].gain + + $vmr.Logout() } diff --git a/lib/voicemeeter.ps1 b/lib/voicemeeter.ps1 index deec62f..be1f25c 100644 --- a/lib/voicemeeter.ps1 +++ b/lib/voicemeeter.ps1 @@ -1,7 +1,4 @@ . $PSScriptRoot\base.ps1 -. $PSScriptRoot\strip.ps1 -. $PSScriptRoot\bus.ps1 -. $PSScriptRoot\macrobuttons.ps1 class Remote { [String]$type