I’m trying to support NKS in my plugin and I’ve got most of it working, but I’m having a hard time figuring out how to query the host with a “hostCanDo” call, and then how to actually send note data to the host for the light guides.
Has anyone out there successfully implemented this?
For anyone else who’s trying to implement NKS, here’s some code that I used to send and receive from an NKS host (Maschine or Komplete Kontrol). It’s not 100% complete because of the NDA, but this should hopefully save someone some time.
MyProcessor.h/.cpp
class MyProcessor : public AudioProcessor,
public VSTCallbackHandler // <- need this for callback
{
std::function<VstHostCallbackType> hostCallback = nullptr;
// etc...
}
// need this just for the audioMasterCanDo definition used below...
namespace Vst2
{
#include <juce_audio_processors/format_types/VST3_SDK/pluginterfaces/vst2.x/aeffect.h>
#include <juce_audio_processors/format_types/VST3_SDK/pluginterfaces/vst2.x/aeffectx.h>
}
// host -> plugin
pointer_sized_int MyProcessor:: handleVstPluginCanDo (int32 opcode,
pointer_sized_int lArg2,
void* ptrArg,
float opt)
{
auto text = (const char*) ptrArg;
if(strcmp(text, nks::vse::effect_can_nks_string()) == 0)
return 1;
return 0;
}
void MyProcessor::handleVstHostCallbackAvailable(std::function<VstHostCallbackType>&& callback)
{
hostCallback = callback;
}
int32 MyProcessor::canHostDo(char* text)
{
if (hostCallback != nullptr)
return (hostCallback(Vst2::audioMasterCanDo, 0, 0, text, 0) != 0);
return 0;
}
pointer_sized_int MyProcessor::hostVendorSpecific(int32 lArg1, int32 lArg2, void* ptrArg, float floatArg)
{
if (hostCallback != nullptr)
return hostCallback(Vst2::audioMasterVendorSpecific, lArg1, lArg2, ptrArg, floatArg);
return 0;
}
Hi, I know it has been two years but right now i am trying to do the same thing. I downloaded the sdk and switched to developer mode.I handled the artwork, presets, knob mapping but i couldn’t manage to complete the code section. Did you add anything else ? Would this be enough to complete this section and have an NKS compatible plugin ?
The sdk is ok.
We have it working well with juce5.
But currently it is subject to terms so I’d suggest you contact NI directly. If you have specific juce questions feel free to contact me privately.
Thank you for your answers.
I contacted them. They send me a link to access their sdk and a document to go through.
I started with installing the Maschine CP. I created my presets.i use an independent preset system. It allows user to save and load presets in a certain file extension. But of course it is an xml file. Then i set the mapping order.i tested it with a komplete keyboard. I had some issues but now everything works. It took me a while to fix the issues. Now i have my presets ready, i created necessary artworks according to that document. I think the last step is to adding tbe header and necessary codes to my project. This is the point that i need help. I see there is two demos. One for windows and one for mac. I compiled them by using cmake but i cannot debug it. The both examples are not like juce template. So i am confused. I don’t know what to add my code. And after this secrion, is there anything else? After this should i send them the files for approval?
You first need to test it and see if all NKS features you’ve decided to use are working as expected. You can debug your code seeing if nks supported host such as MASCHINE or KOMPLETE KONTROL properly handles your plugin or instrument.
I am testing it in MASCHINE. For now looks like it works fine. I am able to load presets, switch to another, control the knobs. I can do all these, once i plugin my komplete keyboard to my computer. I only couldn’t handle the code side.
After adding the “VendorSpecificExtension.h” to my processor and the code above, is it going to be completed? I don’t know what to do on the header and code side.
I am able to debug my plugin but i cannot debug the one that is provided in the demo folder of NKS VST SDK. So i don’t know which methods or parameters are coming from the NKS header. I read their NKS VST Developer SDK document page.But i couldn’t understand what to do the complete it.
I need help to go through the correct procedure to complete the process. Is there a cleaner manual or a post or an example that i can review?
Don’t know anything about NKS, but to me it seems that you generally don’t have any experience in adding third party libraries to C++/JUCE projects, am I right?
If this is the case, I guess you should learn such general things first as I guess this is some basic programing knowledge that is expected by the developers and not very specific to NKS. Maybe playing around with some random open source lib to link to a demo plugin as a pure learning task and discussing that here on the forums to learn the general ideas before starting with a closed source lib that no one can really talk about in public due to NDA restrictions could be a better first step in that direction…? Correct me if I’m wrong and all those stuff like linking to external libs in general is something you are familiar with
I feel like you’re confused with a lot of things altogether.
What are you trying to achieve from NKS?
If you only want to use NKS then you don’t have to do much. just put debug points and see they’re being called. even with the code above.
It feels you need some understanding of the VST2 architecture (as a reminder - you need license for it in addition to NKS. which cannot be obtained for a while now).
You can try supporting ‘open’ VST2 extensions such as PreSonus ones and see if it is working for you. after you get the hang of VST2 extensions the NKS would be a breeze.
@PluginPenguin , @ttg-2 adding an external lib is ok. I see what you mean. I was trying to see if there is a better and more detailed explanation for the steps. I mean;
nks needs to get your preset list. XXX is the method that will get them. Insert your preset list as a xml document array to it.
As you mentioned it is hard to find anything about NKS since it is restricted by an NDA.I will try to contact them directly and see if they can guide me to finalize it. Thank you very much for your valuable answers.