diff --git a/src/sound/mididevices/music_timiditypp_mididevice.cpp b/src/sound/mididevices/music_timiditypp_mididevice.cpp index 8cefb24882..6d775e2dda 100644 --- a/src/sound/mididevices/music_timiditypp_mididevice.cpp +++ b/src/sound/mididevices/music_timiditypp_mididevice.cpp @@ -193,7 +193,7 @@ void TimidityPPMIDIDevice::PrecacheInstruments(const uint16_t *instrumentlist, i void TimidityPPMIDIDevice::HandleEvent(int status, int parm1, int parm2) { if (Renderer != nullptr) - Renderer->send_event(sampletime, status, parm1, parm2); + Renderer->send_event(status, parm1, parm2); } //========================================================================== @@ -205,7 +205,7 @@ void TimidityPPMIDIDevice::HandleEvent(int status, int parm1, int parm2) void TimidityPPMIDIDevice::HandleLongEvent(const uint8_t *data, int len) { if (Renderer != nullptr) - Renderer->send_long_event(sampletime, data, len); + Renderer->send_long_event(data, len); } //========================================================================== @@ -218,7 +218,6 @@ void TimidityPPMIDIDevice::ComputeOutput(float *buffer, int len) { if (Renderer != nullptr) Renderer->compute_data(buffer, len); - sampletime += len; } //========================================================================== diff --git a/src/sound/timiditypp/instrum.cpp b/src/sound/timiditypp/instrum.cpp index ca9a08fbe7..45072bb99a 100644 --- a/src/sound/timiditypp/instrum.cpp +++ b/src/sound/timiditypp/instrum.cpp @@ -639,9 +639,9 @@ Instrument *Instruments::load_gus_instrument(char *name, ToneBank *bank, int dr, } } } - if (noluck) { - ctl_cmsg(CMSG_ERROR, VERB_NORMAL, - "Instrument `%s' can't be found.", name); + if (noluck) + { + ctl_cmsg(CMSG_ERROR, VERB_DEBUG, "Instrument `%s' can't be found.", name); return 0; } /* Read some headers and do cursory sanity checks. There are loads diff --git a/src/sound/timiditypp/playmidi.cpp b/src/sound/timiditypp/playmidi.cpp index fe03b6a613..db8972059a 100644 --- a/src/sound/timiditypp/playmidi.cpp +++ b/src/sound/timiditypp/playmidi.cpp @@ -1312,9 +1312,7 @@ 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); + 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; @@ -1327,10 +1325,7 @@ int Player::find_samples(MidiEvent *e, int *vlist) instruments->instrument_map(channel[ch].mapID, &bank, ¬e); if (! (ip = play_midi_load_instrument(1, bank, note))) return 0; /* No instrument? Then we can't play. */ - /* if (ip->type == INST_GUS && ip->samples != 1) - ctl_cmsg(CMSG_WARNING, VERB_VERBOSE, - "Strange: percussion instrument with %d samples!", - ip->samples); */ + /* "keynum" of SF2, and patch option "note=" */ if (ip->sample->note_to_use) note = ip->sample->note_to_use; @@ -5022,6 +5017,7 @@ int Player::compute_data(float *buffer, int32_t count) if (count == 0) return RC_OK; buffer_pointer = common_buffer; + computed_samples += count; while (count > 0) { @@ -5517,7 +5513,7 @@ int Player::play_event(MidiEvent *ev) break; case ME_SCALE_TUNING: - recache->resamp_cache_refer_alloff(ch, current_event->time); + recache->resamp_cache_refer_alloff(ch, computed_samples); channel[ch].scale_tuning[current_event->a] = current_event->b; adjust_pitch(ch); break; @@ -6078,11 +6074,10 @@ int Player::convert_midi_control_change(int chn, int type, int val, MidiEvent *e } -int Player::send_event(int sampletime, int status, int parm1, int parm2) +int Player::send_event(int status, int parm1, int parm2) { MidiEvent ev; - ev.time = sampletime; ev.type = ME_NONE; ev.channel = status & 0x0000000f; //ev.channel = ev.channel + port * 16; @@ -6130,7 +6125,7 @@ int Player::send_event(int sampletime, int status, int parm1, int parm2) return 0; } -void Player::send_long_event(int sampletime, const uint8_t *sysexbuffer, int exlen) +void Player::send_long_event(const uint8_t *sysexbuffer, int exlen) { int i, ne; MidiEvent ev; diff --git a/src/sound/timiditypp/playmidi.h b/src/sound/timiditypp/playmidi.h index 8964f89eb7..9c400cfb6b 100644 --- a/src/sound/timiditypp/playmidi.h +++ b/src/sound/timiditypp/playmidi.h @@ -31,7 +31,6 @@ struct AlternateAssign; struct MidiEvent { - int32_t time; uint8_t type, channel, a, b; }; @@ -539,6 +538,7 @@ private: int32_t sample_count; /* Length of event_list */ int32_t current_sample; /* Number of calclated samples */ double midi_time_ratio; /* For speed up/down */ + int computed_samples; int note_key_offset = 0; /* For key up/down */ ChannelBitMask channel_mute; /* For channel mute */ @@ -585,11 +585,6 @@ private: return (ISDRUMCHANNEL((ep)->channel) ? (ep)->a : (((int)(ep)->a + note_key_offset + channel[ep->channel].key_shift) & 0x7f)); } - int32_t MIDI_EVENT_TIME(MidiEvent *ep) - { - return ((int32_t)((ep)->time * midi_time_ratio + 0.5)); - } - int16_t conv_lfo_pitch_depth(float val) { return (int16_t)(0.0318f * val * val + 0.6858f * val + 0.5f); @@ -733,8 +728,8 @@ public: int get_default_mapID(int ch); void init_channel_layer(int ch); int compute_data(float *buffer, int32_t count); - int send_event(int time, int status, int parm1, int parm2); - void send_long_event(int sampletime, const uint8_t *sysexbuffer, int exlen); + int send_event(int status, int parm1, int parm2); + void send_long_event(const uint8_t *sysexbuffer, int exlen); }; class SysexConvert diff --git a/src/sound/timiditypp/readmidic.cpp b/src/sound/timiditypp/readmidic.cpp index 88fa730277..14e07a8bdc 100644 --- a/src/sound/timiditypp/readmidic.cpp +++ b/src/sound/timiditypp/readmidic.cpp @@ -31,9 +31,8 @@ namespace TimidityPlus { -inline void SETMIDIEVENT(MidiEvent &e, int32_t at, uint32_t t, uint32_t ch, uint32_t pa, uint32_t pb) +inline void SETMIDIEVENT(MidiEvent &e, int32_t /*time, not needed anymore*/, uint32_t t, uint32_t ch, uint32_t pa, uint32_t pb) { - (e).time = (at); (e).type = (t); (e).channel = (uint8_t)(ch); (e).a = (uint8_t)(pa); diff --git a/src/sound/timiditypp/recache.cpp b/src/sound/timiditypp/recache.cpp index c8893d6b90..dcb15ca383 100644 --- a/src/sound/timiditypp/recache.cpp +++ b/src/sound/timiditypp/recache.cpp @@ -206,7 +206,6 @@ void Recache::resamp_cache_create(void) cache_hash_table[i] = q; } if (n == 0) { - ctl_cmsg(CMSG_INFO, VERB_VERBOSE, "No pre-resampling cache hit"); return; } array = (struct cache_hash **) new_segment(&hash_entry_pool,