Report an error condition in a score and generate an error condition.
error(“formatted_error_message”)
error prints its error message and generates an error condition in the system. This happens immediately upon the parser executing the error command. At that point, all scheduled events are terminated and the parse is exited. Note: If the option exit_on_error is set to 1, error will terminate the process.
// Report an error if a requested soundfile does not have a 44100 sampling rate
if (filesr(soundfile_to_open) != 44100)
{
error("Requested soundfile (%s) sampling rate is %f, not 44100\n",
soundfile_to_open, filesr(soundfile_to_open));
}
// else go on and open it