mirror of
https://github.com/onyx-and-iris/voicemeeter-api-powershell.git
synced 2025-01-18 13:20:47 +00:00
IStrip class added.
getters/setters moved into IStrip Comp, Gate, Denoiser, Eq and Device classes added to PhysicalStrip AppGain, AppMute methods added to VirtualStrip
This commit is contained in:
parent
d86ad2fe87
commit
c999e73e14
153
lib/strip.ps1
153
lib/strip.ps1
@ -1,13 +1,33 @@
|
|||||||
. $PSScriptRoot\meta.ps1
|
. $PSScriptRoot\meta.ps1
|
||||||
|
|
||||||
class Strip {
|
class IStrip {
|
||||||
[int]$index
|
[int]$index
|
||||||
[Object]$remote
|
[Object]$remote
|
||||||
|
|
||||||
Strip ([int]$index, [Object]$remote) {
|
IStrip ([int]$index, [Object]$remote) {
|
||||||
$this.index = $index
|
$this.index = $index
|
||||||
$this.remote = $remote
|
$this.remote = $remote
|
||||||
|
}
|
||||||
|
|
||||||
|
[string] identifier () {
|
||||||
|
return "Strip[" + $this.index + "]"
|
||||||
|
}
|
||||||
|
|
||||||
|
[single] Getter ($param) {
|
||||||
|
return Param_Get -PARAM "$($this.identifier()).$param" -IS_STRING $false
|
||||||
|
}
|
||||||
|
|
||||||
|
[string] Getter_String ($param) {
|
||||||
|
return Param_Get -PARAM "$($this.identifier()).$param" -IS_STRING $true
|
||||||
|
}
|
||||||
|
|
||||||
|
[void] Setter ($param, $val) {
|
||||||
|
Param_Set -PARAM "$($this.identifier()).$param" -Value $val
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
class Strip : IStrip {
|
||||||
|
Strip ([int]$index, [Object]$remote) : base ($index, $remote) {
|
||||||
AddBoolMembers -PARAMS @('mono', 'solo', 'mute')
|
AddBoolMembers -PARAMS @('mono', 'solo', 'mute')
|
||||||
AddIntMembers -PARAMS @('limit')
|
AddIntMembers -PARAMS @('limit')
|
||||||
AddFloatMembers -PARAMS @('gain', 'pan_x', 'pan_y')
|
AddFloatMembers -PARAMS @('gain', 'pan_x', 'pan_y')
|
||||||
@ -21,53 +41,128 @@ class Strip {
|
|||||||
return $this.GetType().Name + $this.index
|
return $this.GetType().Name + $this.index
|
||||||
}
|
}
|
||||||
|
|
||||||
[single] Getter ($cmd) {
|
|
||||||
return Param_Get -PARAM $cmd -IS_STRING $false
|
|
||||||
}
|
|
||||||
|
|
||||||
[string] Getter_String ($cmd) {
|
|
||||||
return Param_Get -PARAM $cmd -IS_STRING $true
|
|
||||||
}
|
|
||||||
|
|
||||||
[void] Setter ($cmd, $val) {
|
|
||||||
Param_Set -PARAM $cmd -Value $val
|
|
||||||
}
|
|
||||||
|
|
||||||
[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)")
|
$this.Setter('FadeTo', "($target, $time)")
|
||||||
}
|
}
|
||||||
|
|
||||||
[void] FadeBy ([single]$target, [int]$time) {
|
[void] FadeBy ([single]$target, [int]$time) {
|
||||||
$this.Setter($this.cmd('FadeBy'), "($target, $time)")
|
$this.Setter('FadeBy', "($target, $time)")
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
class PhysicalStrip : Strip {
|
class PhysicalStrip : Strip {
|
||||||
|
[Object]$comp
|
||||||
|
[Object]$gate
|
||||||
|
[Object]$denoiser
|
||||||
|
[Object]$eq
|
||||||
|
[Object]$device
|
||||||
|
|
||||||
PhysicalStrip ([int]$index, [Object]$remote) : base ($index, $remote) {
|
PhysicalStrip ([int]$index, [Object]$remote) : base ($index, $remote) {
|
||||||
AddFloatMembers -PARAMS @('comp', 'gate', 'color_x', 'color_y', 'fx_x', 'fx_y')
|
AddFloatMembers -PARAMS @('color_x', 'color_y', 'fx_x', 'fx_y')
|
||||||
AddFloatMembers -PARAMS @('reverb', 'delay', 'fx1', 'fx2')
|
AddFloatMembers -PARAMS @('reverb', 'delay', 'fx1', 'fx2')
|
||||||
AddBoolMembers -PARAMS @('postreverb', 'postdelay', 'postfx1', 'postfx2')
|
AddBoolMembers -PARAMS @('postreverb', 'postdelay', 'postfx1', 'postfx2')
|
||||||
|
|
||||||
|
$this.comp = [Comp]::new($index, $remote)
|
||||||
|
$this.gate = [Gate]::new($index, $remote)
|
||||||
|
$this.denoiser = [Denoiser]::new($index, $remote)
|
||||||
|
$this.eq = [Eq]::new($index, $remote)
|
||||||
|
$this.device = [Device]::new($index, $remote)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
class Comp : IStrip {
|
||||||
|
Comp ([int]$index, [Object]$remote) : base ($index, $remote) {
|
||||||
|
AddFloatMembers -PARAMS @('gainin', 'ratio', 'threshold', 'attack', 'release', 'knee', 'gainout')
|
||||||
|
AddBoolMembers -PARAMS @('makeup')
|
||||||
|
}
|
||||||
|
|
||||||
|
[string] identifier () {
|
||||||
|
return "Strip[" + $this.index + "].Comp"
|
||||||
|
}
|
||||||
|
|
||||||
|
hidden $_knob = $($this | Add-Member ScriptProperty 'knob' `
|
||||||
|
{
|
||||||
|
$this.Getter_String('')
|
||||||
|
} `
|
||||||
|
{
|
||||||
|
param($arg)
|
||||||
|
return $this.Setter('', $arg)
|
||||||
|
}
|
||||||
|
)
|
||||||
|
}
|
||||||
|
|
||||||
|
class Gate : IStrip {
|
||||||
|
Gate ([int]$index, [Object]$remote) : base ($index, $remote) {
|
||||||
|
AddFloatMembers -PARAMS @('threshold', 'damping', 'bpsidechain', 'attack', 'hold', 'release')
|
||||||
|
}
|
||||||
|
|
||||||
|
[string] identifier () {
|
||||||
|
return "Strip[" + $this.index + "].Gate"
|
||||||
|
}
|
||||||
|
|
||||||
|
hidden $_knob = $($this | Add-Member ScriptProperty 'knob' `
|
||||||
|
{
|
||||||
|
$this.Getter_String('')
|
||||||
|
} `
|
||||||
|
{
|
||||||
|
param($arg)
|
||||||
|
return $this.Setter('', $arg)
|
||||||
|
}
|
||||||
|
)
|
||||||
|
}
|
||||||
|
|
||||||
|
class Denoiser : IStrip {
|
||||||
|
Denoiser ([int]$index, [Object]$remote) : base ($index, $remote) {
|
||||||
|
}
|
||||||
|
|
||||||
|
[string] identifier () {
|
||||||
|
return "Strip[" + $this.index + "].Denoiser"
|
||||||
|
}
|
||||||
|
|
||||||
|
hidden $_knob = $($this | Add-Member ScriptProperty 'knob' `
|
||||||
|
{
|
||||||
|
$this.Getter_String('')
|
||||||
|
} `
|
||||||
|
{
|
||||||
|
param($arg)
|
||||||
|
return $this.Setter('', $arg)
|
||||||
|
}
|
||||||
|
)
|
||||||
|
}
|
||||||
|
|
||||||
|
class Eq : IStrip {
|
||||||
|
Eq ([int]$index, [Object]$remote) : base ($index, $remote) {
|
||||||
|
AddBoolMembers -PARAMS @('on', 'ab')
|
||||||
|
}
|
||||||
|
|
||||||
|
[string] identifier () {
|
||||||
|
return "Strip[" + $this.index + "].EQ"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
class Device : IStrip {
|
||||||
|
Device ([int]$index, [Object]$remote) : base ($index, $remote) {
|
||||||
|
}
|
||||||
|
|
||||||
|
[string] identifier () {
|
||||||
|
return "Strip[" + $this.index + "].Device"
|
||||||
}
|
}
|
||||||
|
|
||||||
hidden $_device = $($this | Add-Member ScriptProperty 'device' `
|
hidden $_device = $($this | Add-Member ScriptProperty 'device' `
|
||||||
{
|
{
|
||||||
$this.Getter_String($this.cmd('device.name'))
|
$this.Getter_String('name')
|
||||||
} `
|
} `
|
||||||
{
|
{
|
||||||
return Write-Warning ("ERROR: " + $this.cmd('device.name') + " is read only")
|
return Write-Warning ("ERROR: $($this.identifier()).name is read only")
|
||||||
}
|
}
|
||||||
)
|
)
|
||||||
|
|
||||||
hidden $_sr = $($this | Add-Member ScriptProperty 'sr' `
|
hidden $_sr = $($this | Add-Member ScriptProperty 'sr' `
|
||||||
{
|
{
|
||||||
$this.Getter($this.cmd('device.sr'))
|
$this.Getter('sr')
|
||||||
} `
|
} `
|
||||||
{
|
{
|
||||||
return Write-Warning ("ERROR: " + $this.cmd('device.sr') + " is read only")
|
return Write-Warning ("ERROR: $($this.identifier()).sr is read only")
|
||||||
}
|
}
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
@ -77,6 +172,14 @@ class VirtualStrip : Strip {
|
|||||||
AddBoolMembers -PARAMS @('mc')
|
AddBoolMembers -PARAMS @('mc')
|
||||||
AddIntMembers -PARAMS @('k')
|
AddIntMembers -PARAMS @('k')
|
||||||
}
|
}
|
||||||
|
|
||||||
|
[void] AppGain ([string]$appname, [single]$gain) {
|
||||||
|
$this.Setter('AppGain', "(`"$appname`", $gain)")
|
||||||
|
}
|
||||||
|
|
||||||
|
[void] AppMute ([string]$appname, [bool]$mutestate) {
|
||||||
|
$this.Setter('AppMute', "(`"$appname`", $(if ($mutestate) { 1 } else { 0 })")
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user