How to control the API from AutoHotkey (or Python)?

How to use Voicemeeter Remote API and control Voicemeeter Audio Engine
MinorKey
Posts: 1
Joined: Wed Jul 05, 2017 7:58 pm

How to control the API from AutoHotkey (or Python)?

Postby MinorKey » Fri Jul 07, 2017 9:42 am

Hello,

hope you can help me and that what I'm about to ask won't be too much (although I have a hunch that it will).
I would want to develop a custom user interface for VoiceMeeter Banana. I would be happy with the native user interface, but truth be told, apart from a few exceptions, I can't really use it as it is now. The reason is that I'm a blind user and unfortunately the current GUI does not interact well with screen readers. To get around this, instead of using the GUI, I have been changing the values manually in XML files. Thank you, Vincent, for using XML instead of some proprietary format.

I know that asking Vincent to rewrite the GUI in some other language or toolkit is probably too much and so I got the idea to write my own GUI instead. I chose AutoHotkey as my language, because it gives instant results. From what I understand it should be possible to call the API from AHK, because AHK supports DLL calls and COM objects, but (and here it comes), I don't know how to go about it. It should be more simple than I think, but I'm not a programmer and although I have been programming a little, this is beyond my competence.
I would like to ask, is someone here familiar with AutoHotkey and if so, can he or she give me a simple example how to log in to the API, set and retrieve a parameter and log out? That should be all I'll need to get started.
If AHK is not possible for some reason, I know that for example Python GUIs developed with the wxPython framework give accessible results, so maybe you could give me a Python example as well, because I have been trying to write Python programs before.

A little explanation on how screen readers work:
Screen readers are programs that read everything found on the screen to the person in question in a synthesized voice. Of course, it's more complicated than that, but I hope that you can at least imagine how it works.
Screen reading programs perform great in a lot of applications, but in many others they practically don't work at all. This is because in order for the screen reader to read in a certain window some criteria have to be met. Unfortunately VoiceMeeterbelongs to the latter category of programs. Screen readers can only read the contents of a particular window if it contains controls that provide them with information they can use. As an example, every control should be given a meaningful name and it should pass that name to screen readers along with the control's current value. Additionally, the user interface should support keyboard navigation, such as moving between the various controls with tab or shift+tab. It's not so complicated as it sounds - in many cases it's only a matter of adding a couple of functions into the existing code. Of course, the concrete steps that have to be taken depend on the code itself and on the framework used to write that code (if any). Some frameworks (like QT for instance) have guidelines on making accessible applications and some others are accessible right out of the box. If one doesn't know where to get started or if a particular framework doesn't provide any guidelines on accessibility, Microsoft has a general set of recommendations that when followed typically give good results.

All the best and sorry for such a question/request.

CaptaPraelium
Posts: 14
Joined: Mon Oct 17, 2016 4:31 am

Re: How to control the API from AutoHotkey (or Python)?

Postby CaptaPraelium » Tue Aug 08, 2017 3:18 pm

Hi MinorKey,

I had somewhat less noble reasons to also attempt to control Voicemeeter via AutoHotKey and found your posts yesterday, while looking for hints. I'm learning AHK as I go, but I thought I should touch base and let you know that I have had success in loading the DLL, logging in, sending basic commands, logging out, and unloading the DLL.

My code is horrible right now, I've literally just made it work minutes ago, so it's not something I would like to share just yet, but I wanted to let you know that I'm on the job.

My intention at this point, is to create an AHK file which can be used as a library, containing an object who's methods match those in the VBVMR documentation. This should act as a 'wrapper' for the VoiceMeeter API. I hope this would be suitable?

Cheers,
Capta

Vincent Burel
Site Admin
Posts: 429
Joined: Sun Jan 17, 2010 12:01 pm

Re: How to control the API from AutoHotkey (or Python)?

Postby Vincent Burel » Wed Aug 09, 2017 8:13 am

i don't know what you are doing exactly, but feel free to post some example here.
and feel free to ask about API call sequence if needed.

CaptaPraelium
Posts: 14
Joined: Mon Oct 17, 2016 4:31 am

Re: How to control the API from AutoHotkey (or Python)?

Postby CaptaPraelium » Thu Sep 28, 2017 1:16 am

Since MinorKey has left I'm not in much of a rush to get this done. @MinorKey, if you ever return, let me know and I'll be more than happy to help/speed this up for you.

Just in case I also disappear and someone is looking for this information, I'll post what I did so far. Yes, it is an ugly unfinished mess complete with error checking code popups and all kinds of trash. It's just something to help get someone started so they don't have to figure it out themselves.

Code: Select all

#persistent
#NoEnv  ; Recommended for performance and compatibility with future AutoHotkey releases.
; #Warn  ; Enable warnings to assist with detecting common errors.
SendMode Input  ; Recommended for new scripts due to its superior speed and reliability.
SetWorkingDir %A_ScriptDir%  ; Ensures a consistent starting directory.


OnExit("VMLogout") ; Ensure we log out of remote when script exits
VMLogin() ; Login at script start



VMLogin() {
VBVMRDLL := DllCall("LoadLibrary", "str", "C:\Program Files (x86)\VB\Voicemeeter\VoicemeeterRemote64.dll")
msgbox %VBVMRDLL% %ErrorLevel%
success_ind := DllCall("VoicemeeterRemote64\VBVMR_Login")
MsgBox, %success_ind% %ErrorLevel%
}

VMLogout() {
success_ind := DllCall("VoicemeeterRemote64\VBVMR_Logout")
MsgBox, %success_ind% %ErrorLevel%
success_ind := DllCall("FreeLibrary", "Ptr", VBVMRDLL)  ; Unload VBVMR DLL
MsgBox, %success_ind% %ErrorLevel%
}


Return to “Voicemeeter Remote API”

Who is online

Users browsing this forum: No registered users and 1 guest