mirror of
https://github.com/onyx-and-iris/voicemeeter-api-powershell.git
synced 2025-12-05 05:07:47 +00:00
midi/text streams
- added midi and text streams with: - on - name - ip had to manually test as these are currently write-only, but I suspect this is a bug/will change in the future
This commit is contained in:
parent
72185d14b3
commit
17e601a8d6
@ -9,8 +9,7 @@ $KindMap = @{
|
||||
'asio_out' = 8
|
||||
'composite' = 0
|
||||
'insert' = 0
|
||||
'vban_in' = 4
|
||||
'vban_out' = 4
|
||||
'vban' = @{ 'in' = 4; 'out' = 4; 'midi' = 1; 'text' = 1 }
|
||||
'eq_ch' = @{ 'strip' = 0; 'bus' = 0 }
|
||||
'cells' = 0
|
||||
};
|
||||
@ -24,8 +23,7 @@ $KindMap = @{
|
||||
'asio_out' = 8
|
||||
'composite' = 8
|
||||
'insert' = 22
|
||||
'vban_in' = 8
|
||||
'vban_out' = 8
|
||||
'vban' = @{ 'in' = 8; 'out' = 8; 'midi' = 1; 'text' = 1 }
|
||||
'eq_ch' = @{ 'strip' = 0; 'bus' = 8 }
|
||||
'cells' = 6
|
||||
};
|
||||
@ -39,8 +37,7 @@ $KindMap = @{
|
||||
'asio_out' = 8
|
||||
'composite' = 8
|
||||
'insert' = 34
|
||||
'vban_in' = 8
|
||||
'vban_out' = 8
|
||||
'vban' = @{ 'in' = 8; 'out' = 8; 'midi' = 1; 'text' = 1 }
|
||||
'eq_ch' = @{ 'strip' = 2; 'bus' = 8 }
|
||||
'cells' = 6
|
||||
};
|
||||
|
||||
126
lib/vban.ps1
126
lib/vban.ps1
@ -3,14 +3,18 @@ class Vban : IRemote {
|
||||
|
||||
Vban ([int]$index, [Object]$remote, [string]$direction) : base ($index, $remote) {
|
||||
$this.direction = $direction
|
||||
|
||||
AddBoolMembers -PARAMS @('on')
|
||||
AddStringMembers -PARAMS @('name', 'ip')
|
||||
}
|
||||
|
||||
[string] identifier () {
|
||||
return 'vban.' + $this.direction + 'stream[' + $this.index + ']'
|
||||
}
|
||||
}
|
||||
|
||||
class VbanStream : Vban {
|
||||
VbanStream ([int]$index, [Object]$remote, [string]$direction) : base ($index, $remote, $direction) {
|
||||
AddBoolMembers -PARAMS @('on')
|
||||
AddStringMembers -PARAMS @('name', 'ip')
|
||||
}
|
||||
|
||||
hidden $_port = $($this | Add-Member ScriptProperty 'port' `
|
||||
{
|
||||
@ -116,28 +120,126 @@ class Vban : IRemote {
|
||||
)
|
||||
}
|
||||
|
||||
class VbanMidi : Vban {
|
||||
VbanMidi ([int]$index, [Object]$remote, [string]$direction) : base ($index, $remote, $direction) {
|
||||
}
|
||||
|
||||
class VbanInstream : Vban {
|
||||
VbanInstream ([int]$index, [Object]$remote, [string]$direction) : base ($index, $remote, $direction) {
|
||||
hidden $_on = $($this | Add-Member ScriptProperty 'on' `
|
||||
{
|
||||
return Write-Warning ("ERROR: $($this.identifier()).on is write only")
|
||||
} `
|
||||
{
|
||||
param([bool]$arg)
|
||||
$this._on = $this.Setter('on', $arg)
|
||||
}
|
||||
)
|
||||
|
||||
hidden $_name = $($this | Add-Member ScriptProperty 'name' `
|
||||
{
|
||||
return Write-Warning ("ERROR: $($this.identifier()).name is write only")
|
||||
} `
|
||||
{
|
||||
param([string]$arg)
|
||||
$this._name = $this.Setter('name', $arg)
|
||||
}
|
||||
)
|
||||
|
||||
hidden $_ip = $($this | Add-Member ScriptProperty 'ip' `
|
||||
{
|
||||
return Write-Warning ("ERROR: $($this.identifier()).ip is write only")
|
||||
} `
|
||||
{
|
||||
param([string]$arg)
|
||||
$this._ip = $this.Setter('ip', $arg)
|
||||
}
|
||||
)
|
||||
}
|
||||
|
||||
class VbanText : Vban {
|
||||
VbanText ([int]$index, [Object]$remote, [string]$direction) : base ($index, $remote, $direction) {
|
||||
}
|
||||
|
||||
hidden $_on = $($this | Add-Member ScriptProperty 'on' `
|
||||
{
|
||||
return Write-Warning ("ERROR: $($this.identifier()).on is write only")
|
||||
} `
|
||||
{
|
||||
param([bool]$arg)
|
||||
$this._on = $this.Setter('on', $arg)
|
||||
}
|
||||
)
|
||||
|
||||
hidden $_name = $($this | Add-Member ScriptProperty 'name' `
|
||||
{
|
||||
return Write-Warning ("ERROR: $($this.identifier()).name is write only")
|
||||
} `
|
||||
{
|
||||
param([string]$arg)
|
||||
$this._name = $this.Setter('name', $arg)
|
||||
}
|
||||
)
|
||||
|
||||
hidden $_ip = $($this | Add-Member ScriptProperty 'ip' `
|
||||
{
|
||||
return Write-Warning ("ERROR: $($this.identifier()).ip is write only")
|
||||
} `
|
||||
{
|
||||
param([string]$arg)
|
||||
$this._ip = $this.Setter('ip', $arg)
|
||||
}
|
||||
)
|
||||
}
|
||||
|
||||
class VbanInstream : VbanStream {
|
||||
VbanInstream ([int]$index, [Object]$remote) : base ($index, $remote, 'in') {
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
class VbanOutstream : Vban {
|
||||
VbanOutstream ([int]$index, [Object]$remote, [string]$direction) : base ($index, $remote, $direction) {
|
||||
class VbanInMidi : VbanMidi {
|
||||
VbanInMidi ([int]$index, [Object]$remote) : base ($index, $remote, 'in') {
|
||||
}
|
||||
}
|
||||
|
||||
class VbanInText : VbanText {
|
||||
VbanInText ([int]$index, [Object]$remote) : base ($index, $remote, 'in') {
|
||||
}
|
||||
}
|
||||
|
||||
class VbanOutstream : VbanStream {
|
||||
VbanOutstream ([int]$index, [Object]$remote) : base ($index, $remote, 'out') {
|
||||
}
|
||||
}
|
||||
|
||||
class VbanOutMidi : VbanMidi {
|
||||
VbanOutMidi ([int]$index, [Object]$remote) : base ($index, $remote, 'out') {
|
||||
}
|
||||
}
|
||||
|
||||
function Make_Vban ([Object]$remote) {
|
||||
[System.Collections.ArrayList]$instream = @()
|
||||
[System.Collections.ArrayList]$outstream = @()
|
||||
|
||||
0..$($remote.kind.vban_in - 1) | ForEach-Object {
|
||||
[void]$instream.Add([VbanInstream]::new($_, $remote, 'in'))
|
||||
$totalInstreams = $remote.kind.vban.in + $remote.kind.vban.midi + $remote.kind.vban.text
|
||||
$totalOutstreams = $remote.kind.vban.out + $remote.kind.vban.midi
|
||||
|
||||
for ($i = 0; $i -lt $totalInstreams; $i++) {
|
||||
if ($i -lt $remote.kind.vban.in) {
|
||||
[void]$instream.Add([VbanInstream]::new($i, $remote))
|
||||
}
|
||||
elseif ($i -lt ($remote.kind.vban.in + $remote.kind.vban.midi)) {
|
||||
[void]$instream.Add([VbanInMidi]::new($i, $remote))
|
||||
}
|
||||
else {
|
||||
[void]$instream.Add([VbanInText]::new($i, $remote))
|
||||
}
|
||||
}
|
||||
0..$($remote.kind.vban_out - 1) | ForEach-Object {
|
||||
[void]$outstream.Add([VbanOutstream]::new($_, $remote, 'out'))
|
||||
for ($i = 0; $i -lt $totalOutstreams; $i++) {
|
||||
if ($i -lt $remote.kind.vban.out) {
|
||||
[void]$outstream.Add([VbanOutstream]::new($i, $remote))
|
||||
}
|
||||
else {
|
||||
[void]$outstream.Add([VbanOutMidi]::new($i, $remote))
|
||||
}
|
||||
}
|
||||
|
||||
$CustomObject = [pscustomobject]@{
|
||||
|
||||
@ -106,7 +106,9 @@ Describe -Tag 'higher', -TestName 'All Higher Tests' {
|
||||
}
|
||||
|
||||
Context 'Instream' -ForEach @(
|
||||
@{ Index = $vban_in }
|
||||
@{ Index = $vban_inA }
|
||||
# @{ Index = $vban_inM }
|
||||
# @{ Index = $vban_inT }
|
||||
) {
|
||||
It "Should set vban.instream[$index].on" {
|
||||
$vmr.vban.instream[$index].on = $value
|
||||
@ -115,7 +117,8 @@ Describe -Tag 'higher', -TestName 'All Higher Tests' {
|
||||
}
|
||||
|
||||
Context 'Outstream' -ForEach @(
|
||||
@{ Index = $vban_out }
|
||||
@{ Index = $vban_outA }
|
||||
# @{ Index = $vban_outM }
|
||||
) {
|
||||
It "Should set vban.outstream[$index].on" {
|
||||
$vmr.vban.outstream[$index].on = $value
|
||||
@ -427,7 +430,7 @@ Describe -Tag 'higher', -TestName 'All Higher Tests' {
|
||||
}
|
||||
|
||||
Context 'Instream' -ForEach @(
|
||||
@{ Index = $vban_in }
|
||||
@{ Index = $vban_inA }
|
||||
) {
|
||||
It "Should set vban.instream[$index].port" -ForEach @(
|
||||
@{ Value = 1024; Expected = 1024 }
|
||||
@ -470,7 +473,7 @@ Describe -Tag 'higher', -TestName 'All Higher Tests' {
|
||||
}
|
||||
|
||||
Context 'Outstream' -ForEach @(
|
||||
@{ Index = $vban_out }
|
||||
@{ Index = $vban_outA }
|
||||
) {
|
||||
It "Should set vban.outstream[$index].port" -ForEach @(
|
||||
@{ Value = 1024; Expected = 1024 }
|
||||
@ -758,7 +761,9 @@ Describe -Tag 'higher', -TestName 'All Higher Tests' {
|
||||
|
||||
Describe 'Vban' {
|
||||
Context 'Instream' -ForEach @(
|
||||
@{ Index = $vban_in }
|
||||
@{ Index = $vban_inA }
|
||||
# @{ Index = $vban_inM }
|
||||
# @{ Index = $vban_inT }
|
||||
) {
|
||||
It "Should set vban.instream[$index].name" -ForEach @(
|
||||
@{ Value = 'TestIn0'; Expected = 'TestIn0' }
|
||||
@ -777,7 +782,8 @@ Describe -Tag 'higher', -TestName 'All Higher Tests' {
|
||||
}
|
||||
|
||||
Context 'Outstream' -ForEach @(
|
||||
@{ Index = $vban_out }
|
||||
@{ Index = $vban_outA }
|
||||
# @{ Index = $vban_outM }
|
||||
) {
|
||||
It "Should set vban.outstream[$index].name" -ForEach @(
|
||||
@{ Value = 'TestOut0'; Expected = 'TestOut0' }
|
||||
|
||||
@ -14,8 +14,11 @@ function main() {
|
||||
$virt_in = $vmr.kind.p_in + $vmr.kind.v_in - 1
|
||||
$phys_out = $vmr.kind.p_out - 1
|
||||
$virt_out = $vmr.kind.p_out + $vmr.kind.v_out - 1
|
||||
$vban_in = $vmr.kind.vban_in - 1
|
||||
$vban_out = $vmr.kind.vban_out - 1
|
||||
$vban_inA = $vmr.kind.vban.in - 1
|
||||
$vban_inM = $vmr.kind.vban.in + $vmr.kind.vban.midi - 1
|
||||
$vban_inT = $vmr.kind.vban.in + $vmr.kind.vban.midi + $vmr.kind.vban.text - 1
|
||||
$vban_outA = $vmr.kind.vban.out - 1
|
||||
$vban_outM = $vmr.kind.vban.out + $vmr.kind.vban.midi - 1
|
||||
$insert = $vmr.kind.insert - 1
|
||||
$composite = $vmr.kind.composite - 1
|
||||
$strip_ch = $vmr.kind.eq_ch['strip'] - 1
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user