Add Strum Tool to Piano Roll (#7725)

Adds a complex strum tool to the Piano Roll, allowing the user to take a selection of chords, and drag around the notes to shape the strum exactly how they want it.

---------

Co-authored-by: szeli1 <143485814+szeli1@users.noreply.github.com>
Co-authored-by: Sotonye Atemie <satemiej@gmail.com>
This commit is contained in:
regulus79
2025-03-22 05:54:40 -04:00
committed by GitHub
parent 91233e6a73
commit db9ccbeb56
2 changed files with 212 additions and 8 deletions

View File

@@ -112,7 +112,8 @@ public:
Erase,
Select,
Detuning,
Knife
Knife,
Strum
};
/*! \brief Resets settings to default when e.g. creating a new project */
@@ -268,7 +269,8 @@ private:
SelectNotes,
ChangeNoteProperty,
ResizeNoteEditArea,
Knife
Knife,
Strum
};
enum class NoteEditMode
@@ -324,6 +326,9 @@ private:
void setKnifeAction();
void cancelKnifeAction();
void setStrumAction();
void cancelStrumAction();
void updateScrollbars();
void updatePositionLineHeight();
@@ -347,6 +352,7 @@ private:
QPixmap m_toolMove = embed::getIconPixmap("edit_move");
QPixmap m_toolOpen = embed::getIconPixmap("automation");
QPixmap m_toolKnife = embed::getIconPixmap("edit_knife");
QPixmap m_toolStrum = embed::getIconPixmap("arp_free");
static std::array<KeyType, 12> prKeyOrder;
@@ -437,6 +443,7 @@ private:
EditMode m_editMode;
EditMode m_ctrlMode; // mode they were in before they hit ctrl
EditMode m_knifeMode; // mode they where in before entering knife mode
EditMode m_strumMode; //< mode they where in before entering strum mode
bool m_mouseDownRight; //true if right click is being held down
@@ -465,6 +472,21 @@ private:
void updateKnifePos(QMouseEvent* me, bool initial);
//! Stores the chords for the strum tool
std::vector<NoteVector> m_selectedChords;
//! Computes which notes belong to which chords from the selection
void setupSelectedChords();
TimePos m_strumStartTime;
TimePos m_strumCurrentTime;
int m_strumStartVertical = 0;
int m_strumCurrentVertical = 0;
float m_strumHeightRatio = 0.0f;
bool m_strumEnabled = false;
//! Handles updating all of the note positions when performing a strum
void updateStrumPos(QMouseEvent* me, bool initial, bool warp);
friend class PianoRollWindow;
StepRecorderWidget m_stepRecorderWidget;