prefix, filetype

changed to write-only properties
pester tests pass for all kinds
This commit is contained in:
pblivingston 2025-12-04 00:12:37 -05:00
parent 1d41be7396
commit df86ad2175
5 changed files with 38 additions and 25 deletions

View File

@ -16,6 +16,7 @@ AddActionMembers now adds ScriptMethods instead of ScriptProperties:
- See Recorder section of README for details on using playback/record actions - See Recorder section of README for details on using playback/record actions
Deprecated Recorder.Loop removed: use Recorder.Mode.Loop Deprecated Recorder.Loop removed: use Recorder.Mode.Loop
Recorder.FileType changed from method to write-only property
### Added ### Added
@ -35,7 +36,7 @@ Deprecated Recorder.Loop removed: use Recorder.Mode.Loop
- Bus.Mode.Set($mode) - Bus.Mode.Set($mode)
- Recorder.Armedbus - Recorder.Armedbus
- Recorder.PreRecTime - Recorder.PreRecTime
- Recorder.Prefix($prefix) - Recorder.Prefix
- Recorder.Eject() references 'Command.Eject' - Recorder.Eject() references 'Command.Eject'
- Recorder.State - Recorder.State

View File

@ -531,6 +531,8 @@ The following commands are available:
- armedbus: int, from 0 to bus index - armedbus: int, from 0 to bus index
- state: string, ('play', 'stop', 'record', 'pause') - state: string, ('play', 'stop', 'record', 'pause')
- prerectime: int, from 0 to 20 seconds - prerectime: int, from 0 to 20 seconds
- prefix: string, write-only
- filetype: string, write-only, ('wav', 'aiff', 'bwf', 'mp3')
- samplerate: int, (22050, 24000, 32000, 44100, 48000, 88200, 96000, 176400, 192000) - samplerate: int, (22050, 24000, 32000, 44100, 48000, 88200, 96000, 176400, 192000)
- bitresolution: int, (8, 16, 24, 32) - bitresolution: int, (8, 16, 24, 32)
- channel: int, (2, 4, 6, 8) - channel: int, (2, 4, 6, 8)
@ -548,8 +550,6 @@ The following methods are available:
- Eject() - Eject()
- Load($filepath): string - Load($filepath): string
- GoTo($timestring): string, must match the format 'hh:mm:ss' - GoTo($timestring): string, must match the format 'hh:mm:ss'
- FileType($format): string, ('wav', 'aiff', 'bwf', 'mp3')
- Prefix($prefix): string
example: example:

View File

@ -41,22 +41,6 @@ class Recorder : IRemote {
$this.Setter('load', $filename) $this.Setter('load', $filename)
} }
[void] Prefix ([string]$prefix) {
$this.Setter('prefix', $prefix)
}
[void] FileType([string]$format) {
[int]$val = 0
switch ($format) {
'wav' { $val = 1 }
'aiff' { $val = 2 }
'bwf' { $val = 3 }
'mp3' { $val = 100 }
default { "Filetype() got: $format, expected one of 'wav', 'aiff', 'bwf', 'mp3'" }
}
$this.Setter('filetype', $val)
}
[void] GoTo ([string]$timestring) { [void] GoTo ([string]$timestring) {
try { try {
if ([datetime]::ParseExact($timestring, 'HH:mm:ss', $null)) { if ([datetime]::ParseExact($timestring, 'HH:mm:ss', $null)) {
@ -133,6 +117,34 @@ class Recorder : IRemote {
} }
) )
hidden $_prefix = $($this | Add-Member ScriptProperty 'prefix' `
{
return Write-Warning ("ERROR: $($this.identifier()).prefix is write only")
} `
{
param([string]$arg)
$this._prefix = $this.Setter('prefix', $arg)
}
)
hidden $_filetype = $($this | Add-Member ScriptProperty 'filetype' `
{
return Write-Warning ("ERROR: $($this.identifier()).filetype is write only")
} `
{
param([string]$arg)
[int]$val = 0
switch ($arg) {
'wav' { $val = 1 }
'aiff' { $val = 2 }
'bwf' { $val = 3 }
'mp3' { $val = 100 }
default { "Filetype() got: $arg, expected one of 'wav', 'aiff', 'bwf', 'mp3'" }
}
$this._filetype = $this.Setter('filetype', $val)
}
)
hidden $_armedbus = $($this | Add-Member ScriptProperty 'armedbus' ` hidden $_armedbus = $($this | Add-Member ScriptProperty 'armedbus' `
{ {
foreach ($bus in 0..$($this.remote.kind.p_out + $this.remote.kind.v_out - 1)) { foreach ($bus in 0..$($this.remote.kind.p_out + $this.remote.kind.v_out - 1)) {

View File

@ -910,8 +910,8 @@ Describe -Tag 'higher', -TestName 'All Higher Tests' {
try { try {
$prefix = 'stringtest' $prefix = 'stringtest'
$filetype = 'wav' $filetype = 'wav'
$vmr.recorder.prefix($prefix) $vmr.recorder.prefix = $prefix
$vmr.recorder.filetype($filetype) $vmr.recorder.filetype = $filetype
$vmr.recorder.state = 'record' $vmr.recorder.state = 'record'
$stamp = '{0:yyyy-MM-dd} at {0:HH}h{0:mm}m{0:ss}s' -f (Get-Date) $stamp = '{0:yyyy-MM-dd} at {0:HH}h{0:mm}m{0:ss}s' -f (Get-Date)
@ -956,8 +956,8 @@ Describe -Tag 'higher', -TestName 'All Higher Tests' {
BeforeAll { BeforeAll {
$prefix = 'actiontest' $prefix = 'actiontest'
$filetype = 'wav' $filetype = 'wav'
$vmr.recorder.prefix($prefix) $vmr.recorder.prefix = $prefix
$vmr.recorder.filetype($filetype) $vmr.recorder.filetype = $filetype
} }
BeforeEach { BeforeEach {

View File

@ -6,8 +6,8 @@ Import-Module (Join-Path (Split-Path $PSScriptRoot -Parent) 'lib\Voicemeeter.psm
function Test-RecDir ([object]$vmr, [string]$recDir) { function Test-RecDir ([object]$vmr, [string]$recDir) {
$prefix = 'temp' $prefix = 'temp'
$filetype = 'wav' $filetype = 'wav'
$vmr.recorder.prefix($prefix) $vmr.recorder.prefix = $prefix
$vmr.recorder.filetype($filetype) $vmr.recorder.filetype = $filetype
try { try {