Deluge Firmware
1.3.0
Build date: 2026.11.28
Toggle main menu visibility
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
24
class
InstrumentClip
;
25
class
ModelStackWithTimelineCounter
;
26
class
NoteRow
;
27
class
ScaleChange
;
28
38
class
NoteRegrouper
{
39
public
:
41
NoteRegrouper
(
InstrumentClip
& clip,
ModelStackWithTimelineCounter
* modelStack)
42
: clip_(clip), modelStack_(modelStack) {}
43
52
[[nodiscard]]
bool
regroup
(
const
ScaleChange
& change,
deluge::accidentals::AccidentalHandling
handling,
53
int32_t pendingTranspose = 0);
54
55
private
:
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_;
65
ModelStackWithTimelineCounter
* modelStack_;
66
};
InstrumentClip
Definition
instrument_clip.h:52
ModelStackWithTimelineCounter
Definition
model_stack.h:129
MusicalKey
Definition
musical_key.h:10
NoteRegrouper::RowFlags
deluge::vector< uint8_t > RowFlags
One flag per NoteRow: whether its pitch was in the key before the change.
Definition
note_regrouper.h:57
NoteRegrouper::regroup
bool regroup(const ScaleChange &change, deluge::accidentals::AccidentalHandling handling, int32_t pendingTranspose=0)
Definition
note_regrouper.cpp:105
NoteRegrouper::NoteRegrouper
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
NoteRegrouper::sortAndMergeRows
bool sortAndMergeRows(RowFlags &wasInScale)
Definition
note_regrouper.cpp:259
NoteRegrouper::moveWholeRows
bool moveWholeRows(const ScaleChange &change, const MusicalKey &oldKey, const MusicalKey &finalKey, int32_t pendingTranspose)
Definition
note_regrouper.cpp:210
NoteRow
Definition
note_row.h:106
ScaleChange
Definition
scale_change.h:24
deluge::accidentals::AccidentalHandling
AccidentalHandling
What a scale change which shifts scale degrees does with accidentals.
Definition
accidentals.h:41