class Strip : IRemote { [System.Collections.ArrayList]$gainlayer [Object]$levels Strip ([int]$index, [Object]$remote) : base ($index, $remote) { AddBoolMembers -PARAMS @('solo', 'mute') AddFloatMembers -PARAMS @('gain', 'limit', 'pan_x', 'pan_y') AddStringMembers -PARAMS @('label') AddChannelMembers $this.levels = [StripLevels]::new($index, $remote) $this.gainlayer = @() for ($i = 0; $i -lt $remote.kind.gainlayer; $i++) { $this.gainlayer.Add([FloatArrayMember]::new($i, 'gainlayer', $this)) } } [string] identifier () { return 'Strip[' + $this.index + ']' } [void] FadeTo ([single]$target, [int]$time) { $this.Setter('FadeTo', "($target, $time)") } [void] FadeBy ([single]$target, [int]$time) { $this.Setter('FadeBy', "($target, $time)") } } class StripLevels : IRemote { [int]$init [int]$offset StripLevels ([int]$index, [Object]$remote) : base ($index, $remote) { $p_in = $remote.kind.p_in if ($index -lt $p_in) { $this.init = $index * 2 $this.offset = 2 } else { $this.init = ($p_in * 2) + (($index - $p_in) * 8) $this.offset = 8 } } [float] Convert([float]$val) { if ($val -gt 0) { return [math]::Round(20 * [math]::Log10($val), 1) } else { return -200.0 } } [System.Collections.ArrayList] Getter([int]$mode) { [System.Collections.ArrayList]$vals = @() $this.init..$($this.init + $this.offset - 1) | ForEach-Object { $vals.Add($this.Convert($(Get_Level -MODE $mode -INDEX $_))) } return $vals } [System.Collections.ArrayList] PreFader() { return $this.Getter(0) } [System.Collections.ArrayList] PostFader() { return $this.Getter(1) } [System.Collections.ArrayList] PostMute() { return $this.Getter(2) } } class PhysicalStrip : Strip { [Object]$comp [Object]$gate [Object]$denoiser [Object]$eq [Object]$device [Object]$audibility [Object]$pitch 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') AddBoolMembers -PARAMS @('mono', 'vaio') $this.comp = [StripComp]::new($index, $remote) $this.gate = [StripGate]::new($index, $remote) $this.denoiser = [StripDenoiser]::new($index, $remote) $this.pitch = [StripPitch]::new($index, $remote) $this.audibility = [StripAudibility]::new($index, $remote) $this.eq = [StripEq]::new($index, $remote) $this.device = [StripDevice]::new($index, $remote) } } class StripComp : IRemote { StripComp ([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' ` { [math]::Round($this.Getter(''), 2) } ` { param([single]$arg) return $this.Setter('', $arg) } ) } class StripGate : IRemote { StripGate ([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' ` { [math]::Round($this.Getter(''), 2) } ` { param([single]$arg) return $this.Setter('', $arg) } ) } class StripDenoiser : IRemote { StripDenoiser ([int]$index, [Object]$remote) : base ($index, $remote) { AddFloatMembers -PARAMS @('threshold') } [string] identifier () { return 'Strip[' + $this.index + '].Denoiser' } hidden $_knob = $($this | Add-Member ScriptProperty 'knob' ` { [math]::Round($this.Getter(''), 2) } ` { param([single]$arg) return $this.Setter('', $arg) } ) } class StripPitch : IRemote { StripPitch ([int]$index, [Object]$remote) : base ($index, $remote) { AddBoolMembers -PARAMS @('on') AddFloatMembers -PARAMS @('drywet', 'pitchvalue', 'loformant', 'medformant', 'hiformant') } [string] identifier () { return 'Strip[' + $this.index + '].Pitch' } [void] RecallPreset ([int]$presetIndex) { $this.Setter('RecallPreset', $presetIndex) } } class StripAudibility : IRemote { StripAudibility ([int]$index, [Object]$remote) : base ($index, $remote) { } [string] identifier () { return 'Strip[' + $this.index + '].Audibility' } hidden $_knob = $($this | Add-Member ScriptProperty 'knob' ` { [math]::Round($this.Getter(''), 2) } ` { param([single]$arg) return $this.Setter('', $arg) } ) } class StripEq : Eq { StripEq ([int]$index, [Object]$remote) : base ($index, $remote, 'Strip') { } [string] identifier () { return 'Strip[' + $this.index + '].EQ' } } class StripDevice : Device { StripDevice ([int]$index, [Object]$remote) : base ($index, $remote) { } [string] identifier () { return 'Strip[' + $this.index + '].Device' } } class VirtualStrip : Strip { VirtualStrip ([int]$index, [Object]$remote) : base ($index, $remote) { AddBoolMembers -PARAMS @('mc') AddIntMembers -PARAMS @('k') AddFloatMembers -PARAMS @('eqgain1', 'eqgain2', 'eqgain3') AddAliasMembers -MAP @{ mono = 'mc' karaoke = 'k' bass = 'eqgain1' low = 'eqgain1' mid = 'eqgain2' med = 'eqgain2' treble = 'eqgain3' high = 'eqgain3' } } [void] AppGain ([string]$appname, [single]$gain) { $this.Setter('AppGain', "(`"$appname`", $gain)") } [void] AppGain ([int]$appindex, [single]$gain) { $this.Setter("App[$appindex].Gain", $gain) } [void] AppMute ([string]$appname, [bool]$mutestate) { $this.Setter('AppMute', "(`"$appname`", $(if ($mutestate) { 1 } else { 0 }))") } [void] AppMute ([int]$appindex, [bool]$mutestate) { $this.Setter("App[$appindex].Mute", $mutestate) } } function Make_Strips ([Object]$remote) { [System.Collections.ArrayList]$strip = @() 0..$($remote.kind.p_in + $remote.kind.v_in - 1) | ForEach-Object { if ($_ -lt $remote.kind.p_in) { [void]$strip.Add([PhysicalStrip]::new($_, $remote)) } else { [void]$strip.Add([VirtualStrip]::new($_, $remote)) } } $strip }