I would expect to see currentEnvironment: true on the post window when the second event is played, so I’m a bit confused.
I can’t find the way to use currentEnvironment.isRest when it’s true. I’m trying to send events through OSC with a key like \rest, true or similar defined in a custom event type.
I’m using SC 3.10.2 on Linux, no quarks installed.
Any help would be greatly appreciated
Thanks a lot for your answer!
Does it mean that the only way to send a ‘rest’ event through OSC is by adding a key inside Pbind?
e.g. \sendOSC, Pfunc({|e| netaddr.sendMsg("/oscPath", e.asString)})
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).