2022-01-06 15:26:38 +00:00
|
|
|
. $PSScriptRoot\meta.ps1
|
|
|
|
|
2022-12-16 17:18:51 +00:00
|
|
|
class IBus {
|
2022-10-27 21:20:03 +01:00
|
|
|
[int]$index
|
2022-06-25 23:12:02 +01:00
|
|
|
[Object]$remote
|
2022-12-16 17:18:51 +00:00
|
|
|
|
|
|
|
IBus ([int]$index, [Object]$remote) {
|
2022-10-27 21:20:03 +01:00
|
|
|
$this.index = $index
|
2022-06-25 23:12:02 +01:00
|
|
|
$this.remote = $remote
|
2022-12-16 17:18:51 +00:00
|
|
|
}
|
2021-04-28 17:38:36 +01:00
|
|
|
|
2022-12-16 17:18:51 +00:00
|
|
|
[string] identifier () {
|
|
|
|
return "Bus[" + $this.index + "]"
|
2021-04-28 17:38:36 +01:00
|
|
|
}
|
|
|
|
|
2022-10-27 21:20:03 +01:00
|
|
|
[string] ToString() {
|
|
|
|
return $this.GetType().Name + $this.index
|
|
|
|
}
|
|
|
|
|
2022-12-16 17:18:51 +00:00
|
|
|
[single] Getter ($param) {
|
|
|
|
return Param_Get -PARAM "$($this.identifier()).$param" -IS_STRING $false
|
2022-01-19 21:52:59 +00:00
|
|
|
}
|
|
|
|
|
2022-12-16 17:18:51 +00:00
|
|
|
[string] Getter_String ($param) {
|
|
|
|
return Param_Get -PARAM "$($this.identifier()).$param" -IS_STRING $true
|
2022-01-19 21:52:59 +00:00
|
|
|
}
|
|
|
|
|
2022-12-16 17:18:51 +00:00
|
|
|
[void] Setter ($param, $set) {
|
|
|
|
Param_Set -PARAM "$($this.identifier()).$param" -Value $set
|
2021-04-28 17:38:36 +01:00
|
|
|
}
|
2022-12-16 17:18:51 +00:00
|
|
|
}
|
2021-04-28 17:38:36 +01:00
|
|
|
|
2022-12-16 17:18:51 +00:00
|
|
|
class Bus : IBus {
|
|
|
|
[Object]$eq
|
2022-01-06 15:26:38 +00:00
|
|
|
|
2022-12-16 17:18:51 +00:00
|
|
|
# Constructor
|
|
|
|
Bus ([int]$index, [Object]$remote) : base ($index, $remote) {
|
|
|
|
AddBoolMembers -PARAMS @('mono', 'mute')
|
|
|
|
AddStringMembers -PARAMS @('label')
|
|
|
|
AddFloatMembers -PARAMS @('gain', 'returnreverb', 'returndelay', 'returnfx1', 'returnfx2')
|
2022-03-08 22:55:11 +00:00
|
|
|
|
2022-12-16 17:18:51 +00:00
|
|
|
AddBusModeMembers -PARAMS @('normal', 'amix', 'bmix', 'repeat', 'composite', 'tvmix', 'upmix21')
|
|
|
|
AddBusModeMembers -PARAMS @('upmix41', 'upmix61', 'centeronly', 'lfeonly', 'rearonly')
|
|
|
|
|
|
|
|
$this.eq = [Eq]::new($index, $remote)
|
|
|
|
}
|
2022-06-25 23:12:02 +01:00
|
|
|
|
2022-10-27 21:20:03 +01:00
|
|
|
[void] FadeTo ([single]$target, [int]$time) {
|
2022-12-16 17:18:51 +00:00
|
|
|
$this.Setter('FadeTo', "($target, $time)")
|
2022-06-25 23:12:02 +01:00
|
|
|
}
|
|
|
|
|
2022-10-27 21:20:03 +01:00
|
|
|
[void] FadeBy ([single]$target, [int]$time) {
|
2022-12-16 17:18:51 +00:00
|
|
|
$this.Setter('FadeBy', "($target, $time)")
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
class Eq : IBus {
|
|
|
|
Eq ([int]$index, [Object]$remote) : base ($index, $remote) {
|
|
|
|
AddBoolMembers -PARAMS @('on', 'ab')
|
|
|
|
}
|
|
|
|
|
|
|
|
[string] identifier () {
|
|
|
|
return "Bus[" + $this.index + "].EQ"
|
2022-06-25 23:12:02 +01:00
|
|
|
}
|
2021-04-28 17:38:36 +01:00
|
|
|
}
|
|
|
|
|
2022-01-10 20:56:17 +00:00
|
|
|
class PhysicalBus : Bus {
|
2022-12-16 17:18:51 +00:00
|
|
|
[Object]$device
|
|
|
|
|
2022-10-27 21:20:03 +01:00
|
|
|
PhysicalBus ([int]$index, [Object]$remote) : base ($index, $remote) {
|
2022-12-16 17:18:51 +00:00
|
|
|
$this.device = [Device]::new($index, $remote)
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
class Device : IBus {
|
|
|
|
Device ([int]$index, [Object]$remote) : base ($index, $remote) {
|
2022-01-10 20:56:17 +00:00
|
|
|
}
|
2022-12-16 17:18:51 +00:00
|
|
|
|
|
|
|
[string] identifier () {
|
|
|
|
return "Bus[" + $this.index + "].Device"
|
|
|
|
}
|
|
|
|
|
|
|
|
hidden $_name = $($this | Add-Member ScriptProperty 'name' `
|
2022-01-24 20:01:55 +00:00
|
|
|
{
|
2022-12-16 17:18:51 +00:00
|
|
|
$this.Getter_String('name')
|
2022-10-27 21:20:03 +01:00
|
|
|
} `
|
2022-01-24 20:01:55 +00:00
|
|
|
{
|
2022-12-16 17:18:51 +00:00
|
|
|
return Write-Warning ("ERROR: $($this.identifier()).name is read only")
|
2022-01-24 20:01:55 +00:00
|
|
|
}
|
|
|
|
)
|
|
|
|
|
|
|
|
hidden $_sr = $($this | Add-Member ScriptProperty 'sr' `
|
|
|
|
{
|
2022-12-16 17:18:51 +00:00
|
|
|
$this.Getter('sr')
|
2022-10-27 21:20:03 +01:00
|
|
|
} `
|
2022-01-24 20:01:55 +00:00
|
|
|
{
|
2022-12-16 17:18:51 +00:00
|
|
|
return Write-Warning ("ERROR: $($this.identifier()).sr is read only")
|
2022-01-24 20:01:55 +00:00
|
|
|
}
|
|
|
|
)
|
2022-01-10 20:56:17 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
class VirtualBus : Bus {
|
2022-10-27 21:20:03 +01:00
|
|
|
VirtualBus ([int]$index, [Object]$remote) : base ($index, $remote) {
|
2022-01-10 20:56:17 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2022-10-27 21:20:03 +01:00
|
|
|
function Make_Buses ([Object]$remote) {
|
2021-04-28 17:38:36 +01:00
|
|
|
[System.Collections.ArrayList]$bus = @()
|
2022-06-25 23:12:02 +01:00
|
|
|
0..$($remote.kind.p_out + $remote.kind.v_out - 1) | ForEach-Object {
|
|
|
|
if ($_ -lt $remote.kind.p_out) { [void]$bus.Add([PhysicalBus]::new($_, $remote)) }
|
|
|
|
else { [void]$bus.Add([VirtualBus]::new($_, $remote)) }
|
2021-04-28 17:38:36 +01:00
|
|
|
}
|
|
|
|
$bus
|
|
|
|
}
|