From: Eugene Petkevich Date: Sun, 8 May 2022 10:40:36 +0000 (+0300) Subject: Add debug messages X-Git-Url: https://git.zuelum.org/?a=commitdiff_plain;h=b05b9c0445238de76a62f786a18399ef25740a4b;p=scprojects.git Add debug messages --- diff --git a/sampler.scd b/sampler.scd index a6fe1da..e8e7ea5 100644 --- a/sampler.scd +++ b/sampler.scd @@ -1,4 +1,7 @@ ( +// TODO: for whatever reason when called from mac os, +// every method here is executed 4 times + ~samplerFactory = { var maxDur = 10.0; var sampler = Environment[ @@ -21,6 +24,7 @@ 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; @@ -29,16 +33,19 @@ \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, @@ -47,6 +54,7 @@ ); }, \makeSynthArgs -> { |zi| + "makeSynthArgs called".postln; [ \buf, zi.buf, \startPos, zi.startPos, @@ -55,6 +63,7 @@ }, \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; } diff --git a/test.scd b/test.scd index d4a472b..47a77fc 100644 --- a/test.scd +++ b/test.scd @@ -26,7 +26,7 @@ }; ~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]); @@ -198,4 +198,15 @@ try { Exception.new().throw; ret = 1; } { ret = 2 }; ~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