vban commands added, tests updated

Added vban_in/vban_out to definetypes in base

Added string attribute label for strips

Added vban.ps1 which defines instream/oustream attributes.

Version bumped and changelog updated

Unit tests updated to reflect changes
This commit is contained in:
onyx-and-iris 2021-05-11 19:09:57 +01:00
parent 5ceacb4486
commit a66a101ba1
6 changed files with 484 additions and 6 deletions

View File

@ -7,10 +7,14 @@ 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. Before any minor/major patch is released all test units will be run to verify they pass.
## [Unreleased] ## [Unreleased]
- [x] Fetch dll path through registry (support for 32 and 64 bit) - [x] Add vban commands
- [x] Add strip/bus commands section to README - [x] Update tests to reflect changes
- [ ] Add label/device name commands to Strips
- [ ] Add vban commands ## [1.5] - 2021-05-11
### Added
- Fetch dll path through registry (support for 32 and 64 bit)
- Add strip/bus commands section to README
- Add label name command to Strips
## [1.4] - 2021-05-03 ## [1.4] - 2021-05-03
### Added ### Added

View File

@ -5,6 +5,8 @@ class Remote {
[System.Collections.ArrayList]$button [System.Collections.ArrayList]$button
[System.Collections.ArrayList]$strip [System.Collections.ArrayList]$strip
[System.Collections.ArrayList]$bus [System.Collections.ArrayList]$bus
[System.Collections.ArrayList]$vban_in
[System.Collections.ArrayList]$vban_out
# Constructor # Constructor
Remote ([String]$type) Remote ([String]$type)
@ -20,6 +22,8 @@ class Remote {
$this.button = Buttons $this.button = Buttons
$this.strip = Strips $this.strip = Strips
$this.bus = Buses $this.bus = Buses
$this.vban_in = Vban_In
$this.vban_out = Vban_Out
} }
else { Exit } else { Exit }
} }

View File

@ -3,6 +3,7 @@
. $PSScriptRoot\strip.ps1 . $PSScriptRoot\strip.ps1
. $PSScriptRoot\bus.ps1 . $PSScriptRoot\bus.ps1
. $PSScriptRoot\macrobuttons.ps1 . $PSScriptRoot\macrobuttons.ps1
. $PSScriptRoot\vban.ps1
$global:layout = $null $global:layout = $null
@ -224,18 +225,24 @@ Function DefineVersion {
$layout = @{ $layout = @{
"strip" = 3 "strip" = 3
"bus" = 2 "bus" = 2
"vban_in" = 4
"vban_out" = 4
} }
} }
elseif($TYPE -eq 2) { elseif($TYPE -eq 2) {
$layout = @{ $layout = @{
"strip" = 5 "strip" = 5
"bus" = 5 "bus" = 5
"vban_in" = 8
"vban_out" = 8
} }
} }
elseif($TYPE -eq 3) { elseif($TYPE -eq 3) {
$layout = @{ $layout = @{
"strip" = 8 "strip" = 8
"bus" = 8 "bus" = 8
"vban_in" = 8
"vban_out" = 8
} }
} }
$global:layout = $layout $global:layout = $layout

View File

