Hello together,
since I use Voicemeeter Banana, I wanted it to be interactive with my arduino. That means I also want to get a feedback. For this I have to use the Voicemeeter API and not only some MIDI signals.
Does anyone know how to call the API from Python, because i never programmed sth. in C# or C++.
Thanks for helping
Jan
Control VoiceMeeter API from Python
-
- Posts: 59
- Joined: Sun Sep 06, 2020 11:17 pm
Re: Control VoiceMeeter API from Python
No but I'm working on something in AutoHotKey. I've been able to successfully:
https://github.com/SaifAqqad/VMR.ahk
- Capture the state of all buttons and updating my MIDI controller. If you change a button on the screen it updates my controller and visa versa.
- Program the MONO buttons without using Macros. (Voicemeeter doesn't have mapping for these)
https://github.com/SaifAqqad/VMR.ahk
-
- Posts: 59
- Joined: Sun Sep 06, 2020 11:17 pm
Re: Control VoiceMeeter API from Python
Hi,JanF_04 wrote: ↑Sat Sep 26, 2020 11:15 am Hello together,
since I use Voicemeeter Banana, I wanted it to be interactive with my arduino. That means I also want to get a feedback. For this I have to use the Voicemeeter API and not only some MIDI signals.
Does anyone know how to call the API from Python, because i never programmed sth. in C# or C++.
Thanks for helping
Jan
I haven't done Python yet, but I put together a very basic test using VisualStudio 2019 C++. Just Login() and Logout() are currently implemented.
This is actually my first crack at CPP. so it is very basic but maybe it will help you.
Code: Select all
/* VMR-Login/Logout Test
2020-10-15 - Steven J. Caldwell
This is a console based application written with C++ Visual Studio 19 in console mode just to test a few
API functions of Voicemeeter Remote
*/
#include <iostream> // Not sure if this is needed in this app
#include "windows.h"
#include <string>
#include <chrono> // used for Sleep function
using namespace std;
typedef HRESULT(CALLBACK* LPFNDLLFUNC1)();
class Vmr {
public:
string bus[8];
string strip[8];
Vmr()
{
HINSTANCE hDLL;
// For the 32 bit version
hDLL = LoadLibrary("C:\\Program Files (x86)\\VB\\Voicemeeter\\VoicemeeterRemote.dll");
if (hDLL != 0)
{
// set up pointers
cout << "Set up Pointers\n";
cout << "Vmr DLLL=" << hDLL << '\n';
VbVMR vBvmr(hDLL);
}
else
{
// report DLL load error
cout << "Cannot Load DLL\n";
}
// cout << "Hello World!";
}
class VbVMR {
public:
LPFNDLLFUNC1 login;
LPFNDLLFUNC1 logout;
HRESULT hrReturnVal = 0;
VbVMR(HINSTANCE hDLL)
{
// HINSTANCE myHDLL;
// myHDLL = hDLL;
cout << "VbVMRhDLL=" << hDLL << '\n';
login = (LPFNDLLFUNC1)GetProcAddress(hDLL, "VBVMR_Login");
if (login != 0)
{
cout << "Login Success:login=" << login << '\n';
}
else
{
cout << "Login Failure:login=" << login << '\n';
}
logout = (LPFNDLLFUNC1)GetProcAddress(hDLL, "VBVMR_Logout");
if (logout != 0)
{
cout << "Logout Success:logout=" << logout << '\n';
}
else
{
cout << "Logout Failure:logout=" << logout<< '\n';
}
hrReturnVal = login();
if (hrReturnVal)
{
cout << "Login Error\n";
}
Sleep(10000);
hrReturnVal = logout();
if (hrReturnVal)
{
cout << "Logout Error\n";
}
}
};
};
int main() {
Vmr vmr;
return 0;
}
-
- Posts: 173
- Joined: Tue Feb 18, 2020 12:04 am
Re: Control VoiceMeeter API from Python
Thanks for sharing that VMR wrapper, @sjc-or !
@janF_04 take a look at python's ctypes. That should allow you to call the C functions in the DLL, from python. I haven't tried it yet, but it should be relatively straightforward if you're already python-savvy.
@janF_04 take a look at python's ctypes. That should allow you to call the C functions in the DLL, from python. I haven't tried it yet, but it should be relatively straightforward if you're already python-savvy.