compressors: added mkup_gain reset, fixed smooth_only
[goodguy/cinelerra.git] / cinelerra-5.1 / plugins / compressormulti / comprmultigui.C
1 /*
2  * CINELERRA
3  * Copyright (C) 2008-2019 Adam Williams <broadcast at earthling dot net>
4  * 
5  * This program is free software; you can redistribute it and/or modify
6  * it under the terms of the GNU General Public License as published by
7  * the Free Software Foundation; either version 2 of the License, or
8  * (at your option) any later version.
9  * 
10  * This program is distributed in the hope that it will be useful,
11  * but WITHOUT ANY WARRANTY; without even the implied warranty of
12  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
13  * GNU General Public License for more details.
14  * 
15  * You should have received a copy of the GNU General Public License
16  * along with this program; if not, write to the Free Software
17  * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
18  * 
19  */
20
21 #include "asset.h"
22 #include "bchash.h"
23 #include "bcsignals.h"
24 #include "clip.h"
25 #include "comprmultigui.h"
26 #include "cursors.h"
27 #include "edl.h"
28 #include "edlsession.h"
29 #include "eqcanvas.h"
30 #include "file.h"
31 #include "language.h"
32 #include "theme.h"
33 #include "units.h"
34
35 #include <string.h>
36
37 ComprMultiWindow::ComprMultiWindow(ComprMultiEffect *plugin)
38  : PluginClientWindow(plugin, xS(650),yS(560), xS(650),yS(560), 0)
39 {
40         this->plugin = plugin;
41         char string[BCTEXTLEN];
42 // set the default directory
43         sprintf(string, "%s/compressormulti.rc", File::get_config_path());
44         defaults = new BC_Hash(string);
45         defaults->load();
46         plugin->config.current_band = defaults->get("CURRENT_BAND", plugin->config.current_band);
47         gain_frame = 0;
48         freq_frame = 0;
49 }
50
51 ComprMultiWindow::~ComprMultiWindow()
52 {
53         defaults->update("CURRENT_BAND", plugin->config.current_band);
54         defaults->save();
55         delete defaults;
56
57         delete eqcanvas;
58         delete reaction;
59         delete x_text;
60         delete y_text;
61         delete trigger;
62         delete decay;
63         delete gain_frame;
64         delete freq_frame;
65 }
66
67
68 void ComprMultiWindow::create_objects()
69 {
70         int margin = client->get_theme()->widget_border;
71         int x = margin, y = margin;
72         int control_margin = xS(150);
73         int canvas_y2 = get_h() * 2 / 3;
74         BC_Title *title;
75         add_subwindow(title = new BC_Title(x, y, "In:"));
76         int y2 = y + title->get_h() + margin;
77         EDL *edl = plugin->get_edl();
78         add_subwindow(in = new BC_Meter(x, y2, METER_VERT,
79                 canvas_y2 - y2,
80                 edl->session->min_meter_db,
81                 edl->session->max_meter_db,
82                 edl->session->meter_format,
83                 1, // use_titles
84                 -1)); // span
85         x += in->get_w() + margin;
86
87         add_subwindow(title = new BC_Title(x, y, "Gain:"));
88         add_subwindow(gain_change = new BC_Meter(x, y2, METER_VERT,
89                 canvas_y2 - y2,
90                 MIN_GAIN_CHANGE,
91                 MAX_GAIN_CHANGE,
92                 METER_DB,
93                 1, // use_titles
94                 -1, // span
95                 0, // downmix
96                 1)); // is_gain_change
97         x += gain_change->get_w() + xS(35);
98
99         add_subwindow(title = new BC_Title(x, y, _("Current band:")));
100
101         int x1 = title->get_x() + title->get_w() + margin;
102         char string[BCTEXTLEN];
103         for( int i = 0; i < TOTAL_BANDS; i++ ) {
104                 sprintf(string, "%d", i + 1);
105                 add_subwindow(band[i] = new ComprMultiBand(this, plugin, 
106                         x1, y, i, string));
107                 x1 += band[i]->get_w() + margin;
108         }
109         y += band[0]->get_h() + 1;
110
111
112         add_subwindow(title = new BC_Title(x, y,
113                         _("Sound level (Press shift to snap to grid):")));
114         y += title->get_h() + 1;
115         add_subwindow(canvas = new ComprMultiCanvas(plugin, this,
116                 x, y, get_w() - x - control_margin - xS(10), canvas_y2 - y));
117         y += canvas->get_h() + yS(30);
118
119         add_subwindow(title = new BC_Title(margin, y, _("Bandwidth:")));
120         y += title->get_h();
121         eqcanvas = new EQCanvas(this, margin, y,
122                 canvas->get_w() + x - margin, get_h() - y - margin,
123                 plugin->config.min_db, 0.0);
124         eqcanvas->freq_divisions = 10;
125         eqcanvas->initialize();
126
127         x = get_w() - control_margin;
128         y = margin;
129         add_subwindow(title = new BC_Title(x, y, _("Attack secs:")));
130         y += title->get_h();
131         reaction = new ComprMultiReaction(plugin, this, x, y);
132         reaction->create_objects();
133         y += reaction->get_h() + margin;
134
135         add_subwindow(title = new BC_Title(x, y, _("Release secs:")));
136         y += title->get_h();
137         decay = new ComprMultiDecay(plugin, this, x, y);
138         decay->create_objects();
139         y += decay->get_h() + margin;
140
141         add_subwindow(solo = new ComprMultiSolo(plugin, x, y));
142         y += solo->get_h() + margin;
143         add_subwindow(bypass = new ComprMultiBypass(plugin, x, y));
144         y += bypass->get_h() + margin;
145         add_subwindow(title = new BC_Title(x, y, _("Output:")));
146         y += title->get_h();
147
148         y_text = new ComprMultiY(plugin, this, x, y);
149         y_text->create_objects();
150         y += y_text->get_h() + margin;
151
152         add_subwindow(title = new BC_Title(x, y, _("Input:")));
153         y += title->get_h();
154         x_text = new ComprMultiX(plugin, this, x, y);
155         x_text->create_objects();
156         y += x_text->get_h() + margin;
157
158         add_subwindow(clear = new ComprMultiClear(plugin, this, x, y));
159         y += clear->get_h() + margin;
160
161         add_subwindow(title = new BC_Title(x, y, _("Gain:")));
162         
163         int x2 = get_w() - (margin + BC_Pot::calculate_w()) * 2;
164         int x3 = get_w() - (margin + BC_Pot::calculate_w());
165         add_subwindow(title = new BC_Title(x2, y, _("Freq range:")));
166         y += title->get_h() + margin;
167
168         add_subwindow(mkup_gain = new ComprMultiMkupGain(plugin, this, x, y,
169                 &plugin->config.bands[plugin->config.current_band].mkup_gain,
170                 -10., 10.));
171 // the previous high frequency
172         add_subwindow(freq1 = new ComprMultiQPot(this, plugin, x2, y,
173                 plugin->config.current_band == 0 ? 0 :
174                 &plugin->config.bands[plugin->config.current_band-1].freq));
175 // the current high frequency
176         add_subwindow(freq2 = new ComprMultiQPot(this, plugin, x3, y,
177                 plugin->config.current_band!=TOTAL_BANDS-1 ? 0 :
178                 &plugin->config.bands[plugin->config.current_band].freq));
179         y += freq1->get_h() + margin;
180
181         BC_Bar *bar;
182         add_subwindow(bar = new BC_Bar(x, y, get_w() - x - margin));
183         y += bar->get_h() + margin;
184
185         add_subwindow(title = new BC_Title(x, y, _("Trigger Type:")));
186         y += title->get_h();
187         add_subwindow(input = new ComprMultiInput(plugin, this, x, y));
188         input->create_objects();
189         y += input->get_h() + margin;
190         add_subwindow(title = new BC_Title(x, y, _("Channel:")));
191         y += title->get_h();
192
193         trigger = new ComprMultiTrigger(plugin, this, x, y);
194         trigger->create_objects();
195         if( plugin->config.input != ComprMultiConfig::TRIGGER ) trigger->disable();
196         y += trigger->get_h() + margin;
197
198         add_subwindow(smooth = new ComprMultiSmooth(plugin, x, y));
199         y += smooth->get_h() + margin;
200
201         add_subwindow(title = new BC_Title(x, y, _("Steepness:")));
202         add_subwindow(q = new ComprMultiFPot(this, plugin, 
203                 get_w() - margin - BC_Pot::calculate_w(), y, 
204                 &plugin->config.q, 0, 1));
205         y += q->get_h() + margin;
206
207         add_subwindow(title = new BC_Title(x, y, _("Window size:")));
208         y += title->get_h();
209         add_subwindow(size = new ComprMultiSize(this, plugin, x, y));
210         size->create_objects();
211         size->update(plugin->config.window_size);
212         y += size->get_h() + margin;
213
214         add_subwindow(reset = new ComprMultiReset(plugin, this, x, y));
215
216         canvas->create_objects();
217         update_eqcanvas();
218         show_window();
219 }
220
221 // called when the user selects a different band
222 void ComprMultiWindow::update()
223 {
224         int curr_band = plugin->config.current_band;
225         for( int i = 0; i < TOTAL_BANDS; i++ )
226                 band[i]->update(curr_band == i);
227
228         int *ptr1 = !curr_band ? 0 :
229                 &plugin->config.bands[curr_band-1].freq;
230         freq1->output = ptr1;
231         if( ptr1 ) {
232                 freq1->update(*ptr1);
233                 freq1->enable();
234         }
235         else {
236                 freq1->update(0);
237                 freq1->disable();
238         }
239
240 // top band edits the penultimate band
241         int *ptr2 = curr_band == TOTAL_BANDS-1 ? 0 :
242                 &plugin->config.bands[curr_band].freq;
243         freq2->output = ptr2;
244         if( ptr2 ) {
245                 freq2->update(*ptr2);
246                 freq2->enable();
247         }
248         else {
249                 freq2->update(0);
250                 freq2->disable();
251         }
252
253         q->update(plugin->config.q);
254         BandConfig *band_config = &plugin->config.bands[curr_band];
255         double *ptr3 = &band_config->mkup_gain;
256         mkup_gain->output = ptr3;
257         mkup_gain->update(*ptr3);
258         solo->update(band_config->solo);
259         bypass->update(band_config->bypass);
260         size->update(plugin->config.window_size);
261
262         if( atol(trigger->get_text()) != plugin->config.trigger ) {
263                 trigger->update((int64_t)plugin->config.trigger);
264         }
265
266         if( strcmp(input->get_text(), ComprMultiInput::value_to_text(plugin->config.input)) ) {
267                 input->set_text(ComprMultiInput::value_to_text(plugin->config.input));
268         }
269
270         if( plugin->config.input != ComprMultiConfig::TRIGGER && trigger->get_enabled() ) {
271                 trigger->disable();
272         }
273         else
274         if( plugin->config.input == ComprMultiConfig::TRIGGER && !trigger->get_enabled() ) {
275                 trigger->enable();
276         }
277
278         if( !EQUIV(atof(reaction->get_text()), band_config->attack_len) ) {
279                 reaction->update((float)band_config->attack_len);
280         }
281
282         if( !EQUIV(atof(decay->get_text()), band_config->release_len) ) {
283                 decay->update((float)band_config->release_len);
284         }
285
286         smooth->update(plugin->config.smoothing_only);
287         if( canvas->current_operation == ComprMultiCanvas::DRAG ) {
288                 x_text->update((float)band_config->levels.values[canvas->current_point].x);
289                 y_text->update((float)band_config->levels.values[canvas->current_point].y);
290         }
291
292         canvas->update();
293         update_eqcanvas();
294 }
295
296
297
298
299 void ComprMultiWindow::update_eqcanvas()
300 {
301         plugin->calculate_envelope();
302 // filter GUI frames by band & data type
303         int have_meter = 0;
304         CompressorClientFrame *frame = 0;
305 // gdb plugin->dump_frames();
306         double tracking_position = plugin->get_tracking_position();
307         int dir = plugin->get_tracking_direction() == PLAY_REVERSE ? -1 : 1;
308         while( (frame = (CompressorClientFrame*)plugin->next_gui_frame()) ) {
309                 if( dir*(frame->position - tracking_position) > 0 ) break;
310                 if( frame->band == plugin->config.current_band ) {
311 // only frames for desired band
312                         switch( frame->type ) {
313                         case FREQ_COMPRESSORFRAME: {
314                                 delete freq_frame;
315                                 freq_frame = (CompressorFreqFrame *)
316                                         plugin->get_gui_frame(0, 0);
317                                 continue; }
318                         case GAIN_COMPRESSORFRAME: {
319                                 delete gain_frame;
320                                 gain_frame = (CompressorGainFrame *)
321                                         plugin->get_gui_frame(0, 0);
322                                 have_meter = 1;
323                                 continue; }
324                         }
325                 }
326                 delete plugin->get_gui_frame(0, 0);
327         }
328         if( have_meter ) {
329                 gain_change->update(gain_frame->gain, 0);
330                 in->update(gain_frame->level, 0);
331         }
332
333 #ifndef DRAW_AFTER_BANDPASS
334         eqcanvas->update_spectrogram(freq_frame); 
335 #else
336         eqcanvas->update_spectrogram(freq_frame,
337                 plugin->config.current_band * plugin->config.window_size / 2,
338                 TOTAL_BANDS * plugin->config.window_size / 2,
339                 plugin->config.window_size);
340 #endif
341
342 // draw the active band on top of the others
343         for( int pass = 0; pass < 2; pass++ ) {
344                 for( int band = 0; band < TOTAL_BANDS; band++ ) {
345                         if( band == plugin->config.current_band && pass == 0 ||
346                                 band != plugin->config.current_band && pass == 1 ) {
347                                 continue;
348                         }
349
350                         eqcanvas->draw_envelope(plugin->band_states[band]->envelope,
351                                 plugin->PluginAClient::project_sample_rate,
352                                 plugin->config.window_size,
353                                 band == plugin->config.current_band,
354                                 0);
355                 }
356         }
357         eqcanvas->canvas->flash(1);
358 }
359
360 int ComprMultiWindow::resize_event(int w, int h)
361 {
362         return 1;
363 }
364
365
366 ComprMultiFPot::ComprMultiFPot(ComprMultiWindow *gui, ComprMultiEffect *plugin, 
367                 int x, int y, double *output, double min, double max)
368  : BC_FPot(x, y, *output, min, max)
369 {
370         this->gui = gui;
371         this->plugin = plugin;
372         this->output = output;
373         set_precision(0.01);
374 }
375
376 int ComprMultiFPot::handle_event()
377 {
378         *output = get_value();
379         plugin->send_configure_change();
380         gui->update_eqcanvas();
381         return 1;
382 }
383
384
385 ComprMultiQPot::ComprMultiQPot(ComprMultiWindow *gui, ComprMultiEffect *plugin, 
386                 int x, int y, int *output)
387  : BC_QPot(x, y, output ? *output : 0)
388 {
389         this->gui = gui;
390         this->plugin = plugin;
391         this->output = output;
392 }
393
394
395 int ComprMultiQPot::handle_event()
396 {
397         if( output ) {
398                 *output = get_value();
399                 plugin->send_configure_change();
400                 gui->update_eqcanvas();
401         }
402         return 1;
403 }
404
405
406 ComprMultiSize::ComprMultiSize(ComprMultiWindow *gui, 
407         ComprMultiEffect *plugin, int x, int y)
408  : BC_PopupMenu(x, y, xS(100), "4096", 1)
409 {
410         this->gui = gui;
411         this->plugin = plugin;
412 }
413
414 int ComprMultiSize::handle_event()
415 {
416         plugin->config.window_size = atoi(get_text());
417         plugin->send_configure_change();
418         gui->update_eqcanvas();
419         return 1;
420 }
421
422 void ComprMultiSize::create_objects()
423 {
424         add_item(new BC_MenuItem("2048"));
425         add_item(new BC_MenuItem("4096"));
426         add_item(new BC_MenuItem("8192"));
427         add_item(new BC_MenuItem("16384"));
428         add_item(new BC_MenuItem("32768"));
429         add_item(new BC_MenuItem("65536"));
430         add_item(new BC_MenuItem("131072"));
431         add_item(new BC_MenuItem("262144"));
432 }
433
434 void ComprMultiSize::update(int size)
435 {
436         char string[BCTEXTLEN];
437         sprintf(string, "%d", size);
438         set_text(string);
439 }
440
441
442 ComprMultiMkupGain::ComprMultiMkupGain(ComprMultiEffect *plugin,
443                 ComprMultiWindow *window, int x, int y,
444                 double *output, double min, double max)
445  : BC_FPot(x, y, *output, min, max)
446 {
447         this->window = window;
448         this->plugin = plugin;
449         this->output = output;
450         set_precision(0.01);
451 }
452
453 int ComprMultiMkupGain::handle_event()
454 {
455         *output = get_value();
456         plugin->send_configure_change();
457         window->canvas->update();
458         return 1;
459 }
460
461
462 ComprMultiCanvas::ComprMultiCanvas(ComprMultiEffect *plugin, 
463                 ComprMultiWindow *window, int x, int y, int w, int h)
464  : CompressorCanvasBase(&plugin->config, plugin, window, x, y, w, h)
465 {
466 }
467
468 void ComprMultiCanvas::update_window()
469 {
470         ((ComprMultiWindow*)window)->update();
471 }
472
473
474 ComprMultiReaction::ComprMultiReaction(ComprMultiEffect *plugin, 
475                 ComprMultiWindow *window, int x, int y) 
476  : BC_TumbleTextBox(window,
477         (float)plugin->config.bands[plugin->config.current_band].attack_len,
478         (float)MIN_ATTACK, (float)MAX_ATTACK, x, y, xS(100))
479 {
480         this->plugin = plugin;
481         set_increment(0.1);
482         set_precision(2);
483 }
484
485 int ComprMultiReaction::handle_event()
486 {
487         plugin->config.bands[plugin->config.current_band].attack_len = atof(get_text());
488         plugin->send_configure_change();
489         return 1;
490 }
491
492
493
494 ComprMultiDecay::ComprMultiDecay(ComprMultiEffect *plugin, 
495                 ComprMultiWindow *window, int x, int y) 
496  : BC_TumbleTextBox(window,
497         (float)plugin->config.bands[plugin->config.current_band].release_len,
498         (float)MIN_DECAY, (float)MAX_DECAY, x, y, xS(100))
499 {
500         this->plugin = plugin;
501         set_increment(0.1);
502         set_precision(2);
503 }
504 int ComprMultiDecay::handle_event()
505 {
506         plugin->config.bands[plugin->config.current_band].release_len = atof(get_text());
507         plugin->send_configure_change();
508         return 1;
509 }
510
511
512 ComprMultiX::ComprMultiX(ComprMultiEffect *plugin, 
513                 ComprMultiWindow *window, int x, int y) 
514  : BC_TumbleTextBox(window, (float)0.0,
515         plugin->config.min_db, plugin->config.max_db, x, y, xS(100))
516 {
517         this->plugin = plugin;
518         this->window = window;
519         set_increment(0.1);
520         set_precision(2);
521 }
522 int ComprMultiX::handle_event()
523 {
524         BandConfig *band_config = &plugin->config.bands[plugin->config.current_band];
525
526         int current_point = window->canvas->current_point;
527         if( current_point < band_config->levels.total ) {
528                 band_config->levels.values[current_point].x = atof(get_text());
529                 window->canvas->update();
530                 plugin->send_configure_change();
531         }
532         return 1;
533 }
534
535
536 ComprMultiY::ComprMultiY(ComprMultiEffect *plugin, 
537                 ComprMultiWindow *window, int x, int y) 
538  : BC_TumbleTextBox(window, (float)0.0,
539         plugin->config.min_db, plugin->config.max_db, x, y, xS(100))
540 {
541         this->plugin = plugin;
542         this->window = window;
543         set_increment(0.1);
544         set_precision(2);
545 }
546 int ComprMultiY::handle_event()
547 {
548         BandConfig *band_config = &plugin->config.bands[plugin->config.current_band];
549
550         int current_point = window->canvas->current_point;
551         if( current_point < band_config->levels.total ) {
552                 band_config->levels.values[current_point].y = atof(get_text());
553                 window->canvas->update();
554                 plugin->send_configure_change();
555         }
556         return 1;
557 }
558
559
560 ComprMultiTrigger::ComprMultiTrigger(ComprMultiEffect *plugin, 
561                 ComprMultiWindow *window, int x, int y) 
562  : BC_TumbleTextBox(window, (int)plugin->config.trigger,
563         MIN_TRIGGER, MAX_TRIGGER, x, y, xS(100))
564 {
565         this->plugin = plugin;
566 }
567 int ComprMultiTrigger::handle_event()
568 {
569         plugin->config.trigger = atol(get_text());
570         plugin->send_configure_change();
571         return 1;
572 }
573
574
575 ComprMultiInput::ComprMultiInput(ComprMultiEffect *plugin,
576         ComprMultiWindow *window, int x, int y) 
577  : BC_PopupMenu(x, y, xS(100), 
578         ComprMultiInput::value_to_text(plugin->config.input), 1)
579 {
580         this->plugin = plugin;
581         this->window = window;
582 }
583 int ComprMultiInput::handle_event()
584 {
585         plugin->config.input = text_to_value(get_text());
586         window->update();
587         plugin->send_configure_change();
588         return 1;
589 }
590
591 void ComprMultiInput::create_objects()
592 {
593         for( int i = 0; i < 3; i++ ) {
594                 add_item(new BC_MenuItem(value_to_text(i)));
595         }
596 }
597
598 const char* ComprMultiInput::value_to_text(int value)
599 {
600         switch( value ) {
601         case ComprMultiConfig::TRIGGER: return "Trigger";
602         case ComprMultiConfig::MAX: return "Maximum";
603         case ComprMultiConfig::SUM: return "Total";
604         }
605
606         return "Trigger";
607 }
608
609 int ComprMultiInput::text_to_value(char *text)
610 {
611         for( int i = 0; i < 3; i++ ) {
612                 if( !strcmp(value_to_text(i), text) ) return i;
613         }
614
615         return ComprMultiConfig::TRIGGER;
616 }
617
618
619 ComprMultiClear::ComprMultiClear(ComprMultiEffect *plugin,
620                 ComprMultiWindow *window, int x, int y) 
621  : BC_GenericButton(x, y, _("Clear"))
622 {
623         this->plugin = plugin;
624         this->window = window;
625 }
626
627 int ComprMultiClear::handle_event()
628 {
629         BandConfig *band_config = &plugin->config.bands[plugin->config.current_band];
630         band_config->mkup_gain = 0.0;
631         band_config->levels.remove_all();
632 //plugin->config.dump();
633         window->update();
634         plugin->send_configure_change();
635         return 1;
636 }
637
638 ComprMultiReset::ComprMultiReset(ComprMultiEffect *plugin,
639                 ComprMultiWindow *window, int x, int y) 
640  : BC_GenericButton(x, y, _("Reset"))
641 {
642         this->plugin = plugin;
643         this->window = window;
644 }
645
646 int ComprMultiReset::handle_event()
647 {
648         plugin->config.q = 1.0;
649         plugin->config.window_size = 4096;
650         plugin->config.reset_bands();
651         plugin->config.reset_base();
652 //plugin->config.dump();
653         window->update();
654         plugin->send_configure_change();
655         return 1;
656 }
657
658
659 ComprMultiSmooth::ComprMultiSmooth(ComprMultiEffect *plugin, int x, int y) 
660  : BC_CheckBox(x, y, plugin->config.smoothing_only, _("Smooth only"))
661 {
662         this->plugin = plugin;
663 }
664
665 int ComprMultiSmooth::handle_event()
666 {
667         plugin->config.smoothing_only = get_value();
668         plugin->send_configure_change();
669         return 1;
670 }
671
672
673 ComprMultiSolo::ComprMultiSolo(ComprMultiEffect *plugin, int x, int y) 
674  : BC_CheckBox(x, y, plugin->config.bands[plugin->config.current_band].solo, _("Solo band"))
675 {
676         this->plugin = plugin;
677 }
678
679 int ComprMultiSolo::handle_event()
680 {
681         plugin->config.bands[plugin->config.current_band].solo = get_value();
682         for( int i = 0; i < TOTAL_BANDS; i++ ) {
683                 if( i != plugin->config.current_band ) {
684                         plugin->config.bands[i].solo = 0;
685                 }
686         }
687         plugin->send_configure_change();
688         return 1;
689 }
690
691
692 ComprMultiBypass::ComprMultiBypass(ComprMultiEffect *plugin, int x, int y) 
693  : BC_CheckBox(x, y, plugin->config.bands[plugin->config.current_band].bypass, _("Bypass band"))
694 {
695         this->plugin = plugin;
696 }
697
698 int ComprMultiBypass::handle_event()
699 {
700         plugin->config.bands[plugin->config.current_band].bypass = get_value();
701         plugin->send_configure_change();
702         return 1;
703 }
704
705
706 ComprMultiBand::ComprMultiBand(ComprMultiWindow *window, 
707                 ComprMultiEffect *plugin, int x, int y, int number,
708                 char *text)
709  : BC_Radial(x, y, plugin->config.current_band == number, text)
710 {
711         this->window = window;
712         this->plugin = plugin;
713         this->number = number;
714 }
715
716 int ComprMultiBand::handle_event()
717 {
718         if( plugin->config.current_band != number ) {
719                 plugin->config.current_band = number;
720                 window->update();
721         }
722         return 1;
723 }
724
725 // dump envelope sum
726 //       printf("ComprMultiWindow::update_eqcanvas %d\n", __LINE__);
727 //       for( int i = 0; i < plugin->config.window_size / 2; i++ )
728 //       {
729 //               double sum = 0;
730 //               for( int band = 0; band < TOTAL_BANDS; band++ )
731 //               {
732 //                       sum += plugin->engines[band]->envelope[i];
733 //               }
734 //               
735 //               printf("%f ", sum);
736 //               for( int band = 0; band < TOTAL_BANDS; band++ )
737 //               {
738 //                       printf("%f ", plugin->engines[band]->envelope[i]);
739 //               }
740 //               printf("\n");
741 //       }
742
743