From 6d511d8aa6c6e23e1fccd8f7ff3d82564e5008a3 Mon Sep 17 00:00:00 2001 From: pblivingston <71585805+pblivingston@users.noreply.github.com> Date: Sun, 7 Dec 2025 02:20:30 -0500 Subject: [PATCH] limit, alias members - limit [int] -> [float] - moved mono bool member to physicalstrip - added AddAliasMembers meta function - mono and karaoke aliases added to virtualstrip prelim pester tests for potato pass --- CHANGELOG.md | 4 ++++ README.md | 4 ++-- lib/meta.ps1 | 10 ++++++++++ lib/strip.ps1 | 8 +++++--- tests/higher.Tests.ps1 | 44 ++++++++++++++++++++++++++++++------------ 5 files changed, 53 insertions(+), 17 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 3d82391..bf902a0 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -43,6 +43,8 @@ Recorder.FileType changed from method to write-only property - Command.Save($filepath) - Command.StorePreset() - Command.RecallPreset() +- AddAliasMembers meta function takes a hashtable `-MAP` of `alias = property` +- Strip.Karaoke alias for Strip.K ### Changed @@ -58,6 +60,7 @@ Recorder.FileType changed from method to write-only property - Recorder.Armstrip|Armbus -> BoolArrayMember: now have .Get() - Cast Recorder getters to types for consistency - Floats getters/setters now default to two decimal places. +- Strip.Mono is now an alias for Strip.MC on virtual strips ### Fixed @@ -69,6 +72,7 @@ Recorder.FileType changed from method to write-only property - vban route range (API documentation is incorrect) - vban.stream.sr: $this._port -> $this._sr - Recorder.channel values: 1..8 -> (2, 4, 6, 8) +- Strip.Limit type [int] -> [float] ## [3.3.0] - 2024-06-29 diff --git a/README.md b/README.md index 4a503dc..55828fb 100644 --- a/README.md +++ b/README.md @@ -118,11 +118,11 @@ The following strip commands are available: - mute: bool - mono: bool - mc: bool -- k: int, from 0 to 4 +- k/karaoke: int, from 0 to 4 - solo: bool - A1-A5: bool - B1-B3: bool -- limit: int, from -40 to 12 +- limit: float, from -40.00 to 12.00 - gain: float, from -60.00 to 12.00 - label: string - reverb: float, from 0.00 to 10.00 diff --git a/lib/meta.ps1 b/lib/meta.ps1 index 4d69354..e44220f 100644 --- a/lib/meta.ps1 +++ b/lib/meta.ps1 @@ -74,6 +74,16 @@ function AddActionMembers () { } } +function AddAliasMembers () { + param( + [hashtable]$MAP + ) + foreach ($alias in $MAP.Keys) { + $this | Add-Member -MemberType AliasProperty -Name $alias ` + -Value $MAP[$alias] -Force + } +} + function AddChannelMembers () { $num_A = $this.remote.kind.p_out $num_B = $this.remote.kind.v_out diff --git a/lib/strip.ps1 b/lib/strip.ps1 index 87062cc..e7368f1 100644 --- a/lib/strip.ps1 +++ b/lib/strip.ps1 @@ -2,9 +2,8 @@ class Strip : IRemote { [Object]$levels Strip ([int]$index, [Object]$remote) : base ($index, $remote) { - AddBoolMembers -PARAMS @('mono', 'solo', 'mute') - AddIntMembers -PARAMS @('limit') - AddFloatMembers -PARAMS @('gain', 'pan_x', 'pan_y') + AddBoolMembers -PARAMS @('solo', 'mute') + AddFloatMembers -PARAMS @('gain', 'limit', 'pan_x', 'pan_y') AddStringMembers -PARAMS @('label') AddChannelMembers @@ -83,6 +82,7 @@ class PhysicalStrip : Strip { AddFloatMembers -PARAMS @('color_x', 'color_y', 'fx_x', 'fx_y') AddFloatMembers -PARAMS @('reverb', 'delay', 'fx1', 'fx2') AddBoolMembers -PARAMS @('postreverb', 'postdelay', 'postfx1', 'postfx2') + AddBoolMembers -PARAMS @('mono') $this.comp = [StripComp]::new($index, $remote) $this.gate = [StripGate]::new($index, $remote) @@ -174,6 +174,8 @@ class VirtualStrip : Strip { VirtualStrip ([int]$index, [Object]$remote) : base ($index, $remote) { AddBoolMembers -PARAMS @('mc') AddIntMembers -PARAMS @('k') + + AddAliasMembers -MAP @{ mono = 'mc'; karaoke = 'k' } } [void] AppGain ([string]$appname, [single]$gain) { diff --git a/tests/higher.Tests.ps1 b/tests/higher.Tests.ps1 index 431b8c6..fdcb5db 100644 --- a/tests/higher.Tests.ps1 +++ b/tests/higher.Tests.ps1 @@ -30,6 +30,11 @@ Describe -Tag 'higher', -TestName 'All Higher Tests' { Context 'Strip, physical only' -ForEach @( @{ Index = $phys_in } ) { + It "Should set Strip[$index].Mono" { + $vmr.strip[$index].mono = $value + $vmr.strip[$index].mono | Should -Be $expected + } + Context 'Eq' -Skip:$ifNotPotato -ForEach @( @{ Eq = $vmr.strip[$index].eq } ) { @@ -50,6 +55,15 @@ Describe -Tag 'higher', -TestName 'All Higher Tests' { } } + Context 'Strip, first virtual' -ForEach @( + @{ Index = $phys_in + 1 } + ) { + It "Should set Strip[$index].MC via alias 'Mono'" { + $vmr.strip[$index].mono = $value + $vmr.strip[$index].mc | Should -Be $expected + } + } + Context 'Bus, one physical one virtual' -ForEach @( @{ Index = $phys_out }, @{ Index = $virt_out } ) { @@ -255,6 +269,11 @@ Describe -Tag 'higher', -TestName 'All Higher Tests' { $vmr.strip[$index].gain = $gain $vmr.strip[$index].gain | Should -Be $gain } + + It "Should set Strip[$index].Limit" -Skip:$ifBasic { + $vmr.strip[$index].limit = $gain + $vmr.strip[$index].limit | Should -Be $gain + } } Context 'Strip, physical only' -ForEach @( @@ -362,18 +381,6 @@ Describe -Tag 'higher', -TestName 'All Higher Tests' { } Describe 'Int Tests' -Tag 'int' { - Context 'Strip, one physical, one virtual' -ForEach @( - @{ Index = $phys_in }, @{ Index = $virt_in } - ) { - It "Should set and get Strip[$index].Limit" -Skip:$ifBasic -ForEach @( - @{ Value = 3; Expected = 3 } - @{ Value = -6; Expected = -6 } - ) { - $vmr.strip[$index].limit = $value - $vmr.strip[$index].limit | Should -Be $expected - } - } - Context 'Strip, physical only' -ForEach @( @{ Index = $phys_in } ) { @@ -395,6 +402,19 @@ Describe -Tag 'higher', -TestName 'All Higher Tests' { } } + Context 'Strip, second virtual' -Skip:$ifBasic -ForEach @( + @{ Index = $phys_in + 2 } + ) { + It "Should set Strip[$index].K via alias 'Karaoke'" -ForEach @( + @{ Value = 0; Expected = 0 } + @{ Value = 2; Expected = 2 } + @{ Value = 4; Expected = 4 } + ) { + $vmr.strip[$index].karaoke = $value + $vmr.strip[$index].k | Should -Be $expected + } + } + Context 'Bus, one physical one virtual' -ForEach @( @{ Index = $phys_out }, @{ Index = $virt_out } ) {