Skip to content

Commit b9995b9

Browse files
committed
Small changes to the knob view
1 parent 4136c60 commit b9995b9

File tree

4 files changed

+15
-6
lines changed

4 files changed

+15
-6
lines changed

NeuralRack/clap/NeuralRack.cc

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -57,7 +57,6 @@ class NeuralRack
5757
fetch.stop();
5858
free(ui->private_ptr);
5959
free(ui);
60-
//cleanup();
6160
}
6261

6362
void startGui(Window window) {
@@ -545,6 +544,8 @@ class NeuralRack
545544

546545
void cleanup() {
547546
plugin_cleanup(ui);
547+
free(ui->private_ptr);
548+
ui->private_ptr = NULL;
548549
// Xputty free all memory used
549550
// main_quit(&ui->main);
550551
}

NeuralRack/clap/NeuralRackClap.cpp

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -274,6 +274,7 @@ static bool neuralrack_gui_create(const clap_plugin *plugin, const char *api, bo
274274
if (!plug->guiIsCreated) {
275275
plug->r->startGui();
276276
plug->r->enableEngine(1);
277+
fprintf(stderr, "createGui\n");
277278
}
278279
plug->guiIsCreated = true;
279280
return true;
@@ -283,6 +284,7 @@ static bool neuralrack_gui_create(const clap_plugin *plugin, const char *api, bo
283284

284285
static void neuralrack_gui_destroy(const clap_plugin *plugin) {
285286
neuralrack_plugin_t *plug = (neuralrack_plugin_t *)plugin->plugin_data;
287+
if (plug->guiIsCreated) plug->r->cleanup();
286288
plug->r->quitGui();
287289
plug->guiIsCreated = false;
288290
}

NeuralRack/gui/widgets.cc

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -494,7 +494,7 @@ void setKnobFrame(Widget_t* w, int x, int y, int wi, int h) {
494494
cairo_pattern_add_color_stop_rgba
495495
(pat, 0, c->bg[0]*4.5, c->bg[1]*4.5, c->bg[2]*4.5,1.0);
496496
cairo_pattern_add_color_stop_rgba
497-
(pat, 0.2, c->bg[0]*3.0, c->bg[1]*3.0, c->bg[2]*4.0,1.0);
497+
(pat, 0.2, c->bg[0]*3.0, c->bg[1]*3.0, c->bg[2]*3.0,1.0);
498498
cairo_pattern_add_color_stop_rgba
499499
(pat, 0.3, c->bg[0]*2.0, c->bg[1]*2.0, c->bg[2]*2.0,1.0);
500500
cairo_pattern_add_color_stop_rgba
@@ -550,9 +550,9 @@ static void draw_my_knob(void *w_, void* user_data) {
550550
);
551551
cairo_pattern_add_color_stop_rgb(pat, 0.00, 0.33, 0.33, 0.33);
552552
cairo_pattern_add_color_stop_rgb(pat, 0.1, 0.20, 0.20, 0.20);
553-
cairo_pattern_add_color_stop_rgb(pat, 0.30, 0.09, 0.09, 0.09);
554-
cairo_pattern_add_color_stop_rgb(pat, 0.65, 0.03, 0.03, 0.03);
555-
cairo_pattern_add_color_stop_rgb(pat, 1.00, 0.01, 0.01, 0.01);
553+
cairo_pattern_add_color_stop_rgb(pat, 0.25, 0.09, 0.09, 0.09);
554+
cairo_pattern_add_color_stop_rgb(pat, 0.65, 0.063, 0.063, 0.063);
555+
cairo_pattern_add_color_stop_rgb(pat, 1.00, 0.033, 0.033, 0.033);
556556
cairo_set_source(w->crb, pat);
557557
cairo_fill_preserve(w->crb);
558558
cairo_pattern_destroy(pat);

NeuralRack/vst2/NeuralRackvst.cpp

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -43,6 +43,7 @@ struct neuralrack_plugin_t {
4343
float SampleRate;
4444
std::string state;
4545
bool isInited;
46+
bool guiIsCreated;
4647
};
4748

4849
/****************************************************************
@@ -139,11 +140,15 @@ static intptr_t dispatcher(AEffect* effect, int32_t opCode, int32_t index, intpt
139140
plug->r->enableEngine(1);
140141
plug->r->setParent(hostWin);
141142
plug->r->showGui();
143+
plug->guiIsCreated = true;
142144
break;
143145
}
144-
case effEditClose:
146+
case effEditClose: {
147+
if (plug->guiIsCreated) plug->r->cleanup();
145148
plug->r->quitGui();
149+
plug->guiIsCreated = false;
146150
break;
151+
}
147152
case effEditIdle:
148153
break;
149154
//case effGetProgram:
@@ -182,6 +187,7 @@ AEffect* VSTPluginMain(audioMasterCallback audioMaster) {
182187
plug->editorRect = {0, 0, (short) plug->height, (short) plug->width};
183188
plug->SampleRate = 48000.0;
184189
plug->isInited = false;
190+
plug->guiIsCreated = false;
185191

186192
effect->magic = kEffectMagic;
187193
effect->dispatcher = dispatcher;

0 commit comments

Comments
 (0)