Using control bus in task

Hey guys,
I am trying to create a evolving sound of the ocean waves. Is it possible to have the wait time of the Task connected to one of the control buses? I think what I have right now is not working as intended. Also, when I evaluate "In.kr(~bus3, 1) I get “an OutputProyx” as a result. Why does it work when I enter it as argument in Env.perc? Thanks a lot :relaxed:

(
~bus1 = Bus.control(s,1);
~bus2 = Bus.control(s,1);
~bus3 = Bus.control(s,1);
~bus4 = Bus.control(s,1);
)
(
{Out.kr([~bus1], SinOsc.kr(0.05).range(1,2))}.play;
{Out.kr([~bus2], SinOsc.kr(0.0052).range(2.5,4))}.play;
{Out.kr([~bus3], SinOsc.kr(0.006).range(0.1,1).poll)}.play;
{Out.kr([~bus4], SinOsc.kr(0.021).range(-4,4))}.play;
)

~sea = {Out.ar([0,1], {PinkNoise.ar(Env.perc(In.kr(~bus1, 1), 
            In.kr(~bus2, 1), In.kr(~bus3, 1), In.kr(~bus4, 1)).kr(2))}
)};

t = Task({ { ~sea.play; In.kr(~bus, 1)*rrand(1,3)*4.wait;}.loop });                                       
t.start;
t.stop;

I believe getSynchronous will work here:

s.boot;

(
s.newBusAllocators;
~bus = Bus.control(s, 1);

x = {
	var sig;
	sig = SinOsc.kr(0.12, 3pi/2).range(0.02,1);
	Out.kr(~bus, sig);
}.play;
)

(
t = Task({
	loop({
		rrand(1000,9999).postln; //do something
		~bus.getSynchronous.wait; //extract bus value & wait
	})
	
}).play;
)

t.stop;

Eli

Perfect that is exactly what I was looking for, thanks!