From fc290ba90caf796378f1678a232139d2f44b2136 Mon Sep 17 00:00:00 2001 From: onyx-and-iris Date: Fri, 16 Dec 2022 18:19:35 +0000 Subject: [PATCH] entry/exit functions added --- lib/Voicemeeter.psm1 | 28 +++++++++++++++++++++++++++- 1 file changed, 27 insertions(+), 1 deletion(-) diff --git a/lib/Voicemeeter.psm1 b/lib/Voicemeeter.psm1 index 4c35d35..ad4de99 100644 --- a/lib/Voicemeeter.psm1 +++ b/lib/Voicemeeter.psm1 @@ -88,4 +88,30 @@ Function Get-RemotePotato { return [Remote]::new('potato') } -Export-ModuleMember -Function Get-RemoteBasic, Get-RemoteBanana, Get-RemotePotato +Function Connect-Voicemeeter { + param([String]$Kind) + try { + switch ($Kind) { + "basic" { + return Get-RemoteBasic + } + "banana" { + return Get-RemoteBanana + } + "potato" { + return Get-RemotePotato + } + default { throw [LoginError]::new('Unknown Voicemeeter kind') } + } + } + catch [LoginError] { + Write-Warning $_.Exception.ErrorMessage() + Exit + } +} + +Function Disconnect-Voicemeeter { + Logout +} + +Export-ModuleMember -Function Get-RemoteBasic, Get-RemoteBanana, Get-RemotePotato, Connect-Voicemeeter, Disconnect-Voicemeeter