mirror of
https://github.com/onyx-and-iris/voicemeeter-api-powershell.git
synced 2025-01-18 05:10:48 +00:00
Classes for each remote kind added.
They subclass Remote. Factory functions now return the Remote class of a Kind. Return Exit value -1 for DLL setup error.
This commit is contained in:
parent
7e1c5616db
commit
3b1bb06c7d
@ -3,31 +3,15 @@
|
|||||||
|
|
||||||
class Remote {
|
class Remote {
|
||||||
[Hashtable]$kind
|
[Hashtable]$kind
|
||||||
[System.Collections.ArrayList]$strip
|
|
||||||
[System.Collections.ArrayList]$bus
|
|
||||||
[System.Collections.ArrayList]$button
|
|
||||||
[PSCustomObject]$vban
|
|
||||||
[Object]$command
|
|
||||||
[Object]$recorder
|
|
||||||
[Object]$profiles
|
[Object]$profiles
|
||||||
|
|
||||||
Remote ([String]$kind_id) {
|
Remote ([String]$kindId) {
|
||||||
$this.kind = GetKind($kind_id)
|
|
||||||
$this.Setup()
|
|
||||||
}
|
|
||||||
|
|
||||||
[void] Setup() {
|
|
||||||
if (!(Setup_DLL)) {
|
if (!(Setup_DLL)) {
|
||||||
Exit
|
Exit -1
|
||||||
}
|
}
|
||||||
Login -KIND $this.kind.name
|
$this.kind = GetKind($kindId)
|
||||||
$this.profiles = Get_Profiles($this.kind.name)
|
$this.profiles = Get_Profiles($this.kind.name)
|
||||||
$this.strip = Make_Strips($this)
|
Login -KIND $this.kind.name
|
||||||
$this.bus = Make_Buses($this)
|
|
||||||
$this.button = Make_Buttons
|
|
||||||
$this.vban = Make_Vban($this)
|
|
||||||
$this.command = Make_Command
|
|
||||||
$this.recorder = Make_Recorder($this)
|
|
||||||
}
|
}
|
||||||
|
|
||||||
[string] ToString() {
|
[string] ToString() {
|
||||||
@ -75,16 +59,68 @@ class Remote {
|
|||||||
[void] MDirty() { M_Dirty }
|
[void] MDirty() { M_Dirty }
|
||||||
}
|
}
|
||||||
|
|
||||||
|
class RemoteBasic : Remote {
|
||||||
|
[System.Collections.ArrayList]$strip
|
||||||
|
[System.Collections.ArrayList]$bus
|
||||||
|
[System.Collections.ArrayList]$button
|
||||||
|
[PSCustomObject]$vban
|
||||||
|
[Object]$command
|
||||||
|
|
||||||
|
RemoteBasic () : base ('basic') {
|
||||||
|
$this.strip = Make_Strips($this)
|
||||||
|
$this.bus = Make_Buses($this)
|
||||||
|
$this.button = Make_Buttons
|
||||||
|
$this.vban = Make_Vban($this)
|
||||||
|
$this.command = Make_Command
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
class RemoteBanana : Remote {
|
||||||
|
[System.Collections.ArrayList]$strip
|
||||||
|
[System.Collections.ArrayList]$bus
|
||||||
|
[System.Collections.ArrayList]$button
|
||||||
|
[PSCustomObject]$vban
|
||||||
|
[Object]$command
|
||||||
|
[Object]$recorder
|
||||||
|
|
||||||
|
RemoteBanana () : base ('banana') {
|
||||||
|
$this.strip = Make_Strips($this)
|
||||||
|
$this.bus = Make_Buses($this)
|
||||||
|
$this.button = Make_Buttons
|
||||||
|
$this.vban = Make_Vban($this)
|
||||||
|
$this.command = Make_Command
|
||||||
|
$this.recorder = Make_Recorder($this)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
class RemotePotato : Remote {
|
||||||
|
[System.Collections.ArrayList]$strip
|
||||||
|
[System.Collections.ArrayList]$bus
|
||||||
|
[System.Collections.ArrayList]$button
|
||||||
|
[PSCustomObject]$vban
|
||||||
|
[Object]$command
|
||||||
|
[Object]$recorder
|
||||||
|
|
||||||
|
RemotePotato () : base ('potato') {
|
||||||
|
$this.strip = Make_Strips($this)
|
||||||
|
$this.bus = Make_Buses($this)
|
||||||
|
$this.button = Make_Buttons
|
||||||
|
$this.vban = Make_Vban($this)
|
||||||
|
$this.command = Make_Command
|
||||||
|
$this.recorder = Make_Recorder($this)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
Function Get-RemoteBasic {
|
Function Get-RemoteBasic {
|
||||||
return [Remote]::new('basic')
|
[RemoteBasic]::new()
|
||||||
}
|
}
|
||||||
|
|
||||||
Function Get-RemoteBanana {
|
Function Get-RemoteBanana {
|
||||||
return [Remote]::new('banana')
|
[RemoteBanana]::new()
|
||||||
}
|
}
|
||||||
|
|
||||||
Function Get-RemotePotato {
|
Function Get-RemotePotato {
|
||||||
return [Remote]::new('potato')
|
[RemotePotato]::new()
|
||||||
}
|
}
|
||||||
|
|
||||||
Function Connect-Voicemeeter {
|
Function Connect-Voicemeeter {
|
||||||
@ -100,10 +136,10 @@ Function Connect-Voicemeeter {
|
|||||||
"potato" {
|
"potato" {
|
||||||
return Get-RemotePotato
|
return Get-RemotePotato
|
||||||
}
|
}
|
||||||
default { throw [LoginError]::new('Unknown Voicemeeter kind') }
|
default { throw [LoginError]::new("Unknown Voicemeeter kind `"$Kind`"") }
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
catch [LoginError] {
|
catch [LoginError], [CAPIError] {
|
||||||
Write-Warning $_.Exception.ErrorMessage()
|
Write-Warning $_.Exception.ErrorMessage()
|
||||||
throw
|
throw
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user