Create eq.ps1

- eq
- eq channel
- eq cell
This commit is contained in:
pblivingston 2025-11-27 08:40:55 -05:00
parent 3f7bef56c1
commit 6154af7ad7

60
lib/eq.ps1 Normal file
View File

@ -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
}
}