[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [sc-users] Event Timing Offset



tom tlalim <ttlalim@xxxxxxxxx> writes:

> use the currentEnvironment 

Yes, I did that in the code below and it works great; I just thought
I'd use a bus, but never figured out how to address a bus inside a
Task.

Here's what I did: 

MIDIIn.control = {arg src, chan, num, val;
	if(chan == 0,{
		if(num == 20,{
			~timeisme = val/127.0 + 0.5;
			~timeisme.value.println;
		});
	});
};

k = Task({
	var	startCycle, baseTime;
	loop{
		startCycle = thisThread.clock.beats;
		baseTime = thisThread.clock.beats.roundUp(1);
		thisThread.clock.schedAbs(baseTime + ~timeisme,{Synth("foo");});
		(startCycle + 8.0 - thisThread.clock.beats).wait;
	}
})

//transport
~args = [TempoClock.default, true, [8.0, -0.15]]

k.play(*~args);
k.stop;

Thank you for your help.

-- 
Esben Stien is b0ef@e     s      a             
         http://www. s     t    n m
          irc://irc.  b  -  i  .   e/%23contact
          [sip|iax]:   e     e 
           jid:b0ef@    n     n