mirror of
https://github.com/onyx-and-iris/voicemeeter-api-powershell.git
synced 2025-01-18 05:10:48 +00:00
mode class added to Bus.
removed busmodemember meta functions.
This commit is contained in:
parent
714d761af2
commit
42b17a7239
71
lib/bus.ps1
71
lib/bus.ps1
@ -31,6 +31,7 @@ class IBus {
|
||||
}
|
||||
|
||||
class Bus : IBus {
|
||||
[Object]$mode
|
||||
[Object]$eq
|
||||
|
||||
# Constructor
|
||||
@ -39,9 +40,7 @@ class Bus : IBus {
|
||||
AddStringMembers -PARAMS @('label')
|
||||
AddFloatMembers -PARAMS @('gain', 'returnreverb', 'returndelay', 'returnfx1', 'returnfx2')
|
||||
|
||||
AddBusModeMembers -PARAMS @('normal', 'amix', 'bmix', 'repeat', 'composite', 'tvmix', 'upmix21')
|
||||
AddBusModeMembers -PARAMS @('upmix41', 'upmix61', 'centeronly', 'lfeonly', 'rearonly')
|
||||
|
||||
$this.mode = [Mode]::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 {
|
||||
Eq ([int]$index, [Object]$remote) : base ($index, $remote) {
|
||||
AddBoolMembers -PARAMS @('on', 'ab')
|
||||
@ -97,6 +122,46 @@ class Device : IBus {
|
||||
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 {
|
||||
|
17
lib/meta.ps1
17
lib/meta.ps1
@ -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 {
|
||||
$AddMemberParams = @{
|
||||
Name = $param
|
||||
|
Loading…
Reference in New Issue
Block a user