Lmms: Stuck VST notes with high CPU load

Created on 14 Feb 2019  路  6Comments  路  Source: LMMS/lmms

When the CPU usage is too high, notes are skipped to save processing time. This results in the NotePlayHandle's destructor being called in the same buffer as its constructor. The constructor sends a note-on event with the offset set to the offset of the note within the buffer, but the destructor sends a note-off with zero offset. The note-off now comes before the note-on chronologically, so the note gets stuck on. This may also affect some external MIDI devices.

bug vst

Most helpful comment

Looks like it was introduced in https://github.com/LMMS/lmms/commit/5e4308507bee7130e24671b4e9d16515978e8375, where the note-on code was moved from NotePlayHandle::play into NotePlayHandle::NotePlayHandle. The commit message is "more fixes", but I can't figure out what this was meant to fix. This causes the issue as we now send the note-on message even if the play handle gets thrown out due to high CPU usage. I'm going to move that code back to NotePlayHandle::play; if it turns out to cause problems, we can take it from there.

@DomClark Ooo.. Are you saying that a fix actually are going to make general VST-usage, a problem on old/ low-end HW? :[

Unfortunately in this case, yes it will. However, rather than reverting the fix, it's better just to fix this new bug, which occasionally happened previously anyway.

Milestoning for 1.2.0 as it's not out yet and I'm now working on this.

All 6 comments

Interesting find! -What VSTs did this occour with?

( Afair, I have never had a hanging note because of high-cpu. The hangs has been happening, when i pressed a key, and then moved a VSTs controller. Then some VSTs would create a hang-note, and only pressing that note on the LMMS-keyboard, would turn it off, but that was not during high cpu usage, so not related i guess. )

@domclark Is this related to my issue we fixed last time on Discord ? When even the smallest CPU spikes caused notes to be stuck and the only way to kill them was to "PANNIC" all the blocked vst's ?

Will the fix be included in RC8 ?

Interesting find! -What VSTs did this occour with?

T-Force Alpha Plus was one in particular (especially since it uses a lot of CPU). However, since 3a94ed3f3fecbd23227401212d112b4cff773d31, it will affect all VSTs as that commit sorts the MIDI events before they reach the plugin.

Is this related to my issue we fixed last time on Discord ?

Indeed, it's the same issue. I figured we ought to have it recorded on GitHub.

Will the fix be included in RC8 ?

No guarantees here; it seems like rc8 is going to be released pretty soon, but it would be nice if it could get fixed before 1.2. I'm not adding it to the milestone since we need to stop putting things there and start releasing (in my opinion anyway, somebody else can stick it there if they want), but there's only one other unaddressed thing there assigned to me so I'll take this on afterwards if there's time.

Yes, I should have reported it on GitHub when we talked about it !
Ok, anyways you helped me to fix it and I will be able to apply that fix myself for RC8, but maybe some other people with old computers are experiencing the same issue so it would be a good thing to fix it like in 1.2.1

However, since 3a94ed3, it will affect all VSTs as that commit sorts the MIDI events before they reach the plugin.

@DomClark Ooo.. Are you saying that a fix actually are going to make general VST-usage, a problem on old/ low-end HW? :[

Looks like it was introduced in https://github.com/LMMS/lmms/commit/5e4308507bee7130e24671b4e9d16515978e8375, where the note-on code was moved from NotePlayHandle::play into NotePlayHandle::NotePlayHandle. The commit message is "more fixes", but I can't figure out what this was meant to fix. This causes the issue as we now send the note-on message even if the play handle gets thrown out due to high CPU usage. I'm going to move that code back to NotePlayHandle::play; if it turns out to cause problems, we can take it from there.

@DomClark Ooo.. Are you saying that a fix actually are going to make general VST-usage, a problem on old/ low-end HW? :[

Unfortunately in this case, yes it will. However, rather than reverting the fix, it's better just to fix this new bug, which occasionally happened previously anyway.

Milestoning for 1.2.0 as it's not out yet and I'm now working on this.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

FigyTuna picture FigyTuna  路  3Comments

binyominzeev picture binyominzeev  路  3Comments

Gabrielxd195 picture Gabrielxd195  路  3Comments

Sawuare picture Sawuare  路  3Comments

PaulBatchelor picture PaulBatchelor  路  4Comments