October, 2019
void initRTcmix(int objno)
objno – the number of the RTcmix process being initialized
Usually used in the Start() method of a game object script, this will initialize the RTcmix process associated with objno, getting it set for use.
void runRTcmix(float [] data, int objno, int inputflag)
data – an array containing sound samples to be processed or synthesized by the RTcmix engine. Usually this array is 512 left/right interleaved samples (256 stereo frames).
objno – the number of the RTcmix process being used
inputflag – if this is set to “1” it signals that data contains input samples to be processed. “0” signals synthesis only by the RTcmix engine.
This function is called once within the OnAudioFilterRead() method in a game object script. data is passed in from this method.
int checkbangRTcmix(int objno)
objno – the number of the RTcmix process being used
Used to check for ‘bangs’ scheduled inside the RTcmix engine. These are scheduled by the MAXBANG() RTcmix instrument. This function also runs in the OnAudioFilterRead() method of a game object script. It returns “1” if a scheduled ‘bang’ is present.
int checkvalsRTcmix(out float[] farray, int objno)
farray – a declared array that will contain the values generated by the MAXMESSAGE() RTcmix instrument at a scheduled time.
objno – the number of the RTcmix process being used
This function is also called within the OnAudioFilterRead() method in a game object script. The farray is filled with the scheduled MAXMESSAGE() values.
It returns the number of values present at the current time to be read.
Here is an example of how these values may be retreived:
int void printRTcmix(int objno)
objno – the number of the RTcmix process being used
This will cause RTcmix output messages to be printed in the Unity console if the RTcmix scorefile command print_on() is set in the score. NOTE: At present, this will only work for one objno at a time. It is called within the game object OnAudioFilerRead() method.
void setpfieldRTcmix(int inlet, float val, int objno)
inlet – the number of the PField inlet (set by the RTcmix scorefile command makeconnection()) to be addressed.
val – the value to be sent into that PField.
objno – the number of the RTcmix process being used
Used to dynamically modify parameters of executing RTcmix instruments using the PField system. This is called from an interactive method outside the OnAudioFilterRead() method in a game object (such as the Update() method).
String setscorevalsRTcmix(String s, params float[] list)
s – the RTcmix score string containing “$n” variables to be replaced.
list – the list of values (in numeric order) to be used to replce the “$n” var8iables.
For RTcmix scores that use the “$n” (i.e. $1, $2, etc.) feature for altering RTcmix scores, this will substitute the values listed in the function in order for each of the “$n” variables.
A string with the substituted values is returned.
For example, the simple RTcmix score
WAVETABLE(0, 3.4, $1, $2)
can be processed like this:
String score1 = WAVETABLE(0, 3.4, $1, $2)
String score2 = setscorevalsRTcmix(score1, 20000.0f, 341.0f)
and the variable score2 will then contain:
WAVETABLE(0, 3.4, 20000.0, 341.0)
and can be sent to the RTcmix engine for synthesis with those values.
void SendScore(String score, int objno)
score – a string containing an RTcmix score to be sent to the RTcmix engine for execution.
objno – the number of the RTcmix process being used
Upon receupt of the RTcmix score, the RTcmix engine will synthesis/process sound samples immediately, with time “0” being the time that the score was sent. This assumes that initRTcmix() has been called already and that the game object OnAudioFilterRead() method is working. Be sure to designate the game object as an “Audio Source” in the Unity game editor.
void flushScore(int objno)
objno – the number of the RTcmix process to be flushed.
This will remove all currently executing and future RTcmix instruments and scorefile commands from the RTcmix engine queue.