From ce28ce03c3e1727b21c43d96cebe90600bb35fde Mon Sep 17 00:00:00 2001 From: Bent Bisballe Nyeng Date: Sat, 17 Dec 2011 10:38:24 +0100 Subject: Make use of GUI (currently broken) --- vst/drumgizmo_vst.cc | 55 +++++++++++++++++++++++++++++++++++++++++++++++----- vst/drumgizmo_vst.h | 4 +++- 2 files changed, 53 insertions(+), 6 deletions(-) (limited to 'vst') diff --git a/vst/drumgizmo_vst.cc b/vst/drumgizmo_vst.cc index 730a67b..5ada7cb 100644 --- a/vst/drumgizmo_vst.cc +++ b/vst/drumgizmo_vst.cc @@ -28,9 +28,47 @@ #include "constants.h" +#include + #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; + } + + void close() + { + plugingui->hide(); + } + + bool isOpen() + { + return false; + } + + void idle() + { + plugingui->processEvents(); + } + +private: + DrumGizmoVst* dgeff; + PluginGUI *plugingui; +}; + AudioEffect* createEffectInstance(audioMasterCallback audioMaster) { return new DrumGizmoVst(audioMaster); @@ -58,12 +96,19 @@ DrumGizmoVst::DrumGizmoVst(audioMasterCallback audioMaster) setNumOutputs(NUM_OUTPUTS); canProcessReplacing(); isSynth(); - char id[] = "DGV1"; // Four bytes typecasted into an unsigned integer + + char id[] = "DGV2"; // Four bytes typecasted into an unsigned integer setUniqueID(*(unsigned int*)id); + + // setUniqueID((unsigned int)time(NULL)); + } initProcess(); suspend(); + + DGEditor *editor = new DGEditor(this); + setEditor(editor); } DrumGizmoVst::~DrumGizmoVst() @@ -208,7 +253,7 @@ bool DrumGizmoVst::getProgramNameIndexed(VstInt32 category, VstInt32 index, bool DrumGizmoVst::getEffectName(char* name) { - vst_strncpy(name, "DrumGizmo", kVstMaxEffectNameLen); + vst_strncpy(name, "DrumGizmoA", kVstMaxEffectNameLen); return true; } @@ -220,7 +265,7 @@ bool DrumGizmoVst::getVendorString(char* text) bool DrumGizmoVst::getProductString(char* text) { - vst_strncpy(text, "Vst Synth", kVstMaxProductStrLen); + vst_strncpy(text, "Vst SynthA", kVstMaxProductStrLen); return true; } @@ -286,7 +331,7 @@ VstInt32 DrumGizmoVst::getMidiProgramCategory(VstInt32 channel, { cat->parentCategoryIndex = -1; // -1:no parent category cat->flags = 0; // reserved, none defined yet, zero. - VstInt32 category = cat->thisCategoryIndex; + // VstInt32 category = cat->thisCategoryIndex; vst_strncpy(cat->name, "Drums", 63); return 1; } @@ -331,7 +376,7 @@ void DrumGizmoVst::processReplacing(float** inputs, float** outputs, { output->setOutputs(outputs); - if(buffer_size != sampleFrames) { + if(buffer_size != (size_t)sampleFrames) { if(buffer) free(buffer); buffer_size = sampleFrames; buffer = (sample_t*)malloc(sizeof(sample_t) * buffer_size); diff --git a/vst/drumgizmo_vst.h b/vst/drumgizmo_vst.h index 90c7bfc..cf44cf7 100644 --- a/vst/drumgizmo_vst.h +++ b/vst/drumgizmo_vst.h @@ -28,6 +28,7 @@ #define __DRUMGIZMO_DRUMGIZMO_VST_H__ #include +#include #include @@ -77,13 +78,14 @@ public: bool hasMidiProgramsChanged(VstInt32 channel); bool getMidiKeyName(VstInt32 channel, MidiKeyName* keyName); + DrumGizmo *drumgizmo; + private: void initProcess(); // void noteOn(VstInt32 note, VstInt32 velocity, VstInt32 delta); // void noteOff(); void fillProgram(VstInt32 channel, VstInt32 prg, MidiProgramName* mpn); - DrumGizmo *drumgizmo; InputVST *input; OutputVST *output; size_t pos; -- cgit v1.2.3