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

Re: [sc-dev] CocoaDialog works, sched doesn't



I got it working. The key was using NSRunLoop's addTimer:forMode: method, and separating the tasks using two NSTimers instead of one.

	[[NSRunLoop currentRunLoop] addTimer: appClockTimer
		forMode: NSModalPanelRunLoopMode];

Now this works as I expect:

s.boot;

(
SynthDef("tink", { arg freq = 1000;
	Out.ar(0, SinOsc.ar(freq, 0, Line.ar(0.2,0,0.1,doneAction: 2)));
}).writeDefFile;
s.sendMsg("/d_load", "synthdefs/tink.scsyndef");
)

{ s.sendMsg(\s_new, \tink, 1001, 1, 0, \freq, 1000); 0.2 }.play(SystemClock);

{ s.sendMsg(\s_new, \tink, 1002, 1, 0, \freq, 800); 0.2 }.play(AppClock);

CocoaDialog.getPaths({arg x; "ok".postln; x.postln },{"cancel".postln})

s.quit



--
--- james mccartney   james@xxxxxxxxxxxxxx   <http://www.audiosynth.com>
SuperCollider - a real time synthesis programming language for the PowerMac.
<ftp://www.audiosynth.com/pub/updates/SC2.2.16.sea.hqx>