Update of VST UI
This commit is contained in:
parent
29cf293d95
commit
8fc43bc0be
4 changed files with 58 additions and 26 deletions
|
|
@ -59,7 +59,9 @@ endif()
|
||||||
|
|
||||||
# Create the bundle (see "VST 3 Locations / Format")
|
# Create the bundle (see "VST 3 Locations / Format")
|
||||||
execute_process (
|
execute_process (
|
||||||
COMMAND "${CMAKE_COMMAND}" -E make_directory "${CMAKE_CURRENT_BINARY_DIR}/${VSTPLUGIN_BUNDLE_NAME}/Contents")
|
COMMAND "${CMAKE_COMMAND}" -E make_directory "${CMAKE_CURRENT_BINARY_DIR}/${VSTPLUGIN_BUNDLE_NAME}/Contents/Resources")
|
||||||
|
file (COPY "${CMAKE_CURRENT_SOURCE_DIR}/resources/logo.png"
|
||||||
|
DESTINATION "${CMAKE_CURRENT_BINARY_DIR}/${VSTPLUGIN_BUNDLE_NAME}/Contents/Resources")
|
||||||
if(WIN32)
|
if(WIN32)
|
||||||
set_target_properties(${VSTPLUGIN_PRJ_NAME} PROPERTIES
|
set_target_properties(${VSTPLUGIN_PRJ_NAME} PROPERTIES
|
||||||
LIBRARY_OUTPUT_DIRECTORY "${CMAKE_CURRENT_BINARY_DIR}/${VSTPLUGIN_BUNDLE_NAME}/Contents/${VST3_PACKAGE_ARCHITECTURE}-win")
|
LIBRARY_OUTPUT_DIRECTORY "${CMAKE_CURRENT_BINARY_DIR}/${VSTPLUGIN_BUNDLE_NAME}/Contents/${VST3_PACKAGE_ARCHITECTURE}-win")
|
||||||
|
|
|
||||||
|
|
@ -12,11 +12,9 @@
|
||||||
|
|
||||||
using namespace VSTGUI;
|
using namespace VSTGUI;
|
||||||
|
|
||||||
static constexpr int kEditorWidth = 800;
|
|
||||||
static constexpr int kEditorHeight = 40;
|
|
||||||
|
|
||||||
SfizzVstEditor::SfizzVstEditor(void *controller)
|
SfizzVstEditor::SfizzVstEditor(void *controller)
|
||||||
: VSTGUIEditor(controller)
|
: VSTGUIEditor(controller),
|
||||||
|
_logo("logo.png")
|
||||||
{
|
{
|
||||||
static_cast<SfizzVstController*>(getController())->addStateListener(this);
|
static_cast<SfizzVstController*>(getController())->addStateListener(this);
|
||||||
}
|
}
|
||||||
|
|
@ -28,7 +26,7 @@ SfizzVstEditor::~SfizzVstEditor()
|
||||||
|
|
||||||
bool PLUGIN_API SfizzVstEditor::open(void* parent, const VSTGUI::PlatformType& platformType)
|
bool PLUGIN_API SfizzVstEditor::open(void* parent, const VSTGUI::PlatformType& platformType)
|
||||||
{
|
{
|
||||||
CRect wsize(0, 0, kEditorWidth, kEditorHeight);
|
CRect wsize(0, 0, _logo.getWidth(), _logo.getHeight());
|
||||||
CFrame *frame = new CFrame(wsize, this);
|
CFrame *frame = new CFrame(wsize, this);
|
||||||
this->frame = frame;
|
this->frame = frame;
|
||||||
|
|
||||||
|
|
@ -67,8 +65,7 @@ void SfizzVstEditor::valueChanged(CControl* ctl)
|
||||||
if (value != 1)
|
if (value != 1)
|
||||||
break;
|
break;
|
||||||
|
|
||||||
chooseSfzFile();
|
Call::later([this]() { chooseSfzFile(); });
|
||||||
|
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -95,18 +92,23 @@ void SfizzVstEditor::chooseSfzFile()
|
||||||
|
|
||||||
void SfizzVstEditor::loadSfzFile(const std::string& filePath)
|
void SfizzVstEditor::loadSfzFile(const std::string& filePath)
|
||||||
{
|
{
|
||||||
_fileLabel->setText(filePath.c_str());
|
|
||||||
|
|
||||||
Vst::EditController* ctl = getController();
|
Vst::EditController* ctl = getController();
|
||||||
|
|
||||||
|
|
||||||
Vst::IMessage *msg = ctl->allocateMessage();
|
Vst::IMessage *msg = ctl->allocateMessage();
|
||||||
if (msg) {
|
if (!msg) {
|
||||||
msg->setMessageID("LoadSfz");
|
fprintf(stderr, "[Sfizz] UI could not allocate message\n");
|
||||||
Vst::IAttributeList* attr = msg->getAttributes();
|
return;
|
||||||
attr->setString("File", Steinberg::String(filePath.c_str()).text());
|
|
||||||
ctl->sendMessage(msg);
|
|
||||||
msg->release();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
msg->setMessageID("LoadSfz");
|
||||||
|
Vst::IAttributeList* attr = msg->getAttributes();
|
||||||
|
attr->setString("File", Steinberg::String(filePath.c_str()).text());
|
||||||
|
ctl->sendMessage(msg);
|
||||||
|
msg->release();
|
||||||
|
|
||||||
|
if (_fileLabel)
|
||||||
|
_fileLabel->setText(("File: " + filePath).c_str());
|
||||||
}
|
}
|
||||||
|
|
||||||
///
|
///
|
||||||
|
|
@ -156,17 +158,43 @@ void SfizzVstEditor::createFrameContents()
|
||||||
CFrame* frame = this->frame;
|
CFrame* frame = this->frame;
|
||||||
CRect bounds = frame->getViewSize();
|
CRect bounds = frame->getViewSize();
|
||||||
|
|
||||||
CTextLabel *label;
|
frame->setBackgroundColor(CColor(0xff, 0xff, 0xff));
|
||||||
CRect rect;
|
|
||||||
CRect rect2;
|
|
||||||
|
|
||||||
rect = CRect(10.0, 10.0, 120.0, 30.0);
|
CKickButton* sfizzButton = new CKickButton(bounds, this, kTagLoadSfzFile, &_logo);
|
||||||
frame->addView(new SimpleButton(rect, this, kTagLoadSfzFile, "Load SFZ file"));
|
frame->addView(sfizzButton);
|
||||||
|
|
||||||
rect2 = CRect(150.0, 10.0, bounds.right - 10.0, 30.0);
|
CRect bottomRow = bounds;
|
||||||
frame->addView((label = new CTextLabel(rect2, "no file")));
|
bottomRow.top = bottomRow.bottom - 30;
|
||||||
label->setHoriAlign(kLeftText);
|
|
||||||
_fileLabel = label;
|
CRect topRow = bounds;
|
||||||
|
topRow.bottom = topRow.top + 30;
|
||||||
|
|
||||||
|
CTextLabel* descLabel = new CTextLabel(
|
||||||
|
bottomRow, "Paul Ferrand and the SFZ Tools work group");
|
||||||
|
descLabel->setFontColor(CColor(0x00, 0x00, 0x00));
|
||||||
|
descLabel->setBackColor(CColor(0x00, 0x00, 0x00, 0x00));
|
||||||
|
frame->addView(descLabel);
|
||||||
|
|
||||||
|
CRect fileBox = topRow;
|
||||||
|
fileBox.right = fileBox.left + 400;
|
||||||
|
CTextLabel* fileLabel = new CTextLabel(fileBox, "No file loaded");
|
||||||
|
fileLabel->setFontColor(CColor(0x00, 0x00, 0x00));
|
||||||
|
fileLabel->setBackColor(CColor(0x00, 0x00, 0x00, 0x00));
|
||||||
|
// fileLabel->setHoriAlign(kLeftText);
|
||||||
|
frame->addView(fileLabel);
|
||||||
|
_fileLabel = fileLabel;
|
||||||
|
|
||||||
|
// CTextLabel *label;
|
||||||
|
// CRect rect;
|
||||||
|
// CRect rect2;
|
||||||
|
|
||||||
|
// rect = CRect(10.0, 10.0, 120.0, 30.0);
|
||||||
|
// frame->addView(new SimpleButton(rect, this, kTagLoadSfzFile, "Load SFZ file"));
|
||||||
|
|
||||||
|
// rect2 = CRect(150.0, 10.0, bounds.right - 10.0, 30.0);
|
||||||
|
// frame->addView((label = new CTextLabel(rect2, "no file")));
|
||||||
|
// label->setHoriAlign(kLeftText);
|
||||||
|
// _fileLabel = label;
|
||||||
}
|
}
|
||||||
|
|
||||||
void SfizzVstEditor::updateStateDisplay()
|
void SfizzVstEditor::updateStateDisplay()
|
||||||
|
|
@ -176,5 +204,6 @@ void SfizzVstEditor::updateStateDisplay()
|
||||||
|
|
||||||
const SfizzVstState& state = static_cast<SfizzVstController*>(getController())->getSfizzState();
|
const SfizzVstState& state = static_cast<SfizzVstController*>(getController())->getSfizzState();
|
||||||
|
|
||||||
_fileLabel->setText(state.sfzFile.c_str());
|
if (_fileLabel)
|
||||||
|
_fileLabel->setText(("File: " + state.sfzFile).c_str());
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -36,5 +36,6 @@ private:
|
||||||
kTagLoadSfzFile,
|
kTagLoadSfzFile,
|
||||||
};
|
};
|
||||||
|
|
||||||
|
CBitmap _logo;
|
||||||
CTextLabel* _fileLabel = nullptr;
|
CTextLabel* _fileLabel = nullptr;
|
||||||
};
|
};
|
||||||
|
|
|
||||||
BIN
vst/resources/logo.png
Normal file
BIN
vst/resources/logo.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 20 KiB |
Loading…
Add table
Reference in a new issue