From b5546aa56ccd3c95b5a55818d97bfb365d1b2bb5 Mon Sep 17 00:00:00 2001 From: pblivingston <71585805+pblivingston@users.noreply.github.com> Date: Wed, 3 Dec 2025 12:40:04 -0500 Subject: [PATCH 1/3] existing to methods prelim manual testing passes for potato --- README.md | 11 +++++------ lib/command.ps1 | 39 ++++++++++++++------------------------- 2 files changed, 19 insertions(+), 31 deletions(-) diff --git a/README.md b/README.md index 8adc862..9994d31 100644 --- a/README.md +++ b/README.md @@ -418,15 +418,14 @@ $vmr.vban.outstream[3].bit = 16 Certain 'special' commands are defined by the API as performing actions rather than setting values. -The following commands are available: - -- hide -- showvbanchat: bool, (write only) -- lock: bool, (write only) - The following methods are available: - Show() +- Hide() +- Lock() +- Unlock() +- ShowVBANChat() +- HideVBANChat() - Restart() - Shutdown() - Load($filepath): string diff --git a/lib/command.ps1 b/lib/command.ps1 index 4f1e3c3..a8f412d 100644 --- a/lib/command.ps1 +++ b/lib/command.ps1 @@ -1,6 +1,6 @@ class Special : IRemote { Special ([Object]$remote) : base ($remote) { - AddActionMembers -PARAMS @('restart', 'shutdown', 'show') + AddActionMembers -PARAMS @('restart', 'shutdown', 'show', 'lock') } [string] identifier () { @@ -17,32 +17,21 @@ class Special : IRemote { Stop-Process -Name 'VoicemeeterMacroButtons' } - hidden $_hide = $($this | Add-Member ScriptProperty 'hide' ` - { - $this._hide = $this.Setter('show', $false) - } ` - {} - ) + [void] Hide () { + $this.Setter('show', $false) + } - hidden $_showvbanchat = $($this | Add-Member ScriptProperty 'showvbanchat' ` - { - $this.Getter('DialogShow.VBANCHAT') - } ` - { - param([bool]$arg) - $this._showvbanchat = $this.Setter('DialogShow.VBANCHAT', $arg) - } - ) + [void] Unlock () { + $this.Setter('lock', $false) + } - hidden $_lock = $($this | Add-Member ScriptProperty 'lock' ` - { - $this._lock = $this.Getter('lock') - } ` - { - param([bool]$arg) - $this._lock = $this.Setter('lock', $arg) - } - ) + [void] ShowVBANChat () { + $this.Setter('DialogShow.VBANCHAT', $true) + } + + [void] HideVBANChat () { + $this.Setter('DialogShow.VBANCHAT', $false) + } [void] Load ([string]$filename) { $this.Setter('load', $filename) From cfa7de9b1101c4769e18a30decb1cc39293c1e7f Mon Sep 17 00:00:00 2001 From: pblivingston <71585805+pblivingston@users.noreply.github.com> Date: Wed, 3 Dec 2025 15:07:25 -0500 Subject: [PATCH 2/3] reset, save - removed 'lock' test, corrected README example - can now test 'save', 'reset', 'load' prelim test for potato passes --- CHANGELOG.md | 2 ++ README.md | 4 +++- lib/command.ps1 | 6 ++++- tests/higher.Tests.ps1 | 51 +++++++++++++++++++++++++++++++++++++----- 4 files changed, 55 insertions(+), 8 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index a2e8e9b..397655c 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -39,6 +39,8 @@ Recorder.FileType changed from method to write-only property - Recorder.Prefix - Recorder.Eject() references 'Command.Eject' - Recorder.State +- Command.Reset() +- Command.Save($filepath) ### Changed diff --git a/README.md b/README.md index 9994d31..f56d825 100644 --- a/README.md +++ b/README.md @@ -428,6 +428,8 @@ The following methods are available: - HideVBANChat() - Restart() - Shutdown() +- Reset(): Reset all config +- Save($filepath): string - Load($filepath): string - RunMacrobuttons(): Launches the macrobuttons app - CloseMacrobuttons(): Closes the macrobuttons app @@ -437,7 +439,7 @@ example: ```powershell $vmr.command.show() -$vmr.command.lock = $true +$vmr.command.lock() $vmr.command.Load("path/to/filename.xml") diff --git a/lib/command.ps1 b/lib/command.ps1 index a8f412d..18926d1 100644 --- a/lib/command.ps1 +++ b/lib/command.ps1 @@ -1,6 +1,6 @@ class Special : IRemote { Special ([Object]$remote) : base ($remote) { - AddActionMembers -PARAMS @('restart', 'shutdown', 'show', 'lock') + AddActionMembers -PARAMS @('restart', 'shutdown', 'show', 'lock', 'reset') } [string] identifier () { @@ -36,6 +36,10 @@ class Special : IRemote { [void] Load ([string]$filename) { $this.Setter('load', $filename) } + + [void] Save ([string]$filename) { + $this.Setter('save', $filename) + } } function Make_Command([Object]$remote) { diff --git a/tests/higher.Tests.ps1 b/tests/higher.Tests.ps1 index 02f8e38..1e52c78 100644 --- a/tests/higher.Tests.ps1 +++ b/tests/higher.Tests.ps1 @@ -184,12 +184,6 @@ Describe -Tag 'higher', -TestName 'All Higher Tests' { } } - Context 'Command' { - It 'Should set command.lock' { - $vmr.command.lock = $value - } - } - Context 'Fx' -Skip:$ifNotPotato { Context 'Delay' { It 'Should set and get Fx.delay.on' { @@ -948,6 +942,51 @@ Describe -Tag 'higher', -TestName 'All Higher Tests' { } } } + + Context 'Command' { + It 'Should save, reset, then load config' -ForEach @( + @{ Gain = -27.1; Mode = 'composite'; Bit = 24; Port = 1044 } + ) { + $tmp = [System.IO.Path]::Combine([System.IO.Path]::GetTempPath(), "vmrconfig-$(New-Guid).xml") + try { + # set some values + $vmr.strip[$virt_in].gain = $gain + $vmr.bus[$phys_out].mode.set($mode) + $vmr.vban.outstream[$vban_outA].bit = $bit + $vmr.vban.port = $port + + # save config + $vmr.command.save($tmp) + Start-Sleep -Milliseconds 100 + Test-Path $tmp | Should -BeTrue + + # reset config + $vmr.command.reset() + Start-Sleep -Milliseconds 500 + + # verify default values + $vmr.strip[$virt_in].gain | Should -Be 0.0 + $vmr.bus[$phys_out].mode.get() | Should -Be 'normal' + $vmr.vban.outstream[$vban_outA].bit | Should -Be 16 + $vmr.vban.port | Should -Be 6980 + + # load config + $vmr.command.load($tmp) + Start-Sleep -Milliseconds 500 + + # verify values + $vmr.strip[$virt_in].gain | Should -Be $gain + $vmr.bus[$phys_out].mode.get() | Should -Be $mode + $vmr.vban.outstream[$vban_outA].bit | Should -Be $bit + $vmr.vban.port | Should -Be $port + } + finally { + if (Test-Path $tmp) { + Remove-Item $tmp -Force + } + } + } + } } Describe 'Action Tests' -Tag 'action' { From 1310ca25efd23adc42e5cf5fdc8179ceb6e9e5ad Mon Sep 17 00:00:00 2001 From: pblivingston <71585805+pblivingston@users.noreply.github.com> Date: Wed, 3 Dec 2025 23:50:07 -0500 Subject: [PATCH 3/3] storepreset, recallpreset pester tests pass for all kinds manual tests pass for all kinds - show/hide - lock/unlock - showvbanchat/hidevbanchat --- CHANGELOG.md | 2 ++ README.md | 20 ++++++++++---- lib/command.ps1 | 28 +++++++++++++++++++ tests/higher.Tests.ps1 | 61 ++++++++++++++++++++++++++++++++++++++++++ tests/run.ps1 | 1 + 5 files changed, 107 insertions(+), 5 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 397655c..6878064 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -41,6 +41,8 @@ Recorder.FileType changed from method to write-only property - Recorder.State - Command.Reset() - Command.Save($filepath) +- Command.StorePreset() +- Command.RecallPreset() ### Changed diff --git a/README.md b/README.md index f56d825..6677335 100644 --- a/README.md +++ b/README.md @@ -431,21 +431,31 @@ The following methods are available: - Reset(): Reset all config - Save($filepath): string - Load($filepath): string +- StorePreset($index, $name): (int, string) +- RecallPreset($index or $name): (int or string) - RunMacrobuttons(): Launches the macrobuttons app - CloseMacrobuttons(): Closes the macrobuttons app example: ```powershell -$vmr.command.show() - -$vmr.command.lock() - +$vmr.command.Show() +$vmr.command.Lock() $vmr.command.Load("path/to/filename.xml") - $vmr.command.RunMacrobuttons() + +$vmr.command.StorePreset(63, 'example') +$vmr.command.StorePreset('example') +$vmr.command.StorePreset(63) # same as StorePreset(63, '') +$vmr.command.StorePreset() # same as StorePreset(''), overwrites last recalled + +$vmr.command.RecallPreset('example') +$vmr.command.RecallPreset(63) +$vmr.command.RecallPreset() # same as RecallPreset(''), recalls last recalled ``` +StorePreset('') and RecallPreset('') interact with the 'selected' preset. This is highlighted green in the GUI. Recalling a preset selects it. Storing a preset via GUI also selects it. Storing a preset with StorePreset does not select it. + ### Fx The following Fx commands are available: diff --git a/lib/command.ps1 b/lib/command.ps1 index 18926d1..ed1e0d1 100644 --- a/lib/command.ps1 +++ b/lib/command.ps1 @@ -40,6 +40,34 @@ class Special : IRemote { [void] Save ([string]$filename) { $this.Setter('save', $filename) } + + [void] StorePreset () { + $this.Setter('updatepreset', '') + } + + [void] StorePreset ([string]$name) { + $this.Setter('updatepreset', $name) + } + + [void] StorePreset ([int]$index) { + $this.Setter('preset[{0}].store' -f $index, '') + } + + [void] StorePreset ([int]$index, [string]$name) { + $this.Setter('preset[{0}].store' -f $index, $name) + } + + [void] RecallPreset () { + $this.Setter('recallpreset', '') + } + + [void] RecallPreset ([string]$name) { + $this.Setter('recallpreset', $name) + } + + [void] RecallPreset ([int]$index) { + $this.Setter('preset[{0}].recall' -f $index, 1) + } } function Make_Command([Object]$remote) { diff --git a/tests/higher.Tests.ps1 b/tests/higher.Tests.ps1 index 1e52c78..d066648 100644 --- a/tests/higher.Tests.ps1 +++ b/tests/higher.Tests.ps1 @@ -908,6 +908,7 @@ Describe -Tag 'higher', -TestName 'All Higher Tests' { $vmr.recorder.filetype = $filetype $vmr.recorder.state = 'record' + Start-Sleep -Milliseconds 100 $stamp = '{0:yyyy-MM-dd} at {0:HH}h{0:mm}m{0:ss}s' -f (Get-Date) $vmr.recorder.state | Should -Be 'record' Start-Sleep -Milliseconds 2000 @@ -1001,6 +1002,7 @@ Describe -Tag 'higher', -TestName 'All Higher Tests' { BeforeEach { $vmr.recorder.record() + Start-Sleep -Milliseconds 100 $stamp = '{0:yyyy-MM-dd} at {0:HH}h{0:mm}m{0:ss}s' -f (Get-Date) Start-Sleep -Milliseconds 2000 @@ -1043,5 +1045,64 @@ Describe -Tag 'higher', -TestName 'All Higher Tests' { } } } + + Context 'Command' { + Context 'Preset Scene' -ForEach @( + @{ Index = 0; Name = 'Test Scene 1' } + @{ Index = 63; Name = 'Test Scene 64' } + ) { + It "Should store preset at index '$index' with name '$name'" -ForEach @( + @{ Value = -15.5 }, @{ Value = -52.9 } + ) { + $vmr.bus[$phys_out].gain = $value + $vmr.command.storepreset($index, $name) + + $vmr.bus[$phys_out].gain = 0.0 + + $vmr.command.recallpreset($name) + Start-Sleep -Milliseconds 500 + $vmr.bus[$phys_out].gain | Should -Be $value + } + + It "Should update preset at index '$index'" -ForEach @( + @{ Value = $false }, @{ Value = $true } + ) { + $vmr.strip[$virt_in].B1 = $value + $vmr.command.storepreset($index) + + $vmr.strip[$virt_in].B1 = -not $value + + $vmr.command.recallpreset($index) + Start-Sleep -Milliseconds 500 + $vmr.strip[$virt_in].B1 | Should -Be $value + } + + It "Should update preset with name '$name'" -ForEach @( + @{ Value = 2 }, @{ Value = 1 } + ) { + $vmr.bus[$virt_out].mono = $value + $vmr.command.storepreset($name) + + $vmr.bus[$virt_out].mono = 0 + + $vmr.command.recallpreset($name) + Start-Sleep -Milliseconds 500 + $vmr.bus[$virt_out].mono | Should -Be $value + } + + It "Should update last recalled preset ($index`: $(($index + 1).ToString('00')) - $name)" -ForEach @( + @{ Value = 0.8 }, @{ Value = 0.3 } + ) { + $vmr.strip[$phys_in].color_y = $value + $vmr.command.storepreset() + + $vmr.strip[$phys_in].color_y = 0.0 + + $vmr.command.recallpreset() + Start-Sleep -Milliseconds 500 + $vmr.strip[$phys_in].color_y | Should -Be $value + } + } + } } } diff --git a/tests/run.ps1 b/tests/run.ps1 index ebf19fe..4e39383 100644 --- a/tests/run.ps1 +++ b/tests/run.ps1 @@ -12,6 +12,7 @@ function Test-RecDir ([object]$vmr, [string]$recDir) { try { $vmr.recorder.record() + Start-Sleep -Milliseconds 100 $stamp = '{0:yyyy-MM-dd} at {0:HH}h{0:mm}m{0:ss}s' -f (Get-Date) Start-Sleep -Milliseconds 2000