我使用 VST SDK 2.4 制作了一个插件。到目前为止,我一直在使用通用界面来控制插件,但现在我正在尝试使用 VSTGUI 库添加自定义界面。
我已经设置了编辑器文件并尝试使用与库一起打包的示例代码中概述的代码。我有点担心可能无法与 OSX Yosemite 完全兼容,但在这个阶段我正在解决一些基本问题。
我想知道是我做错了什么,还是应该放弃在 OSX 10.10 上使用 VSTGUI?
编译时出现如下错误: ./TutorialEditor.h:42:32: 错误:
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);
^
我的 vst 插件构造函数中的初始化如下所示:
extern AEffGUIEditor* createEditor (AudioEffectX*);
setEditor (createEditor (this));
这是 TutorialEditor.cpp 代码:
#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;
}
这是 TutorialEditor.h 代码:
#include "vstgui.sf/vstgui/aeffguieditor.h"
class Editor : public AEffGUIEditor {
public:
Editor (void* ptr) : AEffGUIEditor (ptr) {}
bool open (void* ptr);
void close ();
};
最佳答案
编译器不会自动将 void*
转换为 AudioEffect*
。
您可以通过编写手动转换
Editor (void* ptr) : AEffGUIEditor ((AudioEffect*)ptr) {}
但理想情况下,您应该完全避免在这种情况下使用 void*。
尝试替换
Editor (void* ptr) : AEffGUIEditor (ptr) {}
由
Editor (AudioEffect* ptr) : AEffGUIEditor (ptr) {}
如果可能的话。
丢失的类型信息越少越好。
关于c++ - 使用 VSTGUI 初始化 'AEffGUIEditor' 没有匹配的构造函数,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/27880483/