diff --git a/CHANGELOG.md b/CHANGELOG.md index 5aa2f9a..c76c419 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -7,7 +7,8 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 Before any minor/major patch is released all test units will be run to verify they pass. ## [Unreleased] -- [ ] +- [x] Add gain, comp, limit to Strips +- [x] Update tests to reflect changes ## [1.3] - 2021-04-30 ### Added diff --git a/FROM_SOURCE.md b/FROM_SOURCE.md index 1cf4641..ff7d442 100644 --- a/FROM_SOURCE.md +++ b/FROM_SOURCE.md @@ -1,5 +1,5 @@ #### Direct download: -All commands remain the same, the only difference when you download from source is how you load scripts. +The only difference when you download from source is how you load scripts. You will need to Import-Module by relative location, for example: Instead of `Import-Module Voicemeeter` use `Import-Module .\lib\Voicemeeter.psm1` (from repository root) diff --git a/lib/base.ps1 b/lib/base.ps1 index a813749..1a2ac6e 100644 --- a/lib/base.ps1 +++ b/lib/base.ps1 @@ -48,7 +48,7 @@ Function Param_Set_Multi { Start-Sleep -m 50 while(M_Dirty) { Start-Sleep -m 1 } - [string[]]$params = ($HASH | out-string -stream) -ne '' | select -Skip 2 + [string[]]$params = ($HASH | out-string -stream) -ne '' | Select-Object -Skip 2 [String]$cmd = [String]::new(512) ForEach ($line in $params) { $line = $($line -replace '\s+', ' ') diff --git a/lib/bus.ps1 b/lib/bus.ps1 index 8dbc4c5..99461de 100644 --- a/lib/bus.ps1 +++ b/lib/bus.ps1 @@ -41,7 +41,7 @@ class Bus { hidden $_gain = $($this | Add-Member ScriptProperty 'gain' ` { - $this.Getter($this.cmd('gain')) + [math]::Round($this.Getter($this.cmd('gain')), 1) }` { param ( [Single]$arg ) diff --git a/lib/strip.ps1 b/lib/strip.ps1 index c5a10ef..791d273 100644 --- a/lib/strip.ps1 +++ b/lib/strip.ps1 @@ -131,13 +131,43 @@ class Strip { hidden $_gain = $($this | Add-Member ScriptProperty 'gain' ` { - $this.Getter($this.cmd('gain')) + [math]::Round($this.Getter($this.cmd('gain')), 1) }` { param ( [Single]$arg ) $this._gain = $this.Setter($this.cmd('gain'), $arg) } ) + + hidden $_comp = $($this | Add-Member ScriptProperty 'comp' ` + { + [math]::Round($this.Getter($this.cmd('comp')), 1) + }` + { + param ( [Single]$arg ) + $this._comp = $this.Setter($this.cmd('comp'), $arg) + } + ) + + hidden $_gate = $($this | Add-Member ScriptProperty 'gate' ` + { + [math]::Round($this.Getter($this.cmd('gate')), 1) + }` + { + param ( [Single]$arg ) + $this._gate = $this.Setter($this.cmd('gate'), $arg) + } + ) + + hidden $_limit = $($this | Add-Member ScriptProperty 'limit' ` + { + [Int]$this.Getter($this.cmd('limit')) + }` + { + param ( [Single]$arg ) + $this._limit = $this.Setter($this.cmd('limit'), $arg) + } + ) } Function Strips { diff --git a/test/higher.Tests.ps1 b/test/higher.Tests.ps1 index 6c1001b..afbbf62 100644 --- a/test/higher.Tests.ps1 +++ b/test/higher.Tests.ps1 @@ -385,5 +385,229 @@ Describe -Tag 'higher', -TestName 'All Alias Tests' { $vmr.strip[2].B3 | Should -Be $false } } + + Context 'Strip[i].Gain' { + It 'Should set Strip[0].Gain to 3.6' { + $vmr.strip[0].gain = 3.6 + $vmr.strip[0].gain | Should -Be 3.6 + } + + It 'Should set Strip[0].Gain to -0.2' { + $vmr.strip[0].gain = -0.2 + $vmr.strip[0].gain | Should -Be -0.2 + } + + It 'Should set Strip[1].Gain to 5.1' { + $vmr.strip[1].gain = 5.1 + $vmr.strip[1].gain | Should -Be 5.1 + } + + It 'Should set Strip[1].Gain to -0.2' { + $vmr.strip[1].gain =-0.2 + $vmr.strip[1].gain | Should -Be -0.2 + } + + It 'Should set Strip[2].Gain to 2.7' { + $vmr.strip[2].gain = 2.7 + $vmr.strip[2].gain | Should -Be 2.7 + } + + It 'Should set Strip[2].Gain to -2.5' { + $vmr.strip[2].gain = -2.5 + $vmr.strip[2].gain | Should -Be -2.5 + } + } + + Context 'Strip[i].Comp' { + It 'Should set Strip[0].Comp to 3.6' { + $vmr.strip[0].comp = 3.6 + $vmr.strip[0].comp | Should -Be 3.6 + } + + It 'Should set Strip[0].Comp to 0.2' { + $vmr.strip[0].comp = 0.2 + $vmr.strip[0].comp | Should -Be 0.2 + } + + It 'Should set Strip[1].Comp to 5.1' { + $vmr.strip[1].comp = 5.1 + $vmr.strip[1].comp | Should -Be 5.1 + } + + It 'Should set Strip[1].Comp to 4.2' { + $vmr.strip[1].comp = 4.2 + $vmr.strip[1].comp | Should -Be 4.2 + } + + It 'Should set Strip[2].Comp to 2.7' { + $vmr.strip[2].comp = 2.7 + $vmr.strip[2].comp | Should -Be 2.7 + } + + It 'Should set Strip[2].Comp to -2.5' { + $vmr.strip[2].comp = 2.5 + $vmr.strip[2].comp | Should -Be 2.5 + } + } + + Context 'Strip[i].Gate' { + It 'Should set Strip[0].Gate to 3.6' { + $vmr.strip[0].gate = 3.6 + $vmr.strip[0].gate | Should -Be 3.6 + } + + It 'Should set Strip[0].Gate to 0.2' { + $vmr.strip[0].gate = 0.2 + $vmr.strip[0].gate | Should -Be 0.2 + } + + It 'Should set Strip[1].Gate to 5.1' { + $vmr.strip[1].gate = 5.1 + $vmr.strip[1].gate | Should -Be 5.1 + } + + It 'Should set Strip[1].Gate to 3.2' { + $vmr.strip[1].gate = 3.2 + $vmr.strip[1].gate | Should -Be 3.2 + } + + It 'Should set Strip[2].Gate to 2.7' { + $vmr.strip[2].gate = 2.7 + $vmr.strip[2].gate | Should -Be 2.7 + } + + It 'Should set Strip[2].Gate to 2.5' { + $vmr.strip[2].gate = 2.5 + $vmr.strip[2].gate | Should -Be 2.5 + } + } + + Context 'Strip[i].Limit' { + It 'Should set Strip[0].Limit to 3' { + $vmr.strip[0].limit = 3 + $vmr.strip[0].limit | Should -Be 3 + } + + It 'Should set Strip[0].Limit to 0' { + $vmr.strip[0].limit = 0 + $vmr.strip[0].limit | Should -Be 0 + } + + It 'Should set Strip[1].Limit to -5' { + $vmr.strip[1].limit = -5 + $vmr.strip[1].limit | Should -Be -5 + } + + It 'Should set Strip[1].Limit to 0' { + $vmr.strip[1].limit = 0 + $vmr.strip[1].limit | Should -Be 0 + } + + It 'Should set Strip[2].Limit to 2' { + $vmr.strip[2].limit = 2 + $vmr.strip[2].limit | Should -Be 2 + } + + It 'Should set Strip[2].Limit to -3' { + $vmr.strip[2].limit = -3 + $vmr.strip[2].limit | Should -Be -3 + } + } + + Context 'Bus[i].Mute' { + It 'Should set Bus[0].Mute to 1' { + $vmr.bus[0].mute = $true + $vmr.bus[0].mute | Should -Be $true + } + + It 'Should set Bus[0].Mute to 0' { + $vmr.bus[0].mute = $false + $vmr.bus[0].mute | Should -Be $false + } + + It 'Should set Bus[1].Mute to 1' { + $vmr.bus[1].mute = $true + $vmr.bus[1].mute | Should -Be $true + } + + It 'Should set Bus[1].Mute to 0' { + $vmr.bus[1].mute = $false + $vmr.bus[1].mute | Should -Be $false + } + + It 'Should set Bus[2].Mute to 1' { + $vmr.bus[2].mute = $true + $vmr.bus[2].mute | Should -Be $true + } + + It 'Should set Bus[2].Mute to 0' { + $vmr.bus[2].mute = $false + $vmr.bus[2].mute | Should -Be $false + } + } + + Context 'Bus[i].Mono' { + It 'Should set Bus[0].Mono to 1' { + $vmr.bus[0].mono = $true + $vmr.bus[0].mono | Should -Be $true + } + + It 'Should set Bus[0].Mono to 0' { + $vmr.bus[0].mono = $false + $vmr.bus[0].mono | Should -Be $false + } + + It 'Should set Bus[1].Mono to 1' { + $vmr.bus[1].mono = $true + $vmr.bus[1].mono | Should -Be $true + } + + It 'Should set Bus[1].Mono to 0' { + $vmr.bus[1].mono = $false + $vmr.bus[1].mono | Should -Be $false + } + + It 'Should set Bus[2].Mono to 1' { + $vmr.bus[2].mono = $true + $vmr.bus[2].mono | Should -Be $true + } + + It 'Should set Bus[2].Mono to 0' { + $vmr.bus[2].mono = $false + $vmr.bus[2].mono | Should -Be $false + } + } + + Context 'Bus[i].Gain' { + It 'Should set Bus[0].Gain to 3.6' { + $vmr.bus[0].gain = 3.6 + $vmr.bus[0].gain | Should -Be 3.6 + } + + It 'Should set Bus[0].Gain to -0.2' { + $vmr.bus[0].gain = -0.2 + $vmr.bus[0].gain | Should -Be -0.2 + } + + It 'Should set Bus[1].Gain to 5.1' { + $vmr.bus[1].gain = 5.1 + $vmr.bus[1].gain | Should -Be 5.1 + } + + It 'Should set Bus[1].Gain to -0.2' { + $vmr.bus[1].gain =-0.2 + $vmr.bus[1].gain | Should -Be -0.2 + } + + It 'Should set Bus[2].Gain to 2.7' { + $vmr.bus[2].gain = 2.7 + $vmr.bus[2].gain | Should -Be 2.7 + } + + It 'Should set Bus[2].Gain to -2.5' { + $vmr.bus[2].gain = -2.5 + $vmr.bus[2].gain | Should -Be -2.5 + } + } } }