-
-
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
4 new note modification tools #5857
Conversation
🤖 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
macOS🤖{"platform_name_to_artifacts": {"Linux": [{"artifact": {"title": {"title": "(AppImage)", "platform_name": "Linux"}, "link": {"link": "https://12645-15778896-gh.circle-artifacts.com/0/lmms-1.3.0-alpha.1.82%2Bg1302cb4-linux-x86_64.AppImage"}}, "build_link": "https://circleci.com/gh/LMMS/lmms/12645?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://12642-15778896-gh.circle-artifacts.com/0/lmms-1.3.0-alpha.1.82%2Bg1302cb431-mingw-win32.exe"}}, "build_link": "https://circleci.com/gh/LMMS/lmms/12642?utm_campaign=vcs-integration-link&utm_medium=referral&utm_source=github-build-link"}, {"artifact": {"title": {"title": "64-bit", "platform_name": "Windows"}, "link": {"link": "https://12644-15778896-gh.circle-artifacts.com/0/lmms-1.3.0-alpha.1.82%2Bg1302cb431-mingw-win64.exe"}}, "build_link": "https://circleci.com/gh/LMMS/lmms/12644?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/ojw289xn6olj0nel/artifacts/build/lmms-1.3.0-alpha-msvc2017-win32.exe"}}, "build_link": "https://ci.appveyor.com/project/Lukas-W/lmms/builds/37987275"}, {"artifact": {"title": {"title": "64-bit", "platform_name": "Windows"}, "link": {"link": "https://ci.appveyor.com/api/buildjobs/07qd7pb339m4rwcp/artifacts/build/lmms-1.3.0-alpha-msvc2017-win64.exe"}}, "build_link": "https://ci.appveyor.com/project/Lukas-W/lmms/builds/37987275"}], "macOS": [{"artifact": {"title": {"title": "", "platform_name": "macOS"}, "link": {"link": "https://12641-15778896-gh.circle-artifacts.com/0/lmms-1.3.0-alpha.1.82%2Bg1302cb431-mac10.14.dmg"}}, "build_link": "https://circleci.com/gh/LMMS/lmms/12641?utm_campaign=vcs-integration-link&utm_medium=referral&utm_source=github-build-link"}]}, "commit_sha": "d5dcac2c0f4932fc60bcfc0465e6af8bc3f025c0"} |
These are pretty good tools, but I suggest |
Thanks, I wanted an English speaker's input on that one. I was afraid "last" could be interpreted as "rightmost". |
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.
Code LGTM! Minor code style suggestion.
We also need some testing to check this approach fits all case scenarios, from reading the logic it seems it does.
Co-authored-by: IanCaio <[email protected]>
Looks good. Merge? |
My approval still stands, can merge it IMO! |
Can you explain what is the expected behaviour for each new tool so I can test them based on that? |
I don't think we should add shortcuts to the last two since they are more of a "use once" action, and we shouldn't waste shortcuts. |
What if instead of having separate shortcuts for different tools, we had one shortcut for the current selected tool, and could switch between them with |
Interesting suggestion @Iron-Squid ... speaking for myself, I'd rather keep the shortcuts for faster access to the more common tools |
Good find @superpaik. I designed Fill to grow the notes to the end of the bar. But it's a bug that Cut cuts the last note spanning a bar line... |
Test 2 bug is fixed. Test 1 bug remains. It happens when the last note ends before the bar line, but a previous note spans across the line... I don't think it's worth adding a check for that to the algorithm. The computer still does 99% of it right. Or am I wrong? @superpaik I added min/max as a lazy way to fix extremely short/long notes created by fill/cut. I understand it can be used in many different ways, but when editing and trying different note lengths, wouldn't it work just as good using (And to be honest I think the design of min/max is backwards when the user has to click a note of the desired length first, then click the tool... But it was the easiest solution.) rec2.mp4 |
Sorry. I couldn't retest it because somehow there isn't the functionality on the installables generated by the bot (checked both mingw and MSVC) |
As you mentioned, the bug 1 is actually the behavior of the algorithm, but it might be a little surprising to the user. What if the behavior for the last chord was: Stretch to the next full bar OR to end position of the note that reaches further, whichever is bigger? Then in that case the small note would fill up to the end of the previous one. The changes to the code would look a bit like this: TimePos lastChordEndPos(0);
// ...
// Update the end position for the last chord, which will stretch
// to the position where the furthest chord ends or to the
// next full bar, whichever is bigger
lastChordEndPos = qMax(notes[i].endPos(), lastChordEndPos);
// Stretch last chord to end of bar or to the calculated position
// notes[i] will always be the longest note in the chord
if (i+1 == notes.count())
{
TimePos lastBarPos(notes[i]->endPos().nextFullBar() * TimePos::ticksPerBar())
lastChordEndPos = qMax(lastBarPos, lastChordEndPos);
chordLength = lastChordEndPos - notes[i]->pos();
} I'm not sure that behavior is more user friendly, but at least you wouldn't unexpectedly have the last chord ending before the previous chord. Let me know if I didn't explain it well enough, can throw some images to give some examples. |
Thanks @IanCaio, now both bugs @superpaik mentioned are fixed, and your approach made the code simpler too. Current implementation: Fill stretches the last chord to the end of the last bar (the end of the clip/tco in song editor). |
Thanks for the regularly testing @superpaik, been really helping out specially now we are getting ready for the refactoring! I was about to post that one in #testing after the latest changes, but you beat me to it. From what I see on the gifs, the behavior is what is expected from the code. I'm not sure if in terms of UX it's the best and most expected behavior, but what you see is not a bug in the code. First of all, any of the actions treat the notes in the patterns as chords. If multiple notes are in the same position in the timeline they are considered part of a chord (even if their sizes are different). Situation from GIF 1) It's possible to come up with a logic that stretches the end of a note to the beginning of a note closest to it (the way you were expecting A#4 to stretch to F#4). But that's a completely different logic from the current one. I think for now this approach is simple and useful for most scenarios where it's designed to be used (which is basically filling gaps between chords after MIDI recording afaik). In the future we can rethink it and account for that situation too, or maybe make a different action that works that way. Situation from GIF 2) |
Okey! |
@superpaik you've brought good feedback. There will always be edge cases. The more weird scenarios we try to account for, the more complex the logic becomes and the more unpredictable the tool is. So we need to come up with a simple and straightforward rule for how the tool should work. GIF 1: GIF 2:
If a user is writing swingy chords, that user won't use Cut overlaps, because it will destroy everything, and that's it. |
I don't think that would be a bad idea. It would work for both the chord situations you were originally making it for (from Avicii video) and on the situations superpaik was expecting. It would be slightly less efficient because for each end position you'd have to go through all notes following it until you found one that has a beginning position higher or equal to the end position and then stretch the single note. I could sketch some code if you want help with it, might have some free time tomorrow to work on something. I agree the cut actions seems to be good as it is, I can't think of a better behavior right now at least. |
Yes, I agree with you both. Maybe I'm overthinking things because I'm in "testing" mode ;-) Maybe we should follow the Pareto Principle and focus on the 80% of most used and normal scenarios. Thanks for the effort. |
The UX perspective is very important too, so keep bringing those concerns up! I think both the author and myself agree with you on the first case, I think the fill behavior could be improved to fill up to the closest note beginning (even if it's 2 or 3 notes away). |
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.
Minor code style fixes and one small possible fix on the logic. Besides that the new logic looks good, without testing (just reading) it seems to fit what @superpaik was expecting as the behavior.
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.
Sorry about the delay, after the last fixes it LGTM!
@allejok96 Could you resolve the conflict with the piano-roll knife PR? I think it can be merged after conflict resolution. |
Also merging this one tomorrow if no one objects! |
* Add new note length modification tools * "Last" instead of "latest" * Code formatting Co-authored-by: IanCaio <[email protected]> * Fix sort * Fix incorrect cut of last note * Fix Fill not stretching last note to end * Fill from end positions * Rename limitNoteLengths * Compare with non-selected notes when filling * Style changes by IanCaio + bugfix * break instead of continue Co-authored-by: IanCaio <[email protected]>
* Add new note length modification tools * "Last" instead of "latest" * Code formatting Co-authored-by: IanCaio <[email protected]> * Fix sort * Fix incorrect cut of last note * Fix Fill not stretching last note to end * Fill from end positions * Rename limitNoteLengths * Compare with non-selected notes when filling * Style changes by IanCaio + bugfix * break instead of continue Co-authored-by: IanCaio <[email protected]>
* Add new note length modification tools * "Last" instead of "latest" * Code formatting Co-authored-by: IanCaio <[email protected]> * Fix sort * Fix incorrect cut of last note * Fix Fill not stretching last note to end * Fill from end positions * Rename limitNoteLengths * Compare with non-selected notes when filling * Style changes by IanCaio + bugfix * break instead of continue Co-authored-by: IanCaio <[email protected]>
Add 4 new tools to the Piano roll note tools menu: