Hm, actually, that’s not the only way.
The Event:play
method always calls the event’s play function. This does a bunch of things:
- Retrieves a set of defaults for the event type.
- Sets the server variable.
- Calls a
\finish
hook (finish preparation before playing). - Updates tempo, if
\tempo
is set. - Calls the event type function, if the event is not a rest.
- Calls a
\callback
hook (giving the caller access to the event’s final state).
Of these, only #5 is skipped for rests. All of the other ones are done for every event.
So you could also do \finish, { |event| ... send your OSC here ... }
in the Pbind (note, that is not \finish, Pfunc { ... }
– the finish
key should get the literal function). \callback
might be OK too, but rest events will not do pitch or duration calculations (that is, if you specify \degree
, sounding events will end up with a \freq
value, but rest events will not – so your callback function cannot assume that \freq
will always be there).
hjh