Csound Csound-dev Csound-tekno Search About

[Csnd] new opcode suggestion: pdefault

Date2014-08-13 22:29
FromKevin Welsh
Subject[Csnd] new opcode suggestion: pdefault
This idea came up in a private email about csound, I'm bringing it to
the list for more feedback.

A new opcode called "pdefault" that would allow the user to set what
default value a pfield receives if no value was provided in the score.
It could also disable the missing pfield warning for that particular
pfield only, since the value is potentially missing by design.
Disabling the warning could even be triggered by an optional opcode
argument if it's more desirable to maintain the warnings by default.

I would use this to allow overriding of automation parameters in blue,
but I'm sure there are other cases where this would be useful.
Currently I can override the values, as long as 0 makes sense for the
default.  But for example, when overriding pan I still want to be able
to pass 0 from the score as a pfield, *AND* be able to detect when no
pfield was provided.

Pseudo-code:

p5 pdefault -99
ipan = p5
; allow override of automation
ipan   = (ipan == -99) ?  : ipan