mirror of
https://github.com/onyx-and-iris/voicemeeter-api-powershell.git
synced 2026-04-18 13:33:31 +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:
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]@{
|
||||
|
||||
Reference in New Issue
Block a user