Midi playback recreates midi events when song ends for no reason
Reported version
3.6
Type
Performance
Frequency
Once
Severity
S4 - Minor
Reproducibility
Always
Status
active
Regression
No
Workaround
No
Project
When a song finishes playing, it "seeks" back to the start. The first time you play the song it also clears all the midi events and recreates them for no reason. The second, third, ... times the song is played the events are not recreated (which is correct). So something strange is happening the first time through.
Recreating all the midi events is a very expensive operation.
To reproduce this, create a song with just a few notes and push the "play" button. Put a breakpoint in rendermidi.cpp in playNote(). You should see the note events get created before the song is played and immediately after it finishes playing (the first time). The second, third... times the song is played it uses the existing midi event list as it should.
Comments
Where and when is that becoming a problem?
In reply to Where and when is that… by Jojo-Schmitz
It's a performance thing. Every time you play a score the program does all this unnecessary work - potentially hundreds (even thousands) of memory allocations/deletions for no reason. The code that is supposed to stop this is working for every playback except the first, so the fix is probably really simple.
So a potential performance increase.
I don't see any CPU load peaks though on start playback, and not when it reaches the end of score either
I don't see any CPU load peaks though on start playback (a just small one on loading a score), and none at all when it reaches the end of score.