@ -1,21 +1,30 @@
class Strip { class Strip {
[int32]$id [int32]$id
[Array]$stringparams
# Constructor # Constructor
Strip ([Int]$id) Strip ([Int]$id)
{ {
$this.id = $id $this.id = $id
$this.stringparams = @('label')
} }
[void] Setter($cmd, $set) { [void] Setter($cmd, $set) {
Param_Set -PARAM $cmd -VALUE $set if( $this.stringparams.Contains($cmd.Split('.')[1]) ) {
Param_Set_String -PARAM $cmd -VALUE $set
}
else { Param_Set -PARAM $cmd -VALUE $set }
} }
[Single] Getter($cmd) { [Single] Getter($cmd) {
return Param_Get -PARAM $cmd return Param_Get -PARAM $cmd
} }
[string] cmd ($arg) { [String] Getter_String($cmd) {
return Param_Get_String -PARAM $cmd
}
[String] cmd ($arg) {
return "Strip[" + $this.id + "].$arg" return "Strip[" + $this.id + "].$arg"
} }
@ -168,6 +177,16 @@ class Strip {
$this._limit = $this.Setter($this.cmd('limit'), $arg) $this._limit = $this.Setter($this.cmd('limit'), $arg)
} }
) )
hidden $_label = $($this | Add-Member ScriptProperty 'label' `
{
[String]$this.Getter_String($this.cmd('label'))
}`
{
param ( [String]$arg )
$this._label = $this.Setter($this.cmd('label'), $arg)
}
)
} }
Function Strips { Function Strips {

186
lib/vban.ps1 Normal file
View File

@ -0,0 +1,186 @@
class Vban {
[int32]$id
[String]$direction
[Array]$stringparams
# Constructor
Vban ([Int]$id, [String]$direction)
{
$this.id = $id
$this.direction = $direction
$this.stringparams = @('name', 'ip')
}
[void] Setter($cmd, $set) {
if( $this.stringparams.Contains($cmd.Split('.')[2]) ) {
Param_Set_String -PARAM $cmd -VALUE $set
}
else { Param_Set -PARAM $cmd -VALUE $set }
}
[Single] Getter($cmd) {
return Param_Get -PARAM $cmd
}
[String] Getter_String($cmd) {
return Param_Get_String -PARAM $cmd
}
[String] cmd ($arg) {
return "vban." + $this.direction + "stream[" + $this.id + "].$arg"
}
hidden $_on = $($this | Add-Member ScriptProperty 'on' `
{
$this.Getter($this.cmd('on'))
}`
{
param ( [Bool]$arg )
$this._on = $this.Setter($this.cmd('on'), $arg)
}
)
hidden $_name = $($this | Add-Member ScriptProperty 'name' `
{
$this.Getter_String($this.cmd('name'))
}`
{
param ( [String]$arg )
$this._name = $this.Setter($this.cmd('name'), $arg)
}
)
hidden $_ip = $($this | Add-Member ScriptProperty 'ip' `
{
$this.Getter_String($this.cmd('ip'))
}`
{
param ( [String]$arg )
$this._ip = $this.Setter($this.cmd('ip'), $arg)
}
)
hidden $_port = $($this | Add-Member ScriptProperty 'port' `
{
$this.Getter($this.cmd('port'))
}`
{
param ( [String]$arg )
if($arg -In 1024..65535) {
$this._port = $this.Setter($this.cmd('port'), $arg)
}
else {
Write-Warning('Expected value from 1024 to 65535')
}
}
)
hidden $_sr = $($this | Add-Member ScriptProperty 'sr' `
{
$this.Getter($this.cmd('sr'))
}`
{
param ( [Int]$arg )
if($this.direction -eq "in") { Write-Warning('Error, read only value') }
else {
$opts = @(11025, 16000, 22050, 24000, 32000, 44100, 48000, 64000, 88200, 96000)
if($opts.Contains($arg)) {
$this._port = $this.Setter($this.cmd('sr'), $arg)
}
else {
Write-Warning('Expected one of', $opts)
}
}
}
)
hidden $_channel = $($this | Add-Member ScriptProperty 'channel' `
{
$this.Getter($this.cmd('channel'))
}`
{
param ( [Int]$arg )
if($this.direction -eq "in") { Write-Warning('Error, read only value') }
else {
if($arg -In 1..8) {
$this._channel = $this.Setter($this.cmd('channel'), $arg)
}
else {
Write-Warning('Expected value from 1 to 8')
}
}
}
)
hidden $_bit = $($this | Add-Member ScriptProperty 'bit' `
{
$val = if($this.Getter($this.cmd('bit')) -eq 1) {16} else {24}
return $val
}`
{
param ( [Int]$arg )
if($this.direction -eq "in") { Write-Warning('Error, read only value') }
else {
if(@(16,24).Contains($arg)) {
$val = if($arg -eq 16) {1} else {2}
$this._bit = $this.Setter($this.cmd('bit'), $val)
}
else {
Write-Warning('Expected value 16 or 24')
}
}
}
)
hidden $_quality = $($this | Add-Member ScriptProperty 'quality' `
{
$this.Getter($this.cmd('quality'))
}`
{
param ( [Int]$arg )
if($this.direction -eq "in") { Write-Warning('Error, read only value') }
else {
if($arg -In 0..4) {
$this._quality = $this.Setter($this.cmd('quality'), $arg)
}
else {
Write-Warning('Expected value from 0 to 4')
}
}
}
)
hidden $_route = $($this | Add-Member ScriptProperty 'route' `
{
$this.Getter($this.cmd('route'))
}`
{
param ( [Int]$arg )
if($this.direction -eq "in") { Write-Warning('Error, read only value') }
else {
if($arg -In 0..8) {
$this._route = $this.Setter($this.cmd('route'), $arg)
}
else {
Write-Warning('Expected value from 0 to 8')
}
}
}
)
}
Function Vban_In {
[System.Collections.ArrayList]$vban_in = @()
0..$($layout.vban_in-1) | ForEach-Object {
[void]$vban_in.Add([Vban]::new($_, "in"))
}
$vban_in
}
Function Vban_Out {
[System.Collections.ArrayList]$vban_out = @()
0..$($layout.vban_out-1) | ForEach-Object {
[void]$vban_out.Add([Vban]::new($_, "out"))
}
$vban_out
}

View File

@ -609,5 +609,263 @@ Describe -Tag 'higher', -TestName 'All Alias Tests' {
$vmr.bus[2].gain | Should -Be -2.5 $vmr.bus[2].gain | Should -Be -2.5
} }
} }
Context 'Strip[i].Label' {
It 'Should set Strip[0].Label to test0' {
$vmr.strip[0].label = 'test0'
$vmr.strip[0].label | Should -Be 'test0'
}
It 'Should set Strip[0].Label to test1' {
$vmr.strip[0].label = 'test1'
$vmr.strip[0].label | Should -Be 'test1'
}
It 'Should set Strip[1].Label to test0' {
$vmr.strip[1].label = 'test0'
$vmr.strip[1].label | Should -Be 'test0'
}
It 'Should set Strip[1].Label to test1' {
$vmr.strip[1].label = 'test1'
$vmr.strip[1].label | Should -Be 'test1'
}
It 'Should set Strip[2].Label to test0' {
$vmr.strip[2].label = 'test0'
$vmr.strip[2].label | Should -Be 'test0'
}
It 'Should set Strip[2].Label to test1' {
$vmr.strip[2].label = 'test1'
$vmr.strip[2].label | Should -Be 'test1'
}
}
}
Describe 'VBAN Command Tests' {
Context 'vban_in[i].on' {
It 'Should set vban_in[0].on to 1' {
$vmr.vban_in[0].on = $true
$vmr.vban_in[0].on | Should -Be $true
}
It 'Should set vban_in[0].on to 0' {
$vmr.vban_in[0].on = $true
$vmr.vban_in[0].on | Should -Be $true
}
It 'Should set vban_in[1].on to 1' {
$vmr.vban_in[1].on = $true
$vmr.vban_in[1].on | Should -Be $true
}
It 'Should set vban_in[1].on to 0' {
$vmr.vban_in[1].on = $true
$vmr.vban_in[1].on | Should -Be $true
}
It 'Should set vban_in[2].on to 1' {
$vmr.vban_in[2].on = $true
$vmr.vban_in[2].on | Should -Be $true
}
It 'Should set vban_in[2].on to 0' {
$vmr.vban_in[2].on = $true
$vmr.vban_in[2].on | Should -Be $true
}
}
Context 'vban_in[i].name' {
It 'Should set vban_in[0].name to test0' {
$vmr.vban_in[0].name = 'test0'
$vmr.vban_in[0].name | Should -Be 'test0'
}
It 'Should set vban_in[0].name to test1' {
$vmr.vban_in[0].name = 'test1'
$vmr.vban_in[0].name | Should -Be 'test1'
}
It 'Should set vban_in[1].name to test0' {
$vmr.vban_in[1].name = 'test2'
$vmr.vban_in[1].name | Should -Be 'test2'
}
It 'Should set vban_in[1].name to test1' {
$vmr.vban_in[1].name = 'test3'
$vmr.vban_in[1].name | Should -Be 'test3'
}
It 'Should set vban_in[2].name to test0' {
$vmr.vban_in[2].name = 'test4'
$vmr.vban_in[2].name | Should -Be 'test4'
}
It 'Should set vban_in[2].name to test1' {
$vmr.vban_in[2].name = 'test5'
$vmr.vban_in[2].name | Should -Be 'test5'
}
}
Context 'vban_in[i].ip' {
It 'Should set vban_in[0].ip to test0' {
$vmr.vban_in[0].ip = '0.0.0.0'
$vmr.vban_in[0].ip | Should -Be '0.0.0.0'
}
It 'Should set vban_in[0].ip to test1' {
$vmr.vban_in[0].ip = '127.0.0.1'
$vmr.vban_in[0].ip | Should -Be '127.0.0.1'
}
It 'Should set vban_in[1].ip to test0' {
$vmr.vban_in[1].ip = '0.0.0.0'
$vmr.vban_in[1].ip | Should -Be '0.0.0.0'
}
It 'Should set vban_in[1].ip to test1' {
$vmr.vban_in[1].ip = '127.0.0.1'
$vmr.vban_in[1].ip | Should -Be '127.0.0.1'
}
It 'Should set vban_in[2].ip to test0' {
$vmr.vban_in[2].ip = '0.0.0.0'
$vmr.vban_in[2].ip | Should -Be '0.0.0.0'
}
It 'Should set vban_in[2].ip to test1' {
$vmr.vban_in[2].ip = '127.0.0.1'
$vmr.vban_in[2].ip | Should -Be '127.0.0.1'
}
}
Context 'vban_out[i].sr' {
It 'Should set vban_out[0].sr to 44100' {
$vmr.vban_out[0].sr = 44100
$vmr.vban_out[0].sr | Should -Be 44100
}
It 'Should set vban_out[0].sr to 48000' {
$vmr.vban_out[0].sr = 48000
$vmr.vban_out[0].sr | Should -Be 48000
}
It 'Should set vban_out[1].sr to 44100' {
$vmr.vban_out[1].sr = 44100
$vmr.vban_out[1].sr | Should -Be 44100
}
It 'Should set vban_out[1].sr to 48000' {
$vmr.vban_out[1].sr = 48000
$vmr.vban_out[1].sr | Should -Be 48000
}
It 'Should set vban_out[2].sr to 44100' {
$vmr.vban_out[2].sr = 44100
$vmr.vban_out[2].sr | Should -Be 44100
}
It 'Should set vban_out[2].sr to 48000' {
$vmr.vban_out[2].sr = 48000
$vmr.vban_out[2].sr | Should -Be 48000
}
}
Context 'vban_out[i].channel' {
It 'Should set vban_out[0].channel to 1' {
$vmr.vban_out[0].channel = 1
$vmr.vban_out[0].channel | Should -Be 1
}
It 'Should set vban_out[0].channel to 2' {
$vmr.vban_out[0].channel = 2
$vmr.vban_out[0].channel | Should -Be 2
}
It 'Should set vban_out[1].channel to 3' {
$vmr.vban_out[1].channel = 3
$vmr.vban_out[1].channel | Should -Be 3
}
It 'Should set vban_out[1].channel to 4' {
$vmr.vban_out[1].channel = 4
$vmr.vban_out[1].channel | Should -Be 4
}
It 'Should set vban_out[2].channel to 5' {
$vmr.vban_out[2].channel = 5
$vmr.vban_out[2].channel | Should -Be 5
}
It 'Should set vban_out[2].channel to 6' {
$vmr.vban_out[2].channel = 6
$vmr.vban_out[2].channel | Should -Be 6
}
}
Context 'vban_out[i].bit' {
It 'Should set vban_out[0].bit to 16' {
$vmr.vban_out[0].bit = 16
$vmr.vban_out[0].bit | Should -Be 16
}
It 'Should set vban_out[0].bit to 24' {
$vmr.vban_out[0].bit = 24
$vmr.vban_out[0].bit | Should -Be 24
}
It 'Should set vban_out[1].bit to 16' {
$vmr.vban_out[1].bit = 16
$vmr.vban_out[1].bit | Should -Be 16
}
It 'Should set vban_out[1].bit to 24' {
$vmr.vban_out[1].bit = 24
$vmr.vban_out[1].bit | Should -Be 24
}
It 'Should set vban_out[2].bit to 16' {
$vmr.vban_out[2].bit = 16
$vmr.vban_out[2].bit | Should -Be 16
}
It 'Should set vban_out[2].bit to 24' {
$vmr.vban_out[2].bit = 24
$vmr.vban_out[2].bit | Should -Be 24
}
}
Context 'vban_out[i].route' {
It 'Should set vban_out[0].route to 0' {
$vmr.vban_out[0].route = 0
$vmr.vban_out[0].route | Should -Be 0
}
It 'Should set vban_out[0].route to 1' {
$vmr.vban_out[0].route = 1
$vmr.vban_out[0].route | Should -Be 1
}
It 'Should set vban_out[1].route to 2' {
$vmr.vban_out[1].route = 2
$vmr.vban_out[1].route | Should -Be 2
}
It 'Should set vban_out[1].route to 3' {
$vmr.vban_out[1].route = 3
$vmr.vban_out[1].route | Should -Be 3
}
It 'Should set vban_out[2].route to 4' {
$vmr.vban_out[2].route = 4
$vmr.vban_out[2].route | Should -Be 4
}
It 'Should set vban_out[2].route to 5' {
$vmr.vban_out[2].route = 5
$vmr.vban_out[2].route | Should -Be 5
}
}
} }
} }