driveAttachment = new AudioProcessorValueTreeState::SliderAttachment(p.getState(), “drive”, driveKnob);
^ This line of code causes my vst to produce a critical error. I am following this tutorial and I am stuck at the 40-minute mark and have copied everything so far exactly. https://www.youtube.com/watch?v=iNCR5flSuDs.
I have no past experience with c++ so you will have to explain where all the stuff goes. is there an alternative or a fix I can do to get this to work. thanks
Thanks for the response, idk what you mean by the debugger but there are no build errors and it is flstudio that shows critical error when i load the plugin with that line of code
Unfortunately “no build errors” means nothing in C++. The code could be completely buggy and the compiler will still compile it. (In some cases enabling compiler warnings as errors may expose some issues, though.)
The debugger is a very important development tool, you should immediately get yourself familiar with it. When you run your code under the debugger, it can catch runtime errors and get you at the place in the code where the error happened, among other things.
I don’t want to watch the video and copy the code from that manually, can you post your project code somewhere already written out? (Why didn’t the Youtube video author provide the source code anyway…? )
that basically sums up the code that I have added to the default juce audio plugin template. I am building a vst2 plugin in 64 bit using the latest Steinberg libraries.
edit to the original post i meant the code was driveAttachment = new AudioProcessorValueTreeState::SliderAttachment(p.getState(), “drive”, *driveKnob);
If you solved the problem could you try to explain quickly what you did to fix it? Other users with the same issue who stumble upon this would find it useful.
Also there’s a few things in the code examples you gave I would change as such:
Firstly, ScopedPointers are depreciated so you want to replace them with std::unique_ptrs:
PluginEditor.h: std::unique_ptr<AudioProcessorValueTreeState::SliderAttachment> driveAttachment;
PluginProcessor.h: std::unique_ptr<AudioProcessorValuetreeState> state;
Second, from the code you’ve given there’s no reason to have your Slider as a pointer. You can just make it a normal object (unless you need it to be a pointer elsewhere in which case make it a unique_ptr also).
You have processor declared twice… Maybe this was just a typo but make sure you only have one.
i am having some issues changing it over to a unique pointer, i cant link it to the parameter name “drive”, where you have done this: PluginEditor(…) : driveKnob(“Drive”)
{
The PluginEditor(…) : driveKnob(“Drive”) syntax will only work for non-pointer types so if driveKnob is a std::unique_ptr you will need to remove this line and initialize your managed slider object inside the constructor body.
Also driveKnob = new Slider("Drive"); doesn’t work for unique_ptr. You must use driveKnob.reset(new Slider("Drive")); instead.
hi, sorry for late reply, that works. i have annother problem now where my plugin crashes when i minimize or close it inside of the daw. also it makes no differance to the sound
Can you please always add the stack trace, when you experience a crash?
There are just too many things that could have gone wrong, especially since nobody knows your code.