Deluge Firmware 1.3.0
Build date: 2026.11.28
Loading...
Searching...
No Matches
note_regrouper.h
1/*
2 * Copyright © 2026 Synthstrom Audible Limited
3 *
4 * This file is part of The Synthstrom Audible Deluge Firmware.
5 *
6 * The Synthstrom Audible Deluge Firmware is free software: you can redistribute it and/or modify it under the
7 * terms of the GNU General Public License as published by the Free Software Foundation,
8 * either version 3 of the License, or (at your option) any later version.
9 *
10 * This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY;
11 * without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
12 * See the GNU General Public License for more details.
13 *
14 * You should have received a copy of the GNU General Public License along with this program.
15 * If not, see <https://www.gnu.org/licenses/>.
16 */
17
18#pragma once
19
20#include "model/scale/accidentals.h"
21#include "util/containers.h"
22#include <cstdint>
23
24class InstrumentClip;
26class NoteRow;
27class ScaleChange;
28
39public:
42 : clip_(clip), modelStack_(modelStack) {}
43
52 [[nodiscard]] bool regroup(const ScaleChange& change, deluge::accidentals::AccidentalHandling handling,
53 int32_t pendingTranspose = 0);
54
55private:
57 using RowFlags = deluge::vector<uint8_t>;
58
59 bool moveWholeRows(const ScaleChange& change, const MusicalKey& oldKey, const MusicalKey& finalKey,
60 int32_t pendingTranspose);
61 bool sortAndMergeRows(RowFlags& wasInScale);
62 void moveRow(NoteRow* row, int32_t rowIndex, int32_t newY);
63
64 InstrumentClip& clip_;
66};
Definition instrument_clip.h:52
Definition model_stack.h:129
Definition musical_key.h:10
deluge::vector< uint8_t > RowFlags
One flag per NoteRow: whether its pitch was in the key before the change.
Definition note_regrouper.h:57
bool regroup(const ScaleChange &change, deluge::accidentals::AccidentalHandling handling, int32_t pendingTranspose=0)
Definition note_regrouper.cpp:105
NoteRegrouper(InstrumentClip &clip, ModelStackWithTimelineCounter *modelStack)
The song's key (modelStack->song->key) must still be the one from before the change.
Definition note_regrouper.h:41
bool sortAndMergeRows(RowFlags &wasInScale)
Definition note_regrouper.cpp:259
bool moveWholeRows(const ScaleChange &change, const MusicalKey &oldKey, const MusicalKey &finalKey, int32_t pendingTranspose)
Definition note_regrouper.cpp:210
Definition note_row.h:106
Definition scale_change.h:24
AccidentalHandling
What a scale change which shifts scale degrees does with accidentals.
Definition accidentals.h:41