rtsetoutput
INSTRUMENT design -- output initialization and setup function
The rtsetoutput() function is used in RTcmix
instrument design to set the start time and duration of a note.
Typically it is used in the INSTRUMENT::init() member function
of an instrument. It handles all scheduling tasks for real-time
output, and it also will set the note up for writing into a soundfile
(if the
rtoutput
scorefile command was specified
in the score)
at the proper time.
It replaces
the older setnote function used in
disk-only cmix.
Usage
int rtsetoutput(float start_time, float duration, Instrument *inst)
-
start_time is the starting time for the note in seconds. Usually
this is a p-field variable.
duration is the duration of the note in seconds. Usually
this is also a p-field variable.
*inst is a pointer to the INSTRUMENT object being scheduled.
Usually this is the token this
(i.e. a pointer to the INSTRUMENT calling the rtsetoutput function).
rtsetoutput() returns the number of samples to be computed. Usually
this is assigned to the INSTRUMENT variable nsamps
Examples
#include <Instrument.h>
int MYINSTRUMENT::init(float p[], int n_args)
{
...
// assumes p[0] = start time (in seconds), p[1] = duration (in seconds)
nsamps = rtsetoutput(p[0], p[1], this);
...
}
See Also