From 6154af7ad7850b3f256638caba49cc670c9a3654 Mon Sep 17 00:00:00 2001 From: pblivingston <71585805+pblivingston@users.noreply.github.com> Date: Thu, 27 Nov 2025 08:40:55 -0500 Subject: [PATCH] Create eq.ps1 - eq - eq channel - eq cell --- lib/eq.ps1 | 60 ++++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 60 insertions(+) create mode 100644 lib/eq.ps1 diff --git a/lib/eq.ps1 b/lib/eq.ps1 new file mode 100644 index 0000000..bf2162c --- /dev/null +++ b/lib/eq.ps1 @@ -0,0 +1,60 @@ +class Eq : IRemote { + [System.Collections.ArrayList]$channel + [string]$prefix + + Eq ([string]$prefix, [int]$chCount, [Object]$parent) : base ($parent.index, $parent.remote) { + AddBoolMembers -PARAMS @('on', 'ab') + + $this.channel = @() + for ($ch = 0; $ch -lt $chCount; $ch++) { + $this.channel.Add([EqChannel]::new($ch, $this)) + } + + $this.prefix = $prefix + } + + [void] Load ([string]$filename) { + $param = 'Command.Load{0}Eq[{1}]' -f $this.prefix, $this.index + $this.remote.Setter($param, $filename) + } + + [void] Save ([string]$filename) { + $param = 'Command.Save{0}Eq[{1}]' -f $this.prefix, $this.index + $this.remote.Setter($param, $filename) + } +} + +class EqChannel : IRemote { + [System.Collections.ArrayList]$cell + [string]$eqId + + EqChannel ([int]$index, [Object]$eq) : base ($index, $eq.remote) { + $this.eqId = $eq.identifier() + + $this.cell = @() + $cellCount = $this.remote.kind.cells + for ($c = 0; $c -lt $cellCount; $c++) { + $this.cell.Add([EqCell]::new($c, $this)) + } + } + + [string] identifier () { + return '{0}.Channel[{1}]' -f $this.eqId, $this.index + } +} + +class EqCell : IRemote { + [string]$channelId + + EqCell ([int]$index, [Object]$channel) : base ($index, $channel.remote) { + $this.channelId = $channel.identifier() + + AddBoolMembers -PARAMS @('on') + AddIntMembers -PARAMS @('type') + AddFloatMembers -PARAMS @('f', 'gain', 'q') + } + + [string] identifier () { + return '{0}.Cell[{1}]' -f $this.channelId, $this.index + } +} \ No newline at end of file