1 |
/* |
/* |
2 |
* Copyright (C) 2006-2011 Andreas Persson |
* Copyright (C) 2006-2013 Andreas Persson |
3 |
* |
* |
4 |
* This program is free software; you can redistribute it and/or |
* This program is free software; you can redistribute it and/or |
5 |
* modify it under the terms of the GNU General Public License as |
* modify it under the terms of the GNU General Public License as |
22 |
#include "global.h" |
#include "global.h" |
23 |
#include "compat.h" |
#include "compat.h" |
24 |
|
|
25 |
|
VelocityCurve::VelocityCurve(double (gig::DimensionRegion::*getter)(uint8_t)) : |
26 |
|
getter(getter), dimreg(0) { |
27 |
|
set_size_request(80, 80); |
28 |
|
} |
29 |
|
|
30 |
|
#if (GTKMM_MAJOR_VERSION == 2 && GTKMM_MINOR_VERSION < 90) || GTKMM_MAJOR_VERSION < 2 |
31 |
|
bool VelocityCurve::on_expose_event(GdkEventExpose* e) { |
32 |
|
const Cairo::RefPtr<Cairo::Context>& cr = |
33 |
|
get_window()->create_cairo_context(); |
34 |
|
#if 0 |
35 |
|
} |
36 |
|
#endif |
37 |
|
#else |
38 |
|
bool VelocityCurve::on_draw(const Cairo::RefPtr<Cairo::Context>& cr) { |
39 |
|
#endif |
40 |
|
if (dimreg) { |
41 |
|
int w = get_width(); |
42 |
|
int h = get_height(); |
43 |
|
|
44 |
|
for (int pass = 0 ; pass < 2 ; pass++) { |
45 |
|
for (int x = 0 ; x < w ; x++) { |
46 |
|
int vel = int(x * 126.0 / w + 1.5); |
47 |
|
int y = int((1 - (dimreg->*getter)(vel)) * (h - 1)); |
48 |
|
|
49 |
|
if (x == 0) { |
50 |
|
cr->move_to(x, y); |
51 |
|
} else { |
52 |
|
cr->line_to(x, y); |
53 |
|
} |
54 |
|
} |
55 |
|
if (pass == 0) { |
56 |
|
cr->line_to(w - 1, h - 1); |
57 |
|
cr->line_to(0, h - 1); |
58 |
|
cr->set_source_rgba(0.5, 0.44, 1.0, 0.2); |
59 |
|
cr->fill(); |
60 |
|
} else { |
61 |
|
cr->set_line_width(3); |
62 |
|
cr->set_source_rgb(0.5, 0.44, 1.0); |
63 |
|
cr->stroke(); |
64 |
|
} |
65 |
|
} |
66 |
|
} |
67 |
|
return true; |
68 |
|
} |
69 |
|
|
70 |
|
|
71 |
|
CrossfadeCurve::CrossfadeCurve() : dimreg(0) { |
72 |
|
set_size_request(280, 80); |
73 |
|
} |
74 |
|
|
75 |
|
#if (GTKMM_MAJOR_VERSION == 2 && GTKMM_MINOR_VERSION < 90) || GTKMM_MAJOR_VERSION < 2 |
76 |
|
bool CrossfadeCurve::on_expose_event(GdkEventExpose* e) { |
77 |
|
const Cairo::RefPtr<Cairo::Context>& cr = |
78 |
|
get_window()->create_cairo_context(); |
79 |
|
#if 0 |
80 |
|
} |
81 |
|
#endif |
82 |
|
#else |
83 |
|
bool CrossfadeCurve::on_draw(const Cairo::RefPtr<Cairo::Context>& cr) { |
84 |
|
#endif |
85 |
|
if (dimreg && dimreg->Crossfade.out_end) { |
86 |
|
int w = get_width(); |
87 |
|
int h = get_height(); |
88 |
|
|
89 |
|
for (int pass = 0 ; pass < 2 ; pass++) { |
90 |
|
cr->move_to(dimreg->Crossfade.in_start / 127.0 * (w - 4) + 2, h); |
91 |
|
cr->line_to(dimreg->Crossfade.in_end / 127.0 * (w - 4) + 2, 2); |
92 |
|
cr->line_to(dimreg->Crossfade.out_start / 127.0 * (w - 4) + 2, 2); |
93 |
|
cr->line_to(dimreg->Crossfade.out_end / 127.0 * (w - 4) + 2, h); |
94 |
|
|
95 |
|
if (pass == 0) { |
96 |
|
cr->line_to(dimreg->Crossfade.in_start / 127.0 * (w - 4) + 2, |
97 |
|
h); |
98 |
|
cr->set_source_rgba(0.5, 0.44, 1.0, 0.2); |
99 |
|
cr->fill(); |
100 |
|
} else { |
101 |
|
cr->set_line_width(3); |
102 |
|
cr->set_source_rgb(0.5, 0.44, 1.0); |
103 |
|
cr->stroke(); |
104 |
|
} |
105 |
|
} |
106 |
|
} |
107 |
|
return true; |
108 |
|
} |
109 |
|
|
110 |
|
|
111 |
DimRegionEdit::DimRegionEdit() : |
DimRegionEdit::DimRegionEdit() : |
112 |
|
velocity_curve(&gig::DimensionRegion::GetVelocityAttenuation), |
113 |
|
release_curve(&gig::DimensionRegion::GetVelocityRelease), |
114 |
|
cutoff_curve(&gig::DimensionRegion::GetVelocityCutoff), |
115 |
eEG1PreAttack(_("Pre-attack"), 0, 100, 2), |
eEG1PreAttack(_("Pre-attack"), 0, 100, 2), |
116 |
eEG1Attack(_("Attack"), 0, 60, 3), |
eEG1Attack(_("Attack"), 0, 60, 3), |
117 |
eEG1Decay1(_("Decay 1"), 0.005, 60, 3), |
eEG1Decay1(_("Decay 1"), 0.005, 60, 3), |
434 |
addProp(eCrossfade_out_start); |
addProp(eCrossfade_out_start); |
435 |
addProp(eCrossfade_out_end); |
addProp(eCrossfade_out_end); |
436 |
|
|
437 |
|
Gtk::Frame* frame = new Gtk::Frame; |
438 |
|
frame->add(crossfade_curve); |
439 |
|
table[pageno]->attach(*frame, 1, 3, rowno, rowno + 1, |
440 |
|
Gtk::SHRINK, Gtk::SHRINK); |
441 |
|
rowno++; |
442 |
|
|
443 |
|
eCrossfade_in_start.signal_value_changed().connect( |
444 |
|
sigc::mem_fun(crossfade_curve, &CrossfadeCurve::queue_draw)); |
445 |
|
eCrossfade_in_end.signal_value_changed().connect( |
446 |
|
sigc::mem_fun(crossfade_curve, &CrossfadeCurve::queue_draw)); |
447 |
|
eCrossfade_out_start.signal_value_changed().connect( |
448 |
|
sigc::mem_fun(crossfade_curve, &CrossfadeCurve::queue_draw)); |
449 |
|
eCrossfade_out_end.signal_value_changed().connect( |
450 |
|
sigc::mem_fun(crossfade_curve, &CrossfadeCurve::queue_draw)); |
451 |
|
|
452 |
nextPage(); |
nextPage(); |
453 |
|
|
454 |
addHeader(_("General Filter Settings")); |
addHeader(_("General Filter Settings")); |
499 |
addProp(eVCFVelocityCurve); |
addProp(eVCFVelocityCurve); |
500 |
addProp(eVCFVelocityScale); |
addProp(eVCFVelocityScale); |
501 |
addProp(eVCFVelocityDynamicRange); |
addProp(eVCFVelocityDynamicRange); |
502 |
|
|
503 |
|
eVCFCutoffController.signal_value_changed().connect( |
504 |
|
sigc::mem_fun(cutoff_curve, &VelocityCurve::queue_draw)); |
505 |
|
eVCFVelocityCurve.signal_value_changed().connect( |
506 |
|
sigc::mem_fun(cutoff_curve, &VelocityCurve::queue_draw)); |
507 |
|
eVCFVelocityScale.signal_value_changed().connect( |
508 |
|
sigc::mem_fun(cutoff_curve, &VelocityCurve::queue_draw)); |
509 |
|
eVCFVelocityDynamicRange.signal_value_changed().connect( |
510 |
|
sigc::mem_fun(cutoff_curve, &VelocityCurve::queue_draw)); |
511 |
|
|
512 |
|
frame = new Gtk::Frame; |
513 |
|
frame->add(cutoff_curve); |
514 |
|
table[pageno]->attach(*frame, 1, 3, rowno, rowno + 1, |
515 |
|
Gtk::SHRINK, Gtk::SHRINK); |
516 |
|
rowno++; |
517 |
|
|
518 |
addProp(eVCFResonance); |
addProp(eVCFResonance); |
519 |
addProp(eVCFResonanceDynamic); |
addProp(eVCFResonanceDynamic); |
520 |
{ |
{ |
597 |
|
|
598 |
nextPage(); |
nextPage(); |
599 |
|
|
600 |
|
addHeader(_("Velocity Reponse")); |
601 |
eVelocityResponseCurve.set_choices(curve_type_texts, curve_type_values); |
eVelocityResponseCurve.set_choices(curve_type_texts, curve_type_values); |
602 |
addProp(eVelocityResponseCurve); |
addProp(eVelocityResponseCurve); |
603 |
addProp(eVelocityResponseDepth); |
addProp(eVelocityResponseDepth); |
604 |
addProp(eVelocityResponseCurveScaling); |
addProp(eVelocityResponseCurveScaling); |
605 |
|
|
606 |
|
eVelocityResponseCurve.signal_value_changed().connect( |
607 |
|
sigc::mem_fun(velocity_curve, &VelocityCurve::queue_draw)); |
608 |
|
eVelocityResponseDepth.signal_value_changed().connect( |
609 |
|
sigc::mem_fun(velocity_curve, &VelocityCurve::queue_draw)); |
610 |
|
eVelocityResponseCurveScaling.signal_value_changed().connect( |
611 |
|
sigc::mem_fun(velocity_curve, &VelocityCurve::queue_draw)); |
612 |
|
|
613 |
|
frame = new Gtk::Frame; |
614 |
|
frame->add(velocity_curve); |
615 |
|
table[pageno]->attach(*frame, 1, 3, rowno, rowno + 1, |
616 |
|
Gtk::SHRINK, Gtk::SHRINK); |
617 |
|
rowno++; |
618 |
|
|
619 |
|
addHeader(_("Release Velocity Reponse")); |
620 |
eReleaseVelocityResponseCurve.set_choices(curve_type_texts, |
eReleaseVelocityResponseCurve.set_choices(curve_type_texts, |
621 |
curve_type_values); |
curve_type_values); |
622 |
addProp(eReleaseVelocityResponseCurve); |
addProp(eReleaseVelocityResponseCurve); |
623 |
addProp(eReleaseVelocityResponseDepth); |
addProp(eReleaseVelocityResponseDepth); |
624 |
|
|
625 |
|
eReleaseVelocityResponseCurve.signal_value_changed().connect( |
626 |
|
sigc::mem_fun(release_curve, &VelocityCurve::queue_draw)); |
627 |
|
eReleaseVelocityResponseDepth.signal_value_changed().connect( |
628 |
|
sigc::mem_fun(release_curve, &VelocityCurve::queue_draw)); |
629 |
|
frame = new Gtk::Frame; |
630 |
|
frame->add(release_curve); |
631 |
|
table[pageno]->attach(*frame, 1, 3, rowno, rowno + 1, |
632 |
|
Gtk::SHRINK, Gtk::SHRINK); |
633 |
|
rowno++; |
634 |
|
|
635 |
addProp(eReleaseTriggerDecay); |
addProp(eReleaseTriggerDecay); |
636 |
{ |
{ |
637 |
const char* choices[] = { _("none"), _("effect4depth"), _("effect5depth"), 0 }; |
const char* choices[] = { _("none"), _("effect4depth"), _("effect5depth"), 0 }; |
782 |
void DimRegionEdit::set_dim_region(gig::DimensionRegion* d) |
void DimRegionEdit::set_dim_region(gig::DimensionRegion* d) |
783 |
{ |
{ |
784 |
dimregion = d; |
dimregion = d; |
785 |
|
velocity_curve.set_dim_region(d); |
786 |
|
release_curve.set_dim_region(d); |
787 |
|
cutoff_curve.set_dim_region(d); |
788 |
|
crossfade_curve.set_dim_region(d); |
789 |
|
|
790 |
set_sensitive(d); |
set_sensitive(d); |
791 |
if (!d) return; |
if (!d) return; |