-
-
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
Feature: Glue notes in Piano-Roll #5482
Conversation
* Added sorting on note key which is very important with the new loop.
🤖 Hey, I'm @LmmsBot from github.com/lmms/bot and I made downloads for this pull request, click me to make them magically appear! 🎩
Linux
Windows
🤖{"platform_name_to_artifacts": {"Linux": [{"artifact": {"title": {"title": "(AppImage)", "platform_name": "Linux"}, "link": {"link": "https://8583-15778896-gh.circle-artifacts.com/0/lmms-1.2.2.697-linux-x86_64.AppImage"}}, "build_link": "https://circleci.com/gh/LMMS/lmms/8583?utm_campaign=vcs-integration-link&utm_medium=referral&utm_source=github-build-link"}], "Windows": [{"artifact": {"title": {"title": "32-bit", "platform_name": "Windows"}, "link": {"link": "https://8586-15778896-gh.circle-artifacts.com/0/lmms-1.2.2.697-mingw-win32.exe"}}, "build_link": "https://circleci.com/gh/LMMS/lmms/8586?utm_campaign=vcs-integration-link&utm_medium=referral&utm_source=github-build-link"}, {"artifact": {"title": {"title": "64-bit", "platform_name": "Windows"}, "link": {"link": "https://8584-15778896-gh.circle-artifacts.com/0/lmms-1.2.2.697-mingw-win64.exe"}}, "build_link": "https://circleci.com/gh/LMMS/lmms/8584?utm_campaign=vcs-integration-link&utm_medium=referral&utm_source=github-build-link"}, {"artifact": {"title": {"title": "32-bit", "platform_name": "Windows"}, "link": {"link": "https://ci.appveyor.com/api/buildjobs/rvl9pyn7l7oph3ef/artifacts/build/lmms-1.2.2-msvc2017-win32.exe"}}, "build_link": "https://ci.appveyor.com/project/Lukas-W/lmms/builds/35046280"}, {"artifact": {"title": {"title": "64-bit", "platform_name": "Windows"}, "link": {"link": "https://ci.appveyor.com/api/buildjobs/nlrihueeaua22yif/artifacts/build/lmms-1.2.2-msvc2017-win64.exe"}}, "build_link": "https://ci.appveyor.com/project/Lukas-W/lmms/builds/35046280"}, {"artifact": {"title": {"title": "32-bit", "platform_name": "Windows"}, "link": {"link": "https://ci.appveyor.com/api/buildjobs/oah37bsb653sg31o/artifacts/build/lmms-1.2.2-msvc2017-win32.exe"}}, "build_link": "https://ci.appveyor.com/project/Lukas-W/lmms/builds/35046281"}, {"artifact": {"title": {"title": "64-bit", "platform_name": "Windows"}, "link": {"link": "https://ci.appveyor.com/api/buildjobs/skuktovhgbfajglk/artifacts/build/lmms-1.2.2-msvc2017-win64.exe"}}, "build_link": "https://ci.appveyor.com/project/Lukas-W/lmms/builds/35046281"}]}, "commit_sha": "d86ba8c17d461922e082b5a93c894b6c63506627"} |
I have tested the glue feature and it works well. I think it's good to merge. The original developer has left GitHub and wont be able to respond so If someone wants to fix anything, just push to this branch. |
Merge? |
Yes.
I have seen crashes and I've had to launch lmms with a file known to work as an argument to make it launch. Not with this build though. |
Oh. It doesn't seem to work well with beat notes though. The result is really inconsistent there. |
Yeah, look at the length I managed to create on the first beat note when trying to glue it to a normal one.
|
Did you merge with an eight note? Beat notes have a length of -192, IIRC, so the math checks out if so (not that it makes this a good result, haha). I wonder how much effort it would take to make beat notes a subclass of Note so length and endPos could be overriden. Or even simpler, add a boolean (isBeatNote, for example) so they can have positive lengths. Might be out of scope for this PR but they really cause a lot of trouble with the current hacky implementation. |
No, more like a whole note. |
Oh, dear! This project Edit: fixed in 587c559 |
I changed the diff --git a/src/gui/editors/PianoRoll.cpp b/src/gui/editors/PianoRoll.cpp
index 30da834df..86cf08c28 100644
--- a/src/gui/editors/PianoRoll.cpp
+++ b/src/gui/editors/PianoRoll.cpp
@@ -703,11 +703,10 @@ void PianoRoll::glueNotes()
if ((*note)->key() == (*nextNote)->key()
&& (*nextNote)->pos() >= (*note)->pos()
&& (*nextNote)->pos() <= (*note)->pos()
- + (*note)->length())
+ + qMax(MidiTime(0), (*note)->length()))
{
- (*note)->setLength((*note)->length() +
- ((*nextNote)->pos() + (*nextNote)->length()) -
- ((*note)->pos() + (*note)->length()));
+ (*note)->setLength(qMax((*note)->length(),
+ MidiTime((*nextNote)->endPos() - (*note)->pos())));
noteToRemove.push_back(*nextNote);
++nextNote;
} I also suggest gluing all notes if no notes are selected. |
I've updated this PR with the changes I suggested. |
Fixed a merge conflict. |
Merge? |
Sounds good to me! |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There's a particular conditional that I believe always return true on the method. I'd understand if it was kept to make the logic more explicit for future readers, but I think a comment would be better suited for that. Besides that, the rest of the code LGTM 👍
src/gui/editors/PianoRoll.cpp
Outdated
{ | ||
// key and position match for glue | ||
if ((*note)->key() == (*nextNote)->key() | ||
&& (*nextNote)->pos() >= (*note)->pos() |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Will that conditional ever be false
? Since the notes were previously ordered by key and by pos, if two notes have the same key isn't it always true
that the next note will have a position equal or greater than the previous note?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The comment highlighted all 4 lines, so to make it clearer the conditional I meant is (*nextNote)->pos() >= (*note)->pos()
which will be evaluated if the key
s are the same on the two notes.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It is redundant, but I think there should be a comment which explains what you said.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
So, what needs to be done here? Remove && (*nextNote)->pos() >= (*note)->pos()
and improve the comment?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yeah, I think just removing that part of the conditional and having the comment explaining that you don't need to check if the next note is after the first because they are ordered already. Removes an unnecessary comparison but leaves an explanation why.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
OK. Hopefully fixed in d86ba8c
Any ideas how we should deal with per-note pitch automation? Should we ignore it for now? |
IMHO it could be just removed from any glued note. It's to be expected that pitch automations would be lost in a note glue operation, and removing it we avoid the inconsistency of it being kept if it's in the first note or being removed if it's in the second one. So just removing it altogether sounds like a good idea to me. Quickly looking at the code I think it has to be done like this?
Personally, I even think that this |
I think we can ignore it for now. The effect of notes with pitch automation in a glue operation isn't hard to predict. |
Implement proposed changes by @IanCaio
Now merge? :) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM too!
Rebased in a separate PR #5721. Closing this one. |
#5216 by CYBERDEViLNL rebased on c755b56 and merge conflict solved.