Compare commits

..

10 Commits

Author SHA1 Message Date
df2d1bb156
Merge pull request #25 from pblivingston/option-monitoringbus
Option.MonitoringBus
2025-12-01 22:57:22 +00:00
pblivingston
6e74db2751 Update README.md 2025-12-01 17:52:29 -05:00
pblivingston
5f064de010 Update higher.Tests.ps1
pester tests pass for all types
manual tests for safety pass
- buffer.asio
2025-12-01 17:52:29 -05:00
pblivingston
dd404ae337 monitoringBus, types
- add monitoringBus for convenience for Bus[i].Monitor since only one will be true
- cast getters to [int] for type consistency
2025-12-01 17:52:29 -05:00
68f582512a
Merge pull request #24 from pblivingston/bus-params
Bus params
2025-12-01 22:47:23 +00:00
pblivingston
8f5536f139 update docs 2025-12-01 17:08:47 -05:00
pblivingston
7eb82c41a2 hide Convert, add mode.set
tests pass for all kinds
2025-12-01 17:05:58 -05:00
pblivingston
ec05790312 Update higher.Tests.ps1
pester tests pass for all kinds
manual tests for safety pass:
- bus.levels.all()
- bus.device.asio
2025-12-01 13:22:07 -05:00
pblivingston
2def27573d update docs 2025-12-01 12:06:51 -05:00
pblivingston
36d4e5f6c4 Update bus.ps1
- sel
- monitor
- vaio
- mono to int
- levels.convert [float] -> [single]
- device.asio $arg -> [string]$arg
2025-12-01 11:17:58 -05:00
5 changed files with 100 additions and 14 deletions

View File

@ -23,6 +23,8 @@ Before any major/minor/patch is released all test units will be run to verify th
- on, write-only - on, write-only
- name, write-only - name, write-only
- ip, write-only - ip, write-only
- Bus.Sel, Bus.Monitor, Bus.Vaio
- Bus.Mode.Set($mode)
### Changed ### Changed
@ -31,6 +33,8 @@ Before any major/minor/patch is released all test units will be run to verify th
- name - name
- ip - ip
- cast vban getters to types for consistency - 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 ### Fixed

View File

@ -234,8 +234,10 @@ $vmr.strip[2].levels.PreFader() -Join ', ' | Write-Host
The following bus commands are available: The following bus commands are available:
- mute: bool - mute: bool
- mono: bool - sel: bool
- limit: int, from -40 to 12 - monitor: bool
- vaio: bool
- mono: int, 0 off, 1 mono, 2 stereo reverse
- gain: float, from -60.0 to 12.0 - gain: float, from -60.0 to 12.0
- label: string - label: string
- returnreverb: float, from 0.0 to 10.0 - 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: The following bus.mode commands are available:
- Set($mode): string, sets the current bus mode
- Get(): returns the current bus mode. - Get(): returns the current bus mode.
for example: for example:
@ -488,6 +491,7 @@ The following Option commands are available:
- asiosr: bool - asiosr: bool
- monitorOnSel: bool - monitorOnSel: bool
- sliderMode: bool - sliderMode: bool
- monitoringBus: int, from 0 to bus index
The following Option.delay[i] methods are available: The following Option.delay[i] methods are available:

View File

