2022-01-06 15:27:11 +00:00
|
|
|
. $PSScriptRoot\meta.ps1
|
|
|
|
|
2022-12-16 17:24:31 +00:00
|
|
|
class IStrip {
|
2022-10-27 21:20:03 +01:00
|
|
|
[int]$index
|
2022-06-25 23:12:02 +01:00
|
|
|
[Object]$remote
|
2021-04-28 17:38:36 +01:00
|
|
|
|
2022-12-16 17:24:31 +00:00
|
|
|
IStrip ([int]$index, [Object]$remote) {
|
2022-10-27 21:20:03 +01:00
|
|
|
$this.index = $index
|
2022-06-25 23:12:02 +01:00
|
|
|
$this.remote = $remote
|
2022-12-16 17:24:31 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
[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
|
|
|
|
}
|
|
|
|
}
|
2022-01-08 16:10:14 +00:00
|
|
|
|
2022-12-16 17:24:31 +00:00
|
|
|
class Strip : IStrip {
|
|
|
|
Strip ([int]$index, [Object]$remote) : base ($index, $remote) {
|
2022-01-19 21:52:59 +00:00
|
|
|
AddBoolMembers -PARAMS @('mono', 'solo', 'mute')
|
|
|
|
AddIntMembers -PARAMS @('limit')
|
2022-10-27 21:20:03 +01:00
|
|
|
AddFloatMembers -PARAMS @('gain', 'pan_x', 'pan_y')
|
2022-01-19 21:52:59 +00:00
|
|
|
AddStringMembers -PARAMS @('label')
|
2021-04-28 17:38:36 +01:00
|
|
|
|
2022-01-19 21:52:59 +00:00
|
|
|
AddChannelMembers
|
2022-03-08 22:55:11 +00:00
|
|
|
AddGainlayerMembers
|
2021-04-28 17:38:36 +01:00
|
|
|
}
|
|
|
|
|
2022-10-27 21:20:03 +01:00
|
|
|
[string] ToString() {
|
|
|
|
return $this.GetType().Name + $this.index
|
|
|
|
}
|
|
|
|
|
2022-12-16 17:24:31 +00:00
|
|
|
[void] FadeTo ([single]$target, [int]$time) {
|
|
|
|
$this.Setter('FadeTo', "($target, $time)")
|
|
|
|
}
|
|
|
|
|
|
|
|
[void] FadeBy ([single]$target, [int]$time) {
|
|
|
|
$this.Setter('FadeBy', "($target, $time)")
|
2021-04-28 17:38:36 +01:00
|
|
|
}
|
2022-12-16 17:24:31 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
class PhysicalStrip : Strip {
|
|
|
|
[Object]$comp
|
|
|
|
[Object]$gate
|
|
|
|
[Object]$denoiser
|
|
|
|
[Object]$eq
|
|
|
|
[Object]$device
|
|
|
|
|
|
|
|
PhysicalStrip ([int]$index, [Object]$remote) : base ($index, $remote) {
|
|
|
|
AddFloatMembers -PARAMS @('color_x', 'color_y', 'fx_x', 'fx_y')
|
|
|
|
AddFloatMembers -PARAMS @('reverb', 'delay', 'fx1', 'fx2')
|
|
|
|
AddBoolMembers -PARAMS @('postreverb', 'postdelay', 'postfx1', 'postfx2')
|
2021-04-28 17:38:36 +01:00
|
|
|
|
2022-12-16 17:24:31 +00:00
|
|
|
$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)
|
2022-01-19 21:52:59 +00:00
|
|
|
}
|
2022-12-16 17:24:31 +00:00
|
|
|
}
|
2022-01-19 21:52:59 +00:00
|
|
|
|
2022-12-16 17:24:31 +00:00
|
|
|
class Comp : IStrip {
|
|
|
|
Comp ([int]$index, [Object]$remote) : base ($index, $remote) {
|
|
|
|
AddFloatMembers -PARAMS @('gainin', 'ratio', 'threshold', 'attack', 'release', 'knee', 'gainout')
|
|
|
|
AddBoolMembers -PARAMS @('makeup')
|
2021-05-11 19:09:57 +01:00
|
|
|
}
|
|
|
|
|
2022-12-16 17:24:31 +00:00
|
|
|
[string] identifier () {
|
|
|
|
return "Strip[" + $this.index + "].Comp"
|
2021-04-28 17:38:36 +01:00
|
|
|
}
|
2022-06-25 23:12:02 +01:00
|
|
|
|
2022-12-16 17:24:31 +00:00
|
|
|
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')
|
2022-06-25 23:12:02 +01:00
|
|
|
}
|
|
|
|
|
2022-12-16 17:24:31 +00:00
|
|
|
[string] identifier () {
|
|
|
|
return "Strip[" + $this.index + "].Gate"
|
2022-06-25 23:12:02 +01:00
|
|
|
}
|
2022-12-16 17:24:31 +00:00
|
|
|
|
|
|
|
hidden $_knob = $($this | Add-Member ScriptProperty 'knob' `
|
|
|
|
{
|
|
|
|
$this.Getter_String('')
|
|
|
|
} `
|
|
|
|
{
|
|
|
|
param($arg)
|
|
|
|
return $this.Setter('', $arg)
|
|
|
|
}
|
|
|
|
)
|
2022-01-24 20:01:55 +00:00
|
|
|
}
|
2022-01-08 16:10:14 +00:00
|
|
|
|
2022-12-16 17:24:31 +00:00
|
|
|
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"
|
2022-01-24 20:01:55 +00:00
|
|
|
}
|
2022-10-27 21:20:03 +01:00
|
|
|
|
2022-01-10 20:56:17 +00:00
|
|
|
hidden $_device = $($this | Add-Member ScriptProperty 'device' `
|
|
|
|
{
|
2022-12-16 17:24:31 +00:00
|
|
|
$this.Getter_String('name')
|
2022-10-27 21:20:03 +01:00
|
|
|
} `
|
2022-01-10 20:56:17 +00:00
|
|
|
{
|
2022-12-16 17:24:31 +00:00
|
|
|
return Write-Warning ("ERROR: $($this.identifier()).name is read only")
|
2022-01-08 16:10:14 +00:00
|
|
|
}
|
2022-01-10 20:56:17 +00:00
|
|
|
)
|
|
|
|
|
|
|
|
hidden $_sr = $($this | Add-Member ScriptProperty 'sr' `
|
|
|
|
{
|
2022-12-16 17:24:31 +00:00
|
|
|
$this.Getter('sr')
|
2022-10-27 21:20:03 +01:00
|
|
|
} `
|
2022-01-10 20:56:17 +00:00
|
|
|
{
|
2022-12-16 17:24:31 +00:00
|
|
|
return Write-Warning ("ERROR: $($this.identifier()).sr is read only")
|
2022-01-08 16:10:14 +00:00
|
|
|
}
|
2022-01-10 20:56:17 +00:00
|
|
|
)
|
|
|
|
}
|
|
|
|
|
|
|
|
class VirtualStrip : Strip {
|
2022-10-27 21:20:03 +01:00
|
|
|
VirtualStrip ([int]$index, [Object]$remote) : base ($index, $remote) {
|
2022-03-08 22:55:11 +00:00
|
|
|
AddBoolMembers -PARAMS @('mc')
|
|
|
|
AddIntMembers -PARAMS @('k')
|
2022-01-08 16:10:14 +00:00
|
|
|
}
|
2022-12-16 17:24:31 +00:00
|
|
|
|
|
|
|
[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 })")
|
|
|
|
}
|
2021-04-28 17:38:36 +01:00
|
|
|
}
|
|
|
|
|
2022-01-08 16:10:14 +00:00
|
|
|
|
2022-10-27 21:20:03 +01:00
|
|
|
function Make_Strips ([Object]$remote) {
|
2021-04-28 17:38:36 +01:00
|
|
|
[System.Collections.ArrayList]$strip = @()
|
2022-06-25 23:12:02 +01:00
|
|
|
0..$($remote.kind.p_in + $remote.kind.v_in - 1) | ForEach-Object {
|
2022-10-27 21:20:03 +01:00
|
|
|
if ($_ -lt $remote.kind.p_in) {
|
|
|
|
[void]$strip.Add([PhysicalStrip]::new($_, $remote))
|
2022-01-10 20:56:17 +00:00
|
|
|
}
|
2022-06-25 23:12:02 +01:00
|
|
|
else { [void]$strip.Add([VirtualStrip]::new($_, $remote)) }
|
2021-04-28 17:38:36 +01:00
|
|
|
}
|
|
|
|
$strip
|
|
|
|
}
|