How to add a custom C++ method to Engine scripting API?
-
I'm building a compiled VST3 plugin with HISE and need to call a Windows API function (CreateMutexA) from HiseScript to detect whether a specific host DAW is running. I'm building HISE from source in Visual Studio 2022.
I tried adding the method to ScriptingApi.cpp and ScriptingApi.h following the existing getName() pattern, but including windows.h at the top of ScriptingApi.cpp causes a Rectangle macro conflict that breaks compilation.
What is the correct way to either (1) include windows.h safely in ScriptingApi.cpp, or (2) add a custom Engine method that calls a Windows API function? -
@pcs800 There is a bit of documentation about it here:
https://docs.hise.dev/cpp_api/index.html#create-your-own-classes
I think this discussion may help:
https://forum.hise.audio/topic/12951/procedure-for-writing-our-own-api-for-hisescript
Best advice here is just to follow and copy the patterns found in the HISE source code already. One thing to note, if you are trying to detect if a specific DAW is running, that's definitely a JUCE task. Does JUCE have a function for detecting your specific DAW? If not then you need to modify the JUCE source code (PluginSourceType) , then mirror that in HISE.