added gain param

Added gain param for strip/bus.

Getter now returns type single instead of int.
This commit is contained in:
onyx-and-iris 2021-04-28 18:21:32 +01:00
parent e1867d0731
commit 12b0085ab6
5 changed files with 68 additions and 26 deletions

View File

@ -1,3 +1,7 @@
. $PSScriptRoot\strip.ps1
. $PSScriptRoot\bus.ps1
. $PSScriptRoot\macrobuttons.ps1
$Handles = @' $Handles = @'
[DllImport(@"C:\Program Files (x86)\VB\Voicemeeter\VoicemeeterRemote64.dll")] [DllImport(@"C:\Program Files (x86)\VB\Voicemeeter\VoicemeeterRemote64.dll")]
public static extern int VBVMR_Login(); public static extern int VBVMR_Login();

View File

@ -11,7 +11,7 @@ class Bus {
Param_Set -PARAM $cmd -VALUE $set Param_Set -PARAM $cmd -VALUE $set
} }
[int] Getter($cmd) { [Single] Getter($cmd) {
return Param_Get -PARAM $cmd return Param_Get -PARAM $cmd
} }
@ -42,6 +42,18 @@ class Bus {
$this._mute = $this.Setter($this.cmd('Mute'), $arg) $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 { Function Buses {
@ -54,14 +66,21 @@ Function Buses {
if ($MyInvocation.InvocationName -ne '.') if ($MyInvocation.InvocationName -ne '.')
{ {
Login . .\voicemeeter.ps1
$bus = Buses $vmr = [Remote]::new('potato')
$bus[0].mono = 1 $vmr.Login()
$bus[0].mono
$bus[0].mono = 0
$bus[0].mono
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()
} }

View File

@ -62,15 +62,18 @@ Function Buttons {
if ($MyInvocation.InvocationName -ne '.') if ($MyInvocation.InvocationName -ne '.')
{ {
. .\voicemeeter.ps1
Login $vmr = [Remote]::new('potato')
$button = Buttons $vmr.Login()
$button[0].state = 1 $vmr.button = Buttons
$button[0].state
$button[0].state = 0
$button[0].state
Logout $vmr.button[0].state = 1
$vmr.button[0].state
$vmr.button[0].state = 0
$vmr.button[0].state
$vmr.Logout()
} }

View File

@ -11,7 +11,7 @@ class Strip {
Param_Set -PARAM $cmd -VALUE $set Param_Set -PARAM $cmd -VALUE $set
} }
[int] Getter($cmd) { [Single] Getter($cmd) {
return Param_Get -PARAM $cmd return Param_Get -PARAM $cmd
} }
@ -150,6 +150,18 @@ class Strip {
$this._B3 = $this.Setter($this.cmd('B3'), $arg) $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 { Function Strips {
@ -162,15 +174,22 @@ Function Strips {
if ($MyInvocation.InvocationName -ne '.') if ($MyInvocation.InvocationName -ne '.')
{ {
. .\voicemeeter.ps1
Login $vmr = [Remote]::new('potato')
$strip = Strips $vmr.Login()
$strip[1].A1 = 1 $vmr.strip[1].A1 = 1
$strip[1].A1 $vmr.strip[1].A1
$strip[2].A2 = 0 $vmr.strip[2].A2 = 0
$strip[2].A2 $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()
} }

View File

@ -1,7 +1,4 @@
. $PSScriptRoot\base.ps1 . $PSScriptRoot\base.ps1
. $PSScriptRoot\strip.ps1
. $PSScriptRoot\bus.ps1
. $PSScriptRoot\macrobuttons.ps1
class Remote { class Remote {
[String]$type [String]$type