-
-
Notifications
You must be signed in to change notification settings - Fork 1k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Update two NotePlayHandle methods to ignore child NotePlayHandles #2603
Conversation
The methods NotePlayHandle::index and NotePlayHandle::nphsOfInstrumentTrack had not yet been brought up-to-date with the new system of attaching child NotePlayHandles directly to the mixer. This caused strange glitches when arpeggio was used in sort mode.
This fixes #2589 for me. Testing welcome! |
This fixes the issue when I try it with one note but not more than one. It also fixes an issue I've had with stuck notes on a pull request I just postponed to 1.3 ... but not for single stream instruments... ( #2130 ( that PR isn't up to date however ) ). |
@zonkmachine Thanks for testing! Can you elaborate on how it doesn't fix the issue with more than one note? How does it behave, and how do you expect it to behave? What steps do you take to get unexpected behavior? |
Easiest to show. I expect this short track to repeat in the exact same way. It skips notes randomly in the second part. |
Confirmed, and it doesn't do that in 1.1.3. Hm, I foresee more bug hunting in my future 😁 |
@zonkmachine Well, how do you know? If I cherry-pick* this pull request onto a821187 (the commit you found bisecting #2589), the second part doesn't skip any notes! Can you confirm that? If yes, it means that some change after a821187 messed things up again. In that case, would you feel like doing another bisect run? *: Resolving the conflict with |
Just want to make sure we're on the same code here. I'm getting compile errors with a821187 and it's basic stuff like:
|
The exact commands I used to get a skip-free a821187:
Note that this will only work if you have Fastigium@eec7f63 locally. If you don't, you should be able to fetch it using |
No go over here...
I tested arpeggiator-sort-fix and it's still on my git. I can
I went stone age and even made a diff that wouldn't apply either. |
It's woodoo. Now it's working and Edit: Sorry, that fix didn't work. |
@Fastigium No, sorry. I can no longer confirm this. If there was a fix in there it's not clearly repeatable. |
@zonkmachine Thanks so much for trying! Let me look into what you've been doing...
That's actually expected behavior you're getting there. That's what the
Well, you got me there. It skips notes here at a821187 with my commit applied, too. Just very seldom, so I thought at first that it didn't skip them at all. Hm. This needs more investigation. Do the missing notes get added to the mixer at all? I'll see if I can get some investigation time in today. Thanks again! |
Check, I found the culprit. And this LB302 note skipping was there in 1.1.3 as well! The problem is caused by this code in InstrumentPlayHandle.h. It was added after the mixer was made multi-threaded because it could no longer be guaranteed that all of an instrument's NotePlayHandles would be played before its InstrumentPlayHandle. Note that only a few instruments (including LB302) use this dual construction of both NotePlayHandles and an InstrumentPlayHandle. At any rate, what goes wrong is that some NotePlayHandles are processed twice simultaneously in different threads, causing all kinds of mayhem with their current frame counters. Frankly I'm much surprised at how usable LB302 still is with this bug going on. Which is probably the reason that it has survived this long 😋. However, fixing this isn't a trivial matter. I managed to quick-fix it by preventing InstrumentPlayHandle::play() from processing the NotePlayHandles and just letting it busy-wait until they're all done, but that's a waste of time and CPU cycles. To solve this correctly, either (1) the mixer should implement some kind of dependency system to prevent a PlayHandle from being processed until certain specific other PlayHandles have been processed, or (2) a ThreadableJob should be able to cancel its processing and be put back in the job pool to be tried again later. Option (1) sounds like a lot of work and extra business logic just to solve what is almost an edge case, since only a few instruments need this, but (2) sounds like a dirty hack. Almost as dirty as making InstrumentPlayHandle::play() busy-wait 😁. So, what to do... This seems complicated enough to me to get its own issue. Besides, the regression reported in #2589 is already fixed by this pull request; the problem we're dealing with now is there in |
Oh, by the way, should you want to test the busy-wait fix, just comment out this line: https://github.com/LMMS/lmms/blob/master/include/InstrumentPlayHandle.h#L65 |
👍 |
#2565 ?
👍 |
Update two NotePlayHandle methods to ignore child NotePlayHandles Fixes #2589
The methods NotePlayHandle::index and NotePlayHandle::nphsOfInstrumentTrack
had not yet been brought up-to-date with the new system of attaching child
NotePlayHandles directly to the mixer. This caused strange glitches when
arpeggio was used in sort mode.