Search code examples
c++macosvst

no matching constructor for initialization of 'AEffGUIEditor' with VSTGUI


I've made a plugin using the VST SDK 2.4. Up until now I've been using the generic interface to control the plugin but now I'm trying to add a custom interface using the VSTGUI library.

I've set up editor files and tried to use the code as outlined in the example code packaged with the library. I'm a bit worried that there might not be total compatibility with OSX Yosemite, however at this stage I'm fighting some rudimentary problems.

I want to know if i'm doing something wrong, or should I give up using VSTGUI with OSX 10.10?

On compilation, I get the following error: ./TutorialEditor.h:42:32: error:

no matching constructor for initialization of 'AEffGUIEditor'
    Editor (const void* ptr) : AEffGUIEditor (ptr) {}
                               ^              ~~~
vstsdk2.4/vstgui.sf/vstgui/aeffguieditor.h:51:7: note: candidate constructor
      (the implicit copy constructor) not viable: cannot convert argument of incomplete type
      'const void *' to 'const AEffGUIEditor'
class AEffGUIEditor : public AEffEditor
      ^
vstsdk2.4/vstgui.sf/vstgui/aeffguieditor.h:55:2: note: candidate constructor not viable: cannot
      convert argument of incomplete type 'const void *' to 'AudioEffect *'
        AEffGUIEditor (AudioEffect* effect);
    ^

The initialisation in the constructor of my vst plugin looks like this:

extern AEffGUIEditor* createEditor (AudioEffectX*);
setEditor (createEditor (this));

Here's the TutorialEditor.cpp code:

#include "TutorialEditor.h"

AEffGUIEditor* createEditor (AudioEffectX* effect) {
    return new Editor (effect);
}

bool Editor::open (void* ptr) {
    CRect frameSize (0, 0, 300, 300);
    frame = new CFrame (frameSize, ptr, this);
    return true;
}
void Editor::close () {
    delete frame;
    frame = 0;
}

Here's the TutorialEditor.h code:

#include "vstgui.sf/vstgui/aeffguieditor.h"

class Editor : public AEffGUIEditor {
public:
    Editor (void* ptr) : AEffGUIEditor (ptr) {}
    bool open (void* ptr);
    void close ();
};

Solution

  • The compiler not cast that void* to a AudioEffect* automatically.

    You can cast it manually by writing

    Editor (void* ptr) : AEffGUIEditor ((AudioEffect*)ptr) {}
    

    but ideally you should avoid using void* at all in this case.

    Try to replace

    Editor (void* ptr) : AEffGUIEditor (ptr) {} 
    

    by

    Editor (AudioEffect* ptr) : AEffGUIEditor (ptr) {}
    

    if possible.

    The less type information you lose, the better.