39 |
bool VelocityCurve::on_expose_event(GdkEventExpose* e) { |
bool VelocityCurve::on_expose_event(GdkEventExpose* e) { |
40 |
const Cairo::RefPtr<Cairo::Context>& cr = |
const Cairo::RefPtr<Cairo::Context>& cr = |
41 |
get_window()->create_cairo_context(); |
get_window()->create_cairo_context(); |
|
#if 0 |
|
|
} |
|
|
#endif |
|
42 |
#else |
#else |
43 |
bool VelocityCurve::on_draw(const Cairo::RefPtr<Cairo::Context>& cr) { |
bool VelocityCurve::on_draw(const Cairo::RefPtr<Cairo::Context>& cr) { |
44 |
#endif |
#endif |
81 |
bool CrossfadeCurve::on_expose_event(GdkEventExpose* e) { |
bool CrossfadeCurve::on_expose_event(GdkEventExpose* e) { |
82 |
const Cairo::RefPtr<Cairo::Context>& cr = |
const Cairo::RefPtr<Cairo::Context>& cr = |
83 |
get_window()->create_cairo_context(); |
get_window()->create_cairo_context(); |
|
#if 0 |
|
|
} |
|
|
#endif |
|
84 |
#else |
#else |
85 |
bool CrossfadeCurve::on_draw(const Cairo::RefPtr<Cairo::Context>& cr) { |
bool CrossfadeCurve::on_draw(const Cairo::RefPtr<Cairo::Context>& cr) { |
86 |
#endif |
#endif |
149 |
} |
} |
150 |
|
|
151 |
|
|
152 |
|
LFOGraph::LFOGraph() : dimreg(0) { |
153 |
|
set_size_request(500, 100); |
154 |
|
} |
155 |
|
|
156 |
|
#if (GTKMM_MAJOR_VERSION == 2 && GTKMM_MINOR_VERSION < 90) || GTKMM_MAJOR_VERSION < 2 |
157 |
|
bool LFOGraph::on_expose_event(GdkEventExpose* e) { |
158 |
|
const Cairo::RefPtr<Cairo::Context>& cr = |
159 |
|
get_window()->create_cairo_context(); |
160 |
|
#else |
161 |
|
bool LFOGraph::on_draw(const Cairo::RefPtr<Cairo::Context>& cr) { |
162 |
|
#endif |
163 |
|
if (dimreg) { |
164 |
|
const int w = get_width(); |
165 |
|
const int h = get_height(); |
166 |
|
const bool sensitive = is_sensitive(); |
167 |
|
const bool signedRange = this->signedRange(); |
168 |
|
const float visiblePeriods = 5.f; // such that minimum LFO frequency 0.1 Hz draws exactly a half period |
169 |
|
|
170 |
|
// short-hand functions for setting colors |
171 |
|
auto setGrayColor = [&] { |
172 |
|
cr->set_source_rgba(0.88, 0.88, 0.88, sensitive ? 1.0 : 0.3); |
173 |
|
}; |
174 |
|
auto setBlackColor = [&] { |
175 |
|
cr->set_source_rgba(0, 0, 0, sensitive ? 1.0 : 0.3); |
176 |
|
}; |
177 |
|
auto setGreenColor = [&] { |
178 |
|
cr->set_source_rgba(94/255.f, 219/255.f, 80/255.f, sensitive ? 1.0 : 0.3); |
179 |
|
}; |
180 |
|
auto setRedColor = [&] { |
181 |
|
cr->set_source_rgba(255.f, 44/255.f, 44/255.f, sensitive ? 1.0 : 0.3); |
182 |
|
}; |
183 |
|
/*auto setBlueColor = [&] { |
184 |
|
cr->set_source_rgba(53/255.f, 167/255.f, 255.f, sensitive ? 1.0 : 0.3); |
185 |
|
};*/ |
186 |
|
auto setOrangeColor = [&] { |
187 |
|
cr->set_source_rgba(255.f, 177/255.f, 82/255.f, sensitive ? 1.0 : 0.3); |
188 |
|
}; |
189 |
|
|
190 |
|
// draw horizontal center line (dashed gray) if LFO range is signed |
191 |
|
if (signedRange) { |
192 |
|
cr->move_to(0, h/2); |
193 |
|
cr->line_to(w, h/2); |
194 |
|
cr->set_line_width(2); |
195 |
|
setGrayColor(); |
196 |
|
cr->set_dash(std::vector<double>{ 7, 5 }, 0 /*offset*/); |
197 |
|
cr->stroke(); |
198 |
|
} |
199 |
|
|
200 |
|
// draw a vertical line for each second |
201 |
|
for (int period = 1; period < visiblePeriods; ++period) { |
202 |
|
int x = float(w) / float(visiblePeriods) * period; |
203 |
|
cr->move_to(x, 0); |
204 |
|
cr->line_to(x, h); |
205 |
|
cr->set_line_width(2); |
206 |
|
setGrayColor(); |
207 |
|
cr->set_dash(std::vector<double>{ 5, 3 }, 0 /*offset*/); |
208 |
|
cr->stroke(); |
209 |
|
} |
210 |
|
|
211 |
|
// how many curves shall we draw, two or one? |
212 |
|
const int runs = (hasControllerAssigned()) ? 2 : 1; |
213 |
|
// only draw the two curves in dashed style if they're very close to each other |
214 |
|
const bool dashedCurves = (runs == 2 && controllerDepth() < 63); |
215 |
|
// draw the required amount of curves |
216 |
|
for (int run = 0; run < runs; ++run) { |
217 |
|
// setup the LFO generator with the relevant parameters |
218 |
|
lfo.setup({ |
219 |
|
.waveType = LinuxSampler::LFO::wave_sine, // see https://sourceforge.net/p/linuxsampler/mailman/linuxsampler-devel/thread/2189307.cNP0Xbctxq%40silver/#msg36774029 |
220 |
|
.rangeType = (signedRange) ? LinuxSampler::LFO::range_signed : LinuxSampler::LFO::range_unsigned, |
221 |
|
.frequency = frequency(), |
222 |
|
//.phase = TODO |
223 |
|
.startLevel = startLevel(), |
224 |
|
.internalDepth = internalDepth(), |
225 |
|
.midiControllerDepth = controllerDepth(), |
226 |
|
.flipPolarity = flipPolarity(), |
227 |
|
.samplerate = w / visiblePeriods, |
228 |
|
.maxValue = (signedRange) ? h/2 : h, |
229 |
|
}); |
230 |
|
// 1st curve reflects min. CC value, 2nd curve max. CC value |
231 |
|
lfo.setMIDICtrlValue( (run == 0) ? 0 : 127 ); |
232 |
|
|
233 |
|
// the actual render/draw loop |
234 |
|
for (int x = 0; x < w ; ++x) { |
235 |
|
const float y = |
236 |
|
(signedRange) ? |
237 |
|
h/2 - lfo.render() : |
238 |
|
h - lfo.render(); |
239 |
|
if (x == 0) |
240 |
|
cr->move_to(x, y); |
241 |
|
else |
242 |
|
cr->line_to(x, y); |
243 |
|
} |
244 |
|
cr->set_line_width( (frequency() <= 4.f) ? 2 : 1 ); |
245 |
|
if (runs == 1) |
246 |
|
setOrangeColor(); |
247 |
|
else if (run == 0) |
248 |
|
setGreenColor(); |
249 |
|
else |
250 |
|
setRedColor(); |
251 |
|
if (dashedCurves) |
252 |
|
cr->set_dash(std::vector<double>{ 3, 3 }, (run == 0) ? 0 : 3 /*offset*/); |
253 |
|
else |
254 |
|
cr->set_dash(std::vector<double>(), 0 /*offset*/); |
255 |
|
cr->stroke(); |
256 |
|
} |
257 |
|
|
258 |
|
// draw text legend |
259 |
|
if (runs == 2) { |
260 |
|
setRedColor(); |
261 |
|
cr->move_to(2, 10); |
262 |
|
cr->show_text("CC Max."); |
263 |
|
|
264 |
|
setGreenColor(); |
265 |
|
cr->move_to(2, 23); |
266 |
|
cr->show_text("CC Min."); |
267 |
|
} else { // no controller assigned, internal depth only ... |
268 |
|
setOrangeColor(); |
269 |
|
cr->move_to(2, 10); |
270 |
|
cr->show_text("Const. Depth"); |
271 |
|
} |
272 |
|
// draw text legend for each second ("1s", "2s", ...) |
273 |
|
for (int period = 1; period < visiblePeriods; ++period) { |
274 |
|
int x = float(w) / float(visiblePeriods) * period; |
275 |
|
setBlackColor(); |
276 |
|
cr->move_to(x - 13, h - 3); |
277 |
|
cr->show_text(ToString(period) + "s"); |
278 |
|
} |
279 |
|
} |
280 |
|
return true; |
281 |
|
} |
282 |
|
|
283 |
|
|
284 |
EGStateOptions::EGStateOptions() : HBox(), |
EGStateOptions::EGStateOptions() : HBox(), |
285 |
label(_("May be cancelled: ")), |
label(_("May be cancelled: ")), |
286 |
checkBoxAttack(_("Attack")), |
checkBoxAttack(_("Attack")), |
564 |
sigc::mem_fun(*this, &DimRegionEdit::onButtonSelectSamplePressed) |
sigc::mem_fun(*this, &DimRegionEdit::onButtonSelectSamplePressed) |
565 |
); |
); |
566 |
|
|
567 |
for (int i = 0 ; i < 7 ; i++) { |
for (int i = 0 ; i < 9 ; i++) { |
568 |
#if USE_GTKMM_GRID |
#if USE_GTKMM_GRID |
569 |
table[i] = new Gtk::Grid; |
table[i] = new Gtk::Grid; |
570 |
table[i]->set_column_spacing(7); |
table[i]->set_column_spacing(7); |
756 |
addProp(eLFO1Controller); |
addProp(eLFO1Controller); |
757 |
addProp(eLFO1FlipPhase); |
addProp(eLFO1FlipPhase); |
758 |
addProp(eLFO1Sync); |
addProp(eLFO1Sync); |
759 |
|
{ |
760 |
|
Gtk::Frame* frame = new Gtk::Frame; |
761 |
|
frame->add(lfo1Graph); |
762 |
|
// on Gtk 3 there is no margin at all by default |
763 |
|
#if GTKMM_MAJOR_VERSION >= 3 |
764 |
|
frame->set_margin_top(12); |
765 |
|
frame->set_margin_bottom(12); |
766 |
|
#endif |
767 |
|
#if USE_GTKMM_GRID |
768 |
|
table[pageno]->attach(*frame, 1, rowno, 2); |
769 |
|
#else |
770 |
|
table[pageno]->attach(*frame, 1, 3, rowno, rowno + 1, |
771 |
|
Gtk::SHRINK, Gtk::SHRINK); |
772 |
|
#endif |
773 |
|
rowno++; |
774 |
|
} |
775 |
|
eLFO1FlipPhase.signal_value_changed().connect( |
776 |
|
sigc::mem_fun(lfo1Graph, &LFOGraph::queue_draw) |
777 |
|
); |
778 |
|
|
779 |
|
nextPage(); |
780 |
|
|
781 |
addHeader(_("Crossfade")); |
addHeader(_("Crossfade")); |
782 |
addProp(eAttenuationController); |
addProp(eAttenuationController); |
783 |
addProp(eInvertAttenuationController); |
addProp(eInvertAttenuationController); |
920 |
addProp(eEG2ControllerDecayInfluence); |
addProp(eEG2ControllerDecayInfluence); |
921 |
addProp(eEG2ControllerReleaseInfluence); |
addProp(eEG2ControllerReleaseInfluence); |
922 |
addLine(eEG2StateOptions); |
addLine(eEG2StateOptions); |
923 |
|
|
924 |
|
nextPage(); |
925 |
|
|
926 |
lLFO2 = addHeader(_("Filter Cutoff Oscillator (LFO2)")); |
lLFO2 = addHeader(_("Filter Cutoff Oscillator (LFO2)")); |
927 |
addProp(eLFO2Frequency); |
addProp(eLFO2Frequency); |
928 |
addProp(eLFO2InternalDepth); |
addProp(eLFO2InternalDepth); |
942 |
addProp(eLFO2Controller); |
addProp(eLFO2Controller); |
943 |
addProp(eLFO2FlipPhase); |
addProp(eLFO2FlipPhase); |
944 |
addProp(eLFO2Sync); |
addProp(eLFO2Sync); |
945 |
|
{ |
946 |
|
Gtk::Frame* frame = new Gtk::Frame; |
947 |
|
frame->add(lfo2Graph); |
948 |
|
// on Gtk 3 there is no margin at all by default |
949 |
|
#if GTKMM_MAJOR_VERSION >= 3 |
950 |
|
frame->set_margin_top(12); |
951 |
|
frame->set_margin_bottom(12); |
952 |
|
#endif |
953 |
|
#if USE_GTKMM_GRID |
954 |
|
table[pageno]->attach(*frame, 1, rowno, 2); |
955 |
|
#else |
956 |
|
table[pageno]->attach(*frame, 1, 3, rowno, rowno + 1, |
957 |
|
Gtk::SHRINK, Gtk::SHRINK); |
958 |
|
#endif |
959 |
|
rowno++; |
960 |
|
} |
961 |
|
eLFO2FlipPhase.signal_value_changed().connect( |
962 |
|
sigc::mem_fun(lfo2Graph, &LFOGraph::queue_draw) |
963 |
|
); |
964 |
|
|
965 |
nextPage(); |
nextPage(); |
966 |
|
|
988 |
} |
} |
989 |
addProp(eLFO3Controller); |
addProp(eLFO3Controller); |
990 |
addProp(eLFO3Sync); |
addProp(eLFO3Sync); |
991 |
|
{ |
992 |
|
Gtk::Frame* frame = new Gtk::Frame; |
993 |
|
frame->add(lfo3Graph); |
994 |
|
// on Gtk 3 there is no margin at all by default |
995 |
|
#if GTKMM_MAJOR_VERSION >= 3 |
996 |
|
frame->set_margin_top(12); |
997 |
|
frame->set_margin_bottom(12); |
998 |
|
#endif |
999 |
|
#if USE_GTKMM_GRID |
1000 |
|
table[pageno]->attach(*frame, 1, rowno, 2); |
1001 |
|
#else |
1002 |
|
table[pageno]->attach(*frame, 1, 3, rowno, rowno + 1, |
1003 |
|
Gtk::SHRINK, Gtk::SHRINK); |
1004 |
|
#endif |
1005 |
|
rowno++; |
1006 |
|
} |
1007 |
|
|
1008 |
nextPage(); |
nextPage(); |
1009 |
|
|
1157 |
sigc::mem_fun(*this, &DimRegionEdit::loop_infinite_toggled)); |
sigc::mem_fun(*this, &DimRegionEdit::loop_infinite_toggled)); |
1158 |
|
|
1159 |
append_page(*table[0], _("Sample")); |
append_page(*table[0], _("Sample")); |
1160 |
append_page(*table[1], _("Amplitude (1)")); |
append_page(*table[1], _("Amp (1)")); |
1161 |
append_page(*table[2], _("Amplitude (2)")); |
append_page(*table[2], _("Amp (2)")); |
1162 |
append_page(*table[3], _("Filter (1)")); |
append_page(*table[3], _("Amp (3)")); |
1163 |
append_page(*table[4], _("Filter (2)")); |
append_page(*table[4], _("Filter (1)")); |
1164 |
append_page(*table[5], _("Pitch")); |
append_page(*table[5], _("Filter (2)")); |
1165 |
append_page(*table[6], _("Misc")); |
append_page(*table[6], _("Filter (3)")); |
1166 |
|
append_page(*table[7], _("Pitch")); |
1167 |
|
append_page(*table[8], _("Misc")); |
1168 |
|
|
1169 |
Settings::singleton()->showTooltips.get_proxy().signal_changed().connect( |
Settings::singleton()->showTooltips.get_proxy().signal_changed().connect( |
1170 |
sigc::mem_fun(*this, &DimRegionEdit::on_show_tooltips_changed) |
sigc::mem_fun(*this, &DimRegionEdit::on_show_tooltips_changed) |
1373 |
release_curve.set_dim_region(d); |
release_curve.set_dim_region(d); |
1374 |
cutoff_curve.set_dim_region(d); |
cutoff_curve.set_dim_region(d); |
1375 |
crossfade_curve.set_dim_region(d); |
crossfade_curve.set_dim_region(d); |
1376 |
|
lfo1Graph.set_dim_region(d); |
1377 |
|
lfo2Graph.set_dim_region(d); |
1378 |
|
lfo3Graph.set_dim_region(d); |
1379 |
|
|
1380 |
set_sensitive(d); |
set_sensitive(d); |
1381 |
if (!d) return; |
if (!d) return; |
1577 |
eLFO2Controller.set_sensitive(sensitive); |
eLFO2Controller.set_sensitive(sensitive); |
1578 |
eLFO2FlipPhase.set_sensitive(sensitive); |
eLFO2FlipPhase.set_sensitive(sensitive); |
1579 |
eLFO2Sync.set_sensitive(sensitive); |
eLFO2Sync.set_sensitive(sensitive); |
1580 |
|
lfo2Graph.set_sensitive(sensitive); |
1581 |
if (sensitive) { |
if (sensitive) { |
1582 |
VCFCutoffController_changed(); |
VCFCutoffController_changed(); |
1583 |
VCFResonanceController_changed(); |
VCFResonanceController_changed(); |