2022-06-25 23:12:02 +01:00
|
|
|
. $PSScriptRoot\kinds.ps1
|
2021-04-28 17:38:36 +01:00
|
|
|
. $PSScriptRoot\base.ps1
|
|
|
|
|
|
|
|
class Remote {
|
2022-06-25 23:12:02 +01:00
|
|
|
[Hashtable]$kind
|
2022-01-24 20:01:12 +00:00
|
|
|
[Object]$profiles
|
2021-04-28 17:38:36 +01:00
|
|
|
|
2022-12-18 04:27:55 +00:00
|
|
|
Remote ([String]$kindId) {
|
2022-10-27 21:20:03 +01:00
|
|
|
if (!(Setup_DLL)) {
|
2022-12-18 04:27:55 +00:00
|
|
|
Exit -1
|
2021-05-04 17:29:38 +01:00
|
|
|
}
|
2022-12-18 04:27:55 +00:00
|
|
|
$this.kind = GetKind($kindId)
|
2022-10-27 21:20:03 +01:00
|
|
|
$this.profiles = Get_Profiles($this.kind.name)
|
2022-12-18 04:27:55 +00:00
|
|
|
Login -KIND $this.kind.name
|
2022-10-27 21:20:03 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
[string] ToString() {
|
2022-10-30 01:31:32 +01:00
|
|
|
return "Voicemeeter " + $this.kind.name.substring(0, 1).toupper() + $this.kind.name.substring(1)
|
2021-04-28 17:38:36 +01:00
|
|
|
}
|
|
|
|
|
2021-04-30 17:07:09 +01:00
|
|
|
[void] Logout() {
|
2021-04-28 17:38:36 +01:00
|
|
|
Logout
|
|
|
|
}
|
2022-01-19 21:55:10 +00:00
|
|
|
|
2022-10-30 01:31:32 +01:00
|
|
|
[string] GetType() {
|
|
|
|
return VmType
|
2022-10-27 21:20:03 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
[String] GetVersion() {
|
|
|
|
return Version
|
|
|
|
}
|
|
|
|
|
2022-01-24 20:01:12 +00:00
|
|
|
[void] Set_Profile([String]$config) {
|
|
|
|
Set_Profile -DATA $this.profiles -CONF $config
|
|
|
|
}
|
|
|
|
|
2022-01-19 21:55:10 +00:00
|
|
|
[Single] Getter([String]$param) {
|
|
|
|
return Param_Get -PARAM $param
|
|
|
|
}
|
|
|
|
|
|
|
|
[String] Getter_String([String]$param) {
|
|
|
|
return Param_Get -PARAM $param -IS_STRING $true
|
|
|
|
}
|
|
|
|
|
|
|
|
[void] Setter([String]$param, [Object]$value) {
|
|
|
|
Param_Set -PARAM $param -VALUE $value
|
|
|
|
}
|
2021-04-30 17:07:09 +01:00
|
|
|
|
2021-04-30 16:47:15 +01:00
|
|
|
[void] Set_Multi([HashTable]$hash) {
|
|
|
|
Param_Set_Multi -HASH $hash
|
|
|
|
}
|
2022-01-19 21:55:10 +00:00
|
|
|
|
2022-10-27 21:20:03 +01:00
|
|
|
[void] SendText([String]$script) {
|
|
|
|
Set_By_Script -SCRIPT $script
|
|
|
|
}
|
|
|
|
|
2022-01-19 21:55:10 +00:00
|
|
|
[void] PDirty() { P_Dirty }
|
|
|
|
|
|
|
|
[void] MDirty() { M_Dirty }
|
2021-04-28 17:38:36 +01:00
|
|
|
}
|
2021-04-30 17:07:09 +01:00
|
|
|
|
2022-12-18 04:27:55 +00:00
|
|
|
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)
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2021-04-30 17:07:09 +01:00
|
|
|
Function Get-RemoteBasic {
|
2022-12-18 04:27:55 +00:00
|
|
|
[RemoteBasic]::new()
|
2021-04-30 17:07:09 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
Function Get-RemoteBanana {
|
2022-12-18 04:27:55 +00:00
|
|
|
[RemoteBanana]::new()
|
2021-04-30 17:07:09 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
Function Get-RemotePotato {
|
2022-12-18 04:27:55 +00:00
|
|
|
[RemotePotato]::new()
|
2021-04-30 17:07:09 +01:00
|
|
|
}
|
|
|
|
|
2022-12-16 18:19:35 +00:00
|
|
|
Function Connect-Voicemeeter {
|
|
|
|
param([String]$Kind)
|
|
|
|
try {
|
|
|
|
switch ($Kind) {
|
|
|
|
"basic" {
|
|
|
|
return Get-RemoteBasic
|
|
|
|
}
|
|
|
|
"banana" {
|
|
|
|
return Get-RemoteBanana
|
|
|
|
}
|
|
|
|
"potato" {
|
|
|
|
return Get-RemotePotato
|
|
|
|
}
|
2022-12-18 04:27:55 +00:00
|
|
|
default { throw [LoginError]::new("Unknown Voicemeeter kind `"$Kind`"") }
|
2022-12-16 18:19:35 +00:00
|
|
|
}
|
|
|
|
}
|
2022-12-18 04:27:55 +00:00
|
|
|
catch [LoginError], [CAPIError] {
|
2022-12-16 18:19:35 +00:00
|
|
|
Write-Warning $_.Exception.ErrorMessage()
|
2022-12-17 20:10:53 +00:00
|
|
|
throw
|
2022-12-16 18:19:35 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
Function Disconnect-Voicemeeter {
|
|
|
|
Logout
|
|
|
|
}
|
|
|
|
|
|
|
|
Export-ModuleMember -Function Get-RemoteBasic, Get-RemoteBanana, Get-RemotePotato, Connect-Voicemeeter, Disconnect-Voicemeeter
|