Example:
public class myprim extends Primitive {
private double frameRate; // Default value set in open()
private double frequency = 1024.0;
private double amplitude = -1.0;
public int open() {
frameRate = MA.getD("RATE", 16.0); // Always reset frameRate
frequency = MA.getD("FREQ", frequency); // Reset frequency if given on command line
if (amplitude <= 0) {
amplitude = MA.getD("AMP", 1.0); // Always preserve amplitude
}
...
}
public int process() { ... }
public int close() { ... }
}
In the above example, following a restart...
frameRate
is always reset back to its initial value (as given on the
command line or 16.0
).
frequency
is reset back to its initial value ONLY if FREQ=
was specified on the command line.
amplitude
is always preserved.