- there's no need to drag the event time around, this really was just an artifact of Timidity's original implementation which is no longer in use.

- plugged a few memory leaks.
This commit is contained in:
Christoph Oelckers 2018-02-21 21:11:31 +01:00
parent af705d1c59
commit 5219916de5
6 changed files with 14 additions and 24 deletions

View file

@ -243,6 +243,7 @@ MIDIDevice *CreateTimidityPPMIDIDevice(const char *args)
void TimidityPP_Shutdown()
{
TimidityPPMIDIDevice::ClearInstruments();
TimidityPlus::free_gauss_table();
TimidityPlus::free_global_mblock();
}

View file

@ -281,6 +281,7 @@ void close_file(struct timidity_file *tf)
if (tf->url != NULL)
{
tf->url->Close();
delete tf->url;
}
delete tf;
}

View file

@ -641,7 +641,7 @@ Instrument *Instruments::load_gus_instrument(char *name, ToneBank *bank, int dr,
}
if (noluck)
{
ctl_cmsg(CMSG_ERROR, VERB_DEBUG, "Instrument `%s' can't be found.", name);
ctl_cmsg(CMSG_INFO, VERB_DEBUG, "Instrument `%s' can't be found.", name);
return 0;
}
/* Read some headers and do cursory sanity checks. There are loads
@ -1099,8 +1099,8 @@ int Instruments::fill_bank(int dr, int b, int *rc)
bank->tone[i].instrument = load_instrument(dr, b, i);
if (bank->tone[i].instrument == NULL)
{
ctl_cmsg(CMSG_WARNING,
(b != 0) ? VERB_VERBOSE : VERB_NORMAL,
// This would be too annoying on 'warning' level.
ctl_cmsg(CMSG_WARNING, VERB_DEBUG,
"No instrument mapped to %s %d, program %d%s",
dr ? "drum set" : "tone bank",
dr ? b + progbase : b,

View file

@ -1312,7 +1312,6 @@ int Player::find_samples(MidiEvent *e, int *vlist)
ch = e->channel;
if (channel[ch].special_sample > 0) {
if ((s = instruments->specialPatch(channel[ch].special_sample)) == NULL) {
ctl_cmsg(CMSG_WARNING, VERB_VERBOSE,"Strange: Special patch %d is not installed",channel[ch].special_sample);
return 0;
}
note = e->a + channel[ch].key_shift + note_key_offset;

View file

@ -743,6 +743,8 @@ public:
int parse_sysex_event(const uint8_t *val, int32_t len, MidiEvent *ev, Instruments *instruments);
};
void free_gauss_table(void);
}

View file

@ -177,9 +177,7 @@ int Instruments::load_soundfont(SFInfo *sf, struct timidity_file *fd)
break;
}
else {
ctl_cmsg(CMSG_WARNING, VERB_NORMAL,
"%s: *** illegal id in level 0: %4.4s %4d",
fd->filename.c_str(), chunk.id, chunk.size);
ctl_cmsg(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);
}
}
@ -290,9 +288,7 @@ int Instruments::process_list(int size, SFInfo *sf, struct timidity_file *fd)
case PDTA_ID:
return process_pdta(size, sf, fd);
default:
ctl_cmsg(CMSG_WARNING, VERB_NORMAL,
"%s: *** illegal id in level 1: %4.4s",
fd->filename.c_str(), chunk.id);
ctl_cmsg(CMSG_WARNING, VERB_NORMAL, "%s: *** illegal id in level 1: %4.4s", fd->filename.c_str(), chunk.id);
FSKIP(size, fd); /* skip it */
return 0;
}
@ -441,9 +437,7 @@ void Instruments::load_sample_names(int size, SFInfo *sf, struct timidity_file *
{
int i, nsamples;
if (sf->version > 1) {
ctl_cmsg(CMSG_WARNING, VERB_NORMAL,
"%s: *** version 2 has obsolete format??",
fd->filename.c_str());
ctl_cmsg(CMSG_WARNING, VERB_NORMAL, "%s: *** version 2 has obsolete format??",fd->filename.c_str());
FSKIP(size, fd);
return;
}
@ -455,9 +449,7 @@ void Instruments::load_sample_names(int size, SFInfo *sf, struct timidity_file *
sf->sample = NEW(SFSampleInfo, sf->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);
ctl_cmsg(CMSG_WARNING, VERB_NORMAL, "%s: *** different # of samples ?? (%d : %d)\n",fd->filename.c_str(), sf->nsamples, nsamples);
FSKIP(size, fd);
return;
}
@ -624,8 +616,7 @@ void Instruments::convert_layers(SFInfo *sf)
if (prbags.bag == NULL || prbags.gen == NULL ||
inbags.bag == NULL || inbags.gen == NULL) {
ctl_cmsg(CMSG_WARNING, VERB_NORMAL,
"%s: *** illegal bags / gens", sf->sf_name);
ctl_cmsg(CMSG_WARNING, VERB_NORMAL, "%s: *** illegal bags / gens", sf->sf_name);
return;
}
@ -653,9 +644,7 @@ void Instruments::generate_layers(SFHeader *hdr, SFHeader *next, SFBags *bags)
hdr->nlayers = next->bagNdx - hdr->bagNdx;
if (hdr->nlayers < 0) {
ctl_cmsg(CMSG_WARNING, VERB_NORMAL,
"%s: illegal layer numbers %d",
"", hdr->nlayers);
ctl_cmsg(CMSG_WARNING, VERB_NORMAL, "%s: illegal layer numbers %d", "", hdr->nlayers);
return;
}
if (hdr->nlayers == 0)
@ -666,9 +655,7 @@ void Instruments::generate_layers(SFHeader *hdr, SFHeader *next, SFBags *bags)
int genNdx = bags->bag[i];
layp->nlists = bags->bag[i + 1] - genNdx;
if (layp->nlists < 0) {
ctl_cmsg(CMSG_WARNING, VERB_NORMAL,
"%s: illegal list numbers %d",
"", layp->nlists);
ctl_cmsg(CMSG_WARNING, VERB_NORMAL, "%s: illegal list numbers %d", "", layp->nlists);
return;
}
layp->list = (SFGenRec*)safe_malloc(sizeof(SFGenRec) * layp->nlists);