2022-10-27 21:20:03 +01:00
|
|
|
function Setup_DLL {
|
2022-06-25 23:12:02 +01:00
|
|
|
try {
|
2023-08-12 01:40:29 +01:00
|
|
|
$vb_path = Get_VMPath
|
2022-06-25 23:12:02 +01:00
|
|
|
|
|
|
|
if ([string]::IsNullOrWhiteSpace($vb_path)) {
|
2022-12-18 04:30:51 +00:00
|
|
|
throw [VMRemoteError]::new("couldn't get Voicemeeter path")
|
2022-06-25 23:12:02 +01:00
|
|
|
}
|
2022-10-30 19:10:17 +00:00
|
|
|
$dll = Join-Path -Path $vb_path -ChildPath ("VoicemeeterRemote" + `
|
|
|
|
(& { if ([Environment]::Is64BitOperatingSystem) { "64" } else { "" } }) + `
|
|
|
|
".dll")
|
2022-06-25 23:12:02 +01:00
|
|
|
}
|
2022-12-18 04:30:51 +00:00
|
|
|
catch [VMRemoteError] {
|
2022-06-25 23:12:02 +01:00
|
|
|
Write-Warning $_.Exception.ErrorMessage()
|
|
|
|
return $false
|
|
|
|
}
|
|
|
|
|
|
|
|
$Signature = @"
|
|
|
|
[DllImport(@"$dll")]
|
|
|
|
public static extern int VBVMR_Login();
|
|
|
|
[DllImport(@"$dll")]
|
|
|
|
public static extern int VBVMR_Logout();
|
|
|
|
[DllImport(@"$dll")]
|
|
|
|
public static extern int VBVMR_RunVoicemeeter(Int64 run);
|
|
|
|
[DllImport(@"$dll")]
|
|
|
|
public static extern int VBVMR_GetVoicemeeterType(ref int ptr);
|
2022-10-27 21:20:03 +01:00
|
|
|
[DllImport(@"$dll")]
|
|
|
|
public static extern int VBVMR_GetVoicemeeterVersion(ref int ptr);
|
2022-06-25 23:12:02 +01:00
|
|
|
|
|
|
|
[DllImport(@"$dll")]
|
|
|
|
public static extern int VBVMR_MacroButton_IsDirty();
|
|
|
|
[DllImport(@"$dll")]
|
|
|
|
public static extern int VBVMR_MacroButton_SetStatus(Int64 id, Single state, Int64 mode);
|
|
|
|
[DllImport(@"$dll")]
|
|
|
|
public static extern int VBVMR_MacroButton_GetStatus(Int64 id, ref float ptr, Int64 mode);
|
|
|
|
|
|
|
|
[DllImport(@"$dll")]
|
|
|
|
public static extern int VBVMR_IsParametersDirty();
|
|
|
|
[DllImport(@"$dll")]
|
|
|
|
public static extern int VBVMR_SetParameterFloat(String param, Single value);
|
|
|
|
[DllImport(@"$dll")]
|
|
|
|
public static extern int VBVMR_GetParameterFloat(String param, ref float ptr);
|
|
|
|
|
|
|
|
[DllImport(@"$dll")]
|
|
|
|
public static extern int VBVMR_SetParameterStringA(String param, String value);
|
|
|
|
[DllImport(@"$dll")]
|
|
|
|
public static extern int VBVMR_GetParameterStringA(String param, byte[] buff);
|
|
|
|
|
|
|
|
[DllImport(@"$dll")]
|
|
|
|
public static extern int VBVMR_SetParameters(String param);
|
2023-08-09 14:16:27 +01:00
|
|
|
|
|
|
|
[DllImport(@"$dll")]
|
|
|
|
public static extern int VBVMR_GetLevel(Int64 mode, Int64 index, ref float ptr);
|
2022-06-25 23:12:02 +01:00
|
|
|
"@
|
|
|
|
|
|
|
|
Add-Type -MemberDefinition $Signature -Name Remote -Namespace Voicemeeter -PassThru | Out-Null
|
|
|
|
return $true
|
2022-10-27 21:20:03 +01:00
|
|
|
}
|