2022-01-06 15:27:11 +00:00
|
|
|
. $PSScriptRoot\meta.ps1
|
|
|
|
|
2021-04-28 17:38:36 +01:00
|
|
|
class Strip {
|
2022-01-08 16:10:14 +00:00
|
|
|
[Int]$id
|
2021-05-16 00:14:51 +01:00
|
|
|
[Array]$string_params
|
|
|
|
[Array]$float_params
|
2022-01-10 20:56:17 +00:00
|
|
|
[System.Collections.ArrayList]$bool_params
|
2022-01-06 15:27:11 +00:00
|
|
|
[Array]$int_params
|
2022-01-10 20:56:17 +00:00
|
|
|
|
|
|
|
hidden SetChannelLayout($num_A, $num_B) {
|
|
|
|
1..$num_A | ForEach-Object {
|
|
|
|
$this.bool_params.Add("A{0}" -f $_)
|
|
|
|
}
|
|
|
|
1..$num_B | ForEach-Object {
|
|
|
|
$this.bool_params.Add("B{0}" -f $_)
|
|
|
|
}
|
|
|
|
}
|
2021-04-28 17:38:36 +01:00
|
|
|
|
|
|
|
# Constructor
|
2022-01-10 20:56:17 +00:00
|
|
|
Strip ([Int]$id, [Int]$num_A, [Int]$num_B)
|
2021-04-28 17:38:36 +01:00
|
|
|
{
|
|
|
|
$this.id = $id
|
2021-05-16 00:14:51 +01:00
|
|
|
$this.string_params = @('label')
|
2022-01-06 15:27:11 +00:00
|
|
|
$this.float_params = @('gain', 'comp', 'gate')
|
|
|
|
$this.int_params = @('limit')
|
2022-01-10 20:56:17 +00:00
|
|
|
$this.bool_params = @('mono', 'solo', 'mute')
|
|
|
|
$this.SetChannelLayout($num_A, $num_B)
|
2022-01-08 16:10:14 +00:00
|
|
|
|
|
|
|
AddPublicMembers($this)
|
2021-04-28 17:38:36 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
[void] Setter($cmd, $set) {
|
2021-05-16 00:14:51 +01:00
|
|
|
if( $this.string_params.Contains($cmd.Split('.')[1]) ) {
|
|
|
|
Param_Set_String -PARAM $cmd -VALUE $set
|
2021-05-11 19:09:57 +01:00
|
|
|
}
|
|
|
|
else { Param_Set -PARAM $cmd -VALUE $set }
|
2021-04-28 17:38:36 +01:00
|
|
|
}
|
|
|
|
|
2021-04-28 18:21:32 +01:00
|
|
|
[Single] Getter($cmd) {
|
2021-04-28 17:38:36 +01:00
|
|
|
return Param_Get -PARAM $cmd
|
|
|
|
}
|
|
|
|
|
2021-05-11 19:09:57 +01:00
|
|
|
[String] Getter_String($cmd) {
|
|
|
|
return Param_Get_String -PARAM $cmd
|
|
|
|
}
|
|
|
|
|
|
|
|
[String] cmd ($arg) {
|
2021-04-28 17:38:36 +01:00
|
|
|
return "Strip[" + $this.id + "].$arg"
|
|
|
|
}
|
2022-01-08 16:10:14 +00:00
|
|
|
|
2022-01-10 20:56:17 +00:00
|
|
|
hidden $_device = $($this | Add-Member ScriptProperty 'device' `
|
|
|
|
{
|
|
|
|
$this.Getter_String($this.cmd('device.name'))
|
|
|
|
}`
|
|
|
|
{
|
|
|
|
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' `
|
|
|
|
{
|
|
|
|
$this.Getter_String($this.cmd('device.sr'))
|
|
|
|
}`
|
|
|
|
{
|
|
|
|
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 PhysicalStrip : Strip {
|
|
|
|
PhysicalStrip ([Int]$id, [Int]$num_A, [Int]$num_B) : base ($id, $num_A, $num_B) {
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
class VirtualStrip : Strip {
|
|
|
|
VirtualStrip ([Int]$id, [Int]$num_A, [Int]$num_B) : base ($id, $num_A, $num_B) {
|
2022-01-08 16:10:14 +00:00
|
|
|
}
|
2021-04-28 17:38:36 +01:00
|
|
|
}
|
|
|
|
|
2022-01-08 16:10:14 +00:00
|
|
|
|
2021-04-28 17:38:36 +01:00
|
|
|
Function Strips {
|
|
|
|
[System.Collections.ArrayList]$strip = @()
|
2022-01-10 20:56:17 +00:00
|
|
|
0..$($layout.p_in + $layout.v_in - 1) | ForEach-Object {
|
|
|
|
if ($_ -lt $layout.p_in) {
|
|
|
|
[void]$strip.Add([PhysicalStrip]::new($_, $layout.p_out, $layout.v_out))
|
|
|
|
}
|
|
|
|
else { [void]$strip.Add([VirtualStrip]::new($_, $layout.p_out, $layout.v_out)) }
|
2021-04-28 17:38:36 +01:00
|
|
|
}
|
|
|
|
$strip
|
|
|
|
}
|