strip.ps1
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 |
. $PSScriptRoot\meta.ps1 class Strip { [Int]$id Strip ([Int]$id) { $this.id = $id AddBoolMembers -PARAMS @('mono', 'solo', 'mute') AddIntMembers -PARAMS @('limit') AddFloatMembers -PARAMS @('gain') AddStringMembers -PARAMS @('label') AddChannelMembers AddGainlayerMembers } [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, $set) { Param_Set -PARAM $cmd -VALUE $set } [String] cmd ($arg) { return "Strip[" + $this.id + "].$arg" } } class PhysicalStrip : Strip { PhysicalStrip ([Int]$id) : base ($id) { AddFloatMembers -PARAMS @('comp', 'gate') } 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") } ) hidden $_sr = $($this | Add-Member ScriptProperty 'sr' ` { $this.Getter($this.cmd('device.sr')) }` { return Write-Warning("ERROR: " + $this.cmd('device.sr') + " is read only") } ) } class VirtualStrip : Strip { VirtualStrip ([Int]$id) : base ($id) { AddBoolMembers -PARAMS @('mc') AddIntMembers -PARAMS @('k') } } Function Make_Strips { [System.Collections.ArrayList]$strip = @() 0..$($layout.p_in + $layout.v_in - 1) | ForEach-Object { if ($_ -lt $layout.p_in) { [void]$strip.Add([PhysicalStrip]::new($_)) } else { [void]$strip.Add([VirtualStrip]::new($_)) } } $strip } |