- gave the Timidity error functions better names and hooked up the WildMidi version.

This commit is contained in:
Christoph Oelckers 2019-09-26 17:22:54 +02:00
parent 021e548db7
commit 159b98ea88
21 changed files with 506 additions and 494 deletions

View file

@ -186,30 +186,30 @@ Instrument *Renderer::load_instrument(const char *name, int percussion,
if (noluck) if (noluck)
{ {
cmsg(CMSG_ERROR, VERB_DEBUG, "Instrument `%s' can't be found.\n", name); printMessage(CMSG_ERROR, VERB_DEBUG, "Instrument `%s' can't be found.\n", name);
return 0; return 0;
} }
cmsg(CMSG_INFO, VERB_NOISY, "Loading instrument %s\n", name); printMessage(CMSG_INFO, VERB_NOISY, "Loading instrument %s\n", name);
/* Read some headers and do cursory sanity checks. */ /* Read some headers and do cursory sanity checks. */
if (sizeof(header) != fp->read(&header, sizeof(header))) if (sizeof(header) != fp->read(&header, sizeof(header)))
{ {
failread: failread:
cmsg(CMSG_ERROR, VERB_NORMAL, "%s: Error reading instrument.\n", name); printMessage(CMSG_ERROR, VERB_NORMAL, "%s: Error reading instrument.\n", name);
fp->close(); fp->close();
return 0; return 0;
} }
if (strncmp(header.Header, GF1_HEADER_TEXT, HEADER_SIZE - 4) != 0) if (strncmp(header.Header, GF1_HEADER_TEXT, HEADER_SIZE - 4) != 0)
{ {
cmsg(CMSG_ERROR, VERB_NORMAL, "%s: Not an instrument.\n", name); printMessage(CMSG_ERROR, VERB_NORMAL, "%s: Not an instrument.\n", name);
fp->close(); fp->close();
return 0; return 0;
} }
if (strcmp(header.Header + 8, "110") < 0) if (strcmp(header.Header + 8, "110") < 0)
{ {
cmsg(CMSG_ERROR, VERB_NORMAL, "%s: Is an old and unsupported patch version.\n", name); printMessage(CMSG_ERROR, VERB_NORMAL, "%s: Is an old and unsupported patch version.\n", name);
fp->close(); fp->close();
return 0; return 0;
} }
@ -225,14 +225,14 @@ failread:
if (header.Instruments != 1 && header.Instruments != 0) /* instruments. To some patch makers, 0 means 1 */ if (header.Instruments != 1 && header.Instruments != 0) /* instruments. To some patch makers, 0 means 1 */
{ {
cmsg(CMSG_ERROR, VERB_NORMAL, "Can't handle patches with %d instruments.\n", header.Instruments); printMessage(CMSG_ERROR, VERB_NORMAL, "Can't handle patches with %d instruments.\n", header.Instruments);
fp->close(); fp->close();
return 0; return 0;
} }
if (idata.Layers != 1 && idata.Layers != 0) /* layers. What's a layer? */ if (idata.Layers != 1 && idata.Layers != 0) /* layers. What's a layer? */
{ {
cmsg(CMSG_ERROR, VERB_NORMAL, "Can't handle instruments with %d layers.\n", idata.Layers); printMessage(CMSG_ERROR, VERB_NORMAL, "Can't handle instruments with %d layers.\n", idata.Layers);
fp->close(); fp->close();
return 0; return 0;
} }
@ -244,7 +244,7 @@ failread:
if (layer_data.Samples == 0) if (layer_data.Samples == 0)
{ {
cmsg(CMSG_ERROR, VERB_NORMAL, "Instrument has 0 samples.\n"); printMessage(CMSG_ERROR, VERB_NORMAL, "Instrument has 0 samples.\n");
fp->close(); fp->close();
return 0; return 0;
} }
@ -258,7 +258,7 @@ failread:
if (sizeof(patch_data) != fp->read(&patch_data, sizeof(patch_data))) if (sizeof(patch_data) != fp->read(&patch_data, sizeof(patch_data)))
{ {
fail: fail:
cmsg(CMSG_ERROR, VERB_NORMAL, "Error reading sample %d.\n", i); printMessage(CMSG_ERROR, VERB_NORMAL, "Error reading sample %d.\n", i);
delete ip; delete ip;
fp->close(); fp->close();
return 0; return 0;
@ -294,14 +294,14 @@ fail:
sp->tremolo_sweep_increment = 0; sp->tremolo_sweep_increment = 0;
sp->tremolo_phase_increment = 0; sp->tremolo_phase_increment = 0;
sp->tremolo_depth = 0; sp->tremolo_depth = 0;
cmsg(CMSG_INFO, VERB_DEBUG, " * no tremolo\n"); printMessage(CMSG_INFO, VERB_DEBUG, " * no tremolo\n");
} }
else else
{ {
sp->tremolo_sweep_increment = convert_tremolo_sweep(patch_data.TremoloSweep); sp->tremolo_sweep_increment = convert_tremolo_sweep(patch_data.TremoloSweep);
sp->tremolo_phase_increment = convert_tremolo_rate(patch_data.TremoloRate); sp->tremolo_phase_increment = convert_tremolo_rate(patch_data.TremoloRate);
sp->tremolo_depth = patch_data.TremoloDepth; sp->tremolo_depth = patch_data.TremoloDepth;
cmsg(CMSG_INFO, VERB_DEBUG, " * tremolo: sweep %d, phase %d, depth %d\n", printMessage(CMSG_INFO, VERB_DEBUG, " * tremolo: sweep %d, phase %d, depth %d\n",
sp->tremolo_sweep_increment, sp->tremolo_phase_increment, sp->tremolo_depth); sp->tremolo_sweep_increment, sp->tremolo_phase_increment, sp->tremolo_depth);
} }
@ -311,14 +311,14 @@ fail:
sp->vibrato_sweep_increment = 0; sp->vibrato_sweep_increment = 0;
sp->vibrato_control_ratio = 0; sp->vibrato_control_ratio = 0;
sp->vibrato_depth = 0; sp->vibrato_depth = 0;
cmsg(CMSG_INFO, VERB_DEBUG, " * no vibrato\n"); printMessage(CMSG_INFO, VERB_DEBUG, " * no vibrato\n");
} }
else else
{ {
sp->vibrato_control_ratio = convert_vibrato_rate(patch_data.VibratoRate); sp->vibrato_control_ratio = convert_vibrato_rate(patch_data.VibratoRate);
sp->vibrato_sweep_increment = convert_vibrato_sweep(patch_data.VibratoSweep, sp->vibrato_control_ratio); sp->vibrato_sweep_increment = convert_vibrato_sweep(patch_data.VibratoSweep, sp->vibrato_control_ratio);
sp->vibrato_depth = patch_data.VibratoDepth; sp->vibrato_depth = patch_data.VibratoDepth;
cmsg(CMSG_INFO, VERB_DEBUG, " * vibrato: sweep %d, ctl %d, depth %d\n", printMessage(CMSG_INFO, VERB_DEBUG, " * vibrato: sweep %d, ctl %d, depth %d\n",
sp->vibrato_sweep_increment, sp->vibrato_control_ratio, sp->vibrato_depth); sp->vibrato_sweep_increment, sp->vibrato_control_ratio, sp->vibrato_depth);
} }
@ -344,7 +344,7 @@ fail:
} }
if (sp->scale_factor != 1024) if (sp->scale_factor != 1024)
{ {
cmsg(CMSG_INFO, VERB_DEBUG, " * Scale: note %d, factor %d\n", printMessage(CMSG_INFO, VERB_DEBUG, " * Scale: note %d, factor %d\n",
sp->scale_note, sp->scale_factor); sp->scale_note, sp->scale_factor);
} }
} }
@ -375,7 +375,7 @@ fail:
if ((strip_loop == 1) && if ((strip_loop == 1) &&
(sp->modes & (PATCH_SUSTAIN | PATCH_LOOPEN | PATCH_BIDIR | PATCH_BACKWARD))) (sp->modes & (PATCH_SUSTAIN | PATCH_LOOPEN | PATCH_BIDIR | PATCH_BACKWARD)))
{ {
cmsg(CMSG_INFO, VERB_DEBUG, " - Removing loop and/or sustain\n"); printMessage(CMSG_INFO, VERB_DEBUG, " - Removing loop and/or sustain\n");
if (j == DESC_SIZE) if (j == DESC_SIZE)
{ {
sp->modes &= ~(PATCH_SUSTAIN | PATCH_LOOPEN | PATCH_BIDIR | PATCH_BACKWARD); sp->modes &= ~(PATCH_SUSTAIN | PATCH_LOOPEN | PATCH_BIDIR | PATCH_BACKWARD);
@ -384,7 +384,7 @@ fail:
if (strip_envelope == 1) if (strip_envelope == 1)
{ {
cmsg(CMSG_INFO, VERB_DEBUG, " - Removing envelope\n"); printMessage(CMSG_INFO, VERB_DEBUG, " - Removing envelope\n");
/* [RH] The envelope isn't really removed, but this is the way the standard /* [RH] The envelope isn't really removed, but this is the way the standard
* Gravis patches get that effect: All rates at maximum, and all offsets at * Gravis patches get that effect: All rates at maximum, and all offsets at
* a constant level. * a constant level.
@ -434,7 +434,7 @@ fail:
/* The GUS apparently plays reverse loops by reversing the /* The GUS apparently plays reverse loops by reversing the
whole sample. We do the same because the GUS does not SUCK. */ whole sample. We do the same because the GUS does not SUCK. */
cmsg(CMSG_WARNING, VERB_NORMAL, "Reverse loop in %s\n", name); printMessage(CMSG_WARNING, VERB_NORMAL, "Reverse loop in %s\n", name);
reverse_data((sample_t *)sp->data, 0, sp->data_length); reverse_data((sample_t *)sp->data, 0, sp->data_length);
sp->data[sp->data_length] = sp->data[sp->data_length - 1]; sp->data[sp->data_length] = sp->data[sp->data_length - 1];
@ -465,7 +465,7 @@ fail:
if (strip_tail == 1) if (strip_tail == 1)
{ {
/* Let's not really, just say we did. */ /* Let's not really, just say we did. */
cmsg(CMSG_INFO, VERB_DEBUG, " - Stripping tail\n"); printMessage(CMSG_INFO, VERB_DEBUG, " - Stripping tail\n");
sp->data_length = sp->loop_end; sp->data_length = sp->loop_end;
} }
} }
@ -578,7 +578,7 @@ int Renderer::fill_bank(int dr, int b)
ToneBank *bank = ((dr) ? instruments->drumset[b] : instruments->tonebank[b]); ToneBank *bank = ((dr) ? instruments->drumset[b] : instruments->tonebank[b]);
if (bank == NULL) if (bank == NULL)
{ {
cmsg(CMSG_ERROR, VERB_NORMAL, printMessage(CMSG_ERROR, VERB_NORMAL,
"Tried to load instruments in non-existent %s %d\n", "Tried to load instruments in non-existent %s %d\n",
(dr) ? "drumset" : "tone bank", b); (dr) ? "drumset" : "tone bank", b);
return 0; return 0;
@ -621,14 +621,14 @@ int Renderer::fill_bank(int dr, int b)
{ {
if (bank->tone[i].name.length() == 0) if (bank->tone[i].name.length() == 0)
{ {
cmsg(CMSG_WARNING, (b != 0) ? VERB_VERBOSE : VERB_DEBUG, printMessage(CMSG_WARNING, (b != 0) ? VERB_VERBOSE : VERB_DEBUG,
"No instrument mapped to %s %d, program %d%s\n", "No instrument mapped to %s %d, program %d%s\n",
(dr) ? "drum set" : "tone bank", b, i, (dr) ? "drum set" : "tone bank", b, i,
(b != 0) ? "" : " - this instrument will not be heard"); (b != 0) ? "" : " - this instrument will not be heard");
} }
else else
{ {
cmsg(CMSG_ERROR, VERB_DEBUG, printMessage(CMSG_ERROR, VERB_DEBUG,
"Couldn't load instrument %s (%s %d, program %d)\n", "Couldn't load instrument %s (%s %d, program %d)\n",
bank->tone[i].name.c_str(), bank->tone[i].name.c_str(),
(dr) ? "drum set" : "tone bank", b, i); (dr) ? "drum set" : "tone bank", b, i);

View file

@ -745,15 +745,15 @@ SFFile *ReadSF2(const char *filename, timidity_file *f)
} }
catch (CIOErr) catch (CIOErr)
{ {
cmsg(CMSG_ERROR, VERB_NORMAL, "Error reading %s: %s\n", filename, strerror(errno)); printMessage(CMSG_ERROR, VERB_NORMAL, "Error reading %s: %s\n", filename, strerror(errno));
} }
catch (CBadForm) catch (CBadForm)
{ {
cmsg(CMSG_ERROR, VERB_NORMAL, "%s is corrupted.\n", filename); printMessage(CMSG_ERROR, VERB_NORMAL, "%s is corrupted.\n", filename);
} }
catch (CBadVer) catch (CBadVer)
{ {
cmsg(CMSG_ERROR, VERB_NORMAL, "%s is not a SoundFont version 2 file.\n", filename); printMessage(CMSG_ERROR, VERB_NORMAL, "%s is not a SoundFont version 2 file.\n", filename);
} }
if (sf2 != NULL) if (sf2 != NULL)
{ {

View file

@ -378,7 +378,7 @@ void Renderer::start_note(int chan, int note, int vel)
} }
if (ip->samples != 1 && ip->sample->type == INST_GUS) if (ip->samples != 1 && ip->sample->type == INST_GUS)
{ {
cmsg(CMSG_WARNING, VERB_VERBOSE, printMessage(CMSG_WARNING, VERB_VERBOSE,
"Strange: percussion instrument with %d samples!", ip->samples); "Strange: percussion instrument with %d samples!", ip->samples);
} }
} }

View file

@ -187,13 +187,13 @@ int Instruments::read_config_file(const char *name)
if (rcf_count > 50) if (rcf_count > 50)
{ {
cmsg(CMSG_ERROR, VERB_NORMAL, "Timidity: Probable source loop in configuration files\n"); printMessage(CMSG_ERROR, VERB_NORMAL, "Timidity: Probable source loop in configuration files\n");
return (-1); return (-1);
} }
auto fp = sfreader->open_timidity_file(name); auto fp = sfreader->open_timidity_file(name);
if (!fp) if (!fp)
{ {
cmsg(CMSG_ERROR, VERB_NORMAL, "Timidity: Unable to open config file\n"); printMessage(CMSG_ERROR, VERB_NORMAL, "Timidity: Unable to open config file\n");
return -1; return -1;
} }
@ -258,7 +258,7 @@ int Instruments::read_config_file(const char *name)
* before TiMidity kills the note. This may be useful to implement * before TiMidity kills the note. This may be useful to implement
* later, but I don't see any urgent need for it. * later, but I don't see any urgent need for it.
*/ */
//cmsg(CMSG_ERROR, VERB_NORMAL, "FIXME: Implement \"timeout\" in TiMidity config.\n"); //printMessage(CMSG_ERROR, VERB_NORMAL, "FIXME: Implement \"timeout\" in TiMidity config.\n");
} }
else if (!strcmp(w[0], "copydrumset") /* "copydrumset" drumset */ else if (!strcmp(w[0], "copydrumset") /* "copydrumset" drumset */
|| !strcmp(w[0], "copybank")) /* "copybank" bank */ || !strcmp(w[0], "copybank")) /* "copybank" bank */
@ -268,7 +268,7 @@ int Instruments::read_config_file(const char *name)
* the current drumset or bank. May be useful later, but not a * the current drumset or bank. May be useful later, but not a
* high priority. * high priority.
*/ */
//cmsg(CMSG_ERROR, VERB_NORMAL, "FIXME: Implement \"%s\" in TiMidity config.\n", w[0]); //printMessage(CMSG_ERROR, VERB_NORMAL, "FIXME: Implement \"%s\" in TiMidity config.\n", w[0]);
} }
else if (!strcmp(w[0], "undef")) /* "undef" progno */ else if (!strcmp(w[0], "undef")) /* "undef" progno */
{ {
@ -276,7 +276,7 @@ int Instruments::read_config_file(const char *name)
* Undefines the tone "progno" of the current tone bank (or * Undefines the tone "progno" of the current tone bank (or
* drum set?). Not a high priority. * drum set?). Not a high priority.
*/ */
//cmsg(CMSG_ERROR, VERB_NORMAL, "FIXME: Implement \"undef\" in TiMidity config.\n"); //printMessage(CMSG_ERROR, VERB_NORMAL, "FIXME: Implement \"undef\" in TiMidity config.\n");
} }
else if (!strcmp(w[0], "altassign")) /* "altassign" prog1 prog2 ... */ else if (!strcmp(w[0], "altassign")) /* "altassign" prog1 prog2 ... */
{ {
@ -284,7 +284,7 @@ int Instruments::read_config_file(const char *name)
* Sets the alternate assign for drum set. Whatever that's * Sets the alternate assign for drum set. Whatever that's
* supposed to mean. * supposed to mean.
*/ */
//cmsg(CMSG_ERROR, VERB_NORMAL, "FIXME: Implement \"altassign\" in TiMidity config.\n"); //printMessage(CMSG_ERROR, VERB_NORMAL, "FIXME: Implement \"altassign\" in TiMidity config.\n");
} }
else if (!strcmp(w[0], "soundfont")) else if (!strcmp(w[0], "soundfont"))
{ {
@ -295,7 +295,7 @@ int Instruments::read_config_file(const char *name)
*/ */
if (words < 2) if (words < 2)
{ {
cmsg(CMSG_ERROR, VERB_NORMAL, "%s: line %d: No soundfont given\n", name, line); printMessage(CMSG_ERROR, VERB_NORMAL, "%s: line %d: No soundfont given\n", name, line);
return -2; return -2;
} }
if (words > 2 && !strcmp(w[2], "remove")) if (words > 2 && !strcmp(w[2], "remove"))
@ -310,7 +310,7 @@ int Instruments::read_config_file(const char *name)
{ {
if (!(cp = strchr(w[i], '='))) if (!(cp = strchr(w[i], '=')))
{ {
cmsg(CMSG_ERROR, VERB_NORMAL, "%s: line %d: bad soundfont option %s\n", name, line, w[i]); printMessage(CMSG_ERROR, VERB_NORMAL, "%s: line %d: bad soundfont option %s\n", name, line, w[i]);
return -2; return -2;
} }
} }
@ -327,7 +327,7 @@ int Instruments::read_config_file(const char *name)
if (words < 3) if (words < 3)
{ {
cmsg(CMSG_ERROR, VERB_NORMAL, "%s: line %d: syntax error\n", name, line); printMessage(CMSG_ERROR, VERB_NORMAL, "%s: line %d: syntax error\n", name, line);
return -2; return -2;
} }
@ -343,7 +343,7 @@ int Instruments::read_config_file(const char *name)
} }
else else
{ {
cmsg(CMSG_ERROR, VERB_NORMAL, "%s: line %d: font subcommand must be 'order' or 'exclude'\n", name, line); printMessage(CMSG_ERROR, VERB_NORMAL, "%s: line %d: font subcommand must be 'order' or 'exclude'\n", name, line);
return -2; return -2;
} }
if (i < words) if (i < words)
@ -377,7 +377,7 @@ int Instruments::read_config_file(const char *name)
* apparently it sets some sort of base offset for tone numbers. * apparently it sets some sort of base offset for tone numbers.
* Why anyone would want to do this is beyond me. * Why anyone would want to do this is beyond me.
*/ */
//cmsg(CMSG_ERROR, VERB_NORMAL, "FIXME: Implement \"progbase\" in TiMidity config.\n"); //printMessage(CMSG_ERROR, VERB_NORMAL, "FIXME: Implement \"progbase\" in TiMidity config.\n");
} }
else if (!strcmp(w[0], "map")) /* "map" name set1 elem1 set2 elem2 */ else if (!strcmp(w[0], "map")) /* "map" name set1 elem1 set2 elem2 */
{ {
@ -387,7 +387,7 @@ int Instruments::read_config_file(const char *name)
* documentation whatsoever for it, but it looks like it's used * documentation whatsoever for it, but it looks like it's used
* for remapping one instrument to another somehow. * for remapping one instrument to another somehow.
*/ */
//cmsg(CMSG_ERROR, VERB_NORMAL, "FIXME: Implement \"map\" in TiMidity config.\n"); //printMessage(CMSG_ERROR, VERB_NORMAL, "FIXME: Implement \"map\" in TiMidity config.\n");
} }
/* Standard TiMidity config */ /* Standard TiMidity config */
@ -396,7 +396,7 @@ int Instruments::read_config_file(const char *name)
{ {
if (words < 2) if (words < 2)
{ {
cmsg(CMSG_ERROR, VERB_NORMAL, "%s: line %d: No directory given\n", name, line); printMessage(CMSG_ERROR, VERB_NORMAL, "%s: line %d: No directory given\n", name, line);
return -2; return -2;
} }
for (i = 1; i < words; i++) for (i = 1; i < words; i++)
@ -409,7 +409,7 @@ int Instruments::read_config_file(const char *name)
{ {
if (words < 2) if (words < 2)
{ {
cmsg(CMSG_ERROR, VERB_NORMAL, "%s: line %d: No file name given\n", name, line); printMessage(CMSG_ERROR, VERB_NORMAL, "%s: line %d: No file name given\n", name, line);
return -2; return -2;
} }
for (i=1; i<words; i++) for (i=1; i<words; i++)
@ -423,7 +423,7 @@ int Instruments::read_config_file(const char *name)
{ {
if (words != 2) if (words != 2)
{ {
cmsg(CMSG_ERROR, VERB_NORMAL, "%s: line %d: Must specify exactly one patch name\n", name, line); printMessage(CMSG_ERROR, VERB_NORMAL, "%s: line %d: Must specify exactly one patch name\n", name, line);
return -2; return -2;
} }
def_instr_name = w[1]; def_instr_name = w[1];
@ -432,13 +432,13 @@ int Instruments::read_config_file(const char *name)
{ {
if (words < 2) if (words < 2)
{ {
cmsg(CMSG_ERROR, VERB_NORMAL, "%s: line %d: No drum set number given\n", name, line); printMessage(CMSG_ERROR, VERB_NORMAL, "%s: line %d: No drum set number given\n", name, line);
return -2; return -2;
} }
i = atoi(w[1]); i = atoi(w[1]);
if (i < 0 || i > 127) if (i < 0 || i > 127)
{ {
cmsg(CMSG_ERROR, VERB_NORMAL, "%s: line %d: Drum set must be between 0 and 127\n", name, line); printMessage(CMSG_ERROR, VERB_NORMAL, "%s: line %d: Drum set must be between 0 and 127\n", name, line);
return -2; return -2;
} }
if (drumset[i] == NULL) if (drumset[i] == NULL)
@ -451,13 +451,13 @@ int Instruments::read_config_file(const char *name)
{ {
if (words < 2) if (words < 2)
{ {
cmsg(CMSG_ERROR, VERB_NORMAL, "%s: line %d: No bank number given\n", name, line); printMessage(CMSG_ERROR, VERB_NORMAL, "%s: line %d: No bank number given\n", name, line);
return -2; return -2;
} }
i = atoi(w[1]); i = atoi(w[1]);
if (i < 0 || i > 127) if (i < 0 || i > 127)
{ {
cmsg(CMSG_ERROR, VERB_NORMAL, "%s: line %d: Tone bank must be between 0 and 127\n", name, line); printMessage(CMSG_ERROR, VERB_NORMAL, "%s: line %d: Tone bank must be between 0 and 127\n", name, line);
return -2; return -2;
} }
if (tonebank[i] == NULL) if (tonebank[i] == NULL)
@ -470,18 +470,18 @@ int Instruments::read_config_file(const char *name)
{ {
if ((words < 2) || (*w[0] < '0' || *w[0] > '9')) if ((words < 2) || (*w[0] < '0' || *w[0] > '9'))
{ {
cmsg(CMSG_ERROR, VERB_NORMAL, "%s: line %d: syntax error\n", name, line); printMessage(CMSG_ERROR, VERB_NORMAL, "%s: line %d: syntax error\n", name, line);
return -2; return -2;
} }
i = atoi(w[0]); i = atoi(w[0]);
if (i < 0 || i > 127) if (i < 0 || i > 127)
{ {
cmsg(CMSG_ERROR, VERB_NORMAL, "%s: line %d: Program must be between 0 and 127\n", name, line); printMessage(CMSG_ERROR, VERB_NORMAL, "%s: line %d: Program must be between 0 and 127\n", name, line);
return -2; return -2;
} }
if (bank == NULL) if (bank == NULL)
{ {
cmsg(CMSG_ERROR, VERB_NORMAL, "%s: line %d: Must specify tone bank or drum set before assignment\n", name, line); printMessage(CMSG_ERROR, VERB_NORMAL, "%s: line %d: Must specify tone bank or drum set before assignment\n", name, line);
return -2; return -2;
} }
bank->tone[i].note = bank->tone[i].pan = bank->tone[i].note = bank->tone[i].pan =
@ -515,7 +515,7 @@ int Instruments::read_config_file(const char *name)
{ {
if (!(cp=strchr(w[j], '='))) if (!(cp=strchr(w[j], '=')))
{ {
cmsg(CMSG_ERROR, VERB_NORMAL, "%s: line %d: bad patch option %s\n", name, line, w[j]); printMessage(CMSG_ERROR, VERB_NORMAL, "%s: line %d: bad patch option %s\n", name, line, w[j]);
return -2; return -2;
} }
*cp++ = 0; *cp++ = 0;
@ -528,7 +528,7 @@ int Instruments::read_config_file(const char *name)
k = atoi(cp); k = atoi(cp);
if ((k < 0 || k > 127) || (*cp < '0' || *cp > '9')) if ((k < 0 || k > 127) || (*cp < '0' || *cp > '9'))
{ {
cmsg(CMSG_ERROR, VERB_NORMAL, "%s: line %d: note must be between 0 and 127\n", name, line); printMessage(CMSG_ERROR, VERB_NORMAL, "%s: line %d: note must be between 0 and 127\n", name, line);
return -2; return -2;
} }
bank->tone[i].note = k; bank->tone[i].note = k;
@ -546,7 +546,7 @@ int Instruments::read_config_file(const char *name)
if ((k < 0 || k > 127) || if ((k < 0 || k > 127) ||
(k == 0 && *cp != '-' && (*cp < '0' || *cp > '9'))) (k == 0 && *cp != '-' && (*cp < '0' || *cp > '9')))
{ {
cmsg(CMSG_ERROR, VERB_NORMAL, "%s: line %d: panning must be left, right, " printMessage(CMSG_ERROR, VERB_NORMAL, "%s: line %d: panning must be left, right, "
"center, or between -100 and 100\n", name, line); "center, or between -100 and 100\n", name, line);
return -2; return -2;
} }
@ -560,7 +560,7 @@ int Instruments::read_config_file(const char *name)
bank->tone[i].strip_loop = 0; bank->tone[i].strip_loop = 0;
else else
{ {
cmsg(CMSG_ERROR, VERB_NORMAL, "%s: line %d: keep must be env or loop\n", name, line); printMessage(CMSG_ERROR, VERB_NORMAL, "%s: line %d: keep must be env or loop\n", name, line);
return -2; return -2;
} }
} }
@ -574,13 +574,13 @@ int Instruments::read_config_file(const char *name)
bank->tone[i].strip_tail = 1; bank->tone[i].strip_tail = 1;
else else
{ {
cmsg(CMSG_ERROR, VERB_NORMAL, "%s: line %d: strip must be env, loop, or tail\n", name, line); printMessage(CMSG_ERROR, VERB_NORMAL, "%s: line %d: strip must be env, loop, or tail\n", name, line);
return -2; return -2;
} }
} }
else else
{ {
cmsg(CMSG_ERROR, VERB_NORMAL, "%s: line %d: bad patch option %s\n", name, line, w[j]); printMessage(CMSG_ERROR, VERB_NORMAL, "%s: line %d: bad patch option %s\n", name, line, w[j]);
return -2; return -2;
} }
} }
@ -821,7 +821,7 @@ static void default_cmsg(int type, int verbosity_level, const char* fmt, ...)
} }
// Allow hosting applications to capture the messages and deal with them themselves. // Allow hosting applications to capture the messages and deal with them themselves.
void (*cmsg)(int type, int verbosity_level, const char* fmt, ...) = default_cmsg; void (*printMessage)(int type, int verbosity_level, const char* fmt, ...) = default_cmsg;
} }

View file

@ -48,7 +48,7 @@ enum
VERB_DEBUG VERB_DEBUG
}; };
extern void (*cmsg)(int type, int verbosity_level, const char *fmt, ...); extern void (*printMessage)(int type, int verbosity_level, const char *fmt, ...);
/* /*

View file

@ -177,6 +177,6 @@ void default_ctl_cmsg(int type, int verbosity_level, const char* fmt, ...)
} }
// Allow hosting applications to capture the messages and deal with them themselves. // Allow hosting applications to capture the messages and deal with them themselves.
void (*ctl_cmsg)(int type, int verbosity_level, const char* fmt, ...) = default_ctl_cmsg; void (*printMessage)(int type, int verbosity_level, const char* fmt, ...) = default_ctl_cmsg;
} }

View file

@ -34,7 +34,7 @@ namespace TimidityPlus
#define MAXWORDS 130 #define MAXWORDS 130
#define CHECKERRLIMIT \ #define CHECKERRLIMIT \
if(++errcnt >= 10) { \ if(++errcnt >= 10) { \
ctl_cmsg(CMSG_ERROR, VERB_NORMAL, \ printMessage(CMSG_ERROR, VERB_NORMAL, \
"Too many errors... Give up read %s", name); \ "Too many errors... Give up read %s", name); \
reuse_mblock(&varbuf); \ reuse_mblock(&varbuf); \
tf_close(tf); return 1; } tf_close(tf); return 1; }
@ -192,7 +192,7 @@ static Quantity **config_parse_modulation(const char *name, int line, const char
if ((delim = strpbrk(strncpy(buf, p, sizeof buf - 1), ":,")) != NULL) if ((delim = strpbrk(strncpy(buf, p, sizeof buf - 1), ":,")) != NULL)
*delim = '\0'; *delim = '\0';
if (*buf != '\0' && (err = string_to_quantity(buf, &mod_list[i][j], qtypes[mod_type * 3 + j])) != NULL) { if (*buf != '\0' && (err = string_to_quantity(buf, &mod_list[i][j], qtypes[mod_type * 3 + j])) != NULL) {
ctl_cmsg(CMSG_ERROR, VERB_NORMAL, "%s: line %d: %s: parameter %d of item %d: %s (%s)", printMessage(CMSG_ERROR, VERB_NORMAL, "%s: line %d: %s: parameter %d of item %d: %s (%s)",
name, line, qtypestr[mod_type], j + 1, i + 1, err, buf); name, line, qtypestr[mod_type], j + 1, i + 1, err, buf);
free_ptr_list(mod_list, *num); free_ptr_list(mod_list, *num);
mod_list = NULL; mod_list = NULL;
@ -257,7 +257,7 @@ int Instruments::set_gus_patchconf_opts(const char *name, int line, char *opts,
int k; int k;
if (!(cp = strchr(opts, '='))) { if (!(cp = strchr(opts, '='))) {
ctl_cmsg(CMSG_ERROR, VERB_NORMAL, printMessage(CMSG_ERROR, VERB_NORMAL,
"%s: line %d: bad patch option %s", name, line, opts); "%s: line %d: bad patch option %s", name, line, opts);
return 1; return 1;
} }
@ -265,7 +265,7 @@ int Instruments::set_gus_patchconf_opts(const char *name, int line, char *opts,
if (!strcmp(opts, "amp")) { if (!strcmp(opts, "amp")) {
k = atoi(cp); k = atoi(cp);
if ((k < 0 || k > MAX_AMPLIFICATION) || (*cp < '0' || *cp > '9')) { if ((k < 0 || k > MAX_AMPLIFICATION) || (*cp < '0' || *cp > '9')) {
ctl_cmsg(CMSG_ERROR, VERB_NORMAL, printMessage(CMSG_ERROR, VERB_NORMAL,
"%s: line %d: amplification must be between 0 and %d", "%s: line %d: amplification must be between 0 and %d",
name, line, MAX_AMPLIFICATION); name, line, MAX_AMPLIFICATION);
return 1; return 1;
@ -275,7 +275,7 @@ int Instruments::set_gus_patchconf_opts(const char *name, int line, char *opts,
else if (!strcmp(opts, "note")) { else if (!strcmp(opts, "note")) {
k = atoi(cp); k = atoi(cp);
if ((k < 0 || k > 127) || (*cp < '0' || *cp > '9')) { if ((k < 0 || k > 127) || (*cp < '0' || *cp > '9')) {
ctl_cmsg(CMSG_ERROR, VERB_NORMAL, printMessage(CMSG_ERROR, VERB_NORMAL,
"%s: line %d: note must be between 0 and 127", "%s: line %d: note must be between 0 and 127",
name, line); name, line);
return 1; return 1;
@ -294,7 +294,7 @@ int Instruments::set_gus_patchconf_opts(const char *name, int line, char *opts,
k = ((atoi(cp) + 100) * 100) / 157; k = ((atoi(cp) + 100) * 100) / 157;
if ((k < 0 || k > 127) if ((k < 0 || k > 127)
|| (k == 0 && *cp != '-' && (*cp < '0' || *cp > '9'))) { || (k == 0 && *cp != '-' && (*cp < '0' || *cp > '9'))) {
ctl_cmsg(CMSG_ERROR, VERB_NORMAL, printMessage(CMSG_ERROR, VERB_NORMAL,
"%s: line %d: panning must be left, right, " "%s: line %d: panning must be left, right, "
"center, or between -100 and 100", "center, or between -100 and 100",
name, line); name, line);
@ -315,7 +315,7 @@ int Instruments::set_gus_patchconf_opts(const char *name, int line, char *opts,
else if (!strcmp(cp, "loop")) else if (!strcmp(cp, "loop"))
tone->strip_loop = 0; tone->strip_loop = 0;
else { else {
ctl_cmsg(CMSG_ERROR, VERB_NORMAL, printMessage(CMSG_ERROR, VERB_NORMAL,
"%s: line %d: keep must be env or loop", name, line); "%s: line %d: keep must be env or loop", name, line);
return 1; return 1;
} }
@ -328,7 +328,7 @@ int Instruments::set_gus_patchconf_opts(const char *name, int line, char *opts,
else if (!strcmp(cp, "tail")) else if (!strcmp(cp, "tail"))
tone->strip_tail = 1; tone->strip_tail = 1;
else { else {
ctl_cmsg(CMSG_ERROR, VERB_NORMAL, printMessage(CMSG_ERROR, VERB_NORMAL,
"%s: line %d: strip must be env, loop, or tail", "%s: line %d: strip must be env, loop, or tail",
name, line); name, line);
return 1; return 1;
@ -391,7 +391,7 @@ int Instruments::set_gus_patchconf_opts(const char *name, int line, char *opts,
else if (!strcmp(opts, "qvelf")) /* resonance velocity-follow */ else if (!strcmp(opts, "qvelf")) /* resonance velocity-follow */
tone->vel_to_resonance = atoi(cp); tone->vel_to_resonance = atoi(cp);
else { else {
ctl_cmsg(CMSG_ERROR, VERB_NORMAL, printMessage(CMSG_ERROR, VERB_NORMAL,
"%s: line %d: bad patch option %s", "%s: line %d: bad patch option %s",
name, line, opts); name, line, opts);
return 1; return 1;
@ -429,7 +429,7 @@ int Instruments::set_gus_patchconf(const char *name, int line, ToneBankElement *
if (opts[0] == NULL || opts[1] == NULL || opts[2] == NULL || if (opts[0] == NULL || opts[1] == NULL || opts[2] == NULL ||
(atoi(opts[1]) == 128 && opts[3] == NULL)) (atoi(opts[1]) == 128 && opts[3] == NULL))
{ {
ctl_cmsg(CMSG_ERROR, VERB_NORMAL, printMessage(CMSG_ERROR, VERB_NORMAL,
"%s: line %d: Syntax error", name, line); "%s: line %d: Syntax error", name, line);
return 1; return 1;
} }
@ -465,7 +465,7 @@ int Instruments::set_gus_patchconf(const char *name, int line, ToneBankElement *
if (opts[0] == NULL) if (opts[0] == NULL)
{ {
ctl_cmsg(CMSG_ERROR, VERB_NORMAL, printMessage(CMSG_ERROR, VERB_NORMAL,
"%s: line %d: Syntax error", name, line); "%s: line %d: Syntax error", name, line);
return 1; return 1;
} }
@ -502,12 +502,12 @@ int Instruments::set_patchconf(const char *name, int line, ToneBank *bank, char
if (i < 0 || i > 127) if (i < 0 || i > 127)
{ {
if (dr) if (dr)
ctl_cmsg(CMSG_ERROR, VERB_NORMAL, printMessage(CMSG_ERROR, VERB_NORMAL,
"%s: line %d: Drum number must be between " "%s: line %d: Drum number must be between "
"0 and 127", "0 and 127",
name, line); name, line);
else else
ctl_cmsg(CMSG_ERROR, VERB_NORMAL, printMessage(CMSG_ERROR, VERB_NORMAL,
"%s: line %d: Program must be between " "%s: line %d: Program must be between "
"%d and %d", "%d and %d",
name, line, progbase, 127 + progbase); name, line, progbase, 127 + progbase);
@ -515,7 +515,7 @@ int Instruments::set_patchconf(const char *name, int line, ToneBank *bank, char
} }
if (!bank) if (!bank)
{ {
ctl_cmsg(CMSG_ERROR, VERB_NORMAL, printMessage(CMSG_ERROR, VERB_NORMAL,
"%s: line %d: Must specify tone bank or drum set " "%s: line %d: Must specify tone bank or drum set "
"before assignment", name, line); "before assignment", name, line);
return 1; return 1;
@ -628,7 +628,7 @@ int Instruments::read_config_file(const char *name, int self, int allow_missing_
if (rcf_count > 50) if (rcf_count > 50)
{ {
ctl_cmsg(CMSG_ERROR, VERB_NORMAL, printMessage(CMSG_ERROR, VERB_NORMAL,
"Probable source loop in configuration files"); "Probable source loop in configuration files");
return READ_CONFIG_RECURSION; return READ_CONFIG_RECURSION;
} }
@ -699,7 +699,7 @@ int Instruments::read_config_file(const char *name, int self, int allow_missing_
{ {
if (!isspace(terminator[1]) && terminator[1] != '\0') if (!isspace(terminator[1]) && terminator[1] != '\0')
{ {
ctl_cmsg(CMSG_ERROR, VERB_NORMAL, printMessage(CMSG_ERROR, VERB_NORMAL,
"%s: line %d: there must be at least one whitespace between " "%s: line %d: there must be at least one whitespace between "
"string terminator (%c) and the next parameter", name, line, tmp[i]); "string terminator (%c) and the next parameter", name, line, tmp[i]);
CHECKERRLIMIT; CHECKERRLIMIT;
@ -734,14 +734,14 @@ int Instruments::read_config_file(const char *name, int self, int allow_missing_
{ {
if (words != 3) if (words != 3)
{ {
ctl_cmsg(CMSG_ERROR, VERB_NORMAL, printMessage(CMSG_ERROR, VERB_NORMAL,
"%s: line %d: syntax error", name, line); "%s: line %d: syntax error", name, line);
CHECKERRLIMIT; CHECKERRLIMIT;
continue; continue;
} }
if (!bank) if (!bank)
{ {
ctl_cmsg(CMSG_ERROR, VERB_NORMAL, printMessage(CMSG_ERROR, VERB_NORMAL,
"%s: line %d: Must specify tone bank or drum set " "%s: line %d: Must specify tone bank or drum set "
"before assignment", name, line); "before assignment", name, line);
CHECKERRLIMIT; CHECKERRLIMIT;
@ -750,7 +750,7 @@ int Instruments::read_config_file(const char *name, int self, int allow_missing_
i = atoi(w[1]); i = atoi(w[1]);
if (i < 0 || i > 127) if (i < 0 || i > 127)
{ {
ctl_cmsg(CMSG_ERROR, VERB_NORMAL, printMessage(CMSG_ERROR, VERB_NORMAL,
"%s: line %d: extension timeout " "%s: line %d: extension timeout "
"must be between 0 and 127", name, line); "must be between 0 and 127", name, line);
CHECKERRLIMIT; CHECKERRLIMIT;
@ -763,7 +763,7 @@ int Instruments::read_config_file(const char *name, int self, int allow_missing_
{ {
if (words < 2) if (words < 2)
{ {
ctl_cmsg(CMSG_ERROR, VERB_NORMAL, printMessage(CMSG_ERROR, VERB_NORMAL,
"%s: line %d: No copydrumset number given", "%s: line %d: No copydrumset number given",
name, line); name, line);
CHECKERRLIMIT; CHECKERRLIMIT;
@ -772,7 +772,7 @@ int Instruments::read_config_file(const char *name, int self, int allow_missing_
i = atoi(w[1]); i = atoi(w[1]);
if (i < 0 || i > 127) if (i < 0 || i > 127)
{ {
ctl_cmsg(CMSG_ERROR, VERB_NORMAL, printMessage(CMSG_ERROR, VERB_NORMAL,
"%s: line %d: extension copydrumset " "%s: line %d: extension copydrumset "
"must be between 0 and 127", name, line); "must be between 0 and 127", name, line);
CHECKERRLIMIT; CHECKERRLIMIT;
@ -780,7 +780,7 @@ int Instruments::read_config_file(const char *name, int self, int allow_missing_
} }
if (!bank) if (!bank)
{ {
ctl_cmsg(CMSG_ERROR, VERB_NORMAL, printMessage(CMSG_ERROR, VERB_NORMAL,
"%s: line %d: Must specify tone bank or " "%s: line %d: Must specify tone bank or "
"drum set before assignment", name, line); "drum set before assignment", name, line);
CHECKERRLIMIT; CHECKERRLIMIT;
@ -793,7 +793,7 @@ int Instruments::read_config_file(const char *name, int self, int allow_missing_
{ {
if (words < 2) if (words < 2)
{ {
ctl_cmsg(CMSG_ERROR, VERB_NORMAL, printMessage(CMSG_ERROR, VERB_NORMAL,
"%s: line %d: No copybank number given", "%s: line %d: No copybank number given",
name, line); name, line);
CHECKERRLIMIT; CHECKERRLIMIT;
@ -802,7 +802,7 @@ int Instruments::read_config_file(const char *name, int self, int allow_missing_
i = atoi(w[1]); i = atoi(w[1]);
if (i < 0 || i > 127) if (i < 0 || i > 127)
{ {
ctl_cmsg(CMSG_ERROR, VERB_NORMAL, printMessage(CMSG_ERROR, VERB_NORMAL,
"%s: line %d: extension copybank " "%s: line %d: extension copybank "
"must be between 0 and 127", name, line); "must be between 0 and 127", name, line);
CHECKERRLIMIT; CHECKERRLIMIT;
@ -810,7 +810,7 @@ int Instruments::read_config_file(const char *name, int self, int allow_missing_
} }
if (!bank) if (!bank)
{ {
ctl_cmsg(CMSG_ERROR, VERB_NORMAL, printMessage(CMSG_ERROR, VERB_NORMAL,
"%s: line %d: Must specify tone bank or " "%s: line %d: Must specify tone bank or "
"drum set before assignment", name, line); "drum set before assignment", name, line);
CHECKERRLIMIT; CHECKERRLIMIT;
@ -826,35 +826,35 @@ int Instruments::read_config_file(const char *name, int self, int allow_missing_
if (words != 3) if (words != 3)
{ {
ctl_cmsg(CMSG_ERROR, VERB_NORMAL, printMessage(CMSG_ERROR, VERB_NORMAL,
"%s: line %d: syntax error", name, line); "%s: line %d: syntax error", name, line);
CHECKERRLIMIT; CHECKERRLIMIT;
continue; continue;
} }
if ((mapto = mapname2id(w[1], &toisdrum)) == -1) if ((mapto = mapname2id(w[1], &toisdrum)) == -1)
{ {
ctl_cmsg(CMSG_ERROR, VERB_NORMAL, printMessage(CMSG_ERROR, VERB_NORMAL,
"%s: line %d: Invalid map name: %s", name, line, w[1]); "%s: line %d: Invalid map name: %s", name, line, w[1]);
CHECKERRLIMIT; CHECKERRLIMIT;
continue; continue;
} }
if ((mapfrom = mapname2id(w[2], &fromisdrum)) == -1) if ((mapfrom = mapname2id(w[2], &fromisdrum)) == -1)
{ {
ctl_cmsg(CMSG_ERROR, VERB_NORMAL, printMessage(CMSG_ERROR, VERB_NORMAL,
"%s: line %d: Invalid map name: %s", name, line, w[2]); "%s: line %d: Invalid map name: %s", name, line, w[2]);
CHECKERRLIMIT; CHECKERRLIMIT;
continue; continue;
} }
if (toisdrum != fromisdrum) if (toisdrum != fromisdrum)
{ {
ctl_cmsg(CMSG_ERROR, VERB_NORMAL, printMessage(CMSG_ERROR, VERB_NORMAL,
"%s: line %d: Map type should be matched", name, line); "%s: line %d: Map type should be matched", name, line);
CHECKERRLIMIT; CHECKERRLIMIT;
continue; continue;
} }
if (copymap(mapto, mapfrom, toisdrum)) if (copymap(mapto, mapfrom, toisdrum))
{ {
ctl_cmsg(CMSG_ERROR, VERB_NORMAL, printMessage(CMSG_ERROR, VERB_NORMAL,
"%s: line %d: No free %s available to map", "%s: line %d: No free %s available to map",
name, line, toisdrum ? "drum set" : "tone bank"); name, line, toisdrum ? "drum set" : "tone bank");
CHECKERRLIMIT; CHECKERRLIMIT;
@ -866,7 +866,7 @@ int Instruments::read_config_file(const char *name, int self, int allow_missing_
{ {
if (words < 2) if (words < 2)
{ {
ctl_cmsg(CMSG_ERROR, VERB_NORMAL, printMessage(CMSG_ERROR, VERB_NORMAL,
"%s: line %d: No undef number given", "%s: line %d: No undef number given",
name, line); name, line);
CHECKERRLIMIT; CHECKERRLIMIT;
@ -875,7 +875,7 @@ int Instruments::read_config_file(const char *name, int self, int allow_missing_
i = atoi(w[1]); i = atoi(w[1]);
if (i < 0 || i > 127) if (i < 0 || i > 127)
{ {
ctl_cmsg(CMSG_ERROR, VERB_NORMAL, printMessage(CMSG_ERROR, VERB_NORMAL,
"%s: line %d: extension undef " "%s: line %d: extension undef "
"must be between 0 and 127", name, line); "must be between 0 and 127", name, line);
CHECKERRLIMIT; CHECKERRLIMIT;
@ -883,7 +883,7 @@ int Instruments::read_config_file(const char *name, int self, int allow_missing_
} }
if (!bank) if (!bank)
{ {
ctl_cmsg(CMSG_ERROR, VERB_NORMAL, printMessage(CMSG_ERROR, VERB_NORMAL,
"%s: line %d: Must specify tone bank or " "%s: line %d: Must specify tone bank or "
"drum set before assignment", name, line); "drum set before assignment", name, line);
CHECKERRLIMIT; CHECKERRLIMIT;
@ -898,7 +898,7 @@ int Instruments::read_config_file(const char *name, int self, int allow_missing_
if (!bank) if (!bank)
{ {
ctl_cmsg(CMSG_ERROR, VERB_NORMAL, printMessage(CMSG_ERROR, VERB_NORMAL,
"%s: line %d: Must specify tone bank or drum set " "%s: line %d: Must specify tone bank or drum set "
"before altassign", name, line); "before altassign", name, line);
CHECKERRLIMIT; CHECKERRLIMIT;
@ -906,14 +906,14 @@ int Instruments::read_config_file(const char *name, int self, int allow_missing_
} }
if (words < 2) if (words < 2)
{ {
ctl_cmsg(CMSG_ERROR, VERB_NORMAL, printMessage(CMSG_ERROR, VERB_NORMAL,
"%s: line %d: No alternate assignment", name, line); "%s: line %d: No alternate assignment", name, line);
CHECKERRLIMIT; CHECKERRLIMIT;
continue; continue;
} }
if (!dr) { if (!dr) {
ctl_cmsg(CMSG_WARNING, VERB_NORMAL, printMessage(CMSG_WARNING, VERB_NORMAL,
"%s: line %d: Warning: Not a drumset altassign" "%s: line %d: Warning: Not a drumset altassign"
" (ignored)", " (ignored)",
name, line); name, line);
@ -927,14 +927,14 @@ int Instruments::read_config_file(const char *name, int self, int allow_missing_
{ {
if (words != 3) if (words != 3)
{ {
ctl_cmsg(CMSG_ERROR, VERB_NORMAL, printMessage(CMSG_ERROR, VERB_NORMAL,
"%s: line %d: syntax error", name, line); "%s: line %d: syntax error", name, line);
CHECKERRLIMIT; CHECKERRLIMIT;
continue; continue;
} }
if (!bank) if (!bank)
{ {
ctl_cmsg(CMSG_ERROR, VERB_NORMAL, printMessage(CMSG_ERROR, VERB_NORMAL,
"%s: line %d: Must specify tone bank or drum set " "%s: line %d: Must specify tone bank or drum set "
"before assignment", name, line); "before assignment", name, line);
CHECKERRLIMIT; CHECKERRLIMIT;
@ -943,7 +943,7 @@ int Instruments::read_config_file(const char *name, int self, int allow_missing_
i = atoi(w[1]); i = atoi(w[1]);
if (i < 0 || i > 127) if (i < 0 || i > 127)
{ {
ctl_cmsg(CMSG_ERROR, VERB_NORMAL, printMessage(CMSG_ERROR, VERB_NORMAL,
"%s: line %d: extension legato " "%s: line %d: extension legato "
"must be between 0 and 127", name, line); "must be between 0 and 127", name, line);
CHECKERRLIMIT; CHECKERRLIMIT;
@ -955,14 +955,14 @@ int Instruments::read_config_file(const char *name, int self, int allow_missing_
{ {
if (words != 3) if (words != 3)
{ {
ctl_cmsg(CMSG_ERROR, VERB_NORMAL, printMessage(CMSG_ERROR, VERB_NORMAL,
"%s: line %d: syntax error", name, line); "%s: line %d: syntax error", name, line);
CHECKERRLIMIT; CHECKERRLIMIT;
continue; continue;
} }
if (!bank) if (!bank)
{ {
ctl_cmsg(CMSG_ERROR, VERB_NORMAL, printMessage(CMSG_ERROR, VERB_NORMAL,
"%s: line %d: Must specify tone bank or drum set " "%s: line %d: Must specify tone bank or drum set "
"before assignment", name, line); "before assignment", name, line);
CHECKERRLIMIT; CHECKERRLIMIT;
@ -971,7 +971,7 @@ int Instruments::read_config_file(const char *name, int self, int allow_missing_
i = atoi(w[1]); i = atoi(w[1]);
if (i < 0 || i > 127) if (i < 0 || i > 127)
{ {
ctl_cmsg(CMSG_ERROR, VERB_NORMAL, printMessage(CMSG_ERROR, VERB_NORMAL,
"%s: line %d: extension damper " "%s: line %d: extension damper "
"must be between 0 and 127", name, line); "must be between 0 and 127", name, line);
CHECKERRLIMIT; CHECKERRLIMIT;
@ -983,14 +983,14 @@ int Instruments::read_config_file(const char *name, int self, int allow_missing_
{ {
if (words != 3) if (words != 3)
{ {
ctl_cmsg(CMSG_ERROR, VERB_NORMAL, printMessage(CMSG_ERROR, VERB_NORMAL,
"%s: line %d: syntax error", name, line); "%s: line %d: syntax error", name, line);
CHECKERRLIMIT; CHECKERRLIMIT;
continue; continue;
} }
if (!bank) if (!bank)
{ {
ctl_cmsg(CMSG_ERROR, VERB_NORMAL, printMessage(CMSG_ERROR, VERB_NORMAL,
"%s: line %d: Must specify tone bank or drum set " "%s: line %d: Must specify tone bank or drum set "
"before assignment", name, line); "before assignment", name, line);
CHECKERRLIMIT; CHECKERRLIMIT;
@ -999,7 +999,7 @@ int Instruments::read_config_file(const char *name, int self, int allow_missing_
i = atoi(w[1]); i = atoi(w[1]);
if (i < 0 || i > 127) if (i < 0 || i > 127)
{ {
ctl_cmsg(CMSG_ERROR, VERB_NORMAL, printMessage(CMSG_ERROR, VERB_NORMAL,
"%s: line %d: extension rnddelay " "%s: line %d: extension rnddelay "
"must be between 0 and 127", name, line); "must be between 0 and 127", name, line);
CHECKERRLIMIT; CHECKERRLIMIT;
@ -1011,13 +1011,13 @@ int Instruments::read_config_file(const char *name, int self, int allow_missing_
{ {
if (words != 3) if (words != 3)
{ {
ctl_cmsg(CMSG_ERROR, VERB_NORMAL, "%s: line %d: syntax error", name, line); printMessage(CMSG_ERROR, VERB_NORMAL, "%s: line %d: syntax error", name, line);
CHECKERRLIMIT; CHECKERRLIMIT;
continue; continue;
} }
if (!bank) if (!bank)
{ {
ctl_cmsg(CMSG_ERROR, VERB_NORMAL, printMessage(CMSG_ERROR, VERB_NORMAL,
"%s: line %d: Must specify tone bank or drum set " "%s: line %d: Must specify tone bank or drum set "
"before assignment", name, line); "before assignment", name, line);
CHECKERRLIMIT; CHECKERRLIMIT;
@ -1026,7 +1026,7 @@ int Instruments::read_config_file(const char *name, int self, int allow_missing_
i = atoi(w[2]); i = atoi(w[2]);
if (i < 0 || i > 127) if (i < 0 || i > 127)
{ {
ctl_cmsg(CMSG_ERROR, VERB_NORMAL, printMessage(CMSG_ERROR, VERB_NORMAL,
"%s: line %d: extension level " "%s: line %d: extension level "
"must be between 0 and 127", name, line); "must be between 0 and 127", name, line);
CHECKERRLIMIT; CHECKERRLIMIT;
@ -1046,13 +1046,13 @@ int Instruments::read_config_file(const char *name, int self, int allow_missing_
{ {
if (words != 3) if (words != 3)
{ {
ctl_cmsg(CMSG_ERROR, VERB_NORMAL, "%s: line %d: syntax error", name, line); printMessage(CMSG_ERROR, VERB_NORMAL, "%s: line %d: syntax error", name, line);
CHECKERRLIMIT; CHECKERRLIMIT;
continue; continue;
} }
if (!bank) if (!bank)
{ {
ctl_cmsg(CMSG_ERROR, VERB_NORMAL, printMessage(CMSG_ERROR, VERB_NORMAL,
"%s: line %d: Must specify tone bank or drum set " "%s: line %d: Must specify tone bank or drum set "
"before assignment", name, line); "before assignment", name, line);
CHECKERRLIMIT; CHECKERRLIMIT;
@ -1061,7 +1061,7 @@ int Instruments::read_config_file(const char *name, int self, int allow_missing_
i = atoi(w[2]); i = atoi(w[2]);
if (i < 0 || i > 127) if (i < 0 || i > 127)
{ {
ctl_cmsg(CMSG_ERROR, VERB_NORMAL, printMessage(CMSG_ERROR, VERB_NORMAL,
"%s: line %d: extension reverbsend " "%s: line %d: extension reverbsend "
"must be between 0 and 127", name, line); "must be between 0 and 127", name, line);
CHECKERRLIMIT; CHECKERRLIMIT;
@ -1081,13 +1081,13 @@ int Instruments::read_config_file(const char *name, int self, int allow_missing_
{ {
if (words != 3) if (words != 3)
{ {
ctl_cmsg(CMSG_ERROR, VERB_NORMAL, "%s: line %d: syntax error", name, line); printMessage(CMSG_ERROR, VERB_NORMAL, "%s: line %d: syntax error", name, line);
CHECKERRLIMIT; CHECKERRLIMIT;
continue; continue;
} }
if (!bank) if (!bank)
{ {
ctl_cmsg(CMSG_ERROR, VERB_NORMAL, printMessage(CMSG_ERROR, VERB_NORMAL,
"%s: line %d: Must specify tone bank or drum set " "%s: line %d: Must specify tone bank or drum set "
"before assignment", name, line); "before assignment", name, line);
CHECKERRLIMIT; CHECKERRLIMIT;
@ -1096,7 +1096,7 @@ int Instruments::read_config_file(const char *name, int self, int allow_missing_
i = atoi(w[2]); i = atoi(w[2]);
if (i < 0 || i > 127) if (i < 0 || i > 127)
{ {
ctl_cmsg(CMSG_ERROR, VERB_NORMAL, printMessage(CMSG_ERROR, VERB_NORMAL,
"%s: line %d: extension chorussend " "%s: line %d: extension chorussend "
"must be between 0 and 127", name, line); "must be between 0 and 127", name, line);
CHECKERRLIMIT; CHECKERRLIMIT;
@ -1116,13 +1116,13 @@ int Instruments::read_config_file(const char *name, int self, int allow_missing_
{ {
if (words != 3) if (words != 3)
{ {
ctl_cmsg(CMSG_ERROR, VERB_NORMAL, "%s: line %d: syntax error", name, line); printMessage(CMSG_ERROR, VERB_NORMAL, "%s: line %d: syntax error", name, line);
CHECKERRLIMIT; CHECKERRLIMIT;
continue; continue;
} }
if (!bank) if (!bank)
{ {
ctl_cmsg(CMSG_ERROR, VERB_NORMAL, printMessage(CMSG_ERROR, VERB_NORMAL,
"%s: line %d: Must specify tone bank or drum set " "%s: line %d: Must specify tone bank or drum set "
"before assignment", name, line); "before assignment", name, line);
CHECKERRLIMIT; CHECKERRLIMIT;
@ -1131,7 +1131,7 @@ int Instruments::read_config_file(const char *name, int self, int allow_missing_
i = atoi(w[2]); i = atoi(w[2]);
if (i < 0 || i > 127) if (i < 0 || i > 127)
{ {
ctl_cmsg(CMSG_ERROR, VERB_NORMAL, printMessage(CMSG_ERROR, VERB_NORMAL,
"%s: line %d: extension delaysend " "%s: line %d: extension delaysend "
"must be between 0 and 127", name, line); "must be between 0 and 127", name, line);
CHECKERRLIMIT; CHECKERRLIMIT;
@ -1151,13 +1151,13 @@ int Instruments::read_config_file(const char *name, int self, int allow_missing_
{ {
if (words != 3) if (words != 3)
{ {
ctl_cmsg(CMSG_ERROR, VERB_NORMAL, "%s: line %d: syntax error", name, line); printMessage(CMSG_ERROR, VERB_NORMAL, "%s: line %d: syntax error", name, line);
CHECKERRLIMIT; CHECKERRLIMIT;
continue; continue;
} }
if (!bank) if (!bank)
{ {
ctl_cmsg(CMSG_ERROR, VERB_NORMAL, printMessage(CMSG_ERROR, VERB_NORMAL,
"%s: line %d: Must specify tone bank or drum set " "%s: line %d: Must specify tone bank or drum set "
"before assignment", name, line); "before assignment", name, line);
CHECKERRLIMIT; CHECKERRLIMIT;
@ -1166,7 +1166,7 @@ int Instruments::read_config_file(const char *name, int self, int allow_missing_
i = atoi(w[2]); i = atoi(w[2]);
if (i < 0 || i > 127) if (i < 0 || i > 127)
{ {
ctl_cmsg(CMSG_ERROR, VERB_NORMAL, printMessage(CMSG_ERROR, VERB_NORMAL,
"%s: line %d: extension playnote" "%s: line %d: extension playnote"
"must be between 0 and 127", name, line); "must be between 0 and 127", name, line);
CHECKERRLIMIT; CHECKERRLIMIT;
@ -1189,7 +1189,7 @@ int Instruments::read_config_file(const char *name, int self, int allow_missing_
if (words < 2) if (words < 2)
{ {
ctl_cmsg(CMSG_ERROR, VERB_NORMAL, printMessage(CMSG_ERROR, VERB_NORMAL,
"%s: line %d: No soundfont file given", "%s: line %d: No soundfont file given",
name, line); name, line);
CHECKERRLIMIT; CHECKERRLIMIT;
@ -1208,7 +1208,7 @@ int Instruments::read_config_file(const char *name, int self, int allow_missing_
} }
if (!(cp = strchr(w[j], '='))) if (!(cp = strchr(w[j], '=')))
{ {
ctl_cmsg(CMSG_ERROR, VERB_NORMAL, printMessage(CMSG_ERROR, VERB_NORMAL,
"%s: line %d: bad patch option %s", "%s: line %d: bad patch option %s",
name, line, w[j]); name, line, w[j]);
CHECKERRLIMIT; CHECKERRLIMIT;
@ -1220,7 +1220,7 @@ int Instruments::read_config_file(const char *name, int self, int allow_missing_
{ {
if (k < 0 || (*cp < '0' || *cp > '9')) if (k < 0 || (*cp < '0' || *cp > '9'))
{ {
ctl_cmsg(CMSG_ERROR, VERB_NORMAL, printMessage(CMSG_ERROR, VERB_NORMAL,
"%s: line %d: order must be a digit", "%s: line %d: order must be a digit",
name, line); name, line);
CHECKERRLIMIT; CHECKERRLIMIT;
@ -1232,7 +1232,7 @@ int Instruments::read_config_file(const char *name, int self, int allow_missing_
{ {
if (k < 0 || (*cp < '0' || *cp > '9')) if (k < 0 || (*cp < '0' || *cp > '9'))
{ {
ctl_cmsg(CMSG_ERROR, VERB_NORMAL, printMessage(CMSG_ERROR, VERB_NORMAL,
"%s: line %d: cutoff must be a digit", "%s: line %d: cutoff must be a digit",
name, line); name, line);
CHECKERRLIMIT; CHECKERRLIMIT;
@ -1244,7 +1244,7 @@ int Instruments::read_config_file(const char *name, int self, int allow_missing_
{ {
if (k < 0 || (*cp < '0' || *cp > '9')) if (k < 0 || (*cp < '0' || *cp > '9'))
{ {
ctl_cmsg(CMSG_ERROR, VERB_NORMAL, printMessage(CMSG_ERROR, VERB_NORMAL,
"%s: line %d: reso must be a digit", "%s: line %d: reso must be a digit",
name, line); name, line);
CHECKERRLIMIT; CHECKERRLIMIT;
@ -1267,7 +1267,7 @@ int Instruments::read_config_file(const char *name, int self, int allow_missing_
int bank, preset, keynote; int bank, preset, keynote;
if (words < 2) if (words < 2)
{ {
ctl_cmsg(CMSG_ERROR, VERB_NORMAL, printMessage(CMSG_ERROR, VERB_NORMAL,
"%s: line %d: no font command", name, line); "%s: line %d: no font command", name, line);
CHECKERRLIMIT; CHECKERRLIMIT;
continue; continue;
@ -1276,7 +1276,7 @@ int Instruments::read_config_file(const char *name, int self, int allow_missing_
{ {
if (words < 3) if (words < 3)
{ {
ctl_cmsg(CMSG_ERROR, VERB_NORMAL, printMessage(CMSG_ERROR, VERB_NORMAL,
"%s: line %d: No bank/preset/key is given", "%s: line %d: No bank/preset/key is given",
name, line); name, line);
CHECKERRLIMIT; CHECKERRLIMIT;
@ -1293,7 +1293,7 @@ int Instruments::read_config_file(const char *name, int self, int allow_missing_
keynote = -1; keynote = -1;
if (exclude_soundfont(bank, preset, keynote)) if (exclude_soundfont(bank, preset, keynote))
{ {
ctl_cmsg(CMSG_ERROR, VERB_NORMAL, printMessage(CMSG_ERROR, VERB_NORMAL,
"%s: line %d: No soundfont is given", "%s: line %d: No soundfont is given",
name, line); name, line);
CHECKERRLIMIT; CHECKERRLIMIT;
@ -1304,7 +1304,7 @@ int Instruments::read_config_file(const char *name, int self, int allow_missing_
int order; int order;
if (words < 4) if (words < 4)
{ {
ctl_cmsg(CMSG_ERROR, VERB_NORMAL, printMessage(CMSG_ERROR, VERB_NORMAL,
"%s: line %d: No order/bank is given", "%s: line %d: No order/bank is given",
name, line); name, line);
CHECKERRLIMIT; CHECKERRLIMIT;
@ -1322,7 +1322,7 @@ int Instruments::read_config_file(const char *name, int self, int allow_missing_
keynote = -1; keynote = -1;
if (order_soundfont(bank, preset, keynote, order)) if (order_soundfont(bank, preset, keynote, order))
{ {
ctl_cmsg(CMSG_ERROR, VERB_NORMAL, printMessage(CMSG_ERROR, VERB_NORMAL,
"%s: line %d: No soundfont is given", "%s: line %d: No soundfont is given",
name, line); name, line);
CHECKERRLIMIT; CHECKERRLIMIT;
@ -1333,7 +1333,7 @@ int Instruments::read_config_file(const char *name, int self, int allow_missing_
{ {
if (words < 2 || *w[1] < '0' || *w[1] > '9') if (words < 2 || *w[1] < '0' || *w[1] > '9')
{ {
ctl_cmsg(CMSG_ERROR, VERB_NORMAL, printMessage(CMSG_ERROR, VERB_NORMAL,
"%s: line %d: syntax error", name, line); "%s: line %d: syntax error", name, line);
CHECKERRLIMIT; CHECKERRLIMIT;
continue; continue;
@ -1346,14 +1346,14 @@ int Instruments::read_config_file(const char *name, int self, int allow_missing_
if (words != 6) if (words != 6)
{ {
ctl_cmsg(CMSG_ERROR, VERB_NORMAL, printMessage(CMSG_ERROR, VERB_NORMAL,
"%s: line %d: syntax error", name, line); "%s: line %d: syntax error", name, line);
CHECKERRLIMIT; CHECKERRLIMIT;
continue; continue;
} }
if ((arg[0] = mapname2id(w[1], &isdrum)) == -1) if ((arg[0] = mapname2id(w[1], &isdrum)) == -1)
{ {
ctl_cmsg(CMSG_ERROR, VERB_NORMAL, printMessage(CMSG_ERROR, VERB_NORMAL,
"%s: line %d: Invalid map name: %s", name, line, w[1]); "%s: line %d: Invalid map name: %s", name, line, w[1]);
CHECKERRLIMIT; CHECKERRLIMIT;
continue; continue;
@ -1376,7 +1376,7 @@ int Instruments::read_config_file(const char *name, int self, int allow_missing_
break; break;
if (i != 5) if (i != 5)
{ {
ctl_cmsg(CMSG_ERROR, VERB_NORMAL, printMessage(CMSG_ERROR, VERB_NORMAL,
"%s: line %d: Invalid parameter", name, line); "%s: line %d: Invalid parameter", name, line);
CHECKERRLIMIT; CHECKERRLIMIT;
continue; continue;
@ -1391,7 +1391,7 @@ int Instruments::read_config_file(const char *name, int self, int allow_missing_
{ {
if (words < 2) if (words < 2)
{ {
ctl_cmsg(CMSG_ERROR, VERB_NORMAL, printMessage(CMSG_ERROR, VERB_NORMAL,
"%s: line %d: No directory given", name, line); "%s: line %d: No directory given", name, line);
CHECKERRLIMIT; CHECKERRLIMIT;
continue; continue;
@ -1403,7 +1403,7 @@ int Instruments::read_config_file(const char *name, int self, int allow_missing_
{ {
if (words < 2) if (words < 2)
{ {
ctl_cmsg(CMSG_ERROR, VERB_NORMAL, printMessage(CMSG_ERROR, VERB_NORMAL,
"%s: line %d: No file name given", name, line); "%s: line %d: No file name given", name, line);
CHECKERRLIMIT; CHECKERRLIMIT;
continue; continue;
@ -1433,7 +1433,7 @@ int Instruments::read_config_file(const char *name, int self, int allow_missing_
{ {
if (words != 2) if (words != 2)
{ {
ctl_cmsg(CMSG_ERROR, VERB_NORMAL, printMessage(CMSG_ERROR, VERB_NORMAL,
"%s: line %d: Must specify exactly one patch name", "%s: line %d: Must specify exactly one patch name",
name, line); name, line);
CHECKERRLIMIT; CHECKERRLIMIT;
@ -1450,7 +1450,7 @@ int Instruments::read_config_file(const char *name, int self, int allow_missing_
if (words < 2) if (words < 2)
{ {
ctl_cmsg(CMSG_ERROR, VERB_NORMAL, printMessage(CMSG_ERROR, VERB_NORMAL,
"%s: line %d: No drum set number given", name, line); "%s: line %d: No drum set number given", name, line);
CHECKERRLIMIT; CHECKERRLIMIT;
continue; continue;
@ -1459,7 +1459,7 @@ int Instruments::read_config_file(const char *name, int self, int allow_missing_
{ {
if ((newmapid = mapname2id(w[1], &isdrum)) == -1 || !isdrum) if ((newmapid = mapname2id(w[1], &isdrum)) == -1 || !isdrum)
{ {
ctl_cmsg(CMSG_ERROR, VERB_NORMAL, printMessage(CMSG_ERROR, VERB_NORMAL,
"%s: line %d: Invalid drum set map name: %s", name, line, w[1]); "%s: line %d: Invalid drum set map name: %s", name, line, w[1]);
CHECKERRLIMIT; CHECKERRLIMIT;
continue; continue;
@ -1472,7 +1472,7 @@ int Instruments::read_config_file(const char *name, int self, int allow_missing_
i = atoi(w[1]) - progbase; i = atoi(w[1]) - progbase;
if (i < 0 || i > 127) if (i < 0 || i > 127)
{ {
ctl_cmsg(CMSG_ERROR, VERB_NORMAL, printMessage(CMSG_ERROR, VERB_NORMAL,
"%s: line %d: Drum set must be between %d and %d", "%s: line %d: Drum set must be between %d and %d",
name, line, name, line,
progbase, progbase + 127); progbase, progbase + 127);
@ -1484,7 +1484,7 @@ int Instruments::read_config_file(const char *name, int self, int allow_missing_
i = alloc_instrument_map_bank(1, newmapid, i); i = alloc_instrument_map_bank(1, newmapid, i);
if (i == -1) if (i == -1)
{ {
ctl_cmsg(CMSG_ERROR, VERB_NORMAL, printMessage(CMSG_ERROR, VERB_NORMAL,
"%s: line %d: No free drum set available to map", "%s: line %d: No free drum set available to map",
name, line); name, line);
CHECKERRLIMIT; CHECKERRLIMIT;
@ -1503,7 +1503,7 @@ int Instruments::read_config_file(const char *name, int self, int allow_missing_
{ {
if (words < 4 || *w[2] < '0' || *w[2] > '9') if (words < 4 || *w[2] < '0' || *w[2] > '9')
{ {
ctl_cmsg(CMSG_ERROR, VERB_NORMAL, printMessage(CMSG_ERROR, VERB_NORMAL,
"%s: line %d: syntax error", name, line); "%s: line %d: syntax error", name, line);
CHECKERRLIMIT; CHECKERRLIMIT;
continue; continue;
@ -1522,7 +1522,7 @@ int Instruments::read_config_file(const char *name, int self, int allow_missing_
if (words < 2) if (words < 2)
{ {
ctl_cmsg(CMSG_ERROR, VERB_NORMAL, printMessage(CMSG_ERROR, VERB_NORMAL,
"%s: line %d: No bank number given", name, line); "%s: line %d: No bank number given", name, line);
CHECKERRLIMIT; CHECKERRLIMIT;
continue; continue;
@ -1531,7 +1531,7 @@ int Instruments::read_config_file(const char *name, int self, int allow_missing_
{ {
if ((newmapid = mapname2id(w[1], &isdrum)) == -1 || isdrum) if ((newmapid = mapname2id(w[1], &isdrum)) == -1 || isdrum)
{ {
ctl_cmsg(CMSG_ERROR, VERB_NORMAL, printMessage(CMSG_ERROR, VERB_NORMAL,
"%s: line %d: Invalid bank map name: %s", name, line, w[1]); "%s: line %d: Invalid bank map name: %s", name, line, w[1]);
CHECKERRLIMIT; CHECKERRLIMIT;
continue; continue;
@ -1544,7 +1544,7 @@ int Instruments::read_config_file(const char *name, int self, int allow_missing_
i = atoi(w[1]); i = atoi(w[1]);
if (i < 0 || i > 127) if (i < 0 || i > 127)
{ {
ctl_cmsg(CMSG_ERROR, VERB_NORMAL, printMessage(CMSG_ERROR, VERB_NORMAL,
"%s: line %d: Tone bank must be between 0 and 127", "%s: line %d: Tone bank must be between 0 and 127",
name, line); name, line);
CHECKERRLIMIT; CHECKERRLIMIT;
@ -1555,7 +1555,7 @@ int Instruments::read_config_file(const char *name, int self, int allow_missing_
i = alloc_instrument_map_bank(0, newmapid, i); i = alloc_instrument_map_bank(0, newmapid, i);
if (i == -1) if (i == -1)
{ {
ctl_cmsg(CMSG_ERROR, VERB_NORMAL, printMessage(CMSG_ERROR, VERB_NORMAL,
"%s: line %d: No free tone bank available to map", "%s: line %d: No free tone bank available to map",
name, line); name, line);
CHECKERRLIMIT; CHECKERRLIMIT;
@ -1574,7 +1574,7 @@ int Instruments::read_config_file(const char *name, int self, int allow_missing_
{ {
if (words < 4 || *w[2] < '0' || *w[2] > '9') if (words < 4 || *w[2] < '0' || *w[2] > '9')
{ {
ctl_cmsg(CMSG_ERROR, VERB_NORMAL, printMessage(CMSG_ERROR, VERB_NORMAL,
"%s: line %d: syntax error", name, line); "%s: line %d: syntax error", name, line);
CHECKERRLIMIT; CHECKERRLIMIT;
continue; continue;
@ -1592,7 +1592,7 @@ int Instruments::read_config_file(const char *name, int self, int allow_missing_
{ {
if (extension_flag) if (extension_flag)
continue; continue;
ctl_cmsg(CMSG_ERROR, VERB_NORMAL, printMessage(CMSG_ERROR, VERB_NORMAL,
"%s: line %d: syntax error", name, line); "%s: line %d: syntax error", name, line);
CHECKERRLIMIT; CHECKERRLIMIT;
continue; continue;

View file

@ -614,7 +614,7 @@ Instrument *Instruments::load_gus_instrument(char *name, ToneBank *bank, int dr,
&& tone->fcnum == 0 && tone->resonum == 0) && tone->fcnum == 0 && tone->resonum == 0)
if ((ip = search_instrument_cache(name, panning, amp, note_to_use, if ((ip = search_instrument_cache(name, panning, amp, note_to_use,
strip_loop, strip_envelope, strip_tail)) != NULL) { strip_loop, strip_envelope, strip_tail)) != NULL) {
ctl_cmsg(CMSG_INFO, VERB_DEBUG, " * Cached"); printMessage(CMSG_INFO, VERB_DEBUG, " * Cached");
return ip; return ip;
} }
/* Open patch file */ /* Open patch file */
@ -648,7 +648,7 @@ Instrument *Instruments::load_gus_instrument(char *name, ToneBank *bank, int dr,
} }
if (noluck) if (noluck)
{ {
ctl_cmsg(CMSG_INFO, VERB_DEBUG, "Instrument `%s' can't be found.", name); printMessage(CMSG_INFO, VERB_DEBUG, "Instrument `%s' can't be found.", name);
return 0; return 0;
} }
/* Read some headers and do cursory sanity checks. There are loads /* Read some headers and do cursory sanity checks. There are loads
@ -664,19 +664,19 @@ Instrument *Instruments::load_gus_instrument(char *name, ToneBank *bank, int dr,
|| (memcmp(tmp, "GF1PATCH110\0ID#000002", 22) || (memcmp(tmp, "GF1PATCH110\0ID#000002", 22)
&& memcmp(tmp, "GF1PATCH100\0ID#000002", 22))) { && memcmp(tmp, "GF1PATCH100\0ID#000002", 22))) {
/* don't know what the differences are */ /* don't know what the differences are */
ctl_cmsg(CMSG_ERROR, VERB_NORMAL, "%s: not an instrument", name); printMessage(CMSG_ERROR, VERB_NORMAL, "%s: not an instrument", name);
tf_close(tf); tf_close(tf);
return 0; return 0;
} }
/* instruments. To some patch makers, 0 means 1 */ /* instruments. To some patch makers, 0 means 1 */
if (tmp[82] != 1 && tmp[82] != 0) { if (tmp[82] != 1 && tmp[82] != 0) {
ctl_cmsg(CMSG_ERROR, VERB_NORMAL, printMessage(CMSG_ERROR, VERB_NORMAL,
"Can't handle patches with %d instruments", tmp[82]); "Can't handle patches with %d instruments", tmp[82]);
tf_close(tf); tf_close(tf);
return 0; return 0;
} }
if (tmp[151] != 1 && tmp[151] != 0) { /* layers. What's a layer? */ if (tmp[151] != 1 && tmp[151] != 0) { /* layers. What's a layer? */
ctl_cmsg(CMSG_ERROR, VERB_NORMAL, printMessage(CMSG_ERROR, VERB_NORMAL,
"Can't handle instruments with %d layers", tmp[151]); "Can't handle instruments with %d layers", tmp[151]);
tf_close(tf); tf_close(tf);
return 0; return 0;
@ -690,7 +690,7 @@ Instrument *Instruments::load_gus_instrument(char *name, ToneBank *bank, int dr,
skip(tf, 7); /* Skip the wave name */ skip(tf, 7); /* Skip the wave name */
if (tf_read(&fractions, 1, 1, tf) != 1) { if (tf_read(&fractions, 1, 1, tf) != 1) {
fail: fail:
ctl_cmsg(CMSG_ERROR, VERB_NORMAL, "Error reading sample %d", i); printMessage(CMSG_ERROR, VERB_NORMAL, "Error reading sample %d", i);
for (j = 0; j < i; j++) for (j = 0; j < i; j++)
free(ip->sample[j].data); free(ip->sample[j].data);
free(ip->sample); free(ip->sample);
@ -729,7 +729,7 @@ Instrument *Instruments::load_gus_instrument(char *name, ToneBank *bank, int dr,
READ_LONG(sp->root_freq); READ_LONG(sp->root_freq);
skip(tf, 2); /* Why have a "root frequency" and then "tuning"?? */ skip(tf, 2); /* Why have a "root frequency" and then "tuning"?? */
READ_CHAR(tmp[0]); READ_CHAR(tmp[0]);
ctl_cmsg(CMSG_INFO, VERB_DEBUG, "Rate/Low/Hi/Root = %d/%d/%d/%d", printMessage(CMSG_INFO, VERB_DEBUG, "Rate/Low/Hi/Root = %d/%d/%d/%d",
sp->sample_rate, sp->low_freq, sp->high_freq, sp->root_freq); sp->sample_rate, sp->low_freq, sp->high_freq, sp->root_freq);
if (panning == -1) if (panning == -1)
/* 0x07 and 0x08 are both center panning */ /* 0x07 and 0x08 are both center panning */
@ -742,13 +742,13 @@ Instrument *Instruments::load_gus_instrument(char *name, ToneBank *bank, int dr,
if (!tmp[13] || !tmp[14]) { if (!tmp[13] || !tmp[14]) {
sp->tremolo_sweep_increment = sp->tremolo_phase_increment = 0; sp->tremolo_sweep_increment = sp->tremolo_phase_increment = 0;
sp->tremolo_depth = 0; sp->tremolo_depth = 0;
ctl_cmsg(CMSG_INFO, VERB_DEBUG, " * no tremolo"); printMessage(CMSG_INFO, VERB_DEBUG, " * no tremolo");
} }
else { else {
sp->tremolo_sweep_increment = convert_tremolo_sweep(tmp[12]); sp->tremolo_sweep_increment = convert_tremolo_sweep(tmp[12]);
sp->tremolo_phase_increment = convert_tremolo_rate(tmp[13]); sp->tremolo_phase_increment = convert_tremolo_rate(tmp[13]);
sp->tremolo_depth = tmp[14]; sp->tremolo_depth = tmp[14];
ctl_cmsg(CMSG_INFO, VERB_DEBUG, printMessage(CMSG_INFO, VERB_DEBUG,
" * tremolo: sweep %d, phase %d, depth %d", " * tremolo: sweep %d, phase %d, depth %d",
sp->tremolo_sweep_increment, sp->tremolo_phase_increment, sp->tremolo_sweep_increment, sp->tremolo_phase_increment,
sp->tremolo_depth); sp->tremolo_depth);
@ -756,20 +756,20 @@ Instrument *Instruments::load_gus_instrument(char *name, ToneBank *bank, int dr,
if (!tmp[16] || !tmp[17]) { if (!tmp[16] || !tmp[17]) {
sp->vibrato_sweep_increment = sp->vibrato_control_ratio = 0; sp->vibrato_sweep_increment = sp->vibrato_control_ratio = 0;
sp->vibrato_depth = 0; sp->vibrato_depth = 0;
ctl_cmsg(CMSG_INFO, VERB_DEBUG, " * no vibrato"); printMessage(CMSG_INFO, VERB_DEBUG, " * no vibrato");
} }
else { else {
sp->vibrato_control_ratio = convert_vibrato_rate(tmp[16]); sp->vibrato_control_ratio = convert_vibrato_rate(tmp[16]);
sp->vibrato_sweep_increment = convert_vibrato_sweep(tmp[15], sp->vibrato_sweep_increment = convert_vibrato_sweep(tmp[15],
sp->vibrato_control_ratio); sp->vibrato_control_ratio);
sp->vibrato_depth = tmp[17]; sp->vibrato_depth = tmp[17];
ctl_cmsg(CMSG_INFO, VERB_DEBUG, printMessage(CMSG_INFO, VERB_DEBUG,
" * vibrato: sweep %d, ctl %d, depth %d", " * vibrato: sweep %d, ctl %d, depth %d",
sp->vibrato_sweep_increment, sp->vibrato_control_ratio, sp->vibrato_sweep_increment, sp->vibrato_control_ratio,
sp->vibrato_depth); sp->vibrato_depth);
} }
READ_CHAR(sp->modes); READ_CHAR(sp->modes);
ctl_cmsg(CMSG_INFO, VERB_DEBUG, " * mode: 0x%02x", sp->modes); printMessage(CMSG_INFO, VERB_DEBUG, " * mode: 0x%02x", sp->modes);
READ_SHORT(sp->scale_freq); READ_SHORT(sp->scale_freq);
READ_SHORT(sp->scale_factor); READ_SHORT(sp->scale_factor);
skip(tf, 36); /* skip reserved space */ skip(tf, 36); /* skip reserved space */
@ -787,12 +787,12 @@ Instrument *Instruments::load_gus_instrument(char *name, ToneBank *bank, int dr,
| MODES_PINGPONG | MODES_REVERSE))) { | MODES_PINGPONG | MODES_REVERSE))) {
sp->modes &= ~(MODES_SUSTAIN | MODES_LOOPING sp->modes &= ~(MODES_SUSTAIN | MODES_LOOPING
| MODES_PINGPONG | MODES_REVERSE); | MODES_PINGPONG | MODES_REVERSE);
ctl_cmsg(CMSG_INFO, VERB_DEBUG, printMessage(CMSG_INFO, VERB_DEBUG,
" - Removing loop and/or sustain"); " - Removing loop and/or sustain");
} }
if (strip_envelope == 1) { if (strip_envelope == 1) {
if (sp->modes & MODES_ENVELOPE) if (sp->modes & MODES_ENVELOPE)
ctl_cmsg(CMSG_INFO, VERB_DEBUG, " - Removing envelope"); printMessage(CMSG_INFO, VERB_DEBUG, " - Removing envelope");
sp->modes &= ~MODES_ENVELOPE; sp->modes &= ~MODES_ENVELOPE;
} }
else if (strip_envelope != 0) { else if (strip_envelope != 0) {
@ -803,7 +803,7 @@ Instrument *Instruments::load_gus_instrument(char *name, ToneBank *bank, int dr,
* No envelope needed either... * No envelope needed either...
*/ */
sp->modes &= ~(MODES_SUSTAIN | MODES_ENVELOPE); sp->modes &= ~(MODES_SUSTAIN | MODES_ENVELOPE);
ctl_cmsg(CMSG_INFO, VERB_DEBUG, printMessage(CMSG_INFO, VERB_DEBUG,
" - No loop, removing sustain and envelope"); " - No loop, removing sustain and envelope");
} }
else if (!memcmp(tmp, "??????", 6) || tmp[11] >= 100) { else if (!memcmp(tmp, "??????", 6) || tmp[11] >= 100) {
@ -812,7 +812,7 @@ Instrument *Instruments::load_gus_instrument(char *name, ToneBank *bank, int dr,
* That's a weird envelope. Take it out. * That's a weird envelope. Take it out.
*/ */
sp->modes &= ~MODES_ENVELOPE; sp->modes &= ~MODES_ENVELOPE;
ctl_cmsg(CMSG_INFO, VERB_DEBUG, printMessage(CMSG_INFO, VERB_DEBUG,
" - Weirdness, removing envelope"); " - Weirdness, removing envelope");
} }
else if (!(sp->modes & MODES_SUSTAIN)) { else if (!(sp->modes & MODES_SUSTAIN)) {
@ -822,7 +822,7 @@ Instrument *Instruments::load_gus_instrument(char *name, ToneBank *bank, int dr,
* mostly drums. I think. * mostly drums. I think.
*/ */
sp->modes &= ~MODES_ENVELOPE; sp->modes &= ~MODES_ENVELOPE;
ctl_cmsg(CMSG_INFO, VERB_DEBUG, printMessage(CMSG_INFO, VERB_DEBUG,
" - No sustain, removing envelope"); " - No sustain, removing envelope");
} }
} }
@ -845,7 +845,7 @@ Instrument *Instruments::load_gus_instrument(char *name, ToneBank *bank, int dr,
sp->data = (sample_t *)safe_malloc(sp->data_length + 4); sp->data = (sample_t *)safe_malloc(sp->data_length + 4);
sp->data_alloced = 1; sp->data_alloced = 1;
if ((j = tf_read(sp->data, 1, sp->data_length, tf)) != (int)sp->data_length) { if ((j = tf_read(sp->data, 1, sp->data_length, tf)) != (int)sp->data_length) {
ctl_cmsg(CMSG_ERROR, VERB_NORMAL, "Too small this patch length: %d < %d", j, sp->data_length); printMessage(CMSG_ERROR, VERB_NORMAL, "Too small this patch length: %d < %d", j, sp->data_length);
goto fail; goto fail;
} }
if (!(sp->modes & MODES_16BIT)) { /* convert to 16-bit data */ if (!(sp->modes & MODES_16BIT)) { /* convert to 16-bit data */
@ -890,7 +890,7 @@ Instrument *Instruments::load_gus_instrument(char *name, ToneBank *bank, int dr,
sp->loop_end = sp->data_length - t; sp->loop_end = sp->data_length - t;
sp->modes &= ~MODES_REVERSE; sp->modes &= ~MODES_REVERSE;
sp->modes |= MODES_LOOPING; /* just in case */ sp->modes |= MODES_LOOPING; /* just in case */
ctl_cmsg(CMSG_WARNING, VERB_NORMAL, "Reverse loop in %s", name); printMessage(CMSG_WARNING, VERB_NORMAL, "Reverse loop in %s", name);
} }
/* If necessary do some anti-aliasing filtering */ /* If necessary do some anti-aliasing filtering */
if (antialiasing_allowed) if (antialiasing_allowed)
@ -910,7 +910,7 @@ Instrument *Instruments::load_gus_instrument(char *name, ToneBank *bank, int dr,
if ((a = abs(tmp[i])) > maxamp) if ((a = abs(tmp[i])) > maxamp)
maxamp = a; maxamp = a;
sp->volume = 32768 / (double)maxamp; sp->volume = 32768 / (double)maxamp;
ctl_cmsg(CMSG_INFO, VERB_DEBUG, printMessage(CMSG_INFO, VERB_DEBUG,
" * volume comp: %f", sp->volume); " * volume comp: %f", sp->volume);
} }
/* These are in bytes. Convert into samples. */ /* These are in bytes. Convert into samples. */
@ -959,7 +959,7 @@ Instrument *Instruments::load_gus_instrument(char *name, ToneBank *bank, int dr,
if (strip_tail == 1) { if (strip_tail == 1) {
/* Let's not really, just say we did. */ /* Let's not really, just say we did. */
sp->data_length = sp->loop_end; sp->data_length = sp->loop_end;
ctl_cmsg(CMSG_INFO, VERB_DEBUG, " - Stripping tail"); printMessage(CMSG_INFO, VERB_DEBUG, " - Stripping tail");
} }
} }
tf_close(tf); tf_close(tf);
@ -1104,7 +1104,7 @@ int Instruments::fill_bank(int dr, int b, int *rc)
if (bank->tone[i].instrument == NULL) if (bank->tone[i].instrument == NULL)
{ {
// This would be too annoying on 'warning' level. // This would be too annoying on 'warning' level.
ctl_cmsg(CMSG_WARNING, VERB_DEBUG, printMessage(CMSG_WARNING, VERB_DEBUG,
"No instrument mapped to %s %d, program %d%s", "No instrument mapped to %s %d, program %d%s",
dr ? "drum set" : "tone bank", dr ? "drum set" : "tone bank",
dr ? b + progbase : b, dr ? b + progbase : b,
@ -1144,7 +1144,7 @@ int Instruments::fill_bank(int dr, int b, int *rc)
bank->tone[i].instrument = load_instrument(dr, b, i); bank->tone[i].instrument = load_instrument(dr, b, i);
if (!bank->tone[i].instrument) if (!bank->tone[i].instrument)
{ {
ctl_cmsg(CMSG_ERROR, VERB_NORMAL, printMessage(CMSG_ERROR, VERB_NORMAL,
"Couldn't load instrument %s " "Couldn't load instrument %s "
"(%s %d, program %d)", bank->tone[i].name, "(%s %d, program %d)", bank->tone[i].name,
dr ? "drum set" : "tone bank", dr ? "drum set" : "tone bank",
@ -2014,7 +2014,7 @@ Instrument *Instruments::recompute_userdrum(int bank, int prog)
copy_tone_bank_element(&drumset[bank]->tone[prog], &drumset[0]->tone[source_note]); copy_tone_bank_element(&drumset[bank]->tone[prog], &drumset[0]->tone[source_note]);
} }
else { else {
ctl_cmsg(CMSG_WARNING, VERB_NORMAL, "Referring user drum set %d, note %d not found - this instrument will not be heard as expected", bank, prog); printMessage(CMSG_WARNING, VERB_NORMAL, "Referring user drum set %d, note %d not found - this instrument will not be heard as expected", bank, prog);
} }
} }
return ip; return ip;

File diff suppressed because it is too large Load diff

View file

@ -212,7 +212,7 @@ static int GetQuantityHints(uint16_t type, QuantityHint *units)
REGISTER_TYPE_INT("ms", VIBRATO_SWEEP_MS); REGISTER_TYPE_INT("ms", VIBRATO_SWEEP_MS);
END_QUANTITY_TYPE; END_QUANTITY_TYPE;
default: default:
ctl_cmsg(CMSG_ERROR, VERB_NORMAL, "Internal parameter error (%d)", type); printMessage(CMSG_ERROR, VERB_NORMAL, "Internal parameter error (%d)", type);
return 0; return 0;
} }
return 1; return 1;
@ -284,7 +284,7 @@ static int GetQuantityConvertProc(const Quantity *quantity, QuantityConvertProc
} }
unit++; unit++;
} }
ctl_cmsg(CMSG_ERROR, VERB_NORMAL, "Internal parameter error"); printMessage(CMSG_ERROR, VERB_NORMAL, "Internal parameter error");
return -1; return -1;
} }

View file

@ -49,7 +49,7 @@ static int set_xg_reverb_type(int msb, int lsb)
(msb >= 0x05 && msb <= 0x0F) || (msb >= 0x05 && msb <= 0x0F) ||
(msb >= 0x14)) /* NO EFFECT */ (msb >= 0x14)) /* NO EFFECT */
{ {
//ctl_cmsg(CMSG_INFO,VERB_NOISY,"XG Set Reverb Type (NO EFFECT %d %d)", msb, lsb); //printMessage(CMSG_INFO,VERB_NOISY,"XG Set Reverb Type (NO EFFECT %d %d)", msb, lsb);
return -1; return -1;
} }
@ -91,7 +91,7 @@ static int set_xg_reverb_type(int msb, int lsb)
if (lsb == 0x02 && msb == 0x02) if (lsb == 0x02 && msb == 0x02)
type = 2; /* Room 3 */ type = 2; /* Room 3 */
//ctl_cmsg(CMSG_INFO,VERB_NOISY,"XG Set Reverb Type (%d)", type); //printMessage(CMSG_INFO,VERB_NOISY,"XG Set Reverb Type (%d)", type);
return type; return type;
} }
@ -105,7 +105,7 @@ static int set_xg_chorus_type(int msb, int lsb)
(msb >= 0x45 && msb <= 0x47) || (msb >= 0x45 && msb <= 0x47) ||
(msb >= 0x49)) /* NO EFFECT */ (msb >= 0x49)) /* NO EFFECT */
{ {
//ctl_cmsg(CMSG_INFO,VERB_NOISY,"XG Set Chorus Type (NO EFFECT %d %d)", msb, lsb); //printMessage(CMSG_INFO,VERB_NOISY,"XG Set Chorus Type (NO EFFECT %d %d)", msb, lsb);
return -1; return -1;
} }
@ -167,7 +167,7 @@ static int set_xg_chorus_type(int msb, int lsb)
} }
} }
//ctl_cmsg(CMSG_INFO,VERB_NOISY,"XG Set Chorus Type (%d)", type); //printMessage(CMSG_INFO,VERB_NOISY,"XG Set Chorus Type (%d)", type);
return type; return type;
} }
@ -487,7 +487,7 @@ int SysexConvert::parse_sysex_event_multi(const uint8_t *val, int32_t len, MidiE
for (ent = addlow; body <= body_end; body++, ent++) { for (ent = addlow; body <= body_end; body++, ent++) {
switch (ent) { switch (ent) {
case 0x00: /* Element Reserve */ case 0x00: /* Element Reserve */
/* //ctl_cmsg(CMSG_INFO,VERB_NOISY,"Element Reserve is not supported. (CH:%d VAL:%d)", p, *body); */ /* //printMessage(CMSG_INFO,VERB_NOISY,"Element Reserve is not supported. (CH:%d VAL:%d)", p, *body); */
break; break;
case 0x01: /* bank select MSB */ case 0x01: /* bank select MSB */
@ -873,7 +873,7 @@ int SysexConvert::parse_sysex_event_multi(const uint8_t *val, int32_t len, MidiE
break; break;
case 0x59: /* AC1 Controller Number */ case 0x59: /* AC1 Controller Number */
//ctl_cmsg(CMSG_INFO,VERB_NOISY,"AC1 Controller Number is not supported. (CH:%d VAL:%d)", p, *body); //printMessage(CMSG_INFO,VERB_NOISY,"AC1 Controller Number is not supported. (CH:%d VAL:%d)", p, *body);
break; break;
case 0x5A: /* AC1 Pitch Control */ case 0x5A: /* AC1 Pitch Control */
@ -907,7 +907,7 @@ int SysexConvert::parse_sysex_event_multi(const uint8_t *val, int32_t len, MidiE
break; break;
case 0x60: /* AC2 Controller Number */ case 0x60: /* AC2 Controller Number */
//ctl_cmsg(CMSG_INFO,VERB_NOISY,"AC2 Controller Number is not supported. (CH:%d VAL:%d)", p, *body); //printMessage(CMSG_INFO,VERB_NOISY,"AC2 Controller Number is not supported. (CH:%d VAL:%d)", p, *body);
break; break;
case 0x61: /* AC2 Pitch Control */ case 0x61: /* AC2 Pitch Control */
@ -949,19 +949,19 @@ int SysexConvert::parse_sysex_event_multi(const uint8_t *val, int32_t len, MidiE
num_events++; num_events++;
case 0x69: /* Pitch EG Initial Level */ case 0x69: /* Pitch EG Initial Level */
//ctl_cmsg(CMSG_INFO,VERB_NOISY,"Pitch EG Initial Level is not supported. (CH:%d VAL:%d)", p, *body); //printMessage(CMSG_INFO,VERB_NOISY,"Pitch EG Initial Level is not supported. (CH:%d VAL:%d)", p, *body);
break; break;
case 0x6A: /* Pitch EG Attack Time */ case 0x6A: /* Pitch EG Attack Time */
//ctl_cmsg(CMSG_INFO,VERB_NOISY,"Pitch EG Attack Time is not supported. (CH:%d VAL:%d)", p, *body); //printMessage(CMSG_INFO,VERB_NOISY,"Pitch EG Attack Time is not supported. (CH:%d VAL:%d)", p, *body);
break; break;
case 0x6B: /* Pitch EG Release Level */ case 0x6B: /* Pitch EG Release Level */
//ctl_cmsg(CMSG_INFO,VERB_NOISY,"Pitch EG Release Level is not supported. (CH:%d VAL:%d)", p, *body); //printMessage(CMSG_INFO,VERB_NOISY,"Pitch EG Release Level is not supported. (CH:%d VAL:%d)", p, *body);
break; break;
case 0x6C: /* Pitch EG Release Time */ case 0x6C: /* Pitch EG Release Time */
//ctl_cmsg(CMSG_INFO,VERB_NOISY,"Pitch EG Release Time is not supported. (CH:%d VAL:%d)", p, *body); //printMessage(CMSG_INFO,VERB_NOISY,"Pitch EG Release Time is not supported. (CH:%d VAL:%d)", p, *body);
break; break;
case 0x6D: /* Velocity Limit Low */ case 0x6D: /* Velocity Limit Low */
@ -975,11 +975,11 @@ int SysexConvert::parse_sysex_event_multi(const uint8_t *val, int32_t len, MidiE
break; break;
case 0x70: /* Bend Pitch Low Control */ case 0x70: /* Bend Pitch Low Control */
//ctl_cmsg(CMSG_INFO,VERB_NOISY,"Bend Pitch Low Control is not supported. (CH:%d VAL:%d)", p, *body); //printMessage(CMSG_INFO,VERB_NOISY,"Bend Pitch Low Control is not supported. (CH:%d VAL:%d)", p, *body);
break; break;
case 0x71: /* Filter EG Depth */ case 0x71: /* Filter EG Depth */
//ctl_cmsg(CMSG_INFO,VERB_NOISY,"Filter EG Depth is not supported. (CH:%d VAL:%d)", p, *body); //printMessage(CMSG_INFO,VERB_NOISY,"Filter EG Depth is not supported. (CH:%d VAL:%d)", p, *body);
break; break;
case 0x72: /* EQ BASS */ case 0x72: /* EQ BASS */
@ -1011,7 +1011,7 @@ int SysexConvert::parse_sysex_event_multi(const uint8_t *val, int32_t len, MidiE
break; break;
default: default:
//ctl_cmsg(CMSG_INFO,VERB_NOISY,"Unsupported XG Bulk Dump SysEx. (ADDR:%02X %02X %02X VAL:%02X)", addhigh, addlow, ent, *body); //printMessage(CMSG_INFO,VERB_NOISY,"Unsupported XG Bulk Dump SysEx. (ADDR:%02X %02X %02X VAL:%02X)", addhigh, addlow, ent, *body);
continue; continue;
break; break;
} }
@ -1076,7 +1076,7 @@ int SysexConvert::parse_sysex_event_multi(const uint8_t *val, int32_t len, MidiE
num_events += 3; num_events += 3;
break; break;
case 0x03: /* Alternate Group */ case 0x03: /* Alternate Group */
//ctl_cmsg(CMSG_INFO,VERB_NOISY,"Alternate Group is not supported. (CH:%d NOTE:%d VAL:%d)", dp, note, *body); //printMessage(CMSG_INFO,VERB_NOISY,"Alternate Group is not supported. (CH:%d NOTE:%d VAL:%d)", dp, note, *body);
break; break;
case 0x04: /* Pan */ case 0x04: /* Pan */
SETMIDIEVENT(evm[num_events], 0, ME_NRPN_MSB, dp, 0x1C, SYSEX_TAG); SETMIDIEVENT(evm[num_events], 0, ME_NRPN_MSB, dp, 0x1C, SYSEX_TAG);
@ -1103,7 +1103,7 @@ int SysexConvert::parse_sysex_event_multi(const uint8_t *val, int32_t len, MidiE
num_events += 3; num_events += 3;
break; break;
case 0x08: /* Key Assign */ case 0x08: /* Key Assign */
//ctl_cmsg(CMSG_INFO,VERB_NOISY,"Key Assign is not supported. (CH:%d NOTE:%d VAL:%d)", dp, note, *body); //printMessage(CMSG_INFO,VERB_NOISY,"Key Assign is not supported. (CH:%d NOTE:%d VAL:%d)", dp, note, *body);
break; break;
case 0x09: /* Rcv Note Off */ case 0x09: /* Rcv Note Off */
SETMIDIEVENT(evm[num_events], 0, ME_SYSEX_MSB, dp, note, 0); SETMIDIEVENT(evm[num_events], 0, ME_SYSEX_MSB, dp, note, 0);
@ -1166,16 +1166,16 @@ int SysexConvert::parse_sysex_event_multi(const uint8_t *val, int32_t len, MidiE
num_events += 3; num_events += 3;
break; break;
case 0x50: /* High Pass Filter Cutoff Frequency */ case 0x50: /* High Pass Filter Cutoff Frequency */
//ctl_cmsg(CMSG_INFO,VERB_NOISY,"High Pass Filter Cutoff Frequency is not supported. (CH:%d NOTE:%d VAL:%d)", dp, note, *body); //printMessage(CMSG_INFO,VERB_NOISY,"High Pass Filter Cutoff Frequency is not supported. (CH:%d NOTE:%d VAL:%d)", dp, note, *body);
break; break;
case 0x60: /* Velocity Pitch Sense */ case 0x60: /* Velocity Pitch Sense */
//ctl_cmsg(CMSG_INFO,VERB_NOISY,"Velocity Pitch Sense is not supported. (CH:%d NOTE:%d VAL:%d)", dp, note, *body); //printMessage(CMSG_INFO,VERB_NOISY,"Velocity Pitch Sense is not supported. (CH:%d NOTE:%d VAL:%d)", dp, note, *body);
break; break;
case 0x61: /* Velocity LPF Cutoff Sense */ case 0x61: /* Velocity LPF Cutoff Sense */
//ctl_cmsg(CMSG_INFO,VERB_NOISY,"Velocity LPF Cutoff Sense is not supported. (CH:%d NOTE:%d VAL:%d)", dp, note, *body); //printMessage(CMSG_INFO,VERB_NOISY,"Velocity LPF Cutoff Sense is not supported. (CH:%d NOTE:%d VAL:%d)", dp, note, *body);
break; break;
default: default:
//ctl_cmsg(CMSG_INFO,VERB_NOISY,"Unsupported XG Bulk Dump SysEx. (ADDR:%02X %02X %02X VAL:%02X)", addhigh, addmid, ent, *body); //printMessage(CMSG_INFO,VERB_NOISY,"Unsupported XG Bulk Dump SysEx. (ADDR:%02X %02X %02X VAL:%02X)", addhigh, addmid, ent, *body);
break; break;
} }
} }
@ -1208,7 +1208,7 @@ int SysexConvert::parse_sysex_event_multi(const uint8_t *val, int32_t len, MidiE
checksum += val[i]; checksum += val[i];
} }
if (((128 - (checksum & 0x7F)) & 0x7F) != val[gslen - 1]) { if (((128 - (checksum & 0x7F)) & 0x7F) != val[gslen - 1]) {
//ctl_cmsg(CMSG_INFO,VERB_NOISY,"GS SysEx: Checksum Error."); //printMessage(CMSG_INFO,VERB_NOISY,"GS SysEx: Checksum Error.");
return num_events; return num_events;
} }
@ -1371,10 +1371,10 @@ int SysexConvert::parse_sysex_event_multi(const uint8_t *val, int32_t len, MidiE
num_events++; num_events++;
break; break;
case 0x1F: /* CC1 Controller Number */ case 0x1F: /* CC1 Controller Number */
//ctl_cmsg(CMSG_INFO,VERB_NOISY,"CC1 Controller Number is not supported. (CH:%d VAL:%d)", p, val[7]); //printMessage(CMSG_INFO,VERB_NOISY,"CC1 Controller Number is not supported. (CH:%d VAL:%d)", p, val[7]);
break; break;
case 0x20: /* CC2 Controller Number */ case 0x20: /* CC2 Controller Number */
//ctl_cmsg(CMSG_INFO,VERB_NOISY,"CC2 Controller Number is not supported. (CH:%d VAL:%d)", p, val[7]); //printMessage(CMSG_INFO,VERB_NOISY,"CC2 Controller Number is not supported. (CH:%d VAL:%d)", p, val[7]);
break; break;
case 0x21: /* Chorus Send Level */ case 0x21: /* Chorus Send Level */
SETMIDIEVENT(evm[0], 0, ME_CHORUS_EFFECT, p, val[7], SYSEX_TAG); SETMIDIEVENT(evm[0], 0, ME_CHORUS_EFFECT, p, val[7], SYSEX_TAG);
@ -1459,7 +1459,7 @@ int SysexConvert::parse_sysex_event_multi(const uint8_t *val, int32_t len, MidiE
num_events += 12; num_events += 12;
break; break;
default: default:
//ctl_cmsg(CMSG_INFO,VERB_NOISY,"Unsupported GS SysEx. (ADDR:%02X %02X %02X VAL:%02X %02X)", addr_h, addr_m, addr_l, val[7], val[8]); //printMessage(CMSG_INFO,VERB_NOISY,"Unsupported GS SysEx. (ADDR:%02X %02X %02X VAL:%02X %02X)", addr_h, addr_m, addr_l, val[7], val[8]);
break; break;
} }
} }
@ -1733,7 +1733,7 @@ int SysexConvert::parse_sysex_event_multi(const uint8_t *val, int32_t len, MidiE
num_events++; num_events++;
break; break;
default: default:
//ctl_cmsg(CMSG_INFO,VERB_NOISY,"Unsupported GS SysEx. (ADDR:%02X %02X %02X VAL:%02X %02X)", addr_h, addr_m, addr_l, val[7], val[8]); //printMessage(CMSG_INFO,VERB_NOISY,"Unsupported GS SysEx. (ADDR:%02X %02X %02X VAL:%02X %02X)", addr_h, addr_m, addr_l, val[7], val[8]);
break; break;
} }
} }
@ -1850,7 +1850,7 @@ int SysexConvert::parse_sysex_event_multi(const uint8_t *val, int32_t len, MidiE
num_events++; num_events++;
break; break;
default: default:
//ctl_cmsg(CMSG_INFO,VERB_NOISY,"Unsupported GS SysEx. (ADDR:%02X %02X %02X VAL:%02X %02X)", addr_h, addr_m, addr_l, val[7], val[8]); //printMessage(CMSG_INFO,VERB_NOISY,"Unsupported GS SysEx. (ADDR:%02X %02X %02X VAL:%02X %02X)", addr_h, addr_m, addr_l, val[7], val[8]);
break; break;
} }
} }
@ -1873,7 +1873,7 @@ int SysexConvert::parse_sysex_event_multi(const uint8_t *val, int32_t len, MidiE
num_events++; num_events++;
break; break;
default: default:
//ctl_cmsg(CMSG_INFO,VERB_NOISY,"Unsupported GS SysEx. (ADDR:%02X %02X %02X VAL:%02X %02X)", addr_h, addr_m, addr_l, val[7], val[8]); //printMessage(CMSG_INFO,VERB_NOISY,"Unsupported GS SysEx. (ADDR:%02X %02X %02X VAL:%02X %02X)", addr_h, addr_m, addr_l, val[7], val[8]);
break; break;
} }
} }
@ -1997,7 +1997,7 @@ int SysexConvert::parse_sysex_event_multi(const uint8_t *val, int32_t len, MidiE
num_events++; num_events++;
break; break;
default: default:
//ctl_cmsg(CMSG_INFO,VERB_NOISY,"Unsupported GS SysEx. (ADDR:%02X %02X %02X VAL:%02X %02X)", addr_h, addr_m, addr_l, val[7], val[8]); //printMessage(CMSG_INFO,VERB_NOISY,"Unsupported GS SysEx. (ADDR:%02X %02X %02X VAL:%02X %02X)", addr_h, addr_m, addr_l, val[7], val[8]);
break; break;
} }
} }
@ -2020,7 +2020,7 @@ int SysexConvert::parse_sysex_event_multi(const uint8_t *val, int32_t len, MidiE
num_events++; num_events++;
break; break;
default: default:
//ctl_cmsg(CMSG_INFO,VERB_NOISY,"Unsupported GS SysEx. (ADDR:%02X %02X %02X VAL:%02X %02X)", addr_h, addr_m, addr_l, val[7], val[8]); //printMessage(CMSG_INFO,VERB_NOISY,"Unsupported GS SysEx. (ADDR:%02X %02X %02X VAL:%02X %02X)", addr_h, addr_m, addr_l, val[7], val[8]);
break; break;
} }
} }
@ -2073,7 +2073,7 @@ int SysexConvert::parse_sysex_event_multi(const uint8_t *val, int32_t len, MidiE
num_events += 3; num_events += 3;
break; break;
default: default:
//ctl_cmsg(CMSG_INFO,VERB_NOISY,"Unsupported GS SysEx. (ADDR:%02X %02X %02X VAL:%02X %02X)", addr_h, addr_m, addr_l, val[7], val[8]); //printMessage(CMSG_INFO,VERB_NOISY,"Unsupported GS SysEx. (ADDR:%02X %02X %02X VAL:%02X %02X)", addr_h, addr_m, addr_l, val[7], val[8]);
break; break;
} }
break; break;
@ -2148,7 +2148,7 @@ int SysexConvert::parse_sysex_event_multi(const uint8_t *val, int32_t len, MidiE
break; break;
#endif #endif
default: default:
//ctl_cmsg(CMSG_INFO,VERB_NOISY,"Unsupported GS SysEx. (ADDR:%02X %02X %02X VAL:%02X %02X)", addr_h, addr_m, addr_l, val[7], val[8]); //printMessage(CMSG_INFO,VERB_NOISY,"Unsupported GS SysEx. (ADDR:%02X %02X %02X VAL:%02X %02X)", addr_h, addr_m, addr_l, val[7], val[8]);
break; break;
} }
break; break;
@ -2165,7 +2165,7 @@ int SysexConvert::parse_sysex_event_multi(const uint8_t *val, int32_t len, MidiE
num_events++; num_events++;
break; break;
default: default:
/* ctl_cmsg(CMSG_INFO,VERB_NOISY, "Unsupported GS SysEx. " /* printMessage(CMSG_INFO,VERB_NOISY, "Unsupported GS SysEx. "
"(ADDR:%02X %02X %02X VAL:%02X %02X)", "(ADDR:%02X %02X %02X VAL:%02X %02X)",
addr_h, addr_m, addr_l, val[7], val[8]);*/ addr_h, addr_m, addr_l, val[7], val[8]);*/
break; break;
@ -2639,15 +2639,15 @@ int SysexConvert::parse_sysex_event(const uint8_t *val, int32_t len, MidiEvent *
case 0x09: /* General MIDI Message */ case 0x09: /* General MIDI Message */
/* GM System Enable/Disable */ /* GM System Enable/Disable */
if (val[3] == 1) { if (val[3] == 1) {
ctl_cmsg(CMSG_INFO, VERB_DEBUG, "SysEx: GM System On"); printMessage(CMSG_INFO, VERB_DEBUG, "SysEx: GM System On");
SETMIDIEVENT(*ev, 0, ME_RESET, 0, GM_SYSTEM_MODE, 0); SETMIDIEVENT(*ev, 0, ME_RESET, 0, GM_SYSTEM_MODE, 0);
} }
else if (val[3] == 3) { else if (val[3] == 3) {
ctl_cmsg(CMSG_INFO, VERB_DEBUG, "SysEx: GM2 System On"); printMessage(CMSG_INFO, VERB_DEBUG, "SysEx: GM2 System On");
SETMIDIEVENT(*ev, 0, ME_RESET, 0, GM2_SYSTEM_MODE, 0); SETMIDIEVENT(*ev, 0, ME_RESET, 0, GM2_SYSTEM_MODE, 0);
} }
else { else {
ctl_cmsg(CMSG_INFO, VERB_DEBUG, "SysEx: GM System Off"); printMessage(CMSG_INFO, VERB_DEBUG, "SysEx: GM System Off");
SETMIDIEVENT(*ev, 0, ME_RESET, 0, DEFAULT_SYSTEM_MODE, 0); SETMIDIEVENT(*ev, 0, ME_RESET, 0, DEFAULT_SYSTEM_MODE, 0);
} }
return 1; return 1;

View file

@ -918,7 +918,7 @@ void pre_resample(Sample * sp)
if ((int64_t)sp->data_length * a >= 0x7fffffffL) if ((int64_t)sp->data_length * a >= 0x7fffffffL)
{ {
/* Too large to compute */ /* Too large to compute */
ctl_cmsg(CMSG_INFO, VERB_DEBUG, " *** Can't pre-resampling for note %d", printMessage(CMSG_INFO, VERB_DEBUG, " *** Can't pre-resampling for note %d",
sp->note_to_use); sp->note_to_use);
return; return;
} }
@ -929,7 +929,7 @@ void pre_resample(Sample * sp)
if ((double)newlen + incr >= 0x7fffffffL) if ((double)newlen + incr >= 0x7fffffffL)
{ {
/* Too large to compute */ /* Too large to compute */
ctl_cmsg(CMSG_INFO, VERB_DEBUG, " *** Can't pre-resampling for note %d", printMessage(CMSG_INFO, VERB_DEBUG, " *** Can't pre-resampling for note %d",
sp->note_to_use); sp->note_to_use);
return; return;
} }

View file

@ -2121,7 +2121,7 @@ void Reverb::alloc_effect(EffectList *ef)
ef->info = safe_malloc(ef->engine->info_size); ef->info = safe_malloc(ef->engine->info_size);
memset(ef->info, 0, ef->engine->info_size); memset(ef->info, 0, ef->engine->info_size);
/* //ctl_cmsg(CMSG_INFO,VERB_NOISY,"Effect Engine: %s", ef->engine->name); */ /* //printMessage(CMSG_INFO,VERB_NOISY,"Effect Engine: %s", ef->engine->name); */
} }
/*! allocate new effect item and add it into the tail of effect list. /*! allocate new effect item and add it into the tail of effect list.
@ -4154,7 +4154,7 @@ void Reverb::set_effect_param_xg(struct effect_xg_t *st, int type_msb, int type_
for (j = 0; j < 10; j++) { for (j = 0; j < 10; j++) {
st->param_msb[j] = effect_parameter_xg[i].param_msb[j]; st->param_msb[j] = effect_parameter_xg[i].param_msb[j];
} }
//ctl_cmsg(CMSG_INFO,VERB_NOISY,"XG EFX: %s", effect_parameter_xg[i].name); //printMessage(CMSG_INFO,VERB_NOISY,"XG EFX: %s", effect_parameter_xg[i].name);
return; return;
} }
} }
@ -4168,7 +4168,7 @@ void Reverb::set_effect_param_xg(struct effect_xg_t *st, int type_msb, int type_
for (j = 0; j < 10; j++) { for (j = 0; j < 10; j++) {
st->param_msb[j] = effect_parameter_xg[i].param_msb[j]; st->param_msb[j] = effect_parameter_xg[i].param_msb[j];
} }
//ctl_cmsg(CMSG_INFO,VERB_NOISY,"XG EFX: %s", effect_parameter_xg[i].name); //printMessage(CMSG_INFO,VERB_NOISY,"XG EFX: %s", effect_parameter_xg[i].name);
return; return;
} }
} }
@ -4347,7 +4347,7 @@ void Reverb::set_effect_param_gs(struct insertion_effect_gs_t *st, int msb, int
for (j = 0; j < 20; j++) { for (j = 0; j < 20; j++) {
st->parameter[j] = effect_parameter_gs[i].param[j]; st->parameter[j] = effect_parameter_gs[i].param[j];
} }
//ctl_cmsg(CMSG_INFO,VERB_NOISY,"GS EFX: %s", effect_parameter_gs[i].name); //printMessage(CMSG_INFO,VERB_NOISY,"GS EFX: %s", effect_parameter_gs[i].name);
break; break;
} }
} }

View file

@ -157,14 +157,14 @@ int Instruments::load_soundfont(SFInfo *sf, struct timidity_file *fd)
/* check RIFF file header */ /* check RIFF file header */
READCHUNK(&chunk, fd); READCHUNK(&chunk, fd);
if (chunkid(chunk.id) != RIFF_ID) { if (chunkid(chunk.id) != RIFF_ID) {
ctl_cmsg(CMSG_ERROR, VERB_NORMAL, printMessage(CMSG_ERROR, VERB_NORMAL,
"%s: *** not a RIFF file", fd->filename.c_str()); "%s: *** not a RIFF file", fd->filename.c_str());
return -1; return -1;
} }
/* check file id */ /* check file id */
READID(chunk.id, fd); READID(chunk.id, fd);
if (chunkid(chunk.id) != SFBK_ID) { if (chunkid(chunk.id) != SFBK_ID) {
ctl_cmsg(CMSG_ERROR, VERB_NORMAL, printMessage(CMSG_ERROR, VERB_NORMAL,
"%s: *** not a SoundFont file", fd->filename.c_str()); "%s: *** not a SoundFont file", fd->filename.c_str());
return -1; return -1;
} }
@ -177,7 +177,7 @@ int Instruments::load_soundfont(SFInfo *sf, struct timidity_file *fd)
break; break;
} }
else { else {
ctl_cmsg(CMSG_WARNING, VERB_NORMAL, "%s: *** illegal id in level 0: %4.4s %4d", fd->filename.c_str(), chunk.id, chunk.size); printMessage(CMSG_WARNING, VERB_NORMAL, "%s: *** illegal id in level 0: %4.4s %4d", fd->filename.c_str(), chunk.id, chunk.size);
FSKIP(chunk.size, fd); FSKIP(chunk.size, fd);
// Not aborting here will inevitably crash. // Not aborting here will inevitably crash.
return -1; return -1;
@ -278,7 +278,7 @@ int Instruments::process_list(int size, SFInfo *sf, struct timidity_file *fd)
/* read the following id string */ /* read the following id string */
READID(chunk.id, fd); size -= 4; READID(chunk.id, fd); size -= 4;
ctl_cmsg(CMSG_INFO, VERB_DEBUG, "%c%c%c%c:", printMessage(CMSG_INFO, VERB_DEBUG, "%c%c%c%c:",
chunk.id[0], chunk.id[1], chunk.id[2], chunk.id[3]); chunk.id[0], chunk.id[1], chunk.id[2], chunk.id[3]);
switch (chunkid(chunk.id)) { switch (chunkid(chunk.id)) {
case INFO_ID: case INFO_ID:
@ -288,7 +288,7 @@ int Instruments::process_list(int size, SFInfo *sf, struct timidity_file *fd)
case PDTA_ID: case PDTA_ID:
return process_pdta(size, sf, fd); return process_pdta(size, sf, fd);
default: default:
ctl_cmsg(CMSG_WARNING, VERB_NORMAL, "%s: *** illegal id in level 1: %4.4s", fd->filename.c_str(), chunk.id); printMessage(CMSG_WARNING, VERB_NORMAL, "%s: *** illegal id in level 1: %4.4s", fd->filename.c_str(), chunk.id);
FSKIP(size, fd); /* skip it */ FSKIP(size, fd); /* skip it */
return 0; return 0;
} }
@ -313,14 +313,14 @@ int Instruments::process_info(int size, SFInfo *sf, struct timidity_file *fd)
return -1; return -1;
size -= 8; size -= 8;
ctl_cmsg(CMSG_INFO, VERB_DEBUG, " %c%c%c%c:", printMessage(CMSG_INFO, VERB_DEBUG, " %c%c%c%c:",
chunk.id[0], chunk.id[1], chunk.id[2], chunk.id[3]); chunk.id[0], chunk.id[1], chunk.id[2], chunk.id[3]);
switch (chunkid(chunk.id)) { switch (chunkid(chunk.id)) {
case IFIL_ID: case IFIL_ID:
/* soundfont file version */ /* soundfont file version */
READW(&sf->version, fd); READW(&sf->version, fd);
READW(&sf->minorversion, fd); READW(&sf->minorversion, fd);
ctl_cmsg(CMSG_INFO, VERB_DEBUG, printMessage(CMSG_INFO, VERB_DEBUG,
" version %d, minor %d", " version %d, minor %d",
sf->version, sf->minorversion); sf->version, sf->minorversion);
break; break;
@ -329,7 +329,7 @@ int Instruments::process_info(int size, SFInfo *sf, struct timidity_file *fd)
sf->sf_name = (char*)safe_malloc(chunk.size + 1); sf->sf_name = (char*)safe_malloc(chunk.size + 1);
tf_read(sf->sf_name, 1, chunk.size, fd); tf_read(sf->sf_name, 1, chunk.size, fd);
sf->sf_name[chunk.size] = 0; sf->sf_name[chunk.size] = 0;
ctl_cmsg(CMSG_INFO, VERB_DEBUG, printMessage(CMSG_INFO, VERB_DEBUG,
" name %s", sf->sf_name); " name %s", sf->sf_name);
break; break;
@ -357,7 +357,7 @@ int Instruments::process_sdta(int size, SFInfo *sf, struct timidity_file *fd)
return -1; return -1;
size -= 8; size -= 8;
ctl_cmsg(CMSG_INFO, VERB_DEBUG, " %c%c%c%c:", printMessage(CMSG_INFO, VERB_DEBUG, " %c%c%c%c:",
chunk.id[0], chunk.id[1], chunk.id[2], chunk.id[3]); chunk.id[0], chunk.id[1], chunk.id[2], chunk.id[3]);
switch (chunkid(chunk.id)) { switch (chunkid(chunk.id)) {
case SNAM_ID: case SNAM_ID:
@ -394,7 +394,7 @@ int Instruments::process_pdta(int size, SFInfo *sf, struct timidity_file *fd)
return -1; return -1;
size -= 8; size -= 8;
ctl_cmsg(CMSG_INFO, VERB_DEBUG, " %c%c%c%c:", printMessage(CMSG_INFO, VERB_DEBUG, " %c%c%c%c:",
chunk.id[0], chunk.id[1], chunk.id[2], chunk.id[3]); chunk.id[0], chunk.id[1], chunk.id[2], chunk.id[3]);
switch (chunkid(chunk.id)) { switch (chunkid(chunk.id)) {
case PHDR_ID: case PHDR_ID:
@ -438,7 +438,7 @@ void Instruments::load_sample_names(int size, SFInfo *sf, struct timidity_file *
{ {
int i, nsamples; int i, nsamples;
if (sf->version > 1) { if (sf->version > 1) {
ctl_cmsg(CMSG_WARNING, VERB_NORMAL, "%s: *** version 2 has obsolete format??",fd->filename.c_str()); printMessage(CMSG_WARNING, VERB_NORMAL, "%s: *** version 2 has obsolete format??",fd->filename.c_str());
FSKIP(size, fd); FSKIP(size, fd);
return; return;
} }
@ -450,7 +450,7 @@ void Instruments::load_sample_names(int size, SFInfo *sf, struct timidity_file *
sf->sample = NEW(SFSampleInfo, sf->nsamples); sf->sample = NEW(SFSampleInfo, sf->nsamples);
} }
else if (sf->nsamples != nsamples) { else if (sf->nsamples != nsamples) {
ctl_cmsg(CMSG_WARNING, VERB_NORMAL, "%s: *** different # of samples ?? (%d : %d)\n",fd->filename.c_str(), sf->nsamples, nsamples); printMessage(CMSG_WARNING, VERB_NORMAL, "%s: *** different # of samples ?? (%d : %d)\n",fd->filename.c_str(), sf->nsamples, nsamples);
FSKIP(size, fd); FSKIP(size, fd);
return; return;
} }
@ -504,7 +504,7 @@ void Instruments::load_inst_header(int size, SFInfo *sf, struct timidity_file *f
sf->inst[i].hdr.nlayers = 0; sf->inst[i].hdr.nlayers = 0;
sf->inst[i].hdr.layer = NULL; sf->inst[i].hdr.layer = NULL;
ctl_cmsg(CMSG_INFO, VERB_DEBUG, printMessage(CMSG_INFO, VERB_DEBUG,
" InstHdr %d (%s) bagNdx=%d", " InstHdr %d (%s) bagNdx=%d",
i, sf->inst[i].hdr.name, sf->inst[i].hdr.bagNdx); i, sf->inst[i].hdr.name, sf->inst[i].hdr.bagNdx);
} }
@ -617,7 +617,7 @@ void Instruments::convert_layers(SFInfo *sf)
if (prbags.bag == NULL || prbags.gen == NULL || if (prbags.bag == NULL || prbags.gen == NULL ||
inbags.bag == NULL || inbags.gen == NULL) { inbags.bag == NULL || inbags.gen == NULL) {
ctl_cmsg(CMSG_WARNING, VERB_NORMAL, "%s: *** illegal bags / gens", sf->sf_name); printMessage(CMSG_WARNING, VERB_NORMAL, "%s: *** illegal bags / gens", sf->sf_name);
return; return;
} }
@ -645,7 +645,7 @@ void Instruments::generate_layers(SFHeader *hdr, SFHeader *next, SFBags *bags)
hdr->nlayers = next->bagNdx - hdr->bagNdx; hdr->nlayers = next->bagNdx - hdr->bagNdx;
if (hdr->nlayers < 0) { if (hdr->nlayers < 0) {
ctl_cmsg(CMSG_WARNING, VERB_NORMAL, "%s: illegal layer numbers %d", "", hdr->nlayers); printMessage(CMSG_WARNING, VERB_NORMAL, "%s: illegal layer numbers %d", "", hdr->nlayers);
return; return;
} }
if (hdr->nlayers == 0) if (hdr->nlayers == 0)
@ -656,7 +656,7 @@ void Instruments::generate_layers(SFHeader *hdr, SFHeader *next, SFBags *bags)
int genNdx = bags->bag[i]; int genNdx = bags->bag[i];
layp->nlists = bags->bag[i + 1] - genNdx; layp->nlists = bags->bag[i + 1] - genNdx;
if (layp->nlists < 0) { if (layp->nlists < 0) {
ctl_cmsg(CMSG_WARNING, VERB_NORMAL, "%s: illegal list numbers %d", "", layp->nlists); printMessage(CMSG_WARNING, VERB_NORMAL, "%s: illegal list numbers %d", "", layp->nlists);
return; return;
} }
layp->list = (SFGenRec*)safe_malloc(sizeof(SFGenRec) * layp->nlists); layp->list = (SFGenRec*)safe_malloc(sizeof(SFGenRec) * layp->nlists);

View file

@ -317,7 +317,7 @@ int Instruments::import_wave_load(char *sample_file, Instrument *inst)
tf_close(tf); tf_close(tf);
return 1; return 1;
} }
//ctl_cmsg(CMSG_INFO,VERB_NOISY,"Loading WAV: %s", sample_file); //printMessage(CMSG_INFO,VERB_NOISY,"Loading WAV: %s", sample_file);
state = chunk_flags = 0; state = chunk_flags = 0;
type_index = 4, type_size = 8; type_index = 4, type_size = 8;
for(;;) { for(;;) {
@ -349,7 +349,7 @@ int Instruments::import_wave_load(char *sample_file, Instrument *inst)
frames = chunk_size / format.wBlockAlign; frames = chunk_size / format.wBlockAlign;
inst->samples = samples = format.wChannels; inst->samples = samples = format.wChannels;
inst->sample = (Sample *)safe_malloc(sizeof(Sample) * samples); inst->sample = (Sample *)safe_malloc(sizeof(Sample) * samples);
//ctl_cmsg(CMSG_INFO,VERB_NOISY,"Format: %d-bits %dHz %dch, %d frames", format.wBitsPerSample, format.dwSamplesPerSec, samples, frames); //printMessage(CMSG_INFO,VERB_NOISY,"Format: %d-bits %dHz %dch, %d frames", format.wBitsPerSample, format.dwSamplesPerSec, samples, frames);
initialize_sample(inst, frames, format.wBitsPerSample, format.dwSamplesPerSec); initialize_sample(inst, frames, format.wBitsPerSample, format.dwSamplesPerSec);
/* load waveform data */ /* load waveform data */
for(i = 0; i < samples; i++) for(i = 0; i < samples; i++)
@ -439,7 +439,7 @@ static int read_WAVFormatChunk(struct timidity_file *tf, WAVFormatChunk *fmt, in
goto fail; goto fail;
return 1; return 1;
fail: fail:
ctl_cmsg(CMSG_WARNING, VERB_VERBOSE, "Unable to read format chunk"); printMessage(CMSG_WARNING, VERB_VERBOSE, "Unable to read format chunk");
return 0; return 0;
} }
@ -485,13 +485,13 @@ static int read_WAVSamplerChunk(struct timidity_file *tf, WAVSamplerChunk *smpl,
} }
} }
if (psize != cbSamplerData) if (psize != cbSamplerData)
ctl_cmsg(CMSG_WARNING, VERB_NOISY, "Bad sampler chunk length"); printMessage(CMSG_WARNING, VERB_NOISY, "Bad sampler chunk length");
if (tf_seek(tf, psize, SEEK_CUR) == -1) if (tf_seek(tf, psize, SEEK_CUR) == -1)
goto fail; goto fail;
//ctl_cmsg(CMSG_INFO,VERB_NOISY,"Sampler: %dns/frame, note=%d, loops=%d", smpl->dwSamplePeriod, smpl->dwMIDIUnityNote, loopCount); //printMessage(CMSG_INFO,VERB_NOISY,"Sampler: %dns/frame, note=%d, loops=%d", smpl->dwSamplePeriod, smpl->dwMIDIUnityNote, loopCount);
return 1; return 1;
fail: fail:
ctl_cmsg(CMSG_WARNING, VERB_VERBOSE, "Unable to read sampler chunk"); printMessage(CMSG_WARNING, VERB_VERBOSE, "Unable to read sampler chunk");
return 0; return 0;
} }
@ -508,12 +508,12 @@ static int read_WAVInstrumentChunk(struct timidity_file *tf, GeneralInstrumentIn
READ_CHAR(inst->highNote); READ_CHAR(inst->highNote);
READ_CHAR(inst->lowVelocity); READ_CHAR(inst->lowVelocity);
READ_CHAR(inst->highVelocity); READ_CHAR(inst->highVelocity);
ctl_cmsg(CMSG_INFO, VERB_VERBOSE, "Instrument: note=%d (%d-%d), gain=%ddb, velocity=%d-%d", printMessage(CMSG_INFO, VERB_VERBOSE, "Instrument: note=%d (%d-%d), gain=%ddb, velocity=%d-%d",
inst->baseNote, inst->lowNote, inst->highNote, inst->gain, inst->baseNote, inst->lowNote, inst->highNote, inst->gain,
inst->lowVelocity, inst->highVelocity); inst->lowVelocity, inst->highVelocity);
return 1; return 1;
fail: fail:
ctl_cmsg(CMSG_WARNING, VERB_VERBOSE, "Unable to read instrument chunk"); printMessage(CMSG_WARNING, VERB_VERBOSE, "Unable to read instrument chunk");
return 0; return 0;
} }
@ -601,7 +601,7 @@ int Instruments::import_aiff_load(char *sample_file, Instrument *inst)
return 1; return 1;
} }
compressed = buf[8 + 3] == 'C'; compressed = buf[8 + 3] == 'C';
//ctl_cmsg(CMSG_INFO,VERB_NOISY,"Loading AIFF: %s", sample_file); //printMessage(CMSG_INFO,VERB_NOISY,"Loading AIFF: %s", sample_file);
type_index = 4, type_size = 8; type_index = 4, type_size = 8;
chunk_flags = 0; chunk_flags = 0;
sound.inst = inst; sound.inst = inst;
@ -748,7 +748,7 @@ int Instruments::import_aiff_load(char *sample_file, Instrument *inst)
goto fail; goto fail;
comm->sampleRate = ConvertFromIeeeExtended(sampleRate); comm->sampleRate = ConvertFromIeeeExtended(sampleRate);
csize -= 8 + 10; csize -= 8 + 10;
//ctl_cmsg(CMSG_INFO,VERB_NOISY,"Format: %d-bits %dHz %dch, %d frames", comm->sampleSize, (int)comm->sampleRate, comm->numChannels, comm->numSampleFrames); //printMessage(CMSG_INFO,VERB_NOISY,"Format: %d-bits %dHz %dch, %d frames", comm->sampleSize, (int)comm->sampleRate, comm->numChannels, comm->numSampleFrames);
if (compressed) if (compressed)
{ {
READ_LONG_BE(compressionType); READ_LONG_BE(compressionType);
@ -761,7 +761,7 @@ int Instruments::import_aiff_load(char *sample_file, Instrument *inst)
if (tf_read(compressionName, compressionNameLength, 1, tf) != 1) if (tf_read(compressionName, compressionNameLength, 1, tf) != 1)
goto fail; goto fail;
compressionName[compressionNameLength] = '\0'; compressionName[compressionNameLength] = '\0';
ctl_cmsg(CMSG_WARNING, VERB_VERBOSE, "AIFF-C unknown compression type: %s", compressionName); printMessage(CMSG_WARNING, VERB_VERBOSE, "AIFF-C unknown compression type: %s", compressionName);
goto fail; goto fail;
} }
csize -= 4; csize -= 4;
@ -771,7 +771,7 @@ int Instruments::import_aiff_load(char *sample_file, Instrument *inst)
goto fail; goto fail;
return 1; return 1;
fail: fail:
ctl_cmsg(CMSG_WARNING, VERB_VERBOSE, "Unable to read common chunk"); printMessage(CMSG_WARNING, VERB_VERBOSE, "Unable to read common chunk");
return 0; return 0;
} }
@ -805,7 +805,7 @@ int Instruments::read_AIFFSoundDataChunk(struct timidity_file *tf, AIFFSoundData
return read_AIFFSoundData(tf, sound->inst, sound->common); return read_AIFFSoundData(tf, sound->inst, sound->common);
} }
fail: fail:
ctl_cmsg(CMSG_WARNING, VERB_VERBOSE, "Unable to read sound data chunk"); printMessage(CMSG_WARNING, VERB_VERBOSE, "Unable to read sound data chunk");
return 0; return 0;
} }
@ -830,7 +830,7 @@ int Instruments::read_AIFFSoundData(struct timidity_file *tf, Instrument *inst,
goto fail; goto fail;
return 1; return 1;
fail: fail:
ctl_cmsg(CMSG_WARNING, VERB_VERBOSE, "Unable to read sound data"); printMessage(CMSG_WARNING, VERB_VERBOSE, "Unable to read sound data");
return 0; return 0;
} }
@ -841,7 +841,7 @@ static int read_AIFFInstumentChunk(struct timidity_file *tf, GeneralInstrumentIn
if (csize != 20) if (csize != 20)
{ {
ctl_cmsg(CMSG_WARNING, VERB_VERBOSE, "Bad instrument chunk length"); printMessage(CMSG_WARNING, VERB_VERBOSE, "Bad instrument chunk length");
if (tf_seek(tf, csize, SEEK_CUR) == -1) if (tf_seek(tf, csize, SEEK_CUR) == -1)
goto fail; goto fail;
return 1; return 1;
@ -858,12 +858,12 @@ static int read_AIFFInstumentChunk(struct timidity_file *tf, GeneralInstrumentIn
READ_SHORT_BE(loop->endID); READ_SHORT_BE(loop->endID);
if (tf_seek(tf, 2 + 2 + 2, SEEK_CUR) == -1) /* release loop */ if (tf_seek(tf, 2 + 2 + 2, SEEK_CUR) == -1) /* release loop */
goto fail; goto fail;
ctl_cmsg(CMSG_INFO, VERB_VERBOSE, "Instrument: note=%d (%d-%d), gain=%ddb, velocity=%d-%d", printMessage(CMSG_INFO, VERB_VERBOSE, "Instrument: note=%d (%d-%d), gain=%ddb, velocity=%d-%d",
inst->baseNote, inst->lowNote, inst->highNote, inst->gain, inst->baseNote, inst->lowNote, inst->highNote, inst->gain,
inst->lowVelocity, inst->highVelocity); inst->lowVelocity, inst->highVelocity);
return 1; return 1;
fail: fail:
ctl_cmsg(CMSG_WARNING, VERB_VERBOSE, "Unable to read instrument chunk"); printMessage(CMSG_WARNING, VERB_VERBOSE, "Unable to read instrument chunk");
return 0; return 0;
} }
@ -879,7 +879,7 @@ static int read_AIFFMarkerChunk(struct timidity_file *tf, AIFFMarkerData **marke
READ_SHORT_BE(markerCount) READ_SHORT_BE(markerCount)
if (csize != 2 + markerCount * (2 + 4)) if (csize != 2 + markerCount * (2 + 4))
{ {
ctl_cmsg(CMSG_WARNING, VERB_VERBOSE, "Bad marker chunk length"); printMessage(CMSG_WARNING, VERB_VERBOSE, "Bad marker chunk length");
if (tf_seek(tf, csize, SEEK_CUR) == -1) if (tf_seek(tf, csize, SEEK_CUR) == -1)
goto fail; goto fail;
return 1; return 1;
@ -899,7 +899,7 @@ static int read_AIFFMarkerChunk(struct timidity_file *tf, AIFFMarkerData **marke
fail: fail:
if (m != NULL) if (m != NULL)
free(m); free(m);
ctl_cmsg(CMSG_WARNING, VERB_VERBOSE, "Unable to read marker chunk"); printMessage(CMSG_WARNING, VERB_VERBOSE, "Unable to read marker chunk");
return 0; return 0;
} }
@ -1020,7 +1020,7 @@ static int read_sample_data(int32_t flags, struct timidity_file *tf, int bits, i
} }
return 1; return 1;
fail: fail:
ctl_cmsg(CMSG_WARNING, VERB_VERBOSE, "Unable to read sample data"); printMessage(CMSG_WARNING, VERB_VERBOSE, "Unable to read sample data");
return 0; return 0;
} }

View file

@ -261,7 +261,7 @@ void Instruments::init_sf(SFInsts *rec)
int i; int i;
if ((rec->tf = open_file(rec->fname, sfreader)) == NULL) { if ((rec->tf = open_file(rec->fname, sfreader)) == NULL) {
ctl_cmsg(CMSG_ERROR, VERB_NORMAL, printMessage(CMSG_ERROR, VERB_NORMAL,
"Can't open soundfont file %s", rec->fname); "Can't open soundfont file %s", rec->fname);
end_soundfont(rec); end_soundfont(rec);
return; return;
@ -359,7 +359,7 @@ Instrument *Instruments::try_load_soundfont(SFInsts *rec, int order, int bank,in
return NULL; return NULL;
if ((rec->tf = open_file(rec->fname, sfreader)) == NULL) if ((rec->tf = open_file(rec->fname, sfreader)) == NULL)
{ {
ctl_cmsg(CMSG_ERROR, VERB_NORMAL, printMessage(CMSG_ERROR, VERB_NORMAL,
"Can't open soundfont file %s", rec->fname); "Can't open soundfont file %s", rec->fname);
end_soundfont(rec); end_soundfont(rec);
return NULL; return NULL;
@ -924,7 +924,7 @@ int Instruments::make_patch(SFInfo *sf, int pridx, LayerTable *tbl)
if(sample->sampletype & SF_SAMPLETYPE_ROM) /* is ROM sample? */ if(sample->sampletype & SF_SAMPLETYPE_ROM) /* is ROM sample? */
{ {
ctl_cmsg(CMSG_INFO, VERB_DEBUG, "preset %d is ROM sample: 0x%x", printMessage(CMSG_INFO, VERB_DEBUG, "preset %d is ROM sample: 0x%x",
pridx, sample->sampletype); pridx, sample->sampletype);
return AWE_RET_SKIP; return AWE_RET_SKIP;
} }
@ -1209,7 +1209,7 @@ void Instruments::set_init_info(SFInfo *sf, SampleList *vp, LayerTable *tbl)
if(tbl->set[SF_keynum]) if(tbl->set[SF_keynum])
vp->v.note_to_use = (int)tbl->val[SF_keynum]; vp->v.note_to_use = (int)tbl->val[SF_keynum];
if(tbl->set[SF_velocity] && (int)tbl->val[SF_velocity] != 0) { if(tbl->set[SF_velocity] && (int)tbl->val[SF_velocity] != 0) {
ctl_cmsg(CMSG_INFO,VERB_DEBUG,"error: fixed-velocity is not supported."); printMessage(CMSG_INFO,VERB_DEBUG,"error: fixed-velocity is not supported.");
} }
vp->v.sample_type = sample->sampletype; vp->v.sample_type = sample->sampletype;
@ -1263,7 +1263,7 @@ void Instruments::set_init_info(SFInfo *sf, SampleList *vp, LayerTable *tbl)
} else if(sample->sampletype == SF_SAMPLETYPE_LEFT) { /* leftSample = 4 */ } else if(sample->sampletype == SF_SAMPLETYPE_LEFT) { /* leftSample = 4 */
vp->v.panning = 0; vp->v.panning = 0;
} else if(sample->sampletype == SF_SAMPLETYPE_LINKED) { /* linkedSample = 8 */ } else if(sample->sampletype == SF_SAMPLETYPE_LINKED) { /* linkedSample = 8 */
ctl_cmsg(CMSG_ERROR,VERB_NOISY,"error: linkedSample is not supported."); printMessage(CMSG_ERROR,VERB_NOISY,"error: linkedSample is not supported.");
} }
memset(vp->v.envelope_keyf, 0, sizeof(vp->v.envelope_keyf)); memset(vp->v.envelope_keyf, 0, sizeof(vp->v.envelope_keyf));

View file

@ -52,7 +52,7 @@ inline bool RC_IS_SKIP_FILE(int rc)
} }
extern void (*ctl_cmsg)(int type, int verbosity_level, const char* fmt, ...); extern void (*printMessage)(int type, int verbosity_level, const char* fmt, ...);
} }

View file

@ -135,6 +135,8 @@ private:
struct _mdi *Init_MDI(); struct _mdi *Init_MDI();
unsigned long int get_inc(struct _mdi *mdi, struct _note *nte); unsigned long int get_inc(struct _mdi *mdi, struct _note *nte);
}; };
extern void (*wm_error_func)(const char *wmfmt, va_list args);
} }
#endif /* WILDMIDI_LIB_H */ #endif /* WILDMIDI_LIB_H */

View file

@ -231,7 +231,7 @@ TimidityMIDIDevice::TimidityMIDIDevice(const char *args, int samplerate)
: SoftSynthMIDIDevice(samplerate, 11025, 65535) : SoftSynthMIDIDevice(samplerate, 11025, 65535)
{ {
LoadConfig(args); LoadConfig(args);
Timidity::cmsg = gzdoom_ctl_cmsg; Timidity::printMessage = gzdoom_ctl_cmsg;
Renderer = new Timidity::Renderer((float)SampleRate, midi_voices, instruments); Renderer = new Timidity::Renderer((float)SampleRate, midi_voices, instruments);
} }

View file

@ -274,7 +274,7 @@ TimidityPPMIDIDevice::TimidityPPMIDIDevice(const char *args, int samplerate)
delete instruments; delete instruments;
instruments = nullptr; instruments = nullptr;
} }
TimidityPlus::ctl_cmsg = gzdoom_ctl_cmsg; TimidityPlus::printMessage = gzdoom_ctl_cmsg;
TimidityPlus::set_playback_rate(SampleRate); TimidityPlus::set_playback_rate(SampleRate);
if (instruments == nullptr) if (instruments == nullptr)

View file

@ -38,6 +38,9 @@
#include "doomerrors.h" #include "doomerrors.h"
#include "i_soundfont.h" #include "i_soundfont.h"
#include "c_console.h"
#include "v_text.h"
// MACROS ------------------------------------------------------------------ // MACROS ------------------------------------------------------------------
// TYPES ------------------------------------------------------------------- // TYPES -------------------------------------------------------------------
@ -111,6 +114,12 @@ void WildMidi_Shutdown()
// CODE -------------------------------------------------------------------- // CODE --------------------------------------------------------------------
static void gzdoom_error_func(const char* wmfmt, va_list args)
{
Printf(TEXTCOLOR_RED);
VPrintf(PRINT_HIGH, wmfmt, args);
}
//========================================================================== //==========================================================================
// //
// WildMIDIDevice Constructor // WildMIDIDevice Constructor
@ -121,6 +130,7 @@ WildMIDIDevice::WildMIDIDevice(const char *args, int samplerate)
:SoftSynthMIDIDevice(samplerate <= 0? wildmidi_frequency : samplerate, 11025, 65535) :SoftSynthMIDIDevice(samplerate <= 0? wildmidi_frequency : samplerate, 11025, 65535)
{ {
Renderer = NULL; Renderer = NULL;
WildMidi::wm_error_func = gzdoom_error_func;
if (args == NULL || *args == 0) args = wildmidi_config; if (args == NULL || *args == 0) args = wildmidi_config;