diff --git a/CHANGELOG.md b/CHANGELOG.md index f298a35..3ed42d0 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -23,6 +23,8 @@ Before any major/minor/patch is released all test units will be run to verify th - on, write-only - name, write-only - ip, write-only +- Bus.Sel, Bus.Monitor, Bus.Vaio +- Bus.Mode.Set($mode) ### Changed @@ -31,6 +33,8 @@ Before any major/minor/patch is released all test units will be run to verify th - name - ip - cast vban getters to types for consistency +- Bus.Mono -> [int] for stereo reverse +- Bus.Levels.Convert return type [float] -> [single] for naming consistency, no functional change ### Fixed diff --git a/README.md b/README.md index aa08db7..aa4707e 100644 --- a/README.md +++ b/README.md @@ -234,8 +234,10 @@ $vmr.strip[2].levels.PreFader() -Join ', ' | Write-Host The following bus commands are available: - mute: bool -- mono: bool -- limit: int, from -40 to 12 +- sel: bool +- monitor: bool +- vaio: bool +- mono: int, 0 off, 1 mono, 2 stereo reverse - gain: float, from -60.0 to 12.0 - label: string - returnreverb: float, from 0.0 to 10.0 @@ -268,6 +270,7 @@ The following bus.mode members are available: The following bus.mode commands are available: +- Set($mode): string, sets the current bus mode - Get(): returns the current bus mode. for example: diff --git a/lib/bus.ps1 b/lib/bus.ps1 index 0ba086d..3145574 100644 --- a/lib/bus.ps1 +++ b/lib/bus.ps1 @@ -4,7 +4,8 @@ class Bus : IRemote { [Object]$levels Bus ([int]$index, [Object]$remote) : base ($index, $remote) { - AddBoolMembers -PARAMS @('mono', 'mute') + AddBoolMembers -PARAMS @('mute', 'sel', 'monitor') + AddIntMembers -PARAMS @('mono') AddStringMembers -PARAMS @('label') AddFloatMembers -PARAMS @('gain', 'returnreverb', 'returndelay', 'returnfx1', 'returnfx2') @@ -35,7 +36,7 @@ class BusLevels : IRemote { $this.offset = 8 } - [float] Convert([float]$val) { + hidden [single] Convert([single]$val) { if ($val -gt 0) { return [math]::Round(20 * [math]::Log10($val), 1) } @@ -81,6 +82,15 @@ class BusMode : IRemote { } return $mode } + + [void] Set ([string]$mode) { + if ($this.modes.Contains($mode)) { + $this.Setter($mode, $true) + } + else { + throw [System.ArgumentException]::new("Invalid mode: $mode") + } + } } class BusEq : Eq { @@ -97,6 +107,8 @@ class PhysicalBus : Bus { PhysicalBus ([int]$index, [Object]$remote) : base ($index, $remote) { $this.device = [BusDevice]::new($index, $remote) + + AddBoolMembers -PARAMS @('vaio') } } @@ -126,7 +138,7 @@ class BusDevice : Device { -Value { return Write-Warning ("ERROR: $($this.identifier()).asio is write only") } -SecondValue { - param($arg) + param([string]$arg) return $this.Setter('asio', $arg) } -Force } diff --git a/tests/higher.Tests.ps1 b/tests/higher.Tests.ps1 index 8ae38fe..de9825f 100644 --- a/tests/higher.Tests.ps1 +++ b/tests/higher.Tests.ps1 @@ -53,12 +53,22 @@ Describe -Tag 'higher', -TestName 'All Higher Tests' { Context 'Bus, one physical one virtual' -ForEach @( @{ Index = $phys_out }, @{ Index = $virt_out } ) { - It "Should set and get Bus[$index].Mono" { - $vmr.bus[$index].mono = $value - $vmr.bus[$index].mono | Should -Be $expected + It "Should set and get Bus[$index].Monitor" -Skip:$ifNotPotato { + $vmr.bus[$index].monitor = $value + $vmr.bus[$index].monitor | Should -Be $expected } - It "Should set and get Bus[$index].mode.amix" -Skip:$ifBasic { + It "Should set and get Bus[$index].Mute" { + $vmr.bus[$index].mute = $value + $vmr.bus[$index].mute | Should -Be $expected + } + + It "Should set and get Bus[$index].Sel" -Skip:$ifNotPotato { + $vmr.bus[$index].sel = $value + $vmr.bus[$index].sel | Should -Be $expected + } + + It "Should set and get Bus[$index].mode.amix" { $vmr.bus[$index].mode.amix = $value $vmr.bus[$index].mode.amix | Should -Be $expected } @@ -88,6 +98,15 @@ Describe -Tag 'higher', -TestName 'All Higher Tests' { } } + Context 'Bus, physical only' -ForEach @( + @{ Index = $phys_out } + ) { + It "Should set and get Bus[$index].vaio" { + $vmr.bus[$index].vaio = $value + $vmr.bus[$index].vaio | Should -Be $expected + } + } + Context 'Macrobutton' -ForEach @( @{ Index = 0 }, @{ Index = 69 } ) { @@ -386,6 +405,15 @@ Describe -Tag 'higher', -TestName 'All Higher Tests' { Context 'Bus, one physical one virtual' -ForEach @( @{ Index = $phys_out }, @{ Index = $virt_out } ) { + It "Should set and get Bus[$index].Mono" -ForEach @( + @{ Value = 0; Expected = 0 } + @{ Value = 1; Expected = 1 } + @{ Value = 2; Expected = 2 } + ) { + $vmr.bus[$index].mono = $value + $vmr.bus[$index].mono | Should -Be $expected + } + Context 'Eq' -Skip:$ifBasic -ForEach @( @{ Eq = $vmr.bus[$index].eq } ) { @@ -663,6 +691,15 @@ Describe -Tag 'higher', -TestName 'All Higher Tests' { $vmr.bus[$index].label | Should -Be $expected } + It "Should set Bus[$index].Mode" -Skip:$ifBasic -ForEach @( + @{ Value = 'bmix'; Expected = 'bmix' } + @{ Value = 'upmix41'; Expected = 'upmix41' } + @{ Value = 'rearonly'; Expected = 'rearonly' } + ) { + $vmr.bus[$index].mode.Set($value) + $vmr.bus[$index].mode.Get() | Should -Be $expected + } + Context 'EQ' -Skip:$ifBasic -ForEach @( @{ Eq = $vmr.bus[$index].eq } ) {