From f58c2e7aee2e392bdeea68abea960db0178b0a98 Mon Sep 17 00:00:00 2001 From: Bent Bisballe Nyeng Date: Mon, 23 Jan 2012 20:29:45 +0100 Subject: New with GUI. --- vst/drumgizmo_vst.cc | 65 ++++++++++++++++++++++++---------------------------- vst/drumgizmo_vst.h | 20 ++++++++++++++++ vst/input_vst.cc | 2 +- 3 files changed, 51 insertions(+), 36 deletions(-) (limited to 'vst') diff --git a/vst/drumgizmo_vst.cc b/vst/drumgizmo_vst.cc index 5ada7cb..381f2f9 100644 --- a/vst/drumgizmo_vst.cc +++ b/vst/drumgizmo_vst.cc @@ -33,41 +33,36 @@ #define NUM_PROGRAMS 0 #define NUM_PARAMS 0 -#include - -class DGEditor : public AEffEditor { -public: - DGEditor(AudioEffect* effect) - { - dgeff = (DrumGizmoVst*)effect; - plugingui = new PluginGUI(dgeff->drumgizmo); - } - - bool open(void* ptr) - { - plugingui->show(); - return true; - } +DGEditor::DGEditor(AudioEffect* effect) +{ + dgeff = (DrumGizmoVst*)effect; + plugingui = NULL; + drumgizmo = dgeff->drumgizmo; +} - void close() - { - plugingui->hide(); - } +bool DGEditor::open(void* ptr) +{ + if(!plugingui) plugingui = new PluginGUI(drumgizmo); + plugingui->show(); + return true; +} - bool isOpen() - { - return false; - } +void DGEditor::close() +{ + plugingui->hide(); + delete plugingui; + plugingui = NULL; +} - void idle() - { - plugingui->processEvents(); - } +bool DGEditor::isOpen() +{ + return plugingui != NULL;; +} -private: - DrumGizmoVst* dgeff; - PluginGUI *plugingui; -}; +void DGEditor::idle() +{ + if(plugingui) plugingui->processEvents(); +} AudioEffect* createEffectInstance(audioMasterCallback audioMaster) { @@ -97,7 +92,7 @@ DrumGizmoVst::DrumGizmoVst(audioMasterCallback audioMaster) canProcessReplacing(); isSynth(); - char id[] = "DGV2"; // Four bytes typecasted into an unsigned integer + char id[] = "DGV4"; // Four bytes typecasted into an unsigned integer setUniqueID(*(unsigned int*)id); // setUniqueID((unsigned int)time(NULL)); @@ -107,7 +102,7 @@ DrumGizmoVst::DrumGizmoVst(audioMasterCallback audioMaster) initProcess(); suspend(); - DGEditor *editor = new DGEditor(this); + editor = new DGEditor(this); setEditor(editor); } @@ -253,7 +248,7 @@ bool DrumGizmoVst::getProgramNameIndexed(VstInt32 category, VstInt32 index, bool DrumGizmoVst::getEffectName(char* name) { - vst_strncpy(name, "DrumGizmoA", kVstMaxEffectNameLen); + vst_strncpy(name, "DrumGizmo4", kVstMaxEffectNameLen); return true; } @@ -265,7 +260,7 @@ bool DrumGizmoVst::getVendorString(char* text) bool DrumGizmoVst::getProductString(char* text) { - vst_strncpy(text, "Vst SynthA", kVstMaxProductStrLen); + vst_strncpy(text, "Vst Synth", kVstMaxProductStrLen); return true; } diff --git a/vst/drumgizmo_vst.h b/vst/drumgizmo_vst.h index cf44cf7..5e063ff 100644 --- a/vst/drumgizmo_vst.h +++ b/vst/drumgizmo_vst.h @@ -31,10 +31,13 @@ #include #include +#include #include "input_vst.h" #include "output_vst.h" +class DGEditor; + class DrumGizmoVst : public AudioEffectX { public: @@ -91,6 +94,23 @@ private: size_t pos; sample_t *buffer; size_t buffer_size; + + DGEditor *editor; +}; + +class DGEditor : public AEffEditor { +public: + DGEditor(AudioEffect* effect); + + bool open(void* ptr); + void close(); + bool isOpen(); + void idle(); + +private: + DrumGizmoVst* dgeff; + PluginGUI *plugingui; + DrumGizmo *drumgizmo; }; #endif/*__DRUMGIZMO_DRUMGIZMO_VST_H__*/ diff --git a/vst/input_vst.cc b/vst/input_vst.cc index 525c687..52015ad 100644 --- a/vst/input_vst.cc +++ b/vst/input_vst.cc @@ -45,7 +45,7 @@ bool InputVST::init(Instruments &instruments) mmap.midimap = p.midimap; for(size_t i = 0; i < instruments.size(); i++) { - mmap.instrmap[instruments[i]->name()] = i; + mmap.instrmap[instruments[i].name()] = i; } return true; -- cgit v1.2.3