Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

side view created!

  • Loading branch information...
commit ee329ec39045a9ca316bdaa82e5cdebaeba545e1 1 parent 80cca0b
@grirgz authored
View
163 coco.sc
@@ -1,3 +1,43 @@
+(
+~mpdef = { arg name, pat;
+ var node, main;
+
+ if(pat.notNil) {
+ if(~seq.notNil && {pat.notNil}) {
+ main = ~seq;
+
+ if(pat.class == Pbind) {
+ if(main.node_exists(name)) {
+ node = main.get_node(name);
+ node.set_input_pattern(pat);
+ Pdef(name, node.vpattern);
+ } {
+ node = ~make_player_from_pbind.(main, pat);
+ if(node.notNil) {
+ node.name = name;
+ node.uname = name;
+ main.add_node(node);
+ main.focus_mpdef(node);
+ Pdef(name, node.vpattern);
+ } {
+ "ERROR: player could not be created".debug;
+ nil;
+ };
+ }
+ } {
+ "ERROR: pat class not understood".debug;
+ Pdef(name, pat);
+ }
+
+ } {
+ "ERROR no seq".debug;
+ Pdef(name, pat);
+ }
+ } {
+ Pdef(name)
+ }
+};
+)
(
@@ -8,6 +48,9 @@ a = Pbind(
\amp, 0.2
)
)
+
+a.patternpairs.clump(2)
+
(
b = Pdef(\rah, Pbind(
\bla, \pulsepass,
@@ -35,17 +78,36 @@ SynthDef(\lead, { arg out=0, freq = 100, pan=0, amp=0.1, detune=1.1, gate=1, rq=
//gate = LFPulse.ar(1);
ou = LFSaw.ar(freq * [1, detune]).sum;
filtenv = EnvGen.ar(Env.adsr(0.01,0.35,0.07,0.3), gate, freq * fratio, fbase, doneAction:0);
- ou = ou * EnvGen.ar(Env.adsr(0.01,0.4,0.1,0.4), gate, doneAction:0);
+ ou = ou * EnvGen.ar(Env.adsr(0.01,0.4,0.1,0.4), gate, doneAction:2);
ou = RLPF.ar(ou, filtenv, rq);
ou = Pan2.ar(ou, pan, amp);
Out.ar(out, ou);
}).add
)
+(
+SynthDef(\lead2, { arg out=0, freq = 100, pan=0, amp=0.1, mdetune=1.004, gate=1, rq=0.1, fratio = 1, fbase=20, wet=1, fbfreq=100, fbamp=0.8, fbpamp=1, rt=0.4;
+ var fb, ou, filtenv;
+ //gate = LFPulse.ar(1);
+ ou = LFSaw.ar(freq * [1, mdetune]).sum;
+ filtenv = EnvGen.ar(Env.adsr(0.01,0.25,0.07,0.3), gate, freq * fratio, fbase, doneAction:0);
+ ou = RLPF.ar(ou, filtenv, rq);
+ fb = LocalIn.ar(1) + ou;
+ fb = HPF.ar(fb, fbfreq);
+ LocalOut.ar(fb * fbamp);
+ fb = Limiter.ar(fb, amp);
+ fb = SelectX.ar(wet, [ou, fb*fbpamp]);
+ fb = fb * EnvGen.ar(Env.adsr(0.01,0.4,0.1,rt), gate, doneAction:2);
+ fb = Pan2.ar(fb, pan, amp);
+ Out.ar(out, fb);
+}).add
+)
+Splay
(
-~mpdef.(\rah, Pbind(
- //\instrument, \lead,
- \freq, 070,
+~mpdef.(\ko, Pbind(
+ \instrument, \lead2,
+ \degree, Pseq([1,4,4,1],inf),
+ \octave, 3,
\legato, 0.7,
\fratio, 0.1,
\fbase, 100,
@@ -56,15 +118,98 @@ SynthDef(\lead, { arg out=0, freq = 100, pan=0, amp=0.1, detune=1.1, gate=1, rq=
));
)
+BusPool
+Pdef(\nio, Pn(Pdef(\ko))).play
+Pdef(\fio).play
+
+Pdef(\fio, Pbind(
+ \instrument, \lead2,
+ \degree, Pseq([1,4,4,1],inf),
+ \octave, 3,
+ \legato, 0.7,
+ \fratio, 0.1,
+ \fbase, 400,
+ \rq, Pseq([0.4,0.7],inf),
+ \dur, 0.5,
+ \wet, 0.7,
+ \detune, 1.007,
+ \amp, 0.2
+));
+
Pbind(\bla, 1).class == Pbind
Pdef(\bla).class == Pbind
+1.degreeToKey(Scale.major)
+(
+"/home/ggz/code/sc/seco/main.sc".load;
+~seq = ~mk_sequencer.value;
+~mpdef.(\ko, Pbind(
+ \instrument, \lead2,
+ \freq, Pseq([44,55,55,54,47,54],inf).midicps,
+ \legato, 0.7,
+ \fratio, 0.1,
+ \fbase, 100,
+ \rq, Pseq([1,1.7],inf),
+ \dur, 0.5,
+ \detune, 1.007,
+ \amp, 0.2
+));
+~seq.edit_mpdef(\ko)
+)
+~seq.get_node(\rah).vpattern.play
+~seq.edit_mpdef(\nia)
+GUI.swing
+Pdef(\kah, ~seq.get_node(\rah).vpattern)
+Pdef(\kah).play
+
+
+b = EventPatternProxy.new;
+b.source = Pbind(\freq, 100)
(
-~mpdef = { arg name, pat;
+a = Pbind(
+ \freq, Pkey(\freq)
+) <> b
+)
+a.trace.play
- if(pat.class == Pbind) {
-
- }
-};
+(
+(Pbind(
+ \freq, Prout { arg ev; 2.do { ev = ev[\freq].yield } }
+) <> Pbind(
+ \freq, Pseq([100,200],inf)
+)).play
+)
+
+(
+SynthDef(\brass, { arg out=0, freq = 100, pan=0, amp=0.1, mdetune=1.004, gate=1, rq=0.1, fratio = 1, fbase=20, rt=0.4,
+ vibfreq=4, vibratio=0.02, pwidth=0.5, pwdetune=0.1,
+ mix=0.71, room=0.5, damp=0.5;
+ var vibrato, ou, filtenv;
+ //gate = LFPulse.ar(1);
+ vibrato = SinOsc.kr(vibfreq) * vibratio * freq * EnvGen.kr(Env.dadsr(0.1,0.1,0.1,0.5,0.1), gate);
+ //vibrato = 0;
+ ou = LFPulse.ar(freq * [1, mdetune] + vibrato, 0, pwidth * [1,1+pwdetune]).sum;
+ filtenv = EnvGen.ar(Env.adsr(0.3,0.15,0.77,0.1,1,[4,0]), gate, freq * fratio, fbase, doneAction:0);
+ ou = RLPF.ar(ou, filtenv, rq);
+ ou = ou * EnvGen.ar(Env.adsr(0.1,0.1,0.8,rt), gate, doneAction:0);
+ ou = FreeVerb.ar(
+ ou,
+ mix, // mix 0-1
+ room, // room 0-1
+ damp // damp 0-1 duh
+ ); // fan out...
+ DetectSilence.ar(ou, doneAction:2);
+ ou = Pan2.ar(ou, pan, amp);
+ Out.ar(out, ou);
+}).add;
+)
+
+(
+"/home/ggz/code/sc/seco/main.sc".load;
+~seq = ~mk_sequencer.value;
+~mpdef.(\bleu, Pbind(
+ \instrument, \brass
+));
+~seq.edit_mpdef(\bleu)
)
View
491 crap13.sc
@@ -0,0 +1,491 @@
+s.boot
+(
+a = Signal.fill(256, { |i|
+ var t = i/255.0;
+ t + (0.1 * (max(t, 0.1) - 0.1) * sin(2pi * t * 80 + sin(2pi * 25.6 * t)))
+})
+);
+GUI.qt
+a.plot
+
+d = (a.copy.reverse.neg) ++(Signal[0])++ a;
+
+d.plot
+
+d.size //must be buffer size/2 + 1, so 513 is fine
+
+
+
+b = Buffer.alloc(s, 1024, 1);
+
+// or, for an arbitrary transfer function, create the data at 1/2 buffer size + 1
+t = Signal.fill(513, { |i| i.linlin(0.0, 512.0, -1.0, 1.0) });
+t = Signal.fill(513, { |i|
+ var a;
+ a = if(i.inclusivelyBetween(0,100)) {
+ i.linlin(0.0, 512.0, 1.0, -2.0)
+ } {
+ i.linlin(0.0, 512.0, -0.3, 1.4)
+ };
+ sin(a*i)
+});
+
+// linear function
+t.plot
+
+// t.asWavetable will convert it to the official Wavetable format at twice the size
+b.sendCollection(t.asWavetableNoWrap); // may also use loadCollection here
+
+// shaper has no effect because of the linear transfer function
+(
+{ var sig = Shaper.ar(b, SinOsc.ar(440, 0, 0.4));
+ sig ! 2
+}.scope;
+)
+
+
+// now for a twist
+(
+a = Signal.fill(256, { |i|
+ var t = i/255.0;
+ t + (0.1 * (max(t, 0.1) - 0.1) * sin(2pi * t * 80 + sin(2pi * 25.6 * t)))
+})
+);
+
+(
+a = Signal.fill(256, { |i|
+ var t = i/255.0;
+ t + (0.5 * (max(t, 0.1) - 0.1) * sin(2pi * t * 80 + sin(2pi * 25.6 * t)))
+})
+);
+
+a.plot
+
+d = (a.copy.reverse.neg) ++(Signal[0])++ a;
+
+d.plot
+
+d.size //must be buffer size/2 + 1, so 513 is fine
+
+b.sendCollection(d.asWavetableNoWrap); // may also use loadCollection here
+
+b.plot // wavetable format!
+
+// test shaper
+(
+{
+ Shaper.ar(
+ b,
+ SinOsc.ar(SinOsc.kr(1).range(50,300), 0.5, Line.kr(0,0.9,6))
+ )
+}.scope
+)
+
+
+
+
+
+b = Buffer.alloc(s, 1024, 1);
+
+//size must be power of two plus 1
+t = Signal.chebyFill(513,[1, 0.5, 1, 0.125]);
+
+// linear function
+t.plot
+
+// t.asWavetableNoWrap will convert it to the official Wavetable format at next power of two size
+b.sendCollection(t.asWavetableNoWrap); // may also use loadCollection here
+
+b.plot
+
+(
+{ var sig = Shaper.ar(b, LFSaw.ar(440, 0, 0.4));
+ var sig2 = LFSaw.ar(440, 0, 0.4);
+ [sig, sig2]
+}.scope;
+)
+(
+{ var sig = SinOsc.ar(440, 0, 0.4);
+ sig ! 2
+}.scope;
+)
+
+b.free;
+
+
+
+(
+
+Ndef(\conv, { var input, kernel;
+ var ou, bla;
+
+ input=LFSaw.ar(500);
+ input=SinOsc.ar(400);
+ kernel= Mix.new(LFSaw.ar([10,11,65]*10*MouseX.kr(1.0,5.0),0,1.0));
+ kernel= LFPulse.ar(SinOsc.ar(150).range(1,100));
+ kernel= Sweep.ar(1,5);
+ //kernel= SinOsc.ar(Impulse.ar(1).range(100,200) + LFNoise1.ar(1).range(10,100));
+ kernel= SinOsc.ar(LFNoise1.ar(1).range(100,500), LFNoise1.ar(2.1).range(0,1));
+ kernel= LFSaw.ar(SinOsc.ar(100).range(700,750));
+ ou = Convolution.ar(input,kernel, 1024, 0.5);
+ bla = SinOsc.ar(ou.range(ou.range(1,50),100));
+ //ou = Convolution.ar(ou,kernel, 1024, 0.5);
+ ou = SinOsc.ar(ou.range(190,70));
+ //ou = LFSaw.ar(ou.range(190,700));
+ //ou = Convolution.ar(ou,bla, 1024, 0.5);
+ //ou = 0;
+ ou = BPF.ar(ou,570,0.01)*8;
+ bla = SinOsc.ar(200);
+ ou = Convolution.ar(ou,bla, 1024, 0.5);
+ //ou = SinOsc.ar(ou+kernel.range(0,100));
+ //ou = LFSaw.ar(ou);
+ //ou = ou.clip;
+ //ou = BPF.ar(ou,500,0.01);
+ //ou = FreqShift.ar(ou, 100-kernel);
+ //must have power of two framesize
+ Out.ar(0,ou!2);
+}).play;
+
+)
+
+
+
+(
+{
+i= K2A.ar(MouseButton.kr(0,1,0)) > 0;
+m = Spring.ar(i, 100, 0.1);
+n = Spring.ar(m, 5, 0.006);
+h = Spring.ar(n, 0.1, 0.0017);
+j = Spring.ar(h, 0.01, 0.003);
+k = Spring.ar(j, 10, 0.0001);
+
+DemandEnvGen.ar(
+ Dseq([m, n, h, j, k], inf ),
+ SampleDur.ir * 10.5,
+ 5,
+ -4
+)}.play
+)
+
+
+
+ (
+ {
+
+ i= K2A.ar(MouseButton.kr(0,1,0)) > 0;
+
+ m = Spring.ar(i, 1, 0.86);
+ n = Spring.ar(m, 1, 0.86);
+ h = Spring.ar(n, 1 , 0.86);
+ j = Spring.ar(h, 1 , 0.86);
+ k = Spring.ar(j, 1 , 0.86);
+ DemandEnvGen.ar(
+
+ Dseq([m, n, h, j, k], inf ),
+ SampleDur.ir * 10.5,
+ 5,
+ -4
+ );
+
+
+ }.play
+)
+
+
+
+(
+{
+i= K2A.ar(MouseButton.kr(0,1,0)) > 0;
+m = Spring.ar(i, 80, 0.002);
+n = Spring.ar(m, 25, 0.007);
+h = Spring.ar(n, 1, 0.00017);
+j = Spring.ar(h, 1.234, 0.00003);
+k = Spring.ar(j, 15, 0.00005);
+
+x = (DemandEnvGen.ar(
+ Dseq([m, n, h, j, k].scramble, inf ),
+ SampleDur.ir * TExpRand.kr(4, 100, i) * (SinOsc.kr(0.085).range(0.95, 1.04)),
+ 5,
+ -2
+).fold(-0.2, 0.2) * 30.542).tanh;
+[x, DelayN.ar(x, 0.001, 0.001)]
+}.play
+)
+
+
+
+(
+{
+i= K2A.ar(MouseButton.kr(0,1,0)) > 0;
+m = Spring.ar(i, 80, 0.002);
+n = Spring.ar(m, 25, 0.007);
+h = Spring.ar(n, 1, 0.00017);
+j = Spring.ar(h, 1.234, 0.00003);
+k = Spring.ar(j, 15, 0.00005);
+
+x = (DemandEnvGen.ar(
+ Dseq([m, n, h, j, k].scramble, inf ),
+ SampleDur.ir * TExpRand.kr(4, 100, i) * (SinOsc.kr(0.085).range(0.95, 1.04)),
+ 5,
+ TRand.kr(-8, 8, i)
+).fold(-0.2, 0.2) * 30.542).tanh;
+[x, DelayN.ar(x, 0.001, 0.001)]
+}.play
+)
+
+
+
+
+(
+{
+i= K2A.ar(MouseButton.kr(0,1,0)) > 0;
+j = 50.collect { i = Spring.ar(i, exprand(1, 10000), exprand(0.0001, 0.1)) };
+DemandEnvGen.ar(
+ Dseq(j, inf ),
+
+ SampleDur.ir * 10.5,
+ 5,
+ -4
+)}.play
+)
+
+
+
+(
+{
+i= K2A.ar(MouseButton.kr(0,1,0)) > 0;
+j = 29.collect { i = Spring.ar(i, exprand(1, 19000), exprand(0.00001, 0.1)) };
+DemandEnvGen.ar(
+ Dseq(j.scramble, inf ),
+
+
+ SampleDur.ir * Dseq(j.scramble, inf ) * 12,
+
+ 5,
+ -4
+)}.play
+)
+
+Quarks.gui
+
+
+
+l = LinearSpline([1@1,2@2,3@3,4@4])
+
+
+l.interpolate
+
+
+
+
+l = LinearSpline([1@1,2.2@1.8,2.9@3.1,4@4])
+
+
+l.interpolate
+
+
+
+(
+
+l = LinearSpline([1@1,2.2@1.8,2.9@3.1,4@4]);
+
+
+l.gui
+
+)
+
+
+(
+
+
+l = LinearSpline([1@1,2@2,3@3,4@4]);
+
+
+l.gui
+
+)
+
+
+
+looped
+
+(
+
+
+
+l = LinearSpline([ [ 1, 1 ], [ 1.5625, 3.55 ], [ 2.7757352941176, 4.425 ], [ 3.2904411764706, 1.825 ] ], true);
+
+
+l.gui
+
+)
+
+GUI.qtkkkkkkkk
+s.boot
+
+
+
+// animate
+
+(
+
+b = BSpline([ Point(0,0), Point(0.58963874282376, 0.4134375), Point(2.2682499386103, 0.826875), Point(4.8180390967671, 0.013125) ], 2.3870967741935,false);
+
+b.gui(nil,1000@200);
+
+n = NumberEditor.new;
+
+n.gui;
+
+b.animate(n,'value_');
+
+)
+
+
+
+(
+
+
+b = BezierSpline(
+
+Point(0.0,-30.0),
+
+ [ ],
+
+Point(1.0,30),
+
+ [],
+
+false
+
+);
+
+
+g = b.gui(nil,1000@300,ControlSpec(-44,44),ControlSpec(0,8,step:0.25));
+
+)
+
+
+(
+
+b = BezierSpline(
+
+0@0,
+
+ [ 0.2@0.4, 0.5@0.9 ],
+
+1@1,
+
+ [],
+
+false
+
+);
+
+
+g = b.gui(nil,1000@300);
+
+g.spec = ControlSpec(0,1,step:0.1);
+
+g.setDomainSpec( ControlSpec(0,8,step:0.25) );
+
+)
+
+
+(
+
+
+b = BezierSpline(
+
+Point(0.0,-30.0),
+
+ [ ],
+
+Point(1.0,30),
+
+ [],
+
+false
+
+);
+
+
+g = b.gui(nil,1000@300);
+
+g.spec = ControlSpec(-44,44);
+
+g.domainSpec = ControlSpec(0,8,step:0.25);
+
+)
+
+
+
+
+
+
+
+s.boot
+
+{ Klank.ar(`["SC.app, the bell tolls for thee.".collectAs(_.ascii.midicps, Set).asArray, nil, 6 ! 17],Impulse.ar(0, 0, 0.1), 0.25) }.play;
+{ Klank.ar(`["va te faire foutre freddy.".collectAs(_.ascii.midicps, Set).asArray, nil, 6 ! 17],Impulse.ar(0, 0, 0.1), 0.25) }.play;
+{ Klank.ar(`["haha petite bite".collectAs(_.ascii.midicps, Set).asArray, nil, 6 ! 17],Impulse.ar(0, 0, 0.1), 0.25) }.play;
+
+
+(
+~ltn = { arg notes, rep;
+ var le = "0123456abcdefghijklmnopqrstuvwxyz";
+ var di = Dictionary.new;
+ var res;
+ le.do { arg l, x;
+ //[l, x].postcs;
+ di[l] = x;
+ };
+ di[$ ] = \rest;
+ res = notes.as(Array).collect{ arg n; di[n] };
+ //res.postcs;
+ Pseq(res, rep);
+};
+)
+$7.asInteger
+~ltn.("abc")
+
+(
+Pbind(
+ \degree, Pseq([5]),
+ \octave, 5
+).play
+)
+(
+Pdef(\bla, Pbind(
+ \note, ~ltn.("abab ifi", inf)-12,
+ \amp, 0.1,
+ \dur, 0.25
+)).play
+)
+(
+Pdef(\bla2, Pbind(
+ \instrument, \lead2,
+ \note, ~ltn.("acf fhjf", inf)-12,
+ \amp, 0.05,
+ \fbase, Pseg(Pseq([500,10],inf),8),
+ \rq, Pseg(Pseq([1,0.2],inf),8),
+ \wet, 0.5,
+ //\rq, 1,
+ \dur, 0.25
+)).play
+)
+(
+Pdef(\bla3, Pbind(
+ \instrument, \lead2,
+ //\note, ~ltn.("acf fhjf", inf)-12,
+ \freq, Pseq([100,190,100,150,\r,100,\r,150],inf),
+ \amp, 0.1,
+ \fbase, Pseg(Pseq([5.1,100],inf),8),
+ //\rq, Pseg(Pseq([1,0.2],inf),8),
+ \wet, 0.8,
+ \rq, 0.01,
+ \dur, 0.125
+)).play
+)
+
+Pdef.defaultQuant = 2;
View
19 editplayer.sc
@@ -58,7 +58,7 @@
editplayer.get_paramlist.debug("BEGIN paramlist update");
editplayer.get_paramlist.do { arg param_name, i;
var param = player.get_arg(param_name);
- param.debug("make_editplayer_view, param");
+ //param.debug("make_editplayer_view, param");
param_name.debug("creation");
case
{ [\adsr].includes(param_name) || param_name.asString.containsStringAt(0,"adsr_") } {
@@ -186,6 +186,7 @@
"chu dans name".debug;
param.name;
},
+ slider_width: 100,
background_color: ~editplayer_color_scheme.control,
show_midibloc: true,
width: 200,
@@ -705,6 +706,20 @@
editplayer.controller.change_kind(\recordbus)
});
+ main.commands.add_enable([\editplayer, \param_set_pkey_mode], nil, {
+ var param = editplayer.controller.get_selected_param;
+ if(param.classtype == \control, {
+ param.set_pkey_mode(true);
+ });
+ });
+
+ main.commands.add_enable([\editplayer, \param_unset_pkey_mode], nil, {
+ var param = editplayer.controller.get_selected_param;
+ if(param.classtype == \control, {
+ param.set_pkey_mode(false);
+ });
+ });
+
// player mode selection
"editplayer shorcut 1".debug;
@@ -845,7 +860,7 @@
// cells
- main.commands.add_enable([\editplayer, \add_cell_bar], [\kb, 0, ~keycode.numpad.plus], {
+ main.commands.add_enable([\editplayer, \add_cell_bar], [\kb, -2, ~keycode.numpad.plus], {
editplayer.controller.add_cell_bar.()
});
main.commands.add_enable([\editplayer, \remove_cell_bar], [\kb, ~keycode.mod.ctrl, ~keycode.numpad.plus], {
View
511 keycode.sc
@@ -166,7 +166,17 @@
};
-
+~keygroups = Environment.make({
+ //~kbpad8x4 = [
+ // "1234567890)=",
+ // "azertyuiop^$",
+ // "qsdfghjklm%*",
+ // "<xcvbn,;:!"
+ //];
+ ~numline = "1234567890)=";
+ ~numpad = (0..9).collect { arg x; (\np ++ x).asSymbol };
+ ~fx = (1..12).collect { arg x; (\f ++ x).asSymbol };
+});
~keycode = Environment.make({
~kbpad8x4 = [
@@ -189,7 +199,7 @@
var alnum = [
"1234567890)=",
"azertyuiop^$",
- "qsdfghjklmù*",
+ "qsdfghjklm%*",
"<xcvbn,;:!"
];
keycodes.do { arg row, rowidx;
@@ -204,14 +214,14 @@
//NOTE: only for Alt modifier
var keycodes = [
[ 38, 233, 34, 39, 40, 45, 232, 31, 231, 224, 41, 61 ],
- [97, 122, 101, 114, 116, 121, 117, 105, 111,112, 36 /* ^ not working */, 36 ],
+ [97, 122, 101, 114, 116, 121, 117, 105, 111,112, 94 /* ^ not working in swing */, 36 ],
[113, 115, 100, 102, 103, 104, 106, 107, 108, 109, 249, 42 ],
- [60, 119, 120, 99, 118, 98, 110, 44, 59 ] //FIXME: complete keycodes
+ [60, 119, 120, 99, 118, 98, 110, 44, 59, 58, 33 ]
];
var alnum = [
"1234567890)=",
"azertyuiop^$",
- "qsdfghjklmù*",
+ "qsdfghjklm%*",
"<wxcvbn,;:!"
];
keycodes.do { arg row, rowidx;
@@ -221,20 +231,21 @@
};
dict;
}.value;
+ ~kbraalphanum = ~kbaalphanum.invert;
~kbsaalphanum = {
var dict = Dictionary.new;
//NOTE: only for Alt and Shift modifier
var keycodes = [
[ 38, 233, 34, 39, 40, 45, 232, 31, 231, 224, 41, 61 ],
- [97, 122, 101, 114, 116, 121, 117, 105, 111,112, 36 /* ^ not working */, 36 ],
+ [97, 122, 101, 114, 116, 121, 117, 105, 111,112, 94 /* ^ not working in swing*/, 36 ],
[113, 115, 100, 102, 103, 104, 106, 107, 108, 109, 249, 42 ],
- [60, 119, 120, 99, 118, 98, 110, 44, 59 ] //FIXME: complete keycodes
+ [60, 119, 120, 99, 118, 98, 110, 44, 59, 58, 33 ]
]-32;
var alnum = [
"1234567890)=",
"azertyuiop^$",
- "qsdfghjklmù*",
+ "qsdfghjklm%*", // ù replaced by % because multibyte cause offset
"<wxcvbn,;:!"
];
keycodes.do { arg row, rowidx;
@@ -244,12 +255,17 @@
};
dict;
}.value;
+ ~kbrsaalphanum = ~kbsaalphanum.invert;
~kb8x2line = [
38, 97, 233, 122, 34, 101, 39, 114, 40, 166, 45, 121, 232, 117, 95, 105
];
~kbnumline = [
38, 233, 34, 39, 40, 45, 232, 95, 231, 224, 41, 61
];
+ ~kbrnumline = [
+ // 11 = ")", 12 = "="
+ 1,2,3,4,5,6,7,8,9,0,")","="
+ ];
~kbcnumline = [ // for control // FIXME: why the fuck 8 changes with control ???
38, 233, 34, 39, 40, 45, 232, 31, 231, 224, 41, 61
];
@@ -269,15 +285,31 @@
shift: 131072,
arrow: 8388608,
altshift: 655360,
+ ctrlalt: 786432,
+ ctrlshift: 393216,
ctrlaltshift: 917504,
+ numpad: 2097152,
alt: 524288
);
+ ~rmod = {
+ var res = ~mod.invert;
+ res[8650752] = \ctrl;
+ res[8519680] = \shift;
+ res[8781824] = \ctrlshift;
+
+ res;
+ }.value;
~kbfx = [
// modifiers = 8388608
63236, 63237, 63238, 63239, 63240, 63241, 63242, 63243, 63244, 63245, 63246, 63247
//49,50,51,52,53,54,55,56,57,58
];
+ ~kbqtfx = [
+ // modifiers = 8388608
+ 16777264, 16777265, 16777266, 16777267, 16777268, 16777269, 16777270, 16777271, 16777272, 16777273, 16777274, 16777275
+ //49,50,51,52,53,54,55,56,57,58
+ ];
~kbarrow = (
// modifiers = 8388608
left: 63234,
@@ -285,6 +317,28 @@
up: 63232,
down: 63233
);
+ ~midispecial = (
+ begin: 34,
+ left: 35,
+ right: 36,
+ end: 37,
+ stop: 38,
+ play: 39,
+ pause: 40,
+ record: 41,
+ hold: 42,
+
+ b1: 43,
+ b2: 44,
+ b3: 45,
+ b4: 46
+ );
+ ~kbqtnumpad = (
+ npslash: 47,
+ npstar: 42,
+ npminus: 45,
+ npplus: 43
+ );
~kbspecial = (
delete: 127,
enter: 13,
@@ -295,6 +349,33 @@
up: 63232,
down: 63233
);
+ ~kbspecial.putAll(~kbqtnumpad);
+ ~kbqtspecial = (
+ space: 32,
+ enter: 16777220,
+ npenter: 16777221,
+ backspace: 16777219,
+ escape: 16777216,
+ point: 46,
+ left: 16777234,
+ right: 16777236,
+ up: 16777235,
+ down: 16777237,
+ insert: 16777222,
+ delete: 16777223,
+ home: 16777232,
+ end: 16777233,
+ pageup: 16777238,
+ pagedown: 16777239,
+ windows: 16777250,
+ scrolllock: 16777254,
+ pause: 16777224,
+ tab: 16777217,
+ square: 178,
+ menu: 16777301,
+ hothome: 16777360
+ );
+ ~kbrqtspecial = ~kbqtspecial.invert;
~kbfxdict = {
var dico = Dictionary.new;
~kbfx.do { arg kc, i;
@@ -316,10 +397,14 @@
\slider: [
25,26,27,28, 29,30,31,32, 33
],
- \pad: [ // in order of label number
+ \pad: [ // in order of label number // FIXME: order incorect
36, 38, 42, 43, 46, 47, 50, 49,
]
);
+ ~midipads = [ // in top-down order
+ 43, 47, 50, 49,
+ 36, 38, 42, 46,
+ ] + 1000; // offset to difference from cc
~midi = {
var dico = Dictionary.new;
~cakewalk.keysValuesDo { arg k, v;
@@ -367,12 +452,35 @@
set_action: { arg self, path, action;
var panel = path[0];
self.actions.put(*path++[action]);
+ if(self.commands[panel].isNil) {
+ self.commands[panel] = Dictionary.new;
+ };
if ( self.commands[panel][self.config.at(*path)] == path ) {
path.debug("already enabled, so enforce");
self.enable(path);
};
},
+ copy_action: { arg self, frompath, topath, enable=true;
+ [frompath, topath].debug("copy_action");
+
+ if(self.actions.at(*frompath).class == IdentityDictionary) {
+ self.actions.leafDoFrom(frompath, { arg leafpath, val;
+ self.copy_action(leafpath, topath ++ ~find_path_difference.(frompath, leafpath));
+ });
+ } {
+ self.actions.at(*frompath).debug("action");
+ self.set_action(topath, self.actions.at(*frompath));
+ if(enable) {
+ self.enable(topath)
+ };
+ };
+ },
+
+ copy_action_list: { arg self, panel, prefix, paths;
+ ~copy_action_bindings.(self, panel, prefix, paths);
+ },
+
remove_panel: { arg self, panel;
self.kb_handler[panel].do { arg sc;
self.commands.removeAt(sc);
@@ -399,26 +507,31 @@
//path.debug("enabling path");
shortcut = self.config.at(*path);
action = self.actions.at(*path);
- //shortcut.debug("shortcut");
- //action.debug("action");
- if(shortcut.notNil, {
- if(self.commands[panel].isNil) {
- self.commands[panel] = Dictionary.new;
- };
- self.commands[panel][shortcut] = path;
- switch(shortcut[0],
- \kb, {
- self.kb_handler[panel] = self.kb_handler[panel] ?? Dictionary.new;
- self.kb_handler[panel][shortcut] = action;
- //[path, shortcut].debug("path enabled");
- },
- \midi, {
- //[path, shortcut].debug("midi path enabled");
- //self.commands.debug("commands");
- self.midi_handler[panel] = self.midi_handler[panel] ?? Dictionary.new;
- self.midi_handler[panel][shortcut] = action;
- })
- })
+
+ if(shortcut.class == IdentityDictionary) {
+ self.config.leafDoFrom(path, { arg leafPath, val; self.enable(leafPath); });
+ } {
+ //shortcut.debug("shortcut");
+ //action.debug("action");
+ if(shortcut.notNil, {
+ if(self.commands[panel].isNil) {
+ self.commands[panel] = Dictionary.new;
+ };
+ self.commands[panel][shortcut] = path;
+ switch(shortcut[0],
+ \kb, {
+ self.kb_handler[panel] = self.kb_handler[panel] ?? Dictionary.new;
+ self.kb_handler[panel][shortcut] = action;
+ //[path, shortcut].debug("path enabled");
+ },
+ \midi, {
+ //[path, shortcut].debug("midi path enabled");
+ //self.commands.debug("commands");
+ self.midi_handler[panel] = self.midi_handler[panel] ?? Dictionary.new;
+ self.midi_handler[panel][shortcut] = action;
+ })
+ })
+ }
},
@@ -426,20 +539,25 @@
var shortcut, panel = path[0];
shortcut = self.config.at(*path);
+ if(shortcut.class == IdentityDictionary) {
+ self.config.leafDoFrom(path, { arg leafPath, val; self.disable(leafPath); });
+ } {
+ shortcut.debug("disabling shortcut");
- if(shortcut.notNil, {
- self.commands[panel][shortcut] = nil;
- switch(shortcut[0],
- \kb, {
- self.kb_handler[panel] = self.kb_handler[panel] ?? Dictionary.new;
- self.kb_handler[panel][shortcut] = nil;
- //[path, shortcut].debug("path disabled");
- },
- \midi, {
- self.midi_handler[panel] = self.midi_handler[panel] ?? Dictionary.new;
- self.midi_handler[panel][shortcut] = nil;
- })
- })
+ if(shortcut.notNil, {
+ self.commands[panel][shortcut] = nil;
+ switch(shortcut[0],
+ \kb, {
+ self.kb_handler[panel] = self.kb_handler[panel] ?? Dictionary.new;
+ self.kb_handler[panel][shortcut] = nil;
+ //[path, shortcut].debug("path disabled");
+ },
+ \midi, {
+ self.midi_handler[panel] = self.midi_handler[panel] ?? Dictionary.new;
+ self.midi_handler[panel][shortcut] = nil;
+ })
+ })
+ };
},
@@ -462,6 +580,12 @@
}
},
+//~rah = MultiLevelIdentityDictionary.new;
+//~rah[\bla,\niak] = 4
+//~rah[\bla,\rah,\goui] = 4
+//~rah.leafDoFrom([\bla], { arg x, y; [x,y].postcs });
+//~rah[\bla,\niak].nodeType
+//~rah[\bla,\rah,\goui].class
overload_mode: { arg self, path;
var restorefun=nil;
@@ -508,7 +632,12 @@
};
},
-
+ array_set_action_enable: { arg self, path, size, action;
+ size.do { arg i;
+ self.set_action(path++[i], { action.(i) });
+ self.enable(path++[i]);
+ };
+ },
set_shortcut: { arg self, path, shortcut;
self.config.put(*path++[shortcut]);
@@ -520,6 +649,10 @@
};
},
+ parse_action_bindings: { arg self, panel, actions;
+ ~parse_action_bindings.(self, panel, actions);
+ },
+
get_kb_responder: { arg self, name;
name.debug("giving panel responder");
{ arg view, char, modifiers, u, k;
@@ -528,31 +661,46 @@
};
},
+ qt_get_kb_responder: { arg self, name;
+ name.debug("giving panel responder");
+ { arg view, char, modifiers, u, k;
+ var res;
+ [name, modifiers, u].debug("KEYBOARD INPUT");
+
+ res = ~keycode_to_keysymbol.(view, char, modifiers, u, k);
+ if( res.notNil ) {
+ self.handle_key(name, [\kb] ++ res);
+ } {
+ "~keycode_to_keysymbol yielded no result".debug;
+ }
+ };
+ },
+
bind_param: { arg self, ccpath, param;
var panel = \midi;
var oldparam;
- "I---I bind_param".debug;
+ //"I---I bind_param".debug;
if(self.midi_handler[panel].isNil) { self.midi_handler[panel] = Dictionary.new };
//oldparam = self.ccpathdict.get_val_by_key(ccpath);
oldparam = self.ccpathToParam[ccpath];
- [param.name, ccpath].debug("assigning ccpath to param");
+ //[param.name, ccpath].debug("assigning ccpath to param");
//self.ccpathdict.bind(ccpath, param); // key: ccpath, val: param
self.ccpathToParam[ccpath] = param;
self.paramToCcpath[param] = ccpath;
if(oldparam.notNil && (oldparam != param)) {
self.paramToCcpath[oldparam] = nil;
//self.get_param_binded_ccpath(oldparam).debug("ce n'est point possible");
- oldparam.name.debug("refreshing oldparam");
+ //oldparam.name.debug("refreshing oldparam");
oldparam.midi.refresh;
};
- param.midi.get_ccpath.debug("verif");
- param.name.debug("refreshing param");
+ //param.midi.get_ccpath.debug("verif");
+ //param.name.debug("refreshing param");
param.midi.refresh;
self.midi_handler[panel][ccpath] = { arg val;
- [param.name, val].debug("bind_param function: set_val");
+ //[param.name, val].debug("bind_param function: set_val");
param.midi.set_val(val);
};
- "I---I end bind_param".debug;
+ //"I---I end bind_param".debug;
},
get_param_binded_ccpath: { arg self, param;
@@ -561,6 +709,14 @@
self.paramToCcpath[param]
},
+ ccpath_to_param: { arg self, ccpath;
+ self.ccpathToParam[ccpath];
+ },
+
+ param_to_ccpath: { arg self, param;
+ self.paramToCcpath[param];
+ },
+
handle_cc: { arg self, ccpath, val;
var panel = \midi;
if(self.midi_handler[panel].isNil) { self.midi_handler[panel] = Dictionary.new };
@@ -594,6 +750,111 @@
);
+~keycode_to_keysymbol = { arg view, char, modifiers, unicode, keycode;
+ var fxtest, fxsymbol, modsymbol, keysymbol;
+ var onlymodifer;
+ [char, modifiers, unicode, keycode].postcs;
+
+ onlymodifer = [
+ 16777249, 16777251, 16777248
+ ];
+
+ if(onlymodifer.includes(keycode)) {
+ "Modifier only".debug;
+ } {
+
+ if(GUI.scheme == QtGUI) {
+ "qtgui".debug;
+ fxtest = { ~keycode.kbqtfx.includes(keycode) };
+ fxsymbol = { ("f" ++ (~keycode.kbqtfx.indexOf(keycode) + 1)).asSymbol; }
+ } {
+ fxtest = { ~keycode.kbfx.includes(unicode) };
+ fxsymbol = { ("f" ++ (~keycode.kbfx.indexOf(unicode) + 1)).asSymbol; }
+ };
+
+ keysymbol = case
+ { ~keycode.kbrqtspecial.includesKey(keycode) }
+ {
+ "MATCH".debug;
+ ~keycode.kbrqtspecial[keycode].postcs
+ }
+ { ~keycode.kbspecial.values.includes(unicode) }
+ {
+ "MATCH".debug;
+ ~keycode.kbspecial.invert[unicode].postcs
+ }
+ { fxtest.() }
+ {
+ "MATCH".debug;
+ fxsymbol.().postcs;
+ }
+ { ~keycode.kbnumpad.includes(unicode) }
+ {
+ "MATCH".debug;
+ (\np ++ ~keycode.kbnumpad.indexOf(unicode)).asSymbol.postcs;
+ }
+ { ~keycode.kbnumline.includes(unicode) }
+ {
+ "MATCH".debug;
+ ~keycode.kbrnumline[~keycode.kbnumline.indexOf(unicode)].asString.postcs;
+ }
+ {
+ ~keycode.kbsaalphanum.values.includes(keycode);
+ //or: { ~keycode.kbsaalphanum.values.includes(unicode)
+ //or: { ~keycode.kbcalphanum.values.includes(unicode) }}
+ }
+ {
+ "MATCH saa".debug;
+ ~keycode.kbrsaalphanum[keycode].asString.toLower.postcs;
+ }
+ {
+ ~keycode.kbaalphanum.values.includes(unicode)
+ //or: { ~keycode.kbsaalphanum.values.includes(unicode)
+ //or: { ~keycode.kbcalphanum.values.includes(unicode) }}
+ }
+ {
+ "MATCH aa".debug;
+ ~keycode.kbraalphanum[unicode].asString.toLower.postcs;
+ }
+ // else
+ {
+ "NO MATCH".debug;
+ };
+
+ modsymbol = case
+ {
+ ~keycode.rmod.includesKey(modifiers)
+ }
+ {
+ var m;
+ "MOD MATCH".debug;
+ m = ~keycode.rmod[modifiers].postcs;
+ if(m == \numpad) {
+ m = 0
+ };
+ if(m == \fx) {
+ 0
+ };
+ m
+ }
+ // else
+ {
+ "MOD NO MATCH".debug;
+ };
+
+ if(modsymbol == \numpad) {
+ if(~keycode.kbqtnumpad.values.includes(keycode)) {
+ keysymbol = ~keycode.kbqtnumpad.invert[keycode]
+ }
+ };
+
+ "--END:".debug;
+ keysymbol.postln;
+ [modsymbol, keysymbol].postcs;
+
+ };
+ nil;
+};
~bindings = (
@@ -614,17 +875,87 @@
["toggle_cc_recording", \kb, \altshift, "r"],
["change_param_kind.recordbus", \kb, \altshift, "u"],
["start_midi_liveplayer", \kb, \altshift, "e"],
+ ["param_set_pkey_mode", \kb, \alt, "k"],
+ ["param_unset_pkey_mode", \kb, \altshift, "k"],
],
parlive: [
["select_header", \kb, \alt, \kbnumline],
["show_panel.editplayer", \kb, 0, \f12],
["create_new_livenode", \kb, \alt, "c"],
+ ],
+ side: [
+ ["decrease_select_offset", \midi, 0, \begin],
+ ["increase_select_offset", \midi, 0, \end],
+
+ ["play_selected", \kb, 0, \f5],
+ ["midi.play_selected", \midi, 0, \play],
+ ["stop_selected", \kb, 0, \f6],
+ ["midi.stop_selected", \midi, 0, \stop],
+ //["mute_selected", \kb, 0, \f7],
+ //["unmute_selected", \kb, \ctrl, \f7],
+ ["solo_selected", \kb, 0, \f7],
+ ["unsolo_selected", \kb, \ctrl, \f7],
+ ["toggle_solo_selected", \midi, 0, \pause],
+ ["panic", \kb, 0, \f8],
+ ["edit_tempo", \kb, \ctrlalt, "r"], // t open terminal
+ ["edit_quant", \kb, \ctrlalt, "q"],
+ ["edit_barrecord", \kb, \ctrlalt, "b"],
+ ["edit_selected_param", \kb, 0, \enter],
+
+ ["load_node_from_lib", \kb, 0, \f1],
+ ["create_default_node", \kb, \alt, "c"],
+
+ ["select_param", \kb, 0, \kbpad8x4_flat],
+ ["pad_select_param", \midi, 0, \midipads],
+
+ ["select_param_cell", \kb, \alt, \kbnumline],
+
+ ["select_player", \kb, 0, \kbpad8x4_flat],
+ ["pad_select_player", \midi, 0, \midipads],
+
+ ["set_global_mode.param", \kb, 0, \f9],
+ ["set_global_mode.group", \kb, 0, \f10],
+ ["set_global_mode.liveplay", \kb, 0, \f11],
+ ["midi.set_global_mode.param", \midi, 0, \b1],
+ ["midi.set_global_mode.group", \midi, 0, \b2],
+ ["midi.set_global_mode.liveplay", \midi, 0, \b3],
+
+ ["set_notequant", \kb, \alt, "q"],
+ ["add_cell_bar", \kb, 0, \npplus],
+ ["remove_cell_bar", \kb, \ctrl, \npplus],
+
+
+ //["toggle_player_recording", \midi, 0, \record],
+ ["toggle_player_recording", \midi, 0, \record],
+ ["toggle_metronome", \kb, \alt, "m"],
+
+ ["change_param_kind.seq", \kb, \altshift, "q"],
+ ["change_param_kind.scalar", \kb, \altshift, "s"],
+ ["change_param_kind.recordbus", \kb, \altshift, "d"],
+ ["change_param_kind.bus", \kb, \altshift, "f"],
+ ["change_param_kind.seg", \kb, \altshift, "g"],
+ ["change_param_kind.pkey", \kb, \altshift, "h"],
+
+ ["change_player_mode.stepline", \kb, \altshift, "q"],
+ ["change_player_mode.noteline", \kb, \altshift, "s"],
+ ["change_player_mode.sampleline", \kb, \altshift, "d"],
]
);
~string_to_symbol_list = { arg str;
- str.split($.).collect(_.asSymbol);
+ if(str.class == Symbol) {
+ [str]
+ } {
+ str.split($.).collect(_.asSymbol);
+ }
+};
+
+~qt_get_modifer = { arg binding;
+ var realmod;
+ var key = binding[3];
+ var mod = binding[2];
+ mod;
};
~get_modifer = { arg binding;
@@ -661,11 +992,12 @@
~get_keycode = { arg binding;
var realkey;
+ var kind = binding[1];
var key = binding[3];
var mod = binding[2];
if( key.isString && (key.size < 3) ) {
case
- { [\ctrl, \ctrlaltshift, \ctrlshift].includes(mod) } {
+ { [\ctrl, \ctrlaltshift, \ctrlshift, \ctrlalt].includes(mod) } {
realkey = ~keycode.kbcalphanum[key];
}
{ [\shift, \altshift].includes(mod) } {
@@ -676,7 +1008,11 @@
}
} {
- realkey = ~keycode.kbspecial[key];
+ if(kind == \midi) {
+ realkey = ~keycode.midispecial[key];
+ } {
+ realkey = ~keycode.kbspecial[key];
+ };
if(realkey.isNil) {
realkey = ~keycode[key];
};
@@ -684,6 +1020,17 @@
realkey;
};
+~qt_get_keycode = { arg binding;
+ var realkey;
+ var key = binding[3];
+ var mod = binding[2];
+ if( ~keygroups[key].notNil ) {
+ ~keygroups[key]
+ } {
+ key;
+ };
+};
+
~parse_bindings = { arg commands, bindings;
"**begin parsing bindings".debug;
bindings.keysValuesDo { arg panel, blist;
@@ -702,3 +1049,61 @@
"**end parsing bindings".debug;
};
+~parse_action_bindings = { arg commands, panel, actions;
+ var path;
+ var process_line;
+
+ process_line = { arg action;
+ path = [panel] ++ ~string_to_symbol_list.(action[0]);
+ action.postcs;
+ if(action.last == \disabled) {
+ if(action[1].isInteger) {
+ commands.array_set_action(path, action[1], action[2]);
+ } {
+ commands.set_action(path, action[1]);
+ }
+ } {
+ if(action[1].isInteger) {
+ commands.array_set_action_enable(path, action[1], action[2]);
+ } {
+ commands.add_enable(path, nil, action[1]);
+ }
+ }
+ };
+ "CCCCC parse_action_bindings".debug;
+ actions.do { arg action;
+ if(action[0].class == Array) {
+ action[0].do { arg path;
+ process_line.([path] ++ action[1..]);
+ }
+ } {
+ process_line.(action)
+ }
+ }
+};
+
+~copy_action_bindings = { arg commands, panel, prefix, paths;
+ paths.do { arg path;
+ path = ~string_to_symbol_list.(path);
+ commands.copy_action([panel]++path, [panel, prefix] ++ path)
+ };
+};
+
+~bladebug = {
+ GUI.scheme;
+ ~keycode.kbqtfx.indexOf(16777264);
+ ~keycode.kbqtfx.includes(16777264);
+ w = Window.new;
+ UserView.new(w);
+ w.view.keyDownAction = ~keycode_to_keysymbol;
+ w.front;
+ ~keycode.mod.invert;
+ GUI.swing;
+ s.boot;
+ GUI.qt;
+ //~keycode.kbsaalphanum.values.includes(36);
+ //~keycode.kbaalphanum.values.includes(36);
+ //~keycode.kbsaalphanum.values;
+ //~keycode.kbraalphanum.keys;
+ //~keycode.kbraalphanum[36].asString.toLower.postcs;
+};
View
61 live10.sc
@@ -0,0 +1,61 @@
+
+(
+s.waitForBoot{
+~seq = Mdef.init;
+~synthlib = [
+ \audiotrack_expander,
+ \lead2,
+ \pulsepass,
+ \flute1,
+ \miaou1,
+ \ringbpf1,
+ \piano2,
+ \pmosc,
+ \monosampler,
+ \stereosampler,
+ \ss_comb,
+ \ss_combfreq,
+].collect({ arg i; i -> i });
+
+~effectlib = [
+ \echo
+].collect({arg i; i -> i });
+
+~samplelib = [
+ "sounds/perc1.wav",
+ "sounds/pok1.wav",
+ "sounds/amen-break.wav",
+ "sounds/default.wav"
+];
+~seq.load_patlib( ~synthlib );
+~seq.load_effectlib( ~effectlib );
+//~seq.set_presetlib_path("mypresets2");
+~seq.append_samplelib_from_path("sounds/" );
+~seq.append_samplelib_from_path("sounds/hydrogen/GMkit" );
+~seq.append_samplelib_from_path("sounds/hydrogen/HardElectro1" );
+
+
+
+Mdef.side_gui;
+}
+)
+Mdef(\froid, Pbind(
+ \instrument, \lead2
+));
+Mdef(\chaud, Pbind(
+ \instrument, \lead2
+));
+Mdef(\sampleme, Pbind(
+ \instrument, \monosampler
+));
+
+(
+Mdef(\bleu, Pbind(
+ \instrument, \lead2
+));
+)
+(
+Mdef(\sampleme, Pbind(
+ \instrument, \monosampler
+));
+)
View
17 live9.sc
@@ -5,6 +5,7 @@ TempoClock.tempo = 1.5;
~synthlib = [
\audiotrack_expander,
+ \lead2,
\pulsepass,
\flute1,
\miaou1,
@@ -43,6 +44,22 @@ TempoClock.tempo = 1.5;
~seq.save_project("blablareggae");
~seq.load_project("blablareggae");
(
+SynthDef(\lead2, { arg out=0, freq = 100, pan=0, amp=0.1, mdetune=1.004, gate=1, rq=0.1, fratio = 1, fbase=400, wet=1, fbfreq=100, fbamp=0.8, fbpamp=1, rt=0.4;
+ var fb, ou, filtenv;
+ //gate = LFPulse.ar(1);
+ ou = LFSaw.ar(freq * [1, mdetune]).sum;
+ filtenv = EnvGen.ar(Env.adsr(0.01,0.25,0.07,0.3), gate, freq * fratio, fbase, doneAction:0);
+ ou = RLPF.ar(ou, filtenv, rq);
+ fb = LocalIn.ar(1) + ou;
+ fb = HPF.ar(fb, fbfreq);
+ LocalOut.ar(fb * fbamp);
+ fb = Limiter.ar(fb, amp);
+ fb = SelectX.ar(wet, [ou, fb*fbpamp]);
+ fb = fb * EnvGen.ar(Env.adsr(0.001,0.4,0.1,rt), gate, doneAction:2);
+ fb = Pan2.ar(fb, pan, amp);
+ Out.ar(out, fb);
+}).store;
+
SynthDef(\echo, { arg out=0, in=0, maxdtime=0.6, dtime=0.2, decay=2, wet=1, gate=1;
var env, ou;
env = Linen.kr(gate, 0.05, 1, decay, doneAction:14);
View
75 main.sc
@@ -32,6 +32,10 @@
};
~general_sizes = (
+ midi_cc: (
+ knob: 8,
+ slider: 8
+ ),
safe_inf: 10000,
bank: 10,
children_per_groupnode: 16,
@@ -86,6 +90,7 @@
control: Color.newHex("6F88BA"),
control2: Color.newHex("6F889A"),
led: Color.newHex("A788BA"),
+ led_ok: Color.newHex("A7BBBA"),
header_cell: Color.newHex("BBBBA9")
@@ -112,6 +117,35 @@
parent.onClose = parent.onClose.addFunc { controller.remove };
if(auto_refresh) { model.refresh() };
+
+ controller;
+};
+
+~sort_by_template = { arg list, template;
+ var res = List.new;
+ template.do { arg i;
+ if(list.includes(i)) {
+ res.add(i);
+ }
+ };
+ list.do { arg i;
+ if(res.includes(i).not) {
+ res.add(i)
+ }
+ };
+ res;
+
+};
+
+~find_path_difference = { arg path1, path2;
+ var res = List.new;
+ path1.do { arg i, x;
+ if(i == path2[x]) {
+ } {
+ res.add(i)
+ }
+ };
+ res;
};
// this function take a pattern and a list of Pmono pattern as effects
@@ -175,14 +209,14 @@
"hmatrix",
"editplayer",
"mixer",
- "score"
+ "score",
+ "side",
].do { arg file;
("Loading " ++ file ++".sc...").inform;
("/home/ggz/code/sc/seco/"++file++".sc").load;
};
"Done loading.".inform;
-
// ==========================================
// SEQUENCER FACTORY
// ==========================================
@@ -351,12 +385,12 @@
current_panel: \parlive,
clipboard: nil,
- nodelib: nil,
+ nodelib: List.new,
presetlib: Dictionary.new,
presetlib_path: nil,
colpresetlib: Dictionary.new,
- patlist: nil,
+ patlist: List.new,
patpool: Dictionary.new,
samplelist: List.new,
@@ -398,7 +432,7 @@
block { arg break;
1000.do {
newname = makename.();
- if( main.get_node(newname).isNil ) { break.value };
+ if( self.get_node(newname).isNil ) { break.value };
newname.debug("Name exist already");
};
"make_livenodename_from_libnodename: Error, can't find free name".error;
@@ -417,10 +451,10 @@
var livenodename;
var player;
livenodename = self.make_livenodename_from_libnodename(libnodename);
- player = ~make_player.(main, main.model.patpool[libnodename]);
+ player = ~make_player.(main, self.model.patpool[libnodename]);
player.name = livenodename;
player.uname = livenodename;
- main.add_node(player);
+ self.add_node(player);
player.uname;
},
@@ -430,9 +464,9 @@
newlivenodename.debug("newlivenodename");
livenodename.debug("livenodename");
//main.model.livenodepool.keys.debug("livenodepool");
- main.model.livenodepool[newlivenodename] = main.model.livenodepool[livenodename].clone;
- main.model.livenodepool[newlivenodename].name = newlivenodename;
- main.model.livenodepool[newlivenodename].uname = newlivenodename;
+ self.model.livenodepool[newlivenodename] = self.model.livenodepool[livenodename].clone;
+ self.model.livenodepool[newlivenodename].name = newlivenodename;
+ self.model.livenodepool[newlivenodename].uname = newlivenodename;
newlivenodename;
},
@@ -759,21 +793,38 @@
//self.window.view.focus(true);
},
+ edit_mpdef: { arg self, name;
+ var player, ep;
+ player = main.get_node(name);
+ self.current_test_player = player;
+ self.model.current_panel = \editplayer;
+ self.context.set_selected_node(player);
+
+ self.main_view = ~main_view.(self);
+ },
+
+
make_gui: { arg self;
self.main_view = ~main_view.(self);
},
+ make_side_gui: { arg self;
+ self.panels.side.make_gui;
+ },
+
init: { arg self;
self.init_synthdesclib;
"ijensuisla".debug;
self.add_node(~empty_player);
"jensuisla".debug;
~parse_bindings.(main.commands,~bindings);
+ self.node_manager = ~make_node_manager.(self);
+ self.midi_center = ~midi_center.(self);
self.play_manager = ~make_playmanager.(self);
+ self.context = ~make_context.(main);
self.panels.parlive = ~make_parlive.(self);
self.panels.seqlive = ~make_seqlive.(self);
- self.context = ~make_context.(main);
- self.midi_center = ~midi_center.(self);
+ self.panels.side = ~make_side_panel.(self);
}
View
65 midi.sc
@@ -77,25 +77,33 @@
knob: 0
),
+
+
get_main: { arg self; main },
+ is_next_free: { arg self, kind;
+ self.next_free[kind] < ~general_sizes.midi_cc[kind]
+ },
+
assign_first: { arg self, kind, param;
var ccpath;
- "HEINNNN".debug;
- if(self.next_free[kind] < 8) { //FIXME: hardcoded value
+ //"HEINNNN".debug;
+ if(self.is_next_free(kind)) { //FIXME: hardcoded value
ccpath = [kind, self.next_free[kind]];
- [param.name, ccpath, self.next_free].debug("III: assign_first: assigning midi");
+ //[param.name, ccpath, self.next_free].debug("III: assign_first: assigning midi");
main.commands.bind_param(ccpath, param);
- main.commands.get_param_binded_ccpath(param).debug("III: assigned ccpath verification");
+ //main.commands.get_param_binded_ccpath(param).debug("III: assigned ccpath verification");
self.next_free[kind] = self.next_free[kind] + 1;
+ true;
} {
- ("Too much assigned param: no midi controller left."+param.name).error;
+ ("Too much assigned param: no midi controller left."+param.name).warn;
+ false;
};
},
assign_adsr: { arg self, param;
var ccpath;
- param.name.debug("midi_center: assign_adsr");
+ //param.name.debug("midi_center: assign_adsr");
~adsr_point_order.do { arg key, i;
ccpath = [\slider, i+4];
main.commands.bind_param(ccpath, param.get_param(key));
@@ -120,7 +128,7 @@
},
set_control_val: { arg self, ccpath, val;
- [ccpath, val].debug("===================midi_center: set_control_val");
+ //[ccpath, val].debug("===================midi_center: set_control_val");
self.cc_states[ccpath] = val;
},
@@ -165,12 +173,36 @@
},
+ install_pad_responders: { arg self;
+ self.nonr = List.new;
+
+ [\pad].do { arg cctype; ~keycode.cakewalk[cctype].do { arg keycode, i;
+ var ccpath = [\midi, 0, keycode + 1000]; // add offset to difference from cc
+ self.nonr.add(
+ NoteOnResponder ({ arg src, chan, num, veloc;
+ main.commands.handle_midi_key(main.model.current_panel, ccpath);
+ },
+ nil,
+ nil,
+ keycode,
+ nil
+ )
+ )
+ }};
+ },
+
+ uninstall_pad_responders: { arg self;
+ self.nonr.do { arg x; x.remove; };
+ self.nonr = nil;
+ },
+
uninstall_responders: { arg self;
self.ccresp.do { arg x; x.remove };
self.ccresp = nil;
}
);
CCResponder.removeAll;
+ NoteOnResponder.removeAll;
mc.install_responders;
mc;
};
@@ -179,10 +211,10 @@
// param interface: name, set_norm_val, get_norm_val, changed, spec
// changed notifications: midi_val(number), blocked(bool), label
(
- blocked: \sup,
+ blocked: \inf,
set_val: { arg self, val, cell=nil;
- [param.name, val].debug("get_midi_control_handler:set_val");
+ //[param.name, val].debug("get_midi_control_handler:set_val");
self.unblock_do {
//debug("get_midi_control_handler:set_val: not blocked");
//self.get_midi_norm_val.debug("BLAAA1");
@@ -197,7 +229,7 @@
},
get_midi_val: { arg self;
- [self.get_ccpath, midi_center.get_control_val(self.get_ccpath), param.spec.map(midi_center.get_control_val(self.get_ccpath))].debug("get_midi_val");
+ //[self.get_ccpath, midi_center.get_control_val(self.get_ccpath), param.spec.map(midi_center.get_control_val(self.get_ccpath))].debug("get_midi_val");
param.spec.map(midi_center.get_control_val(self.get_ccpath));
},
@@ -213,17 +245,17 @@
},
label: { arg self;
- param.name.debug("get_midi_control_handler: label");
+ //param.name.debug("get_midi_control_handler: label");
if(self.get_ccpath.isNil) {
"X"
} {
- (self.get_ccpath[0].asString[0].asString ++ (self.get_ccpath[1]+1).asString).debug("get_midi_control_handler: label: label choosed");
+ //(self.get_ccpath[0].asString[0].asString ++ (self.get_ccpath[1]+1).asString).debug("get_midi_control_handler: label: label choosed");
self.get_ccpath[0].asString[0].asString ++ (self.get_ccpath[1]+1).asString;
}
},
set_ccpath: { arg self, val;
- param.name.debug("get_midi_control_handler: set_ccpath (deprecated method??)");
+ //param.name.debug("get_midi_control_handler: set_ccpath (deprecated method??)");
self.ccpath = val;
self.refresh;
},
@@ -295,7 +327,7 @@
},
refresh: { arg self;
- param.name.debug("get_midi_control_handler: refresh");
+ //param.name.debug("get_midi_control_handler: refresh");
self.block;
param.changed(\label);
param.changed(\midi_val, self.get_midi_val);
@@ -429,7 +461,10 @@
},
cancel_recording: { arg self;
- self.stop_immediate_recording;
+ self.nonr.remove;
+ self.noffr.remove;
+ self.livebook.keysValuesDo { arg k, v; v.release }; // free last synths
+ self.recording = false;
},
start_tempo_recording: { arg self, action, preend_action;
View
534 param.sc
@@ -99,7 +99,7 @@
~player_get_arg = { arg self, argName;
var ret;
- argName.dump;
+ //argName.dump;
//self.get_args.do { arg an; an.debug("an====").dump };
ret = if(self.get_args.includes(argName), {
if([\type, \stepline].includes(argName), {
@@ -142,6 +142,13 @@ Spec.add(\repeat, ControlSpec(0, 100, \lin, 1, 0));
Spec.add(\pos, ControlSpec(0, 1, \lin, 0.0001, 0));
Spec.add(\amp, ControlSpec(0, 3, \lin, 0.0001, 0));
Spec.add(\wet, ControlSpec(0, 1, \lin, 0, 0));
+Spec.add(\mix, ControlSpec(0, 1, \lin, 0, 0));
+Spec.add(\damp, ControlSpec(0, 1, \lin, 0, 0));
+Spec.add(\room, ControlSpec(0, 1, \lin, 0, 0));
+Spec.add(\mdetune, ControlSpec(0.1, 2, \lin, 0, 0));
+Spec.add(\pwidth, ControlSpec(0, 1, \lin, 0, 0.5));
+Spec.add(\pwdetune, ControlSpec(-1, 1, \lin, 0, 0));
+Spec.add(\vibratio, ControlSpec(0, 1, \lin, 0, 0));
//SynthDescLib.global.synthDescs[\pulsepass].metadata;
@@ -191,6 +198,7 @@ Spec.add(\wet, ControlSpec(0, 1, \lin, 0, 0));
// ==========================================
~make_status_view = { arg parent, play_manager;
+ // DEPRECATED, use make_status_view_horizontal
var win, vlayout, but_layout, bt, bar, temp, pos, clock, task, color;
var hstatetxt;
var refresh_pos;
@@ -290,16 +298,270 @@ Spec.add(\wet, ControlSpec(0, 1, \lin, 0, 0));
};
+~make_status_view_horizontal = { arg parent, play_manager, size;
+ var win, vlayout, but_layout, bt, bar, temp, pos, clock, task, color;
+ var hstatetxt;
+ var quanttxt;
+ var refresh_pos;
+ var fieldsize;
+ size = size ?? (120@200);
+ fieldsize = (size.x/8)@size.y;
+
+
+ "hein".debug;
+ clock = play_manager.get_clock;
+
+ vlayout = HLayoutView(parent, Rect(0,0,size.x,size.y));
+ hstatetxt = StaticText(vlayout, fieldsize);
+ temp = StaticText(vlayout, fieldsize);
+ temp.string = "Tempo:" + (clock.tempo*60).asString;
+ pos = StaticText(vlayout, fieldsize);
+ pos.string = "002 / 004 | 2 | 1254";
+ but_layout = HLayoutView(vlayout, fieldsize);
+ bt = { arg i;
+ StaticText(but_layout, Rect(0,0,20,20)).background_(Color.black);
+ } ! clock.beatsPerBar;
+ bar = RangeSlider(vlayout, fieldsize);
+
+ quanttxt = StaticText(vlayout, fieldsize);
+
+ refresh_pos = { arg clock;
+ var posstring, barrange, bib, col;
+ if(play_manager.is_playing || play_manager.is_recording) {
+ clock.beatInBar.debug("beatInBar");
+ posstring = play_manager.get_rel_beat.round(0.01).asString.padLeft(3, " ")
+ + "/" + play_manager.get_record_length.asString
+ + "|" + clock.beats.asString; // FIXME: find a way to zero pad
+ barrange = play_manager.get_rel_beat / play_manager.get_record_length;
+ bib = clock.beatInBar;
+ col = if(play_manager.is_near_end) { Color.red } { Color.green };
+ {
+ bt[bib].background = col;
+ bt.wrapAt(bib - 1).background = Color.black;
+ pos.string = posstring;
+ bar.range = barrange;
+ }.defer;
+ true; // continue
+ } {
+ play_manager.get_rel_beat.debug("refresh vimetro task: stopped");
+ {
+ pos.string = "0 /" + play_manager.get_record_length.asString + "| 0";
+ bar.range = 0;
+ }.defer;
+ false; // exit
+ }
+ };
+
+
+
+ clock.postln;
+ task = TaskProxy.new;
+ task.source = {
+ //play_manager.start_pos = clock.beats; // debug
+ var clock = play_manager.get_clock;
+ play_manager.get_rel_beat.debug("start vimetro task");
+ {
+ bt.do { arg x; x.background = Color.black };
+ }.defer;
+ block { arg break;
+ 10000.do { //FIXME: fake loop
+ if(refresh_pos.(clock).not) { "BREAK".debug; break.value };
+ 1.wait;
+ }
+ }
+ };
+
+ parent.onClose = parent.onClose.addFunc { "close".postln; task.stop };
+
+ ~make_view_responder.(parent, play_manager, (
+ tempo: { arg obj, msg, tempo;
+ temp.string = "Tempo: " ++ play_manager.get_bpm_tempo.asString;
+ },
+ pos: { arg obj, msg, position;
+ refresh_pos.(play_manager.get_clock);
+ },
+ quant: { arg obj;
+ quanttxt.string = "Quant: "++EventPatternProxy.defaultQuant;
+ },
+ visual_metronome: { arg self;
+ if(self.visual_metronome_enabled) {
+ play_manager.get_rel_beat.debug("start vimetro!!!");
+ task.play(play_manager.get_clock,quant:1);
+ } {
+ play_manager.get_rel_beat.debug("stop vimetro!!!");
+ task.stop;
+ task.reset;
+ }
+ },
+ head_state: { arg obj, msg, state;
+ switch(state,
+ \prepare, { hstatetxt.string = "Prepare"; hstatetxt.background = Color.new255(255, 165, 0) },
+ \record, { hstatetxt.string = "Rec"; hstatetxt.background = Color.red },
+ \overdub, { hstatetxt.string = "Dub"; hstatetxt.background = Color.new255(205, 92, 92) },
+ \play, { hstatetxt.string = "Play"; hstatetxt.background = Color.green },
+ \stop, { hstatetxt.string = "Stop"; hstatetxt.background = Color.clear }
+ );
+ }
+
+ ));
+
+};
+
~make_edit_number_view = { arg main, name, param, midi_cc;
var win = Window.new(name,Rect(500,500,200,100));
- var layout = GUI.hLayoutView.new(win, Rect(0,0,200,100));
+ var parent = win;
+ var vlayout, hlayout;
+ var bt_name, txt_midi_label, kind, txt_midi_val, paramval, slider;
+ var bsize = 23;
+ var font;
+ var param_view, param_responder;
+ var size = 200@56;
+ var lineheigth = 26;
+ var tf_val;
+ var validate_action;
+ var key_responder;
+ var old_param, old_ccpath;
+ var close_window;
+ font = Font.default;
+ font.size = 12;
+ font.setDefault;
+
+ vlayout = VLayoutView.new(parent, Rect(0,0,size.x,size.y+45));
+ bt_name = StaticText.new(vlayout, Rect(0,0,size.x,lineheigth));
+ tf_val = TextField.new(vlayout, Rect(0,0,size.x,lineheigth));
+ hlayout = HLayoutView.new(vlayout, Rect(0,0,size.x,lineheigth));
+ slider = Slider(vlayout, Rect(0,0,size.x,5));
+ txt_midi_label = StaticText.new(hlayout, Rect(0,0,bsize-7,size.y/2));
+ kind = StaticText.new(hlayout, Rect(0,0,bsize,size.y/2));
+ txt_midi_val = StaticText.new(hlayout, Rect(0,0,(size.x-(bsize*2)-15)/2,size.y/2));
+ paramval = StaticText.new(hlayout, Rect(0,0,(size.x-(bsize*2))/2,size.y/2));
+
+ bt_name.string = param.name;
+ txt_midi_label.string = "";
+ kind.string = "";
+ txt_midi_val.string = "";
+ paramval.string = "";
+
+ vlayout.background = ~color_scheme.background;
+ //bt_name.background = ~color_scheme.control;
+ //bt_name.background = Color.newHex("343154");
+ bt_name.background = Color.newHex("54516A");
+ bt_name.stringColor = Color.white;
+ bt_name.font = font.boldVariant;
+ //txt_midi_label.background = ~color_scheme.control;
+ txt_midi_label.stringColor = Color.white;
+ //kind.background = ~color_scheme.control;
+ kind.stringColor = Color.white;
+ txt_midi_val.background = ~color_scheme.control;
+ txt_midi_val.stringColor = Color.white;
+ paramval.background = ~color_scheme.control;
+ paramval.stringColor = Color.white;
+
+ slider.value = param.get_norm_val;
+ //tf_val.string = param.get_val;
+
+ old_param = main.commands.ccpath_to_param(midi_cc);
+ old_ccpath = main.commands.param_to_ccpath(param);
+ main.commands.bind_param(midi_cc, param);
+ win.front;
+
+ validate_action = {
+ var val = tf_val.value;
+ if(val.size > 0) {
+ param.set_val(val.asFloat.debug("la valeur"));
+ };
+ };
+ close_window = {
+ main.commands.bind_param(midi_cc, old_param);
+ if(old_ccpath.notNil) {
+ main.commands.bind_param(old_ccpath, param);
+ };
+ win.close;
+ };
+ slider.action = { param.set_norm_val(slider.value) };
+
+ key_responder = { arg view, char, modifiers, u, k;
+ ["tempo", modifiers, u].debug("KEYBOARD INPUT");
+ if( u == ~keycode.kbspecial.escape ) { close_window.() };
+ if( u == ~keycode.kbspecial.enter ) { validate_action.(); close_window.(); };
+ };
+
+
+ tf_val.keyDownAction = key_responder;
+ vlayout.keyDownAction = key_responder;
+
+ param_responder = { arg display; (
+ selected: { arg self;
+ if(display.selected == 1) {
+ self.name.debug("je suis select");
+ bt_name.debug("bt_name");
+ bt_name.background = Color.newHex("B4B1BA");
+ } {
+ self.name.debug("je suis DEselect");
+ bt_name.background = Color.newHex("54516A");
+ }
+ },
+
+ val: { arg self, msg, cellidx=0;
+ var newval;
+ name.debug("param_responder: val");
+ paramval.string = self.get_val(cellidx);
+
+ if(slider.notNil, {
+ slider.value = self.get_norm_val(cellidx);
+ });
+ },
+
+ kind: { arg self;
+ kind.string = if(self.pkey_mode.notNil and: {self.pkey_mode}) {
+ "KEY"
+ } {
+ if([\stepline,\sampleline,\noteline].includes(self.classtype)) {
+ ""
+ } {
+ switch(self.current_kind,
+ \seq, { "seq" },
+ \seg, { "sg" },
+ \scalar, { "sca" },
+ \bus, { "bus" },
+ \recordbus, { "rbu" },
+ \preset, { "pre" },
+ { "..." }
+ )
+ }
+ };
+ },
+
+ label: { arg self;
+ txt_midi_label.string = self.midi.label;
+ },
+ midi_val: { arg self, msg, val;
+ txt_midi_val.string = val;
+ },
+ blocked: { arg self, msg, blocked;
+ txt_midi_val.background = if(blocked.not, { ~color_scheme.led_ok }, { ~editplayer_color_scheme.led });
+ },
+ recording: { arg self, msg, recording;
+ txt_midi_label.background = if(recording, { ~editplayer_color_scheme.led }, { Color.clear });
+ }
+ )};
+
+ ~make_view_responder.(vlayout, param, param_responder.((selected:1)));
+
+};
+~make_edit_number_view2 = { arg main, name, param, midi_cc;
+ var win = Window.new(name,Rect(500,500,200,100));
+ var layout = GUI.hLayoutView.new(win, Rect(0,0,400,100));
var ez, midi_val;
+ var validate_action;
+ var bla;
ez = EZSlider(layout, 150@42, name, param.spec ,unitWidth:0, numberWidth:60,layout:\line2, margin: 1@1);
ez.setColors(Color.grey,Color.white, Color.grey(0.7),Color.grey, Color.black, Color.yellow,nil,nil, Color.grey(0.7));
midi_val = StaticText.new(layout,Rect(0,0,200,100));
midi_val.string = param.midi.get_midi_val.asString;
ez.value = param.get_val;
+ bla = Button.new(layout,Rect(0,0,50,50));
ez.action = { arg ezs; ezs.value.debug("make_edit_number_view: action called"); param.set_val(ezs.value) };
// FIXME: action not called with 3.5 when hiting enter
@@ -321,15 +583,20 @@ Spec.add(\wet, ControlSpec(0, 1, \lin, 0, 0));
main.commands.bind_param(midi_cc, param);
+ validate_action = { bla.focus; ez.value.debug("con"); ez.doAction; "rah".debug; win.close };
+
layout.keyDownAction = { arg view, char, modifiers, u, k;
["tempo", modifiers, u].debug("KEYBOARD INPUT");
if( u == ~keycode.kbspecial.escape ) { win.close };
- if( u == ~keycode.kbspecial.enter ) { "bla".debug; win.close }; // return false -> propage keydown
+ //if( u == ~keycode.kbspecial.enter ) { "bla".debug; win.close }; // return false -> propage keydown
+ if( modifiers == ~keycode.mod.ctrl and: { u == 3 }) { validate_action.() }; // ctrl-c
};
ez.numberView.keyDownAction = { arg view, char, modifiers, u, k;
["tempo", modifiers, u].debug("KEYBOARD INPUT");
if( u == ~keycode.kbspecial.escape ) { win.close };
- if( u == ~keycode.kbspecial.enter ) { ez.value.debug("con"); ez.doAction; "rah".debug; win.close };
+ //if( u == ~keycode.kbspecial.enter ) { ez.value.debug("con"); ez.doAction; "rah".debug; win.close };
+ //if( u == ~keycode.kbspecial.enter ) { ez.value.debug("con"); ez.doAction; "rah".debug; win.close };
+ if( modifiers == ~keycode.mod.ctrl and: { u == 3 }) { validate_action.() }; // ctrl-c
};
win.front;
@@ -769,7 +1036,7 @@ Spec.add(\wet, ControlSpec(0, 1, \lin, 0, 0));
height = 30;
var txt_midi_label, txt_midi_val;
var sc_param, sc_midi;
- var max_cells = display.max_cells; // FIXME: already defined in editplayer
+ var max_cells = display.max_cells;
var content_view;
var inrange;
var ccview;
@@ -787,11 +1054,15 @@ Spec.add(\wet, ControlSpec(0, 1, \lin, 0, 0));
bt_name = ~make_name_button.(row_layout, display.name, display.name_width ?? btnamesize, height);
if(display.show_midibloc, {
- midibloc = GUI.hLayoutView.new(row_layout, Rect(0,0,150,height));
+ midibloc = GUI.hLayoutView.new(row_layout, Rect(0,0,15+75+5+display.slider_width,height));
txt_midi_label = GUI.staticText.new(midibloc, Rect(0,0,15,height));
txt_midi_val = GUI.staticText.new(midibloc, Rect(0,0,75,height));
- slider = GUI.slider.new(midibloc, Rect(0,0,60,height));
+ slider = GUI.slider.new(midibloc, Rect(0,0,display.slider_width,height));
+ slider.action = {
+ param.set_norm_val(slider.value)
+ };
+
},{
// spacer
txt_midi_val = GUI.staticText.new(row_layout, Rect(0,0,30,height));
@@ -873,26 +1144,28 @@ Spec.add(\wet, ControlSpec(0, 1, \lin, 0, 0));
});
},
- val: { arg self, msg, cellidx;
+ val: { arg self, msg, cellidx=0;
var newval;
cellidx.debug("val handler: cellidx");
- self.get_cells[cellidx].debug("val handler: cellidx value");
- newval = self.get_cells[cellidx];
- if(btl_cells.children.size > 0) {
- ~change_button_label.(btl_cells.children.wrapAt( cellidx % max_cells ), newval);
- };
- //self.debug("val changed");
- if(self.classtype == \stepline, {
+ if(btl_cells.notNil) {
+ self.get_cells[cellidx].debug("val handler: cellidx value");
+ newval = self.get_cells[cellidx];
if(btl_cells.children.size > 0) {
- btl_cells.children.wrapAt( cellidx % max_cells ).value = newval
- }
- },{
- if(slider.notNil, {
- slider.value = self.spec.unmap(newval);
+ ~change_button_label.(btl_cells.children.wrapAt( cellidx % max_cells ), newval);
+ };
+ //self.debug("val changed");
+ if(self.classtype == \stepline, {
+ if(btl_cells.children.size > 0) {
+ btl_cells.children.wrapAt( cellidx % max_cells ).value = newval
+ }
+ },{
+ if(slider.notNil, {
+ slider.value = self.spec.unmap(newval);
+ });
});
- });
- //btl_cells.children[ cellidx ].states.debug("======heeeeerreeeee");
- //btl_cells.children[ cellidx ] = newval;
+ //btl_cells.children[ cellidx ].states.debug("======heeeeerreeeee");
+ //btl_cells.children[ cellidx ] = newval;
+ };
},
cells: { arg self;
@@ -955,16 +1228,24 @@ Spec.add(\wet, ControlSpec(0, 1, \lin, 0, 0));
},
label: { arg self;
- txt_midi_label.string = self.midi.label;
+ if(display.show_midibloc) {
+ txt_midi_label.string = self.midi.label;
+ };
},
midi_val: { arg self, msg, val;
- txt_midi_val.string = val;
+ if(display.show_midibloc) {
+ txt_midi_val.string = val;
+ };
},
blocked: { arg self, msg, blocked;
- txt_midi_val.background = if(blocked.not, { Color.green }, { ~editplayer_color_scheme.led });
+ if(display.show_midibloc) {
+ txt_midi_val.background = if(blocked.not, { Color.green }, { ~editplayer_color_scheme.led });
+ };
},
recording: { arg self, msg, recording;
- txt_midi_label.background = if(recording, { ~editplayer_color_scheme.led }, { Color.clear });
+ if(display.show_midibloc) {
+ txt_midi_label.background = if(recording, { ~editplayer_color_scheme.led }, { Color.clear });
+ };
},
midi_key: { arg self, msg, key;
param_messages.val(param, msg); //TODO
@@ -1343,6 +1624,10 @@ Spec.add(\wet, ControlSpec(0, 1, \lin, 0, 0));
};
+~make_empty_param = { arg main;
+ ~make_simple_number_param.(main, "voidparam", \amp.asSpec, 0.123);
+};
+
~make_simple_number_param = { arg main, name, spec, default_value;
var res = (
name: name,
@@ -1403,8 +1688,11 @@ Spec.add(\wet, ControlSpec(0, 1, \lin, 0, 0));
},
refresh: { arg self;
+ self.changed(\kind);
self.changed(\val);
+ //self.changed(\cells);
self.changed(\selected);
+ self.midi.refresh;
}
);
res.midi = main.midi_center.get_midi_control_handler(res);
@@ -1751,7 +2039,7 @@ Spec.add(\wet, ControlSpec(0, 1, \lin, 0, 0));
start_offset: 0,
end_offset: 0,
muted: false,
- archive_data: [\name, \classtype, \selected, \selected_cell, \default_val, \notes, \start_offset, \end_offset, \notequant],
+ archive_data: [\name, \classtype, \selected, \selected_cell, \default_val, \notes, \start_offset, \end_offset, \notequant, \muted],
notequant: nil,
vnotes: [],
@@ -1780,6 +2068,7 @@ Spec.add(\wet, ControlSpec(0, 1, \lin, 0, 0));
self[kind][key] = data[kind][key];
}
};
+ self.refresh;
},
seq: (
@@ -2234,6 +2523,7 @@ Spec.add(\wet, ControlSpec(0, 1, \lin, 0, 0));
classtype: \stepline,
selected_cell: 0,
selected: 0,
+ current_kind: \stepline, // hack to harmonize with control_param
default_val: default_value.asList,
save_data: { arg self;
@@ -2396,7 +2686,7 @@ Spec.add(\wet, ControlSpec(0, 1, \lin, 0, 0));
var param;
var bar_length = 4;
- name.debug("---- make_control_param");
+ //name.debug("---- make_control_param");
param = (
name: name,
@@ -2407,7 +2697,9 @@ Spec.add(\wet, ControlSpec(0, 1, \lin, 0, 0));
selected_cell: 0,
bar_length: bar_length,
default_val: default_value,
- archive_data: [\name, \classtype, \current_kind, \spec, \selected, \selected_cell, \default_val, \noteline],
+ pkey_mode: false,
+ muted: false,
+ archive_data: [\name, \classtype, \current_kind, \spec, \selected, \selected_cell, \default_val, \noteline, \muted, \pkey_mode],
save_data: { arg self;
var data = ();
@@ -2415,10 +2707,12 @@ Spec.add(\wet, ControlSpec(0, 1, \lin, 0, 0));
arg key;
data[key] = self[key];
};
- [\seq, \scalar, \preset].do { arg kind;
+ [\seq, \scalar, \preset, \bus, \recordbus].do { arg kind;
data[kind] = ();
- [\val, \selected_cell].do { arg key;
- data[kind][key] = self[kind][key];
+ [\val, \selected_cell, \record].do { arg key;
+ if(self[kind][key].notNil) {
+ data[kind][key] = self[kind][key];
+ }
}
};
data;
@@ -2430,8 +2724,10 @@ Spec.add(\wet, ControlSpec(0, 1, \lin, 0, 0));
self[key] = data[key];
};
[\seq, \scalar, \preset].do { arg kind;
- [\val, \selected_cell].do { arg key;
- self[kind][key] = data[kind][key];
+ [\val, \selected_cell, \record].do { arg key;
+ if(data[kind][key].notNil) {
+ self[kind][key] = data[kind][key];
+ }
}
};
},
@@ -2497,7 +2793,7 @@ Spec.add(\wet, ControlSpec(0, 1, \lin, 0, 0));
),
scalar: (
- quoi: { "QUOI".debug; }.value,
+ //quoi: { "QUOI".debug; }.value,
selected_cell: 0, // always 0
val: if(default_value.isArray, { default_value[0] }, { default_value }),
@@ -2608,7 +2904,7 @@ Spec.add(\wet, ControlSpec(0, 1, \lin, 0, 0));
bus: (
// dummy functions
- quoi: { "QUOI".debug; }.value,
+ //quoi: { "QUOI".debug; }.value,
selected_cell: 0, // always 0
val: if(default_value.isArray, { default_value[0] }, { default_value }),
busindex: nil,
@@ -2669,7 +2965,7 @@ Spec.add(\wet, ControlSpec(0, 1, \lin, 0, 0));
select_cell: { arg self, idx; param.seq.selected_cell = idx }, // when changing kind, correct cell is selected in colselect mode
get_selected_cell: { arg self; 0 },
add_cells: {},
- quoii: { "QUOI3".debug }.value,
+ //quoii: { "QUOI3".debug }.value,
remove_cells: {}
@@ -2755,8 +3051,14 @@ Spec.add(\wet, ControlSpec(0, 1, \lin, 0, 0));
}
},
+ set_pkey_mode: { arg self, set=true;
+ self.pkey_mode = set;
+ self.changed(\kind);
+ },
+
refresh: { arg self;
self.changed(\kind);
+ self.changed(\val);
//self.changed(\cells);
self.changed(\selected);
self.midi.refresh;
@@ -2818,85 +3120,89 @@ Spec.add(\wet, ControlSpec(0, 1, \lin, 0, 0));
}
);
Prout({ arg ev;
- var repeat = 1000000;
+ var repeat = ~general_sizes.safe_inf;
var idx, val=0;
repeat.do {
//[name, ev].debug("################################## prout!!!!");
//ev.dump;
- switch( self.current_kind,
- \scalar, {
- //ev.debug("=========== in scalar ev");
- 8.do { // hack to be in phase when changing kind (should be the size of stepline)
+ if(self.pkey_mode) {
+ ev = ev[self.name].yield;
+ } {
+ switch( self.current_kind,
+ \scalar, {
+ //ev.debug("=========== in scalar ev");
+ 8.do { // hack to be in phase when changing kind (should be the size of stepline)
+ switch(player.get_mode,
+ \sampleline, {
+ [name, scalm.value(ev)].debug("############# scalm!!");
+ ev = scalm.value(ev).yield;
+ //ev = 1.yield;
+ },
+ \noteline, {
+ ev = scalf.value(ev).yield;
+ },
+ \stepline, {
+ ev = self.scalar.val.yield;
+ }
+ );
+ }
+ //ev.debug("=========== in scalar ev END");
+ },
+ \seg, {
+ [
+ ev[\elapsed], ev[\segdur],
+ ev[\elapsed]/ev[\segdur],
+ (self.seg.val.size),
+ (ev[\elapsed]/ev[\segdur]) % (self.seg.val.size),
+ self.seg.val.blendAt((ev[\elapsed]/ev[\segdur]) % (self.seg.val.size))
+ ].debug("seggggggggggggggggg: elapsed, segdur, size, el/dur, el/dur%size, res");
+ ev = (self.seg.val++[self.seg.val[0]]).blendAt((ev[\elapsed]/ev[\segdur]) % (self.seg.val.size)).yield;
+ },
+ \seq, {
+ if(player.get_mode == \noteline, {
+ //ev.debug("=========== in noteline ev");
+ //segf.debug("=========== in noteline segf");
+ //segf.value(ev).debug("=========== in noteline");
+ ev = segf.value(ev).yield;
+ }, {
+ idx = 0;
+ val = self.seq.val[idx];
+ while( { val.notNil } , {
+ ev = val.yield;
+ idx = idx + 1;
+ val = self.seq.val[idx];
+ });
+ });
+ //ev.debug("=========== in seq ev END");
+ },
+ \preset, {
switch(player.get_mode,
\sampleline, {
- [name, scalm.value(ev)].debug("############# scalm!!");
- ev = scalm.value(ev).yield;
+ [name, scalm.value(ev)].debug("############# scalm!!2");
//ev = 1.yield;
+ ev = scalm.value(ev).yield;
},
\noteline, {
- ev = scalf.value(ev).yield;
+ ev = pref.value(ev).yield;
},
\stepline, {
- ev = self.scalar.val.yield;
+ ev = self.preset.val[self.preset.selected_cell].yield
}
);
+ },
+ \bus, {
+ self.bus.get_bus.asMap.yield;
+ },
+ \recordbus, {
+ self.bus.get_bus.asMap.yield;
+ },
+ // else
+ {
+ [param.name, self.current_kind].debug("ERROR: param kind dont match");
+ 0.yield;
}
- //ev.debug("=========== in scalar ev END");
- },
- \seg, {
- [
- ev[\elapsed], ev[\segdur],
- ev[\elapsed]/ev[\segdur],
- (self.seg.val.size),
- (ev[\elapsed]/ev[\segdur]) % (self.seg.val.size),
- self.seg.val.blendAt((ev[\elapsed]/ev[\segdur]) % (self.seg.val.size))
- ].debug("seggggggggggggggggg: elapsed, segdur, size, el/dur, el/dur%size, res");
- ev = (self.seg.val++[self.seg.val[0]]).blendAt((ev[\elapsed]/ev[\segdur]) % (self.seg.val.size)).yield;
- },
- \seq, {
- if(player.get_mode == \noteline, {
- //ev.debug("=========== in noteline ev");
- //segf.debug("=========== in noteline segf");
- //segf.value(ev).debug("=========== in noteline");
- ev = segf.value(ev).yield;
- }, {
- idx = 0;
- val = self.seq.val[idx];
- while( { val.notNil } , {
- ev = val.yield;
- idx = idx + 1;
- val = self.seq.val[idx];
- });
- });
- //ev.debug("=========== in seq ev END");
- },
- \preset, {
- switch(player.get_mode,
- \sampleline, {