mode class added to Bus.

removed busmodemember meta functions.
This commit is contained in:
onyx-and-iris 2022-12-17 15:40:07 +00:00
parent 714d761af2
commit 42b17a7239
2 changed files with 68 additions and 20 deletions

View File

@ -31,6 +31,7 @@ class IBus {
} }
class Bus : IBus { class Bus : IBus {
[Object]$mode
[Object]$eq [Object]$eq
# Constructor # Constructor
@ -39,9 +40,7 @@ class Bus : IBus {
AddStringMembers -PARAMS @('label') AddStringMembers -PARAMS @('label')
AddFloatMembers -PARAMS @('gain', 'returnreverb', 'returndelay', 'returnfx1', 'returnfx2') AddFloatMembers -PARAMS @('gain', 'returnreverb', 'returndelay', 'returnfx1', 'returnfx2')
AddBusModeMembers -PARAMS @('normal', 'amix', 'bmix', 'repeat', 'composite', 'tvmix', 'upmix21') $this.mode = [Mode]::new($index, $remote)
AddBusModeMembers -PARAMS @('upmix41', 'upmix61', 'centeronly', 'lfeonly', 'rearonly')
$this.eq = [Eq]::new($index, $remote) $this.eq = [Eq]::new($index, $remote)
} }
@ -54,6 +53,32 @@ class Bus : IBus {
} }
} }
class Mode : IBus {
[System.Collections.ArrayList]$modes
Mode ([int]$index, [Object]$remote) : base ($index, $remote) {
$this.modes = @(
'normal', 'amix', 'bmix', 'repeat', 'composite', 'tvmix', 'upmix21', 'upmix41', 'upmix61',
'centeronly', 'lfeonly', 'rearonly'
)
AddBoolMembers -PARAMS $this.modes
}
[string] identifier () {
return "Bus[" + $this.index + "].mode"
}
[string] Get () {
foreach ($mode in $this.modes) {
if ($this.$mode) {
break
}
}
return $mode
}
}
class Eq : IBus { class Eq : IBus {
Eq ([int]$index, [Object]$remote) : base ($index, $remote) { Eq ([int]$index, [Object]$remote) : base ($index, $remote) {
AddBoolMembers -PARAMS @('on', 'ab') AddBoolMembers -PARAMS @('on', 'ab')
@ -97,6 +122,46 @@ class Device : IBus {
return Write-Warning ("ERROR: $($this.identifier()).sr is read only") return Write-Warning ("ERROR: $($this.identifier()).sr is read only")
} }
) )
hidden $_wdm = $($this | Add-Member ScriptProperty 'wdm' `
{
return Write-Warning ("ERROR: $($this.identifier()).wdm is write only")
} `
{
param($arg)
return $this.Setter('wdm', $arg)
}
)
hidden $_ks = $($this | Add-Member ScriptProperty 'ks' `
{
return Write-Warning ("ERROR: $($this.identifier()).ks is write only")
} `
{
param($arg)
return $this.Setter('ks', $arg)
}
)
hidden $_mme = $($this | Add-Member ScriptProperty 'mme' `
{
return Write-Warning ("ERROR: $($this.identifier()).mme is write only")
} `
{
param($arg)
return $this.Setter('mme', $arg)
}
)
hidden $_asio = $($this | Add-Member ScriptProperty 'asio' `
{
return Write-Warning ("ERROR: $($this.identifier()).asio is write only")
} `
{
param($arg)
return $this.Setter('asio', $arg)
}
)
} }
class VirtualBus : Bus { class VirtualBus : Bus {

View File

@ -104,23 +104,6 @@ function AddGainlayerMembers () {
} }
} }
function AddBusModeMembers () {
param(
[String[]]$PARAMS
)
[hashtable]$Signatures = @{}
foreach ($param in $PARAMS) {
# Define getter
$Signatures["Getter"] = "[bool]`$this.Getter('mode.{0}')" -f $param
# Define setter
$Signatures["Setter"] = "param ( [Single]`$arg )`n`$this.Setter('mode.{0}', `$arg)" `
-f $param
$param = "mode_{0}" -f $param
Addmember
}
}
function Addmember { function Addmember {
$AddMemberParams = @{ $AddMemberParams = @{
Name = $param Name = $param