From 1d41be7396f93f43d1452c7fa2159d267f8b8872 Mon Sep 17 00:00:00 2001 From: pblivingston <71585805+pblivingston@users.noreply.github.com> Date: Wed, 3 Dec 2025 04:18:25 -0500 Subject: [PATCH] channel, types - correct channel values - add 'gain' to README - cast getters to [int] - add some int tests for safety - skip recording test if basic pester tests pass for all kinds manual tests for safety pass - channel --- CHANGELOG.md | 2 ++ README.md | 3 ++- lib/recorder.ps1 | 13 +++++++------ tests/higher.Tests.ps1 | 21 +++++++++++++++++++++ tests/run.ps1 | 7 ++++++- 5 files changed, 38 insertions(+), 8 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 0d06cda..462d961 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -51,6 +51,7 @@ Deprecated Recorder.Loop removed: use Recorder.Mode.Loop - Meta: AddBoolMembers, AddIntMembers $arg types for consistency - Device: explicit $arg types for consistency - Recorder.Armstrip|Armbus -> BoolArrayMember: now have .Get() +- Cast Recorder getters to types for consistency ### Fixed @@ -61,6 +62,7 @@ Deprecated Recorder.Loop removed: use Recorder.Mode.Loop - vban.stream.port: [string]$arg -> [int]$arg - vban route range (API documentation is incorrect) - vban.stream.sr: $this._port -> $this._sr +- Recorder.channel values: 1..8 -> (2, 4, 6, 8) ## [3.3.0] - 2024-06-29 diff --git a/README.md b/README.md index 0c9bf38..14b8668 100644 --- a/README.md +++ b/README.md @@ -527,12 +527,13 @@ The following commands are available: - A1 - A5: bool - B1 - B3: bool +- gain: float, from -60.0 to 12.0 - armedbus: int, from 0 to bus index - state: string, ('play', 'stop', 'record', 'pause') - prerectime: int, from 0 to 20 seconds - samplerate: int, (22050, 24000, 32000, 44100, 48000, 88200, 96000, 176400, 192000) - bitresolution: int, (8, 16, 24, 32) -- channel: int, from 1 to 8 +- channel: int, (2, 4, 6, 8) - kbps: int, (32, 40, 48, 56, 64, 80, 96, 112, 128, 160, 192, 224, 256, 320) The following methods are available: diff --git a/lib/recorder.ps1 b/lib/recorder.ps1 index 24bda3e..1d688bd 100644 --- a/lib/recorder.ps1 +++ b/lib/recorder.ps1 @@ -71,7 +71,7 @@ class Recorder : IRemote { hidden $_samplerate = $($this | Add-Member ScriptProperty 'samplerate' ` { - $this.Getter('samplerate') + [int]$this.Getter('samplerate') } ` { param([int]$arg) @@ -87,7 +87,7 @@ class Recorder : IRemote { hidden $_bitresolution = $($this | Add-Member ScriptProperty 'bitresolution' ` { - $this.Getter('bitresolution') + [int]$this.Getter('bitresolution') } ` { param([int]$arg) @@ -103,22 +103,23 @@ class Recorder : IRemote { hidden $_channel = $($this | Add-Member ScriptProperty 'channel' ` { - $this.Getter('channel') + [int]$this.Getter('channel') } ` { param([int]$arg) - if ($arg -ge 1 -and $arg -le 8) { + $opts = @(2, 4, 6, 8) + if ($opts.Contains($arg)) { $this._channel = $this.Setter('channel', $arg) } else { - "channel got: $arg, expected value from 1 to 8" | Write-Warning + "channel got: $arg, expected one of $opts" | Write-Warning } } ) hidden $_kbps = $($this | Add-Member ScriptProperty 'kbps' ` { - $this.Getter('kbps') + [int]$this.Getter('kbps') } ` { param([int]$arg) diff --git a/tests/higher.Tests.ps1 b/tests/higher.Tests.ps1 index 1804098..a787e05 100644 --- a/tests/higher.Tests.ps1 +++ b/tests/higher.Tests.ps1 @@ -640,6 +640,27 @@ Describe -Tag 'higher', -TestName 'All Higher Tests' { $vmr.recorder.prerectime = $value $vmr.recorder.prerectime | Should -Be $value } + + It 'Should set and get Recorder.samplerate' -ForEach @( + @{ Value = 44100 }, @{ Value = 48000 } + ) { + $vmr.recorder.samplerate = $value + $vmr.recorder.samplerate | Should -Be $value + } + + It 'Should set and get Recorder.bitresolution' -ForEach @( + @{ Value = 24 }, @{ Value = 16 } + ) { + $vmr.recorder.bitresolution = $value + $vmr.recorder.bitresolution | Should -Be $value + } + + It 'Should set and get Recorder.kbps' -ForEach @( + @{ Value = 96 }, @{ Value = 192 } + ) { + $vmr.recorder.kbps = $value + $vmr.recorder.kbps | Should -Be $value + } } } diff --git a/tests/run.ps1 b/tests/run.ps1 index 5257371..74b1cc3 100644 --- a/tests/run.ps1 +++ b/tests/run.ps1 @@ -65,7 +65,12 @@ function main() { # recording directory: default ~/My Documents/Voicemeeter, override if custom $recDir = [System.IO.Path]::GetFullPath($recDir) - $ifCustomDir = Test-RecDir -vmr $vmr -recDir $recDir # avoid creating files we can't delete + if ($ifBasic) { + $ifCustomDir = $ifBasic # basic can't record, so skip the test + } + else { + $ifCustomDir = Test-RecDir -vmr $vmr -recDir $recDir # avoid creating files we can't delete + } Invoke-Pester -Tag $tag -PassThru | Out-Null }