LMMS / lmms

Cross-platform music production software
https://lmms.io
GNU General Public License v2.0
8.01k stars 997 forks source link

Add splitting to all types of clips #7477

Open regulus79 opened 4 weeks ago

regulus79 commented 4 weeks ago

Makes the knife tool work for all types of clips, not just SampleClips.

Changes

Most of the code is copied from SampleClipView.cpp's splitClip() function, and then modified for each clip type.

Notes

Rossmaxx commented 4 weeks ago

@szeli1 mind reviewing this?

szeli1 commented 4 weeks ago

@szeli1 mind reviewing this?

I will review this soon

messmerd commented 3 weeks ago

Here are some things I noticed while testing it:

Unrelated bug: In the Piano Roll, the mouse icon when in Pitch Bend mode can disappear if you click on a note, then close the note's automation editor window.

Other than the issues above, everything seems to work fine. I'm pretty excited about this feature and hope we can get it merged soon.

regulus79 commented 3 weeks ago

I think I have fixed most of the bugs, however I don't understand how journalling works enough to fix the bug where the new clips don't disappear after undoing. I will continue to look into it, but I may need some help.

Also, I decided to remove the restriction on midi clips needing to be split on the bar, and instead implemented your suggestion on letting the left clip's length be longer and extend behind the right clip. So now they can be split at arbitrary positions!

regulus79 commented 3 weeks ago

Ah, nevermind, it seems that using close() instead of remove() makes it work! I will have to look into why that happens.

messmerd commented 5 days ago

@regulus79 It seems that when I split a midi clip, the original singular clip still remains though it is invisible. You can hear it when the song plays since it plays twice as loud as before the clip was split, and if you clone the track, it becomes visible in the cloned track.

regulus79 commented 5 days ago

Okay that's an interesting bug... I think it may have to do with me using close() instead of remove() when removing the old clip. But that's odd, since it doesn't appear to happen for AutomationClips which also use close() (???)

After some testing, it appears that using remove() solves the issue. I also think I found the cause of the old problem when using remove(), which is that I was calling it after m_clip->getTrack()->restoreJournallingState();. Again, I'm not an expert in Journalling, but calling it before appears to fix the problem.

regulus79 commented 31 minutes ago

I fixed the problem with out/in values and tangents in automation clip splitting.