(
+// TODO: for whatever reason when called from mac os,
+// every method here is executed 4 times
+
~samplerFactory = {
var maxDur = 10.0;
var sampler = Environment[
Out.ar(out, sig!2);
}).add,
\startRec -> { |zi|
+ "startRec called".postln;
zi.startPos = 0.0;
zi.recSynth = Synth(\samplerRecord, [\input, s.inputBus, \buf, zi.buf], addAction: \addToTail);
zi.endPos = s.sampleRate * 10;
\startPos -> 0,
\duration -> 0,
\stopRec -> { |zi|
+ "stopRec called".postln;
zi.duration = thisThread.seconds - zi.startTime;
zi.recSynth.free;
},
\playSample -> { |zi|
var playSynth;
+ "playSample called".postln;
playSynth = Synth(\samplerPlay,
[\out, 0, \buf, zi.buf, \startPos, zi.startPos, \duration, zi.duration],
addAction: \addToHead);
},
\makeSynthEvent -> { |zi|
+ "makeSynthEvent called".postln;
(
instrument: \samplerPlay,
buf: zi.buf,
);
},
\makeSynthArgs -> { |zi|
+ "makeSynthArgs called".postln;
[
\buf, zi.buf,
\startPos, zi.startPos,
},
\shiftPos -> { |zi, delta|
var endPos = zi.startPos + zi.duration;
+ "shiftPos called".postln;
zi.startPos = (zi.startPos + delta).clip(0, endPos);
zi.duration = endPos - zi.startPos;
}
};
~push.padDown = { |zi, row, col, vel|
var note, amp;
- ~push.padLight(row, col, 2, 1, false, 1);
+ ~push.padLight(row, col, 2, 1, false, 0);
note = Scale.major.degreeToFreq(col, 0.midicps, row+1);
amp = vel.linlin(1, 127, 0.01, 0.4);
Synth(~se.synthName, ~se.makeSynthArgs++[\freq, note]);
~test = ~factory.value;
-~push.setTempo(1);
\ No newline at end of file
+~push.setTempo(1);
+
+(
+~caller = Environment[
+ \func -> { "test".postln; }
+];
+~caller.know = true;
+)
+
+~caller.func
+
+~se.maxDur
\ No newline at end of file