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

Re: [sc-users] Pbind: doing something after the event



James Harkins escreveu:
On Feb 20, 2009, at 6:46 PM, Andrea Valle wrote:
Hi to all,

wandering amidst patterns...

I'd like to do something exactly after an event in Pbind has occured. Substantially the same thing the doneAction:2 does for synths, but not for synths.
"When dur is passed, do this."
Hmm. What's the way?

I can think of a couple of ways.

You could .collect the pattern, and in the collect function, schedule an action to happen at the right time.

Pbind(...).collect({ |ev|
    thisThread.clock.sched(timeUntilPostAction, { myAction });
    ev
}).play;

(The collect function should return the event unmodified.)

Or, use a finish function in the event. finish is a user supplied function that normally gives you a hook to do some further processing on the event values before the event type is called, but nothing prevents you from using it to schedule something.

Pbind(
    ...,
    \finish, { thisThread.clock.sched(timeUntilPostAction, { myAction }) }
).play;

Or, slightly faster:

Pbind(
    ...
).play(protoEvent: Event.default.put(\finish, { thisThread.clock.sched(timeUntilPostAction, { myAction }) }));


The other question is, do you want the event's environment variables to be available in your scheduled function? If so...

Pbind(...).collect({ |ev|
    thisThread.clock.sched(timeUntilPostAction, { ev.use(myAction) });
    ev
}).play;

Or:

Pbind(
    ...
).play(protoEvent: Event.default.put(\finish, {
    thisThread.clock.sched(timeUntilPostAction, inEnvir { myAction })
}));

hjh


: H. James Harkins
: jamshark70@xxxxxxxxxxxxxxxxx
: http://www.dewdrop-world.net
.::!:.:.......:.::........:..!.::.::...:..:...:.:.:.:..:

"Come said the Muse,
Sing me a song no poet has yet chanted,
Sing me the universal."  -- Whitman


Hi

I have a similar problem. I want to send an osc message when a event in Pbind starts, but I also want to have access to the parameters of that event so I can send some of them in the osc message to another computer. As an example lest say I want to send the frequency of the event that just started in an osc message. how would I do that ?

thanks

--
Miguel Negrão // ZLB
http://www.friendlyvirus.org/artists/zlb/

_______________________________________________
sc-users mailing list

info (subscription, etc.): http://www.beast.bham.ac.uk/research/sc_mailing_lists.shtml
archive: https://listarc.bham.ac.uk/marchives/sc-users/
search: https://listarc.bham.ac.uk/lists/sc-users/search/