sfizz/vst/SfizzVstEditor.h

59 lines
1.8 KiB
C
Raw Normal View History

2020-03-05 11:16:47 +01:00
// SPDX-License-Identifier: BSD-2-Clause
// This code is part of the sfizz library and is licensed under a BSD 2-clause
// license. You should have receive a LICENSE.md file along with the code.
// If not, contact the sfizz maintainers at https://github.com/sfztools/sfizz
#pragma once
#include "SfizzVstController.h"
2020-08-29 04:54:18 +02:00
#include "editor/EditorController.h"
2020-03-05 11:16:47 +01:00
#include "public.sdk/source/vst/vstguieditor.h"
2020-08-29 04:54:18 +02:00
class Editor;
2020-03-12 00:41:35 +01:00
#if !defined(__APPLE__) && !defined(_WIN32)
namespace VSTGUI { class RunLoop; }
#endif
2020-03-05 11:16:47 +01:00
using namespace Steinberg;
using namespace VSTGUI;
2020-08-29 04:54:18 +02:00
class SfizzVstEditor : public Vst::VSTGUIEditor, public SfizzVstController::StateListener, public EditorController {
2020-03-05 11:16:47 +01:00
public:
explicit SfizzVstEditor(void *controller);
~SfizzVstEditor();
bool PLUGIN_API open(void* parent, const VSTGUI::PlatformType& platformType = VSTGUI::kDefaultNative) override;
void PLUGIN_API close() override;
2020-03-05 18:21:46 +01:00
SfizzVstController* getController() const
{
return static_cast<SfizzVstController*>(Vst::VSTGUIEditor::getController());
}
2020-03-12 00:41:35 +01:00
// VSTGUIEditor
CMessageResult notify(CBaseObject* sender, const char* message) override;
2020-03-05 11:16:47 +01:00
// SfizzVstController::StateListener
void onStateChanged() override;
2020-08-29 04:54:18 +02:00
protected:
// EditorController
void uiSendValue(EditId id, const EditValue& v) override;
void uiBeginSend(EditId id) override;
void uiEndSend(EditId id) override;
2020-10-14 20:04:59 +02:00
void uiSendMIDI(const uint8_t* data, uint32_t len) override;
2020-08-29 04:54:18 +02:00
2020-03-05 11:16:47 +01:00
private:
void loadSfzFile(const std::string& filePath);
2020-06-20 05:49:00 +02:00
void loadScalaFile(const std::string& filePath);
2020-03-05 11:16:47 +01:00
void updateStateDisplay();
2020-08-29 04:54:18 +02:00
Vst::ParamID parameterOfEditId(EditId id);
2020-03-12 00:41:35 +01:00
2020-08-29 04:54:18 +02:00
std::unique_ptr<Editor> editor_;
2020-08-12 19:23:50 +02:00
2020-03-12 00:41:35 +01:00
#if !defined(__APPLE__) && !defined(_WIN32)
SharedPointer<RunLoop> _runLoop;
#endif
2020-03-05 11:16:47 +01:00
};