Merge pull request #15161 from RomanPudashkin/play_notes_when_adding_them_on_tab_staff
[MU4] Fix #13403: No sound when entering fretmarks in tablature
This commit is contained in:
commit
1a66637d52
4 changed files with 30 additions and 2 deletions
|
@ -474,7 +474,7 @@ void NotationActionController::init()
|
|||
registerTabPadNoteAction("pad-note-1024-TAB", Pad::NOTE1024);
|
||||
|
||||
for (int i = 0; i < MAX_FRET; ++i) {
|
||||
registerAction("fret-" + std::to_string(i), &Interaction::addFret, i, &Controller::isTablatureStaff);
|
||||
registerAction("fret-" + std::to_string(i), [i, this]() { addFret(i); }, &Controller::isTablatureStaff);
|
||||
}
|
||||
|
||||
// listen on state changes
|
||||
|
@ -1140,6 +1140,17 @@ void NotationActionController::addSlur()
|
|||
}
|
||||
}
|
||||
|
||||
void NotationActionController::addFret(int num)
|
||||
{
|
||||
auto interaction = currentNotationInteraction();
|
||||
if (!interaction) {
|
||||
return;
|
||||
}
|
||||
|
||||
interaction->addFret(num);
|
||||
playSelectedElement(currentNotationElements()->msScore()->playChord());
|
||||
}
|
||||
|
||||
IInteractive::Result NotationActionController::showErrorMessage(const std::string& message) const
|
||||
{
|
||||
return interactive()->info(message,
|
||||
|
@ -1843,6 +1854,10 @@ void NotationActionController::playSelectedElement(bool playChord)
|
|||
}
|
||||
|
||||
playbackController()->playElements({ element });
|
||||
|
||||
mu::engraving::Score* score = currentNotationElements()->msScore();
|
||||
score->setPlayChord(false);
|
||||
score->setPlayNote(false);
|
||||
}
|
||||
|
||||
void NotationActionController::startNoteInputIfNeed()
|
||||
|
|
|
@ -108,6 +108,7 @@ private:
|
|||
void addTie();
|
||||
void chordTie();
|
||||
void addSlur();
|
||||
void addFret(int num);
|
||||
|
||||
framework::IInteractive::Result showErrorMessage(const std::string& message) const;
|
||||
|
||||
|
|
|
@ -2715,6 +2715,18 @@ void NotationInteraction::moveStringSelection(MoveDirection d)
|
|||
int strg = is.string() + delta;
|
||||
if (strg >= 0 && strg < instrStrgs && strg != is.string()) {
|
||||
is.setString(strg);
|
||||
|
||||
const ChordRest* chordRest = is.cr();
|
||||
if (chordRest && chordRest->isChord()) {
|
||||
const Chord* chord = toChord(chordRest);
|
||||
|
||||
for (Note* note : chord->notes()) {
|
||||
if (note->string() == strg) {
|
||||
select({ note }, SelectType::SINGLE);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
notifyAboutNoteInputStateChanged();
|
||||
}
|
||||
}
|
||||
|
|
|
@ -772,7 +772,7 @@ void NotationViewInputController::mouseReleaseEvent(QMouseEvent* event)
|
|||
|
||||
void NotationViewInputController::handleLeftClickRelease(const QPointF& releasePoint)
|
||||
{
|
||||
if (m_view->isNoteEnterMode()) {
|
||||
if (m_view->isNoteEnterMode() || playbackController()->isPlaying()) {
|
||||
return;
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue