Skip to content

Commit 262145d

Browse files
Re-add note_off_fast, gain ~2% MIDI boost
1 parent 41b96ef commit 262145d

File tree

3 files changed

+7
-10
lines changed

3 files changed

+7
-10
lines changed

lib/TinySoundFont

Submodule TinySoundFont updated 1 file

src/AudioGeneratorMIDI.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -440,7 +440,7 @@ int AudioGeneratorMIDI::PlayMIDI() {
440440
for (tgnum = 0; tgnum < num_tonegens; ++tgnum) { /* find which generator is playing it */
441441
tg = &tonegen[tgnum];
442442
if (tg->playing && tg->track == tracknum && tg->note == trk->note) {
443-
tsf_note_off/*_fast*/(g_tsf, tg->instrument, tg->note);//, tg->playIndex);
443+
tsf_note_off_fast(g_tsf, tg->instrument, tg->note, tg->playIndex);
444444
tg->playing = false;
445445
tg->playIndex = -1;
446446
trk->tonegens[tgnum] = false;

src/libtinysoundfont/tsf.h

Lines changed: 5 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -2052,11 +2052,11 @@ TSFDEF int tsf_note_on(tsf* f, int preset_index, int key, float vel)
20522052
tsf_voice_lfo_setup(&voice->modlfo, region->delayModLFO, region->freqModLFO, f->outSampleRate);
20532053
tsf_voice_lfo_setup(&voice->viblfo, region->delayVibLFO, region->freqVibLFO, f->outSampleRate);
20542054
}
2055-
//#ifndef TSF_SAMPLES_SHORT
2055+
#ifndef TSF_SAMPLES_SHORT
20562056
return 1;
2057-
//#else
2058-
// return voicePlayIndex + 1;
2059-
//#endif
2057+
#else
2058+
return voicePlayIndex + 1;
2059+
#endif
20602060
}
20612061

20622062
TSFDEF int tsf_bank_note_on(tsf* f, int bank, int preset_number, int key, float vel)
@@ -2086,12 +2086,10 @@ TSFDEF void tsf_note_off(tsf* f, int preset_index, int key)
20862086
}
20872087
}
20882088

2089-
#if 0
2090-
// Less than 0.5% speed difference seen w/fast
20912089
/**
20922090
* Stops all voices with the given playing index. If no key provided or if -1, fallbacks to tsf_note_off
20932091
*/
2094-
TSFDEF void tsf_note_off_fast(tsf* f, int preset_index, int key, int playIndex = -1)
2092+
TSFDEF void tsf_note_off_fast(tsf* f, int preset_index, int key, int playIndex)
20952093
{
20962094
if (playIndex < 0) {
20972095
tsf_note_off(f, preset_index, key);
@@ -2104,7 +2102,6 @@ TSFDEF void tsf_note_off_fast(tsf* f, int preset_index, int key, int playIndex =
21042102
}
21052103
}
21062104
}
2107-
#endif
21082105

21092106
TSFDEF int tsf_bank_note_off(tsf* f, int bank, int preset_number, int key)
21102107
{

0 commit comments

Comments
 (0)