Return values from the server of MouseX MouseY?

Hello,

Seemingly simple problem, but I am struggling to find a way . I want to return the values of MouseX and MouseY from the server, but without using “.poll”. The being I want the readout to be a bit slower so I can do some calculations.

I found this ‘solution’ but it doesn’t return anything:

{SendTrig.kr(Impulse.kr(1), 0, MouseX.kr)}.play;

Many thanks for any help.

Did you check the SendTrig helpfile ? You need to catch the OSC messages with OSCFunc or OSCdef.

(
{ SendTrig.kr(Impulse.kr(1), 0, MouseX.kr) }.play;

o = OSCFunc({ arg msg, time;
	msg[3].postln;
},'/tr', s.addr);
)
1 Like

If all you want is slower polling, the first argument to .poll() is a frequency. You’d write MouseX.kr.poll(1) for once per second.

1 Like

Thanks dkmayer,

For some reason I had the impression the first part of the code was freestanding. I did see the additional code, but I thought there was a more concise way to achieve it without that. My mistake - thank you for your reply though.

Hi Virtualdog,

Ah this is helpful, I was not aware of that. Much appreciated!