IF3Si/scd/gui_chaos.scd

837 lines
25 KiB
Plaintext
Raw Normal View History

2015-09-09 14:03:24 +02:00
/*
2015-09-09 15:13:45 +02:00
This file is part of "Interface Fractures III - Silicon".
Copyright (c) 2015 Luka Prinčič, All right reserved.
This program is free software distributed under
GNU General Public Licence. See COPYING for more info.
- - - - - - - - - - - - - - - - - - - - - - - - - - - -
2015-09-09 14:03:24 +02:00
gui_chaos.scd - takes care of all GUI elements under
the chaos tab...
********************************************************** */
~tab_views[~tab_names.at("chaos")].layout = HLayout();
~tab_views[~tab_names.at("chaos")].layout.margins = 0;
~tab_views[~tab_names.at("chaos")].layout.add(nil);
// create a view for StandardMap synth ---------------------------------------------------------
~standardMapView = View.new(~tab_views[~tab_names.at("chaos")]);
~standardMapView.background = Color.gray(0.5);
~standardMapView.layout = VLayout( // vert. layout:
Button()
.states_([
["Standard"],
["Standard", Color.gray(0.2), Color.grey(0.8)] ])
.mouseDownAction_({ | state |
switch(state.value,
0, {~standard2D = Synth(\StandardMap, [\amp, 0]);},
1, {~standard2D.free;}
);
})
.minHeight_(40).minWidth_(70),
HLayout(
VLayout( // parameters
StaticText().string_("frq"),
RangeSlider(nil,Rect(0,0,20,270))
.minWidth_(70) .minHeight_(270)
.lo_(0) .hi_(0.11)
.action_({ | slider |
var minfreq, maxfreq;
minfreq = slider.lo.value.linexp(0, 1, 10, 15000);
maxfreq = slider.hi.value.linexp(0, 1, 10, 15000);
~standard2D.set(\minfreq, minfreq.value);
~standard2D.set(\maxfreq, maxfreq.value);
}),
StaticText().string_("k"),
Knob() .centered_(true) .value_(0.5) .mode_(\horiz) .step_(0.003) .minHeight_(60).minWidth_(60)
.action_({ | val |
val = val.value.linlin(0, 1, 0, 2.8);
~standard2D.set(\k, val);
}),
StaticText().maxHeight_(1).background_(Color.gray(0.1,0.2)),
StaticText().string_("x0"),
Knob() .centered_(true) .value_(0.5) .mode_(\horiz) .step_(0.003) .minHeight_(60).minWidth_(60)
.action_({ | val |
val = val.value.linlin(0, 1, 0, 4.9789799812499 * 2);
~standard2D.set(\x0, val);
}),
StaticText().maxHeight_(1).background_(Color.gray(0.1,0.2)),
StaticText().string_("y0"),
Knob() .centered_(true) .value_(0.5) .mode_(\horiz) .step_(0.003) .minHeight_(60).minWidth_(60)
.action_({ | val |
val = val.value.linlin(0, 1, 0, 5.7473416156381 * 2);
if(~standard2D.isPlaying, {
~standard2D.set(\x0, val); }
);
}),
StaticText().maxHeight_(1).background_(Color.gray(0.1,0.2)),
nil
),
VLayout( // gains and filters section
StaticText().string_("OUT"),
StaticText().maxHeight_(1).background_(Color.gray(0.1,0.2)),
StaticText().string_("N"),
Knob().value_(0).mode_(\horiz).step_(0.003).minHeight_(60).minWidth_(60)
.action_({ arg amp;
amp = amp.value.linexp(0, 1, 0.01, 1) - 0.01;
~standard2D.set(\ampN, amp);
}),
StaticText().maxHeight_(1).background_(Color.gray(0.1,0.2)),
StaticText().string_("L"),
Knob().value_(0).mode_(\horiz).step_(0.003).minHeight_(60).minWidth_(60)
.action_({ arg amp;
amp = amp.value.linexp(0, 1, 0.01, 1) - 0.01;
~standard2D.set(\ampL, amp);
}),
StaticText().maxHeight_(1).background_(Color.gray(0.1,0.2)),
StaticText().string_("C"),
Knob().value_(0).mode_(\horiz).step_(0.003).minHeight_(60).minWidth_(60)
.action_({ arg amp;
amp = amp.value.linexp(0, 1, 0.01, 1) - 0.01;
~standard2D.set(\ampC, amp);
}),
StaticText().maxHeight_(1).background_(Color.gray(0.1,0.2)),
StaticText().string_("f"),
Knob() .value_(1) .mode_(\horiz) .step_(0.003) .minHeight_(60).minWidth_(60)
.action_({arg freq;
freq = freq.value.linexp(0, 1, 40, 20000);
~standard2D.set(\bpffreq, freq);
}),
StaticText().maxHeight_(1).background_(Color.gray(0.1,0.2)),
StaticText().align_(\left).string_("q"),
Knob() .value_(0) .mode_(\horiz) .step_(0.003) .minHeight_(60).minWidth_(60)
.action_({ arg rq;
rq = abs(rq.value - 1);
rq = rq.value.linexp(0, 1, 0.1, 100);
~standard2D.set(\bpfrq, rq);
}),
StaticText().maxHeight_(1).background_(Color.gray(0.1,0.2)),
StaticText().string_("A"),
Knob().value_(0).mode_(\horiz).step_(0.003).minHeight_(60).minWidth_(60)
.action_({ arg amp;
amp = amp.value.linexp(0, 1, 0.01, 1) - 0.01;
~standard2D.set(\amp, amp);
}),
nil
)
),
nil;
);
// -------------------------------------------------------------------------------------------------
// create a view for GbmanMap synth ---------------------------------------------------------
~gbmanMapView = View.new(~tab_views[~tab_names.at("chaos")]);
~gbmanMapView.background = Color.gray(0.5);
~gbmanMapView.layout = VLayout( // vert. layout:
Button()
.states_([
["Gbman"],
["Gbman", Color.gray(0.2), Color.grey(0.8)] ])
.mouseDownAction_({ | state |
switch(state.value,
0, {~gbman2D = Synth(\GbmanMap, [\amp, 0]);},
1, {~gbman2D.free;}
);
})
.minHeight_(40).minWidth_(70),
HLayout(
VLayout( // parameters
StaticText().string_("frq"),
RangeSlider(nil,Rect(0,0,20,270))
.minWidth_(70) .minHeight_(270)
.lo_(0) .hi_(0.11)
.action_({ | slider |
var minfreq, maxfreq;
minfreq = slider.lo.value.linexp(0, 1, 10, 15000);
maxfreq = slider.hi.value.linexp(0, 1, 10, 15000);
~gbman2D.set(\minfreq, minfreq.value);
~gbman2D.set(\maxfreq, maxfreq.value);
}),
StaticText().string_("x0"),
Knob() .centered_(true) .value_(0.5) .mode_(\horiz) .step_(0.003) .minHeight_(60).minWidth_(60)
.action_({ | val |
val = val.value.linlin(0, 1, 0, 1.2 * 2);
~gbman2D.set(\x0, val);
}),
StaticText().maxHeight_(1).background_(Color.gray(0.1,0.2)),
StaticText().string_("y0"),
Knob() .centered_(true) .value_(0.5) .mode_(\horiz) .step_(0.003) .minHeight_(60).minWidth_(60)
.action_({ | val |
val = val.value.linlin(0, 1, 0, 2.1 * 2);
~gbman2D.set(\y0, val);
}),
StaticText().maxHeight_(1).background_(Color.gray(0.1,0.2)),
nil
),
VLayout( // gains and filters section
StaticText().string_("OUT"),
StaticText().maxHeight_(1).background_(Color.gray(0.1,0.2)),
StaticText().string_("N"),
Knob().value_(0).mode_(\horiz).step_(0.003).minHeight_(60).minWidth_(60)
.action_({ arg amp;
amp = amp.value.linexp(0, 1, 0.01, 1) - 0.01;
~gbman2D.set(\ampN, amp);
}),
StaticText().maxHeight_(1).background_(Color.gray(0.1,0.2)),
StaticText().string_("L"),
Knob().value_(0).mode_(\horiz).step_(0.003).minHeight_(60).minWidth_(60)
.action_({ arg amp;
amp = amp.value.linexp(0, 1, 0.01, 1) - 0.01;
~gbman2D.set(\ampL, amp);
}),
StaticText().maxHeight_(1).background_(Color.gray(0.1,0.2)),
StaticText().string_("C"),
Knob().value_(0).mode_(\horiz).step_(0.003).minHeight_(60).minWidth_(60)
.action_({ arg amp;
amp = amp.value.linexp(0, 1, 0.01, 1) - 0.01;
~gbman2D.set(\ampC, amp);
}),
StaticText().maxHeight_(1).background_(Color.gray(0.1,0.2)),
StaticText().string_("f"),
Knob() .value_(1) .mode_(\horiz) .step_(0.003) .minHeight_(60).minWidth_(60)
.action_({arg freq;
freq = freq.value.linexp(0, 1, 40, 20000);
~gbman2D.set(\bpffreq, freq);
}),
StaticText().maxHeight_(1).background_(Color.gray(0.1,0.2)),
StaticText().align_(\left).string_("q"),
Knob() .value_(0) .mode_(\horiz) .step_(0.003) .minHeight_(60).minWidth_(60)
.action_({ arg rq;
rq = abs(rq.value - 1);
rq = rq.value.linexp(0, 1, 0.1, 100);
~gbman2D.set(\bpfrq, rq);
}),
StaticText().maxHeight_(1).background_(Color.gray(0.1,0.2)),
StaticText().string_("A"),
Knob().value_(0).mode_(\horiz).step_(0.003).minHeight_(60).minWidth_(60)
.action_({ arg amp;
amp = amp.value.linexp(0, 1, 0.01, 1) - 0.01;
~gbman2D.set(\amp, amp);
}),
nil
)
),
nil;
);
// -------------------------------------------------------------------------------------------------
// create a view for HenonMap synth ---------------------------------------------------------
~henonMapView = View.new(~tab_views[~tab_names.at("chaos")]);
~henonMapView.background = Color.gray(0.5);
~henonMapView.layout = VLayout( // vert. layout:
Button()
.states_([
["Henon"],
["Henon", Color.gray(0.2), Color.grey(0.8)] ])
.mouseDownAction_({ | state |
switch(state.value,
0, {~henon2D = Synth(\HenonMap, [\amp, 0]);},
1, {~henon2D.free;}
);
})
.minHeight_(40).minWidth_(70),
HLayout(
VLayout( // parameters
StaticText().string_("frq"),
RangeSlider(nil,Rect(0,0,20,270))
.minWidth_(70) .minHeight_(270)
.lo_(0) .hi_(0.11)
.action_({ | slider |
var minfreq, maxfreq;
minfreq = slider.lo.value.linexp(0, 1, 10, 15000);
maxfreq = slider.hi.value.linexp(0, 1, 10, 15000);
~henon2D.set(\minfreq, minfreq.value);
~henon2D.set(\maxfreq, maxfreq.value);
}),
StaticText().string_("a"),
Knob() .centered_(true) .value_(0.9) .mode_(\horiz) .step_(0.003) .minHeight_(60).minWidth_(60)
.action_({ | val |
val = val.value.explin(0.01, 1, 0, 1.42);
~henon2D.set(\a, val);
}),
StaticText().maxHeight_(1).background_(Color.gray(0.1,0.2)),
nil
),
VLayout( // gains and filters section - - - -
StaticText().string_("OUT"),
StaticText().maxHeight_(1).background_(Color.gray(0.1,0.2)),
StaticText().string_("N"),
Knob().value_(0).mode_(\horiz).step_(0.003).minHeight_(60).minWidth_(60)
.action_({ arg amp;
amp = amp.value.linexp(0, 1, 0.01, 1) - 0.01;
~henon2D.set(\ampN, amp);
}),
StaticText().maxHeight_(1).background_(Color.gray(0.1,0.2)),
StaticText().string_("L"),
Knob().value_(0).mode_(\horiz).step_(0.003).minHeight_(60).minWidth_(60)
.action_({ arg amp;
amp = amp.value.linexp(0, 1, 0.01, 1) - 0.01;
~henon2D.set(\ampL, amp);
}),
StaticText().maxHeight_(1).background_(Color.gray(0.1,0.2)),
StaticText().string_("C"),
Knob().value_(0).mode_(\horiz).step_(0.003).minHeight_(60).minWidth_(60)
.action_({ arg amp;
amp = amp.value.linexp(0, 1, 0.01, 1) - 0.01;
~henon2D.set(\ampC, amp);
}),
StaticText().maxHeight_(1).background_(Color.gray(0.1,0.2)),
StaticText().string_("f"),
Knob() .value_(1) .mode_(\horiz) .step_(0.003) .minHeight_(60).minWidth_(60)
.action_({arg freq;
freq = freq.value.linexp(0, 1, 40, 20000);
~henon2D.set(\bpffreq, freq);
}),
StaticText().maxHeight_(1).background_(Color.gray(0.1,0.2)),
StaticText().align_(\left).string_("q"),
Knob() .value_(0) .mode_(\horiz) .step_(0.003) .minHeight_(60).minWidth_(60)
.action_({ arg rq;
rq = abs(rq.value - 1);
rq = rq.value.linexp(0, 1, 0.1, 100);
~henon2D.set(\bpfrq, rq);
}),
StaticText().maxHeight_(1).background_(Color.gray(0.1,0.2)),
StaticText().string_("A"),
Knob().value_(0).mode_(\horiz).step_(0.003).minHeight_(60).minWidth_(60)
.action_({ arg amp;
amp = amp.value.linexp(0, 1, 0.01, 1) - 0.01;
~henon2D.set(\amp, amp);
}),
nil
)
),
nil;
);
// -------------------------------------------------------------------------------------------------
// create a view for LatoocarfianMap synth ---------------------------------------------------------
~latoocarfianMapView = View.new(~tab_views[~tab_names.at("chaos")]);
~latoocarfianMapView.background = Color.gray(0.5);
~latoocarfianMapView.layout = VLayout( // vert. layout:
Button()
.states_([
["Latoocarfian"],
["Latoocarfian", Color.gray(0.2), Color.grey(0.8)] ])
.mouseDownAction_({ | state |
switch(state.value,
0, {~latoocarfian2D = Synth(\LatoocarfianMap, [\amp, 0]);},
1, {~latoocarfian2D.free;}
);
})
.minHeight_(40).minWidth_(70),
HLayout(
VLayout( // parameters
StaticText().string_("frq"),
RangeSlider(nil,Rect(0,0,20,180))
.minWidth_(70) .minHeight_(180)
.lo_(0) .hi_(0.11)
.action_({ | slider |
var minfreq, maxfreq;
minfreq = slider.lo.value.linexp(0, 1, 10, 15000);
maxfreq = slider.hi.value.linexp(0, 1, 10, 15000);
~latoocarfian2D.set(\minfreq, minfreq.value);
~latoocarfian2D.set(\maxfreq, maxfreq.value);
}),
StaticText().string_("a"),
Knob().centered_(true) .value_(0.5).mode_(\horiz).step_(0.003).minHeight_(60).minWidth_(60)
.action_({ arg a;
a = a.value.linlin(0, 1, 0, 2);
~latoocarfian2D.set(\a, a);
}),
StaticText().maxHeight_(1).background_(Color.gray(0.1,0.2)),
StaticText().string_("b"),
Knob().centered_(true) .value_(0.5) .mode_(\horiz).step_(0.003).minHeight_(60).minWidth_(60)
.action_({ arg b;
b = b.value.linlin(0, 1, 0, 6);
~latoocarfian2D.set(\b, b);
}),
StaticText().maxHeight_(1).background_(Color.gray(0.1,0.2)),
StaticText().string_("c"),
Knob().centered_(true) .value_(0.5) .mode_(\horiz).step_(0.003).minHeight_(60).minWidth_(60)
.action_({ arg c;
c = c.value;
~latoocarfian2D.set(\c, c);
}),
StaticText().maxHeight_(1).background_(Color.gray(0.1,0.2)),
StaticText().string_("d"),
Knob().centered_(true) .value_(0.5) .mode_(\horiz).step_(0.003).minHeight_(60).minWidth_(60)
.action_({ arg d;
d = d.value;
~latoocarfian2D.set(\d, d);
}),
nil
),
VLayout( // gains and filters section
StaticText().string_("OUT"),
StaticText().maxHeight_(1).background_(Color.gray(0.1,0.2)),
StaticText().string_("N"),
Knob().value_(0).mode_(\horiz).step_(0.003).minHeight_(60).minWidth_(60)
.action_({ arg amp;
amp = amp.value.linexp(0, 1, 0.01, 1) - 0.01;
~latoocarfian2D.set(\ampN, amp);
}),
StaticText().maxHeight_(1).background_(Color.gray(0.1,0.2)),
StaticText().string_("L"),
Knob().value_(0).mode_(\horiz).step_(0.003).minHeight_(60).minWidth_(60)
.action_({ arg amp;
amp = amp.value.linexp(0, 1, 0.01, 1) - 0.01;
~latoocarfian2D.set(\ampL, amp);
}),
StaticText().maxHeight_(1).background_(Color.gray(0.1,0.2)),
StaticText().string_("C"),
Knob().value_(0).mode_(\horiz).step_(0.003).minHeight_(60).minWidth_(60)
.action_({ arg amp;
amp = amp.value.linexp(0, 1, 0.01, 1) - 0.01;
~latoocarfian2D.set(\ampC, amp);
}),
StaticText().maxHeight_(1).background_(Color.gray(0.1,0.2)),
StaticText().string_("f"),
Knob() .value_(1) .mode_(\horiz) .step_(0.003) .minHeight_(60).minWidth_(60)
.action_({arg freq;
freq = freq.value.linexp(0, 1, 40, 20000);
~latoocarfian2D.set(\bpffreq, freq);
}),
StaticText().maxHeight_(1).background_(Color.gray(0.1,0.2)),
StaticText().align_(\left).string_("q"),
Knob() .value_(0) .mode_(\horiz) .step_(0.003) .minHeight_(60).minWidth_(60)
.action_({ arg rq;
rq = abs(rq.value - 1);
rq = rq.value.linexp(0, 1, 0.1, 100);
~latoocarfian2D.set(\bpfrq, rq);
}),
StaticText().maxHeight_(1).background_(Color.gray(0.1,0.2)),
StaticText().string_("A"),
Knob().value_(0).mode_(\horiz).step_(0.003).minHeight_(60).minWidth_(60)
.action_({ arg amp;
amp = amp.value.linexp(0, 1, 0.01, 1) - 0.01;
~latoocarfian2D.set(\amp, amp);
}),
nil
)
),
nil;
);
// create a view for LorenzMap synth ---------------------------------------------------------
~lorenzMapView = View.new(~tab_views[~tab_names.at("chaos")]);
~lorenzMapView.background = Color.gray(0.5);
~lorenzMapView.layout = VLayout( // vert. layout:
Button()
.states_([
["Lorenz"],
["Lorenz", Color.gray(0.2), Color.grey(0.8)] ])
.mouseDownAction_({ | state |
switch(state.value,
0, {~lorenz2D = Synth(\LorenzMap, [\amp, 0]);},
1, {~lorenz2D.free;}
);
})
.minHeight_(40).minWidth_(70),
HLayout(
VLayout( // parameters
StaticText().string_("frq"),
RangeSlider(nil,Rect(0,0,20,270))
.minWidth_(70) .minHeight_(270)
.lo_(0) .hi_(0.11)
.action_({ | slider |
var minfreq, maxfreq;
minfreq = slider.lo.value.linexp(0, 1, 10, 15000);
maxfreq = slider.hi.value.linexp(0, 1, 10, 15000);
~lorenz2D.set(\minfreq, minfreq.value);
~lorenz2D.set(\maxfreq, maxfreq.value);
}),
StaticText().string_("x0"),
Knob() .centered_(true) .value_(0.5) .mode_(\horiz) .step_(0.003) .minHeight_(60).minWidth_(60)
.action_({ | val |
val = val.value.linlin(0, 1, 0, 0.090879182417163 * 2);
~lorenz2D.set(\x0, val);
}),
StaticText().maxHeight_(1).background_(Color.gray(0.1,0.2)),
StaticText().string_("y0"),
Knob() .centered_(true) .value_(0.5) .mode_(\horiz) .step_(0.003) .minHeight_(60).minWidth_(60)
.action_({ | val |
val = val.value.linlin(0, 1, 0, 2.97077458055 * 2);
~lorenz2D.set(\y0, val);
}),
StaticText().maxHeight_(1).background_(Color.gray(0.1,0.2)),
StaticText().string_("z0"),
Knob() .centered_(true) .value_(0.5) .mode_(\horiz) .step_(0.003) .minHeight_(60).minWidth_(60)
.action_({ | val |
val = val.value.linlin(0, 1, 0, 24.282041054363 * 2);
~lorenz2D.set(\z0, val);
}),
StaticText().maxHeight_(1).background_(Color.gray(0.1,0.2)),
nil
),
VLayout(
nil,
StaticText().maxHeight_(1).background_(Color.gray(0.1,0.2)),
StaticText().string_("s"),
Knob() .centered_(true) .value_(0.5) .mode_(\horiz) .step_(0.003) .minHeight_(60).minWidth_(60)
.action_({ | val |
val = val.value.linlin(0, 1, 0, 10 * 2);
~lorenz2D.set(\s, val);
}),
StaticText().maxHeight_(1).background_(Color.gray(0.1,0.2)),
StaticText().string_("r"),
Knob() .centered_(true) .value_(0.5) .mode_(\horiz) .step_(0.003) .minHeight_(60).minWidth_(60)
.action_({ | val |
val = val.value.linlin(0, 1, 0, 28 * 2);
~lorenz2D.set(\r, val);
}),
StaticText().maxHeight_(1).background_(Color.gray(0.1,0.2)),
StaticText().string_("b"),
Knob() .centered_(true) .value_(0.5) .mode_(\horiz) .step_(0.003) .minHeight_(60).minWidth_(60)
.action_({ | val |
val = val.value.linlin(0, 1, 0, 2.666666667 * 2);
~lorenz2D.set(\b, val);
}),
StaticText().maxHeight_(1).background_(Color.gray(0.1,0.2)),
StaticText().string_("h"),
Knob() .centered_(true) .value_(0.5) .mode_(\horiz) .step_(0.003) .minHeight_(60).minWidth_(60)
.action_({ | val |
val = val.value.linlin(0, 1, 0, 0.02 * 2);
~lorenz2D.set(\h, val);
}),
nil
),
VLayout( // gains and filters section
StaticText().string_("OUT"),
StaticText().maxHeight_(1).background_(Color.gray(0.1,0.2)),
StaticText().string_("N"),
Knob().value_(0).mode_(\horiz).step_(0.003).minHeight_(60).minWidth_(60)
.action_({ arg amp;
amp = amp.value.linexp(0, 1, 0.01, 1) - 0.01;
~lorenz2D.set(\ampN, amp);
}),
StaticText().maxHeight_(1).background_(Color.gray(0.1,0.2)),
StaticText().string_("L"),
Knob().value_(0).mode_(\horiz).step_(0.003).minHeight_(60).minWidth_(60)
.action_({ arg amp;
amp = amp.value.linexp(0, 1, 0.01, 1) - 0.01;
~lorenz2D.set(\ampL, amp);
}),
StaticText().maxHeight_(1).background_(Color.gray(0.1,0.2)),
StaticText().string_("C"),
Knob().value_(0).mode_(\horiz).step_(0.003).minHeight_(60).minWidth_(60)
.action_({ arg amp;
amp = amp.value.linexp(0, 1, 0.01, 1) - 0.01;
~lorenz2D.set(\ampC, amp);
}),
StaticText().maxHeight_(1).background_(Color.gray(0.1,0.2)),
StaticText().string_("f"),
Knob() .value_(1) .mode_(\horiz) .step_(0.003) .minHeight_(60).minWidth_(60)
.action_({arg freq;
freq = freq.value.linexp(0, 1, 40, 20000);
~lorenz2D.set(\bpffreq, freq);
}),
StaticText().maxHeight_(1).background_(Color.gray(0.1,0.2)),
StaticText().align_(\left).string_("q"),
Knob() .value_(0) .mode_(\horiz) .step_(0.003) .minHeight_(60).minWidth_(60)
.action_({ arg rq;
rq = abs(rq.value - 1);
rq = rq.value.linexp(0, 1, 0.1, 100);
~lorenz2D.set(\bpfrq, rq);
}),
StaticText().maxHeight_(1).background_(Color.gray(0.1,0.2)),
StaticText().string_("A"),
Knob().value_(0).mode_(\horiz).step_(0.003).minHeight_(60).minWidth_(60)
.action_({ arg amp;
amp = amp.value.linexp(0, 1, 0.01, 1) - 0.01;
~lorenz2D.set(\amp, amp);
}),
nil
)
),
nil;
);
// create a view for FhnMap synth ---------------------------------------------------------
~fhnMapView = View.new(~tab_views[~tab_names.at("chaos")]);
~fhnMapView.background = Color.gray(0.5);
~fhnMapView.layout = VLayout( // vert. layout:
Button()
.states_([
["Fhn"],
["Fhn", Color.gray(0.2), Color.grey(0.8)] ])
.mouseDownAction_({ | state |
switch(state.value,
0, {~fhn2D = Synth(\FhnMap, [\amp, 0]);},
1, {~fhn2D.free;}
);
})
.minHeight_(40).minWidth_(70),
HLayout(
VLayout( // parameters
StaticText().string_("frq"),
RangeSlider(nil,Rect(0,0,20,270))
.minWidth_(70) .minHeight_(270)
.lo_(0) .hi_(0.11)
.action_({ | slider |
var minfreq, maxfreq;
minfreq = slider.lo.value.linexp(0, 1, 10, 15000);
maxfreq = slider.hi.value.linexp(0, 1, 10, 15000);
~fhn2D.set(\minfreq, minfreq.value);
~fhn2D.set(\maxfreq, maxfreq.value);
}),
/* urate: 0.1, wrate: 0.1,
b0: 0.6, b1: 0.8,
i: 0, u0: 0, w0: 0, */
StaticText().string_("urate"),
Knob() .centered_(true) .value_(0.5) .mode_(\horiz) .step_(0.003) .minHeight_(60).minWidth_(60)
.action_({ | val |
val = val.value.linlin(0, 1, 0, 0.1 * 2);
~fhn2D.set(\urate, val);
}),
StaticText().maxHeight_(1).background_(Color.gray(0.1,0.2)),
StaticText().string_("wrate"),
Knob() .centered_(true) .value_(0.5) .mode_(\horiz) .step_(0.003) .minHeight_(60).minWidth_(60)
.action_({ | val |
val = val.value.linlin(0, 1, 0, 0.1 * 2);
~fhn2D.set(\wrate, val);
}),
StaticText().maxHeight_(1).background_(Color.gray(0.1,0.2)),
nil
),
VLayout(
nil,
StaticText().maxHeight_(1).background_(Color.gray(0.1,0.2)),
StaticText().string_("b0"),
Knob() .centered_(true) .value_(0.5) .mode_(\horiz) .step_(0.003) .minHeight_(60).minWidth_(60)
.action_({ | val |
val = val.value.linlin(0, 1, 0, 0.6 * 2);
~fhn2D.set(\b0, val);
}),
StaticText().maxHeight_(1).background_(Color.gray(0.1,0.2)),
StaticText().string_("b1"),
Knob() .centered_(true) .value_(0.5) .mode_(\horiz) .step_(0.003) .minHeight_(60).minWidth_(60)
.action_({ | val |
val = val.value.linlin(0, 1, 0, 0.8 * 2);
~fhn2D.set(\b1, val);
}),
StaticText().maxHeight_(1).background_(Color.gray(0.1,0.2)),
StaticText().string_("i"),
Knob() .centered_(true) .value_(0.5) .mode_(\horiz) .step_(0.003) .minHeight_(60).minWidth_(60)
.action_({ | val |
val = val.value.linlin(0, 1, -1, 1);
~fhn2D.set(\i, val);
}),
StaticText().maxHeight_(1).background_(Color.gray(0.1,0.2)),
StaticText().string_("u0"),
Knob() .centered_(true) .value_(0.5) .mode_(\horiz) .step_(0.003) .minHeight_(60).minWidth_(60)
.action_({ | val |
val = val.value.linlin(0, 1, -1, 1);
~fhn2D.set(\u0, val);
}),
StaticText().maxHeight_(1).background_(Color.gray(0.1,0.2)),
StaticText().string_("w0"),
Knob() .centered_(true) .value_(0.5) .mode_(\horiz) .step_(0.003) .minHeight_(60).minWidth_(60)
.action_({ | val |
val = val.value.linlin(0, 1, -1, 1);
~fhn2D.set(\w0, val);
}),
nil
),
VLayout( // gains and filters section
StaticText().string_("OUT"),
StaticText().maxHeight_(1).background_(Color.gray(0.1,0.2)),
StaticText().string_("N"),
Knob().value_(0).mode_(\horiz).step_(0.003).minHeight_(60).minWidth_(60)
.action_({ arg amp;
amp = amp.value.linexp(0, 1, 0.01, 1) - 0.01;
~fhn2D.set(\ampN, amp);
}),
StaticText().maxHeight_(1).background_(Color.gray(0.1,0.2)),
StaticText().string_("L"),
Knob().value_(0).mode_(\horiz).step_(0.003).minHeight_(60).minWidth_(60)
.action_({ arg amp;
amp = amp.value.linexp(0, 1, 0.01, 1) - 0.01;
~fhn2D.set(\ampL, amp);
}),
StaticText().maxHeight_(1).background_(Color.gray(0.1,0.2)),
StaticText().string_("C"),
Knob().value_(0).mode_(\horiz).step_(0.003).minHeight_(60).minWidth_(60)
.action_({ arg amp;
amp = amp.value.linexp(0, 1, 0.01, 1) - 0.01;
~fhn2D.set(\ampC, amp);
}),
StaticText().maxHeight_(1).background_(Color.gray(0.1,0.2)),
StaticText().string_("f"),
Knob() .value_(1) .mode_(\horiz) .step_(0.003) .minHeight_(60).minWidth_(60)
.action_({arg freq;
freq = freq.value.linexp(0, 1, 40, 20000);
~fhn2D.set(\bpffreq, freq);
}),
StaticText().maxHeight_(1).background_(Color.gray(0.1,0.2)),
StaticText().align_(\left).string_("q"),
Knob() .value_(0) .mode_(\horiz) .step_(0.003) .minHeight_(60).minWidth_(60)
.action_({ arg rq;
rq = abs(rq.value - 1);
rq = rq.value.linexp(0, 1, 0.1, 100);
~fhn2D.set(\bpfrq, rq);
}),
StaticText().maxHeight_(1).background_(Color.gray(0.1,0.2)),
StaticText().string_("A"),
Knob().value_(0).mode_(\horiz).step_(0.003).minHeight_(60).minWidth_(60)
.action_({ arg amp;
amp = amp.value.linexp(0, 1, 0.01, 1) - 0.01;
~fhn2D.set(\amp, amp);
}),
nil
)
),
nil;
);
// -------------------------------------------------------------------------------------------------
~tab_views[~tab_names.at("chaos")].layout.add(nil);
// -------------------------------------------------------------------------------------------------