@ -4,7 +4,8 @@ class Bus : IRemote {
[Object]$levels [Object]$levels
Bus ([int]$index, [Object]$remote) : base ($index, $remote) { Bus ([int]$index, [Object]$remote) : base ($index, $remote) {
AddBoolMembers -PARAMS @('mono', 'mute') AddBoolMembers -PARAMS @('mute', 'sel', 'monitor')
AddIntMembers -PARAMS @('mono')
AddStringMembers -PARAMS @('label') AddStringMembers -PARAMS @('label')
AddFloatMembers -PARAMS @('gain', 'returnreverb', 'returndelay', 'returnfx1', 'returnfx2') AddFloatMembers -PARAMS @('gain', 'returnreverb', 'returndelay', 'returnfx1', 'returnfx2')
@ -35,7 +36,7 @@ class BusLevels : IRemote {
$this.offset = 8 $this.offset = 8
} }
[float] Convert([float]$val) { hidden [single] Convert([single]$val) {
if ($val -gt 0) { if ($val -gt 0) {
return [math]::Round(20 * [math]::Log10($val), 1) return [math]::Round(20 * [math]::Log10($val), 1)
} }
@ -81,6 +82,15 @@ class BusMode : IRemote {
} }
return $mode 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 { class BusEq : Eq {
@ -97,6 +107,8 @@ class PhysicalBus : Bus {
PhysicalBus ([int]$index, [Object]$remote) : base ($index, $remote) { PhysicalBus ([int]$index, [Object]$remote) : base ($index, $remote) {
$this.device = [BusDevice]::new($index, $remote) $this.device = [BusDevice]::new($index, $remote)
AddBoolMembers -PARAMS @('vaio')
} }
} }
@ -126,7 +138,7 @@ class BusDevice : Device {
-Value { -Value {
return Write-Warning ("ERROR: $($this.identifier()).asio is write only") return Write-Warning ("ERROR: $($this.identifier()).asio is write only")
} -SecondValue { } -SecondValue {
param($arg) param([string]$arg)
return $this.Setter('asio', $arg) return $this.Setter('asio', $arg)
} -Force } -Force
} }

View File

@ -24,7 +24,7 @@ class Option : IRemote {
hidden $_sr = $($this | Add-Member ScriptProperty 'sr' ` hidden $_sr = $($this | Add-Member ScriptProperty 'sr' `
{ {
$this.Getter('sr') [int]$this.Getter('sr')
} ` } `
{ {
param([int]$arg) param([int]$arg)
@ -37,6 +37,28 @@ class Option : IRemote {
} }
} }
) )
hidden $_monitoringBus = $($this | Add-Member ScriptProperty 'monitoringBus' `
{
foreach ($bus in 0..$($this.remote.kind.p_out + $this.remote.kind.v_out - 1)) {
if ($this.remote.Getter("Bus[$bus].Monitor")) {
break
}
}
return $bus
} `
{
param([int]$arg)
$busMax = $this.remote.kind.p_out + $this.remote.kind.v_out - 1
if ($arg -ge 0 -and $arg -le $busMax) {
$this._monitoringBus = $this.remote.Setter("Bus[$arg].Monitor", $arg)
}
else {
Write-Warning ("Expected a bus index between 0 and $busMax")
}
}
)
} }
class OptionBuffer : IRemote { class OptionBuffer : IRemote {
@ -48,7 +70,7 @@ class OptionBuffer : IRemote {
hidden $_mme = $($this | Add-Member ScriptProperty 'mme' ` hidden $_mme = $($this | Add-Member ScriptProperty 'mme' `
{ {
$this.Getter('mme') [int]$this.Getter('mme')
} ` } `
{ {
param([int]$arg) param([int]$arg)
@ -64,7 +86,7 @@ class OptionBuffer : IRemote {
hidden $_wdm = $($this | Add-Member ScriptProperty 'wdm' ` hidden $_wdm = $($this | Add-Member ScriptProperty 'wdm' `
{ {
$this.Getter('wdm') [int]$this.Getter('wdm')
} ` } `
{ {
param([int]$arg) param([int]$arg)
@ -80,7 +102,7 @@ class OptionBuffer : IRemote {
hidden $_ks = $($this | Add-Member ScriptProperty 'ks' ` hidden $_ks = $($this | Add-Member ScriptProperty 'ks' `
{ {
$this.Getter('ks') [int]$this.Getter('ks')
} ` } `
{ {
param([int]$arg) param([int]$arg)
@ -96,7 +118,7 @@ class OptionBuffer : IRemote {
hidden $_asio = $($this | Add-Member ScriptProperty 'asio' ` hidden $_asio = $($this | Add-Member ScriptProperty 'asio' `
{ {
$this.Getter('asio') [int]$this.Getter('asio')
} ` } `
{ {
param([int]$arg) param([int]$arg)

View File

@ -53,12 +53,22 @@ Describe -Tag 'higher', -TestName 'All Higher Tests' {
Context 'Bus, one physical one virtual' -ForEach @( Context 'Bus, one physical one virtual' -ForEach @(
@{ Index = $phys_out }, @{ Index = $virt_out } @{ Index = $phys_out }, @{ Index = $virt_out }
) { ) {
It "Should set and get Bus[$index].Mono" { It "Should set and get Bus[$index].Monitor" -Skip:$ifNotPotato {
$vmr.bus[$index].mono = $value $vmr.bus[$index].monitor = $value
$vmr.bus[$index].mono | Should -Be $expected $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 = $value
$vmr.bus[$index].mode.amix | Should -Be $expected $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 @( Context 'Macrobutton' -ForEach @(
@{ Index = 0 }, @{ Index = 69 } @{ Index = 0 }, @{ Index = 69 }
) { ) {
@ -386,6 +405,15 @@ Describe -Tag 'higher', -TestName 'All Higher Tests' {
Context 'Bus, one physical one virtual' -ForEach @( Context 'Bus, one physical one virtual' -ForEach @(
@{ Index = $phys_out }, @{ Index = $virt_out } @{ 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 @( Context 'Eq' -Skip:$ifBasic -ForEach @(
@{ Eq = $vmr.bus[$index].eq } @{ Eq = $vmr.bus[$index].eq }
) { ) {
@ -546,6 +574,13 @@ Describe -Tag 'higher', -TestName 'All Higher Tests' {
$vmr.option.sr | Should -Be $value $vmr.option.sr | Should -Be $value
} }
It 'Should set and get Option.MonitoringBus' -Skip:$ifNotPotato -ForEach @(
@{ Value = $phys_out }, @{ Value = $virt_out }
) {
$vmr.option.monitoringbus = $value
$vmr.option.monitoringbus | Should -Be $value
}
Context 'Option.buffer' -ForEach @( Context 'Option.buffer' -ForEach @(
@{ Value = 1024 }, @{ Value = 512 } @{ Value = 1024 }, @{ Value = 512 }
) { ) {
@ -663,6 +698,15 @@ Describe -Tag 'higher', -TestName 'All Higher Tests' {
$vmr.bus[$index].label | Should -Be $expected $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 @( Context 'EQ' -Skip:$ifBasic -ForEach @(
@{ Eq = $vmr.bus[$index].eq } @{ Eq = $vmr.bus[$index].eq }
) { ) {