-
Notifications
You must be signed in to change notification settings - Fork 2.6k
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
Switch PianoKeyboard between Notated Pitch (effective pitch) and Playback Pitch (completed). #24784
base: master
Are you sure you want to change the base?
Switch PianoKeyboard between Notated Pitch (effective pitch) and Playback Pitch (completed). #24784
Conversation
This PR should be ready for review now. I moved the EDIT: I tested without the -F option and it indeed preserves the setting across executions of MuseScore. |
src/engraving/dom/edit.cpp
Outdated
@@ -1587,7 +1587,7 @@ NoteVal Score::noteVal(int pitch) const | |||
|
|||
// if transposing, interpret MIDI pitch as representing desired written pitch | |||
// set pitch based on corresponding sounding pitch | |||
if (!style().styleB(Sid::concertPitch)) { | |||
if (!style().styleB(Sid::concertPitch) && configuration()->pianoKeyboardUseNotatedPitch().val) { |
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.
I'm not sure if we should do this check here. It might be preferable to move the setting back to notationConfiguration
and retrieve its value outside the engraving module (since I'd rather consider it UI logic than business logic) and pass it as a bool parameter to Score::addMidiPitch
and Score::noteVal
.
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.
I don't disagree with what you say at all, but I have trouble seeing any philosophical difference between the Display Concert Pitch setting and this new one as far as to whether they are business logic or UI. If we are going to move the new one, we should move the old one as well, and that may get into a rats' nest of refactoring. (You would know better than I whether it is a lot.)
Or maybe the noteVal
function should not be part of Score. But that seems like gets into even more refactoring.
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.
I would say that the difference is the scope of these settings. Sid::concertPitch
is a score setting, and affects also how the score is typeset, i.e. really the content; pianoKeyboardUseNotatedPitch
is a UI setting, independent of the score, affecting only the behaviour of the UI.
There are absolutely a lot more opportunities for refactoring in the Score class and things around note input... but let's save that for different PRs!
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.
Hmm. I hope you will get to know me well enough that I sometimes when write out a counter argument, I then begin arguing against my own argument in my head and eventually convince myself that I was wrong. I think I get how Display Concert Pitch could be construed as business logic (perhaps because it controls engraving output) while there is no possibility of the input being so construed. So I will investigate your suggestion.
@@ -32,6 +32,7 @@ | |||
namespace mu::notation { | |||
class PianoKeyboardController : public muse::Injectable, public muse::async::Asyncable | |||
{ | |||
muse::Inject<engraving::IEngravingConfiguration> configuration = { this }; |
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.
(when injecting a Configuration from a different module, we would usually make that clear in the name, like engravingConfiguration
)
See also the recent discussion in #15594; the scope of the issue has been extended a little bit. Personally I prefer the two "use notated pitch" / "use sounding pitch" options over a single checkbox though, because with these options you really know what you are choosing from. I'll add that as a comment at #15594. |
The boolean (potentially) needs to be passed from three locations:
I am passing the boolean in from the latter 2 but not the 1st ( |
I agree that the UI should be in Preferences. I'll tackle that on a different commit, though it can be on this PR if you wish. I would like to nail down the PR as it was. |
Hm, adding a bool parameter Re. how to test: when you right-click the note input button in the toolbar, you get a menu where you can choose "realtime" note input mode. I've never studied how this works, but maybe the MuseScore 3 (!) handbook is useful: https://musescore.org/en/handbook/3/note-input-modes#realtime-auto Making the preferences changes in separate commits to this PR seems good to me. |
Given that Perhaps |
…EngravingConfiguration to make it accessible in Score class.
…core, plus other codereview fixes.
fd5ecbd
to
a2edd6f
Compare
Assuming the checks pass, it looks ready for review to me. (I've reviewed the cumulative file changes and they now all look as I intended them to.) The names have all been changed to match the new menu items and location of the menu. |
Resolves: #15594
Supercedes: #22991, which should be closed.
Added buttons in the PianoKeyboardPanelContextMenuModel class that communicate with the PianoKeyboardController class to change a boolean variable. The aim is to address a limitation in the current implementation of MuseScore's keyboard view, which struggles with differently-tuned instruments. When users click on a key, the corresponding note used to be placed on the score as notated pitch, while the equivalent standard pitch was highlighted on the keyboard UI, leading to potential confusion.
This PR also adds a change to
Score::noteVal
so that the correct pitch is entered into the score, based on the menu option selected.