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
This commit is contained in:
pblivingston 2025-12-03 04:18:25 -05:00
parent ab4baa5c44
commit 1d41be7396
5 changed files with 38 additions and 8 deletions

View File

@ -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

View File

@ -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:

View File

@ -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)

View File

@ -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
}
}
}

View File

@ -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
}