2022-01-06 15:27:11 +00:00
|
|
|
. $PSScriptRoot\meta.ps1
|
|
|
|
|
2021-04-28 17:38:36 +01:00
|
|
|
class Strip {
|
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-10-27 21:20:03 +01:00
|
|
|
Strip ([int]$index, [Object]$remote) {
|
|
|
|
$this.index = $index
|
2022-06-25 23:12:02 +01:00
|
|
|
$this.remote = $remote
|
2022-01-08 16:10:14 +00:00
|
|
|
|
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
|
|
|
|
}
|
|
|
|
|
|
|
|
[single] Getter ($cmd) {
|
2022-01-19 21:52:59 +00:00
|
|
|
return Param_Get -PARAM $cmd -IS_STRING $false
|
2021-04-28 17:38:36 +01:00
|
|
|
}
|
|
|
|
|
2022-10-27 21:20:03 +01:00
|
|
|
[string] Getter_String ($cmd) {
|
2022-01-19 21:52:59 +00:00
|
|
|
return Param_Get -PARAM $cmd -IS_STRING $true
|
|
|
|
}
|
|
|
|
|
2022-10-27 21:20:03 +01:00
|
|
|
[void] Setter ($cmd, $val) {
|
|
|
|
Param_Set -PARAM $cmd -Value $val
|
2021-05-11 19:09:57 +01:00
|
|
|
}
|
|
|
|
|
2022-10-27 21:20:03 +01:00
|
|
|
[string] cmd ($arg) {
|
|
|
|
return "Strip[" + $this.index + "].$arg"
|
2021-04-28 17:38:36 +01:00
|
|
|
}
|
2022-06-25 23:12:02 +01:00
|
|
|
|
2022-10-27 21:20:03 +01:00
|
|
|
[void] FadeTo ([single]$target, [int]$time) {
|
2022-06-25 23:12:02 +01:00
|
|
|
$this.Setter($this.cmd('FadeTo'), "($target, $time)")
|
|
|
|
}
|
|
|
|
|
2022-10-27 21:20:03 +01:00
|
|
|
[void] FadeBy ([single]$target, [int]$time) {
|
2022-06-25 23:12:02 +01:00
|
|
|
$this.Setter($this.cmd('FadeBy'), "($target, $time)")
|
|
|
|
}
|
2022-01-24 20:01:55 +00:00
|
|
|
}
|
2022-01-08 16:10:14 +00:00
|
|
|
|
2022-01-24 20:01:55 +00:00
|
|
|
class PhysicalStrip : Strip {
|
2022-10-27 21:20:03 +01:00
|
|
|
PhysicalStrip ([int]$index, [Object]$remote) : base ($index, $remote) {
|
|
|
|
AddFloatMembers -PARAMS @('comp', 'gate', 'color_x', 'color_y', 'fx_x', 'fx_y')
|
|
|
|
AddFloatMembers -PARAMS @('reverb', 'delay', 'fx1', 'fx2')
|
|
|
|
AddBoolMembers -PARAMS @('postreverb', 'postdelay', 'postfx1', 'postfx2')
|
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' `
|
|
|
|
{
|
|
|
|
$this.Getter_String($this.cmd('device.name'))
|
2022-10-27 21:20:03 +01:00
|
|
|
} `
|
2022-01-10 20:56:17 +00:00
|
|
|
{
|
2022-10-27 21:20:03 +01:00
|
|
|
return Write-Warning ("ERROR: " + $this.cmd('device.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-01-19 21:52:59 +00:00
|
|
|
$this.Getter($this.cmd('device.sr'))
|
2022-10-27 21:20:03 +01:00
|
|
|
} `
|
2022-01-10 20:56:17 +00:00
|
|
|
{
|
2022-10-27 21:20:03 +01:00
|
|
|
return Write-Warning ("ERROR: " + $this.cmd('device.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
|
|
|
}
|
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
|
|
|
|
}
|