Deluge Firmware 1.3.0
Build date: 2026.11.28
Loading...
Searching...
No Matches
song.h
1/*
2 * Copyright © 2014-2023 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 "definitions_cxx.hpp"
21#include "gui/colour/rgb.h"
22#include "gui/menu_item/reverb/model.h"
23#include "io/midi/learned_midi.h"
24#include "model/clip/clip.h"
25#include "model/clip/clip_array.h"
26#include "model/global_effectable/global_effectable_for_song.h"
27#include "model/instrument/instrument.h"
28#include "model/note/note_locks.h"
29#include "model/output.h"
30#include "model/scale/musical_key.h"
31#include "model/scale/note_set.h"
32#include "model/scale/preset_scales.h"
33#include "model/scale/scale_change.h"
34#include "model/scale/scale_mapper.h"
35#include "model/sync.h"
36#include "model/timeline_counter.h"
37#include "modulation/params/param.h"
38#include "modulation/params/param_manager.h"
39#include "storage/flash_storage.h"
40#include "util/container/array/ordered_resizeable_array_with_multi_word_key.h"
41#include "util/d_string.h"
42
43class MidiCommand;
44class Clip;
45class AudioClip;
46class Instrument;
47class InstrumentClip;
48class Synth;
50class Instrument;
52class Drum;
53class SoundInstrument;
54class SoundDrum;
55class Action;
56class ArrangementRow;
59class Kit;
60class MIDIInstrument;
61class NoteRow;
62class Output;
63class AudioOutput;
64class ModelStack;
66
67namespace deluge::accidentals {
68enum class AccidentalHandling;
69}
70Clip* getCurrentClip();
71InstrumentClip* getCurrentInstrumentClip();
72AudioClip* getCurrentAudioClip();
73Output* getCurrentOutput();
74Kit* getCurrentKit();
75Instrument* getCurrentInstrument();
76OutputType getCurrentOutputType();
77
78class Section {
79public:
80 LearnedMIDI launchMIDICommand;
81 int16_t num_repetitions = 0;
82 // Index into defaultClipSectionColours, so the colour can travel with the section when it's moved
83 uint8_t colour_index = 0;
84
85 // Resolve this section's colour independently of its current position in the song.
86 [[nodiscard]] RGB getColour() const;
87};
88
90 ModControllableAudio* modControllable;
91 Clip* clip;
92 ParamManager paramManager;
93};
94
95#define MAX_NOTES_CHORD_MEM 10
96
97enum SessionMacroKind : int8_t {
98 NO_MACRO = 0,
99 CLIP_LAUNCH,
100 OUTPUT_CYCLE,
101 SECTION,
102 NUM_KINDS,
103};
104
106 SessionMacroKind kind{NO_MACRO};
107 Clip* clip{nullptr};
108 Output* output{nullptr};
109 uint8_t section{0};
110};
111
112class Song final : public TimelineCounter {
113public:
114 Song();
115 ~Song() override;
116
119
120 bool mayDoubleTempo();
121 bool ensureAtLeastOneSessionClip();
122 void transposeAllScaleModeClips(int32_t interval);
123 void transposeAllScaleModeClips(int32_t offset, bool chromatic);
124 bool anyScaleModeClips();
126 void changeMusicalMode(uint8_t yVisualWithinOctave, int8_t change);
130 void rotateMusicalMode(int8_t change, int32_t pendingTranspose = 0);
133 void replaceMusicalMode(const ScaleChange& changes, bool affectMIDITranspose,
134 deluge::accidentals::AccidentalHandling accidentalHandling, int32_t pendingTranspose = 0);
135 int32_t getYVisualFromYNote(int32_t yNote, bool inKeyMode);
136 int32_t getYVisualFromYNote(int32_t yNote, bool inKeyMode, const MusicalKey& key);
137 int32_t incrementYNoteInKey(int32_t yNote, int32_t increment, bool inOctave, bool inKey) const;
138 static int32_t incrementYNoteInKey(int32_t yNote, int32_t increment, bool inOctave, const MusicalKey& key);
139 static int32_t incrementYNoteNoKey(int32_t yNote, int32_t increment, bool inOctave, const MusicalKey& key);
140 int32_t getYNoteFromYVisual(int32_t yVisual, bool inKeyMode);
141 int32_t getYNoteFromYVisual(int32_t yVisual, bool inKeyMode, const MusicalKey& key);
142 bool mayMoveModeNote(int16_t yVisualWithinOctave, int8_t newOffset);
143 ParamManagerForTimeline* findParamManagerForDrum(Kit* kit, Drum* drum, Clip* stopTraversalAtClip = nullptr);
144 void setupPatchingForAllParamManagersForDrum(SoundDrum* drum);
145 void setupPatchingForAllParamManagersForInstrument(SoundInstrument* sound);
146 void grabVelocityToLevelFromMIDICableAndSetupPatchingForAllParamManagersForInstrument(MIDICable& cable,
147 SoundInstrument* instrument);
148 void grabVelocityToLevelFromMIDICableAndSetupPatchingForAllParamManagersForDrum(MIDICable& cable, SoundDrum* drum,
149 Kit* kit);
150 void grabVelocityToLevelFromMIDICableAndSetupPatchingForEverything(MIDICable& cable);
151 void getCurrentRootNoteAndScaleName(StringBuf& buffer);
152 void displayCurrentRootNoteAndScaleName();
153
154 // Scale-related methods
155
157 Scale cycleThroughScales();
159 Scale getCurrentScale();
162 Scale setScale(Scale newScale);
165 bool setScaleNotes(NoteSet newScale);
169 bool hasUserScale();
172 void setRootNote(int32_t newRootNote, InstrumentClip* clipToAvoidAdjustingScrollFor = nullptr);
176 void setRootNoteForClipEnteringScaleMode(int32_t newRootNote, InstrumentClip* clip);
183 NoteSet anchorsInScaleModeClips(const MusicalKey& lineageKey, InstrumentClip* clipToSkip = nullptr);
184
185 void setTempoFromNumSamples(double newTempoSamples, bool shouldLogAction);
186 void setupDefault();
187 void setBPM(float tempoBPM, bool shouldLogAction);
188 void setTempoFromParams(int32_t magnitude, int8_t whichValue, bool shouldLogAction);
189 void deleteSoundsWhichWontSound();
190 void writeTemplateSong(const char* templateSong);
191 void
192 deleteClipObject(Clip* clip, bool songBeingDestroyedToo = false,
193 InstrumentRemoval instrumentRemovalInstruction = InstrumentRemoval::DELETE_OR_HIBERNATE_IF_UNUSED);
194 int32_t getMaxMIDIChannelSuffix(int32_t channel);
195 void addOutput(Output* output, bool atStart = true);
196 void deleteOutputThatIsInMainList(Output* output, bool stopAnyAuditioningFirst = true);
197 void markAllInstrumentsAsEdited();
198 Instrument* getInstrumentFromPresetSlot(OutputType outputType, int32_t presetNumber, int32_t presetSubSlotNumber,
199 char const* name, char const* dirPath, bool searchHibernatingToo = true,
200 bool searchNonHibernating = true);
201 AudioOutput* getAudioOutputFromName(std::string_view name);
202 void setupPatchingForAllParamManagers();
203 void replaceInstrument(Instrument* oldInstrument, Instrument* newInstrument, bool keepNoteRowsWithMIDIInput = true);
204 void stopAllMIDIAndGateNotesPlaying();
205 void stopAllAuditioning();
206 void deleteOrHibernateOutput(Output* output);
207 Instrument* getNonAudioInstrumentToSwitchTo(OutputType newOutputType, Availability availabilityRequirement,
208 int16_t newSlot, int8_t newSubSlot, bool* instrumentWasAlreadyInSong);
209 void removeSessionClipLowLevel(Clip* clip, int32_t clipIndex);
210 void changeSwingInterval(int32_t newValue);
211 int32_t convertSyncLevelFromFileValueToInternalValue(int32_t fileValue);
212 int32_t convertSyncLevelFromInternalValueToFileValue(int32_t internalValue);
213 String getSongFullPath();
214 void setSongFullPath(const char* fullPath);
215 int32_t getInputTickMagnitude() const { return insideWorldTickMagnitude + insideWorldTickMagnitudeOffsetFromBPM; }
216
217 GlobalEffectableForSong globalEffectable;
218
219 ClipArray sessionClips;
220 ClipArray arrangementOnlyClips;
221
222 Output* firstOutput;
224 firstHibernatingInstrument; // All Instruments have inValidState set to false when they're added to this list
225
226 OrderedResizeableArrayWithMultiWordKey backedUpParamManagers;
227
228 uint32_t xZoom[2]; // Set default zoom at max zoom-out;
229 int32_t xScroll[2]; // Leave this as signed
230 int32_t xScrollForReturnToSongView;
231 int32_t xZoomForReturnToSongView;
232 bool tripletsOn;
233 uint32_t tripletsLevel; // The number of ticks in one of the three triplets
234
235 uint64_t timePerTimerTickBig;
236 int32_t divideByTimePerTimerTick;
237
238 // How many orders of magnitude faster internal ticks are going than input ticks. Used in combination with
239 // inputTickScale, which is usually 1, but is different if there's an inputTickScaleClip. So, e.g. if
240 // insideWorldTickMagnitude is 1, this means the inside world is spinning twice as fast as the external world, so
241 // MIDI sync coming in representing an 8th-note would be interpreted internally as a quarter-note (because two
242 // internal 8th-notes would have happened, twice as fast, making a quarter-note)
243 int32_t insideWorldTickMagnitude;
244
245 // Sometimes, we'll do weird stuff to insideWorldTickMagnitude for sync-scaling, which would make BPM values look
246 // weird. So, we keep insideWorldTickMagnitudeOffsetFromBPM
247 int32_t insideWorldTickMagnitudeOffsetFromBPM;
248
249 int8_t swingAmount;
250 uint8_t swingInterval;
251
252 Section sections[kMaxNumSections];
253
254 MusicalKey key;
255 std::bitset<NUM_PRESET_SCALES> disabledPresetScales;
256
257 String name;
258
259 bool affectEntire;
260
261 SessionLayoutType sessionLayout = FlashStorage::defaultSessionLayout;
262 int32_t songGridScrollX = 0;
263 int32_t songGridScrollY = 0;
264 int32_t songViewYScroll;
265 int32_t arrangementYScroll;
266
267 uint8_t sectionToReturnToAfterSongEnd;
268
269 bool wasLastInArrangementEditor;
270 int32_t lastClipInstanceEnteredStartPos; // -1 means we are not "inside" an arrangement. While we're in the
271 // ArrangementEditor, it's 0
272
273 bool arrangerAutoScrollModeActive;
274
275 MIDIInstrument* hibernatingMIDIInstrument;
276
277 bool outputClipInstanceListIsCurrentlyInvalid; // Set to true during scenarios like replaceInstrument(), to warn
278 // other functions not to look at Output::clipInstances
279
280 bool paramsInAutomationMode;
281
282 bool inClipMinderViewOnLoad; // Temp variable only valid while loading Song
283
284 int32_t unautomatedParamValues[deluge::modulation::params::kMaxNumUnpatchedParams];
285
286 String dirPath;
287
288 std::array<SessionMacro, 8> sessionMacros{};
289
290 bool getAnyClipsSoloing() const;
291 Clip* getCurrentClip();
292 void setCurrentClip(Clip* clip) {
293 if (currentClip != nullptr) {
294 previousClip = currentClip;
295 }
296 currentClip = clip;
297 }
298 uint32_t getInputTickScale();
299 Clip* getSyncScalingClip();
300 void setInputTickScaleClip(Clip* clip);
301 inline bool isFillModeActive() { return fillModeActive; }
302 void changeFillMode(bool on);
303 void loadNextSong();
304 void setClipLength(Clip* clip, uint32_t newLength, Action* action, bool mayReSyncClip = true);
305 void doubleClipLength(InstrumentClip* clip, Action* action = nullptr);
306 Clip* getClipWithOutput(Output* output, bool mustBeActive = false, Clip* excludeClip = nullptr);
307 Error readFromFile(Deserializer& reader);
308 void writeToFile();
309 void loadAllSamples(bool mayActuallyReadFiles = true);
310 void renderAudio(std::span<StereoSample> outputBuffer, int32_t* reverbBuffer, int32_t sideChainHitPending);
311 Clip* syncScalingClip;
312 void setTimePerTimerTick(uint64_t newTimeBig, bool shouldLogAction = false);
313 bool hasAnySwing();
314 void resyncLFOs(bool reset_state = false);
315 void ensureInaccessibleParamPresetValuesWithoutKnobsAreZero(Sound* sound);
316 bool areAllClipsInSectionPlaying(int32_t section);
317 void turnSoloingIntoJustPlaying(bool getRidOfArmingToo = true);
318 void reassessWhetherAnyClipsSoloing();
319 float getTimePerTimerTickFloat();
320 uint32_t getTimePerTimerTickRounded();
321 int32_t getNumOutputs();
322 Clip* getNextSessionClipWithOutput(int32_t offset, Output* output, Clip* prevClip);
323 bool anyClipsSoloing;
324
325 ParamManager* getBackedUpParamManagerForExactClip(ModControllableAudio* modControllable, Clip* clip,
326 ParamManager* stealInto = nullptr);
327 ParamManager* getBackedUpParamManagerPreferablyWithClip(ModControllableAudio* modControllable, Clip* clip,
328 ParamManager* stealInto = nullptr);
329 void backUpParamManager(ModControllableAudio* modControllable, Clip* clip, ParamManagerForTimeline* paramManager,
330 bool shouldStealExpressionParamsToo = false);
331 void moveInstrumentToHibernationList(Instrument* instrument);
332 void deleteOrHibernateOutputIfNoClips(Output* output);
333 void removeInstrumentFromHibernationList(Instrument* instrument);
334 bool doesOutputHaveActiveClipInSession(Output* output);
335 bool doesNonAudioSlotHaveActiveClipInSession(OutputType outputType, int32_t slot, int32_t subSlot = -1);
336 bool doesNonAudioSlotHaveClipInSession(OutputType outputType, int32_t slot, int32_t subSlot);
337 bool doesOutputHaveAnyClips(Output* output);
338 void deleteBackedUpParamManagersForClip(Clip* clip);
339 void deleteBackedUpParamManagersForModControllable(ModControllableAudio* modControllable);
340 void deleteHibernatingInstrumentWithSlot(OutputType outputType, char const* name);
341 void loadCrucialSamplesOnly();
342 Clip* getSessionClipWithOutput(Output* output, int32_t requireSection = -1, Clip* excludeClip = nullptr,
343 int32_t* clipIndex = nullptr, bool excludePendingOverdubs = false);
344 void restoreClipStatesBeforeArrangementPlay();
345 void deleteOrAddToHibernationListOutput(Output* output);
346 int32_t getLowestSectionWithNoSessionClipForOutput(Output* output);
347 void assertActiveness(ModelStackWithTimelineCounter* modelStack, int32_t endInstanceAtTime = -1);
348 [[nodiscard]] bool isClipActive(Clip const* clip) const;
349 void sendAllMIDIPGMs();
350 void sortOutWhichClipsAreActiveWithoutSendingPGMs(ModelStack* modelStack, int32_t playbackWillStartInArrangerAtPos);
351 void deactivateAnyArrangementOnlyClips();
352 Clip* getLongestClip(bool includePlayDisabled, bool includeArrangementOnly);
353 Clip* getLongestActiveClipWithMultipleOrFactorLength(int32_t targetLength, bool revertToAnyActiveClipIfNone = true,
354 Clip* excludeClip = nullptr);
355 int32_t getOutputIndex(Output* output);
356 void setHibernatingMIDIInstrument(MIDIInstrument* newInstrument);
357 void deleteHibernatingMIDIInstrument();
358 MIDIInstrument* grabHibernatingMIDIInstrument(int32_t newSlot, int32_t newSubSlot);
359 NoteRow* findNoteRowForDrum(Kit* kit, Drum* drum, Clip* stopTraversalAtClip = nullptr);
360
361 bool anyOutputsSoloingInArrangement;
362 bool getAnyOutputsSoloingInArrangement();
363 void reassessWhetherAnyOutputsSoloingInArrangement();
364 bool isOutputActiveInArrangement(Output* output);
365 Output* getOutputFromIndex(int32_t index);
366 void ensureAllInstrumentsHaveAClipOrBackedUpParamManager(char const* errorMessageNormal,
367 char const* errorMessageHibernating);
368 Error placeFirstInstancesOfActiveClips(int32_t pos);
369 void endInstancesOfActiveClips(int32_t pos, bool detachClipsToo = false);
370 void clearArrangementBeyondPos(int32_t pos, Action* action);
371 void deletingClipInstanceForClip(Output* output, Clip* clip, Action* action, bool shouldPickNewActiveClip);
372 bool arrangementHasAnyClipInstances();
373 void resumeClipsClonedForArrangementRecording();
374 void setParamsInAutomationMode(bool newState);
375 bool shouldOldOutputBeReplaced(Clip* clip, Availability* availabilityRequirement = nullptr);
376 Output* navigateThroughPresetsForInstrument(Output* output, int32_t offset, Clip* displayClip = nullptr);
377 void instrumentSwapped(Instrument* newInstrument);
378 Instrument* changeOutputType(Instrument* oldInstrument, OutputType newOutputType);
379 AudioOutput* getFirstAudioOutput();
380 AudioOutput* createNewAudioOutput(Output* replaceOutput = nullptr);
382 void getNoteLengthName(StringBuf& buffer, uint32_t noteLength, char const* notesString = "-notes",
383 bool clarifyPerColumn = false) const;
384 void replaceOutputLowLevel(Output* newOutput, Output* oldOutput);
385 void removeSessionClip(Clip* clip, int32_t clipIndex, bool forceClipsAboveToMoveVertically = false);
386 bool deletePendingOverdubs(Output* onlyWithOutput = nullptr, int32_t* originalClipIndex = nullptr,
387 bool createConsequencesForOtherLinearlyRecordingClips = false);
388 Clip* getPendingOverdubWithOutput(Output* output);
389 Clip* getClipWithOutputAboutToBeginLinearRecording(Output* output);
390 Clip* createPendingNextOverdubBelowClip(Clip* clip, int32_t clipIndex, OverDubType newOverdubNature);
391 bool hasAnyPendingNextOverdubs();
392 Output* getNextAudioOutput(int32_t offset, Output* oldOutput, Availability availabilityRequirement);
393 void deleteOutput(Output* output);
394 void clearRecordingFromReferencesTo(Output* output);
395 void retargetRecordingFromReferences(Output* oldOutput, Output* newOutput);
396 void cullAudioClipVoice();
397 int32_t getYScrollSongViewWithoutPendingOverdubs();
398 int32_t removeOutputFromMainList(Output* output, bool stopAnyAuditioningFirst = true);
399 void swapClips(Clip* newClip, Clip* oldClip, int32_t clipIndex);
400 Clip* replaceInstrumentClipWithAudioClip(Clip* oldClip, int32_t clipIndex);
401 void setDefaultVelocityForAllInstruments(uint8_t newDefaultVelocity);
402 void midiCableBendRangeUpdatedViaMessage(ModelStack* modelStack, MIDICable& cable, int32_t channelOrZone,
403 int32_t whichBendRange, int32_t bendSemitones);
404 Error addInstrumentsToFileItems(OutputType outputType);
405
406 uint32_t getQuarterNoteLength();
407 uint32_t getBarLength();
408 uint32_t getSixteenthNoteLength();
409 ModelStackWithThreeMainThings* setupModelStackWithSongAsTimelineCounter(void* memory);
410 ModelStackWithTimelineCounter* setupModelStackWithCurrentClip(void* memory);
411 ModelStackWithThreeMainThings* addToModelStack(ModelStack* modelStack);
414 ModelStackWithAutoParam* getModelStackWithParam(ModelStackWithThreeMainThings* modelStack, int32_t paramID);
415
416 // TimelineCounter implementation
417 [[nodiscard]] int32_t getLastProcessedPos() const override;
418 [[nodiscard]] uint32_t getLivePos() const override;
419 [[nodiscard]] int32_t getLoopLength() const override;
420 [[nodiscard]] bool isPlayingAutomationNow() const override;
421 [[nodiscard]] bool backtrackingCouldLoopBackToEnd() const override;
422 [[nodiscard]] int32_t getPosAtWhichPlaybackWillCut(ModelStackWithTimelineCounter const* modelStack) const override;
423 void getActiveModControllable(ModelStackWithTimelineCounter* modelStack) override;
424 void expectEvent() override;
425 TimelineCounter* getTimelineCounterToRecordTo() override;
426
427 // Reverb params to be stored here between loading and song being made the active one
428 dsp::Reverb::Model model;
429 float reverbRoomSize;
430 float reverbHPF;
431 float reverbLPF;
432 float reverbDamp;
433 float reverbWidth;
434 int32_t reverbPan;
435 int32_t reverbSidechainVolume;
436 int32_t reverbSidechainShape;
437 int32_t reverbSidechainAttack;
438 int32_t reverbSidechainRelease;
439 SyncLevel reverbSidechainSync;
440
441 // START ~ new Automation Arranger View Variables
442 int32_t lastSelectedParamID; // last selected Parameter to be edited in Automation Arranger View
444 lastSelectedParamKind; // 0 = patched, 1 = unpatched, 2 = global effectable, 3 = none
445 int32_t lastSelectedParamShortcutX;
446 int32_t lastSelectedParamShortcutY;
447 int32_t lastSelectedParamArrayPosition;
448 // END ~ new Automation Arranger View Variables
449
450 // Song level transpose control (encoder actions)
451 void commandTranspose(int32_t interval);
452 int32_t masterTransposeInterval = 0;
453 void transpose(int32_t interval);
454 void adjustMasterTransposeInterval(int32_t interval);
455 void displayMasterTransposeInterval();
456
457 // MIDI controlled song transpose
458 bool hasBeenTransposed = 0;
459 int16_t transposeOffset = 0;
460
461 int32_t countAudioVoices() const;
462
463 // Chord memory
464 uint8_t chordMemNoteCount[kDisplayHeight] = {0};
465 uint8_t chordMem[kDisplayHeight][MAX_NOTES_CHORD_MEM] = {0};
466
467 // Tempo automation
468 void clearTempoAutomation();
469 void updateBPMFromAutomation();
470
471 float calculateBPM() {
472 float timePerTimerTick = getTimePerTimerTickFloat();
473 return calculateBPM(timePerTimerTick);
474 }
475 float calculateBPM(float timePerTimerTick) {
476
477 if (insideWorldTickMagnitude > 0) {
478 timePerTimerTick *= ((uint32_t)1 << (insideWorldTickMagnitude));
479 }
480 float tempoBPM = (float)110250 / timePerTimerTick;
481 if (insideWorldTickMagnitude < 0) {
482 tempoBPM *= ((uint32_t)1 << (-insideWorldTickMagnitude));
483 }
484 return tempoBPM;
485 }
486
487 int8_t defaultAudioClipOverdubOutputCloning = -1; // -1 means no default set
488
489 // Threshold
490 void changeThresholdRecordingMode(int8_t offset);
491 void displayThresholdRecordingMode();
492 ThresholdRecordingMode thresholdRecordingMode;
493
494private:
495 void changeRootNote(int32_t newRootNote, InstrumentClip* clipToAvoidAdjustingScrollFor,
496 InstrumentClip* clipEnteringScaleMode);
497 ScaleMapper scaleMapper;
498 NoteSet userScaleNotes;
499 bool fillModeActive;
500 Clip* currentClip = nullptr;
501 Clip* previousClip = nullptr; // for future use, maybe finding an instrument clip or something
502 void inputTickScalePotentiallyJustChanged(uint32_t oldScale);
503 Error readClipsFromFile(Deserializer& reader, ClipArray* clipArray);
504 void addInstrumentToHibernationList(Instrument* instrument);
505 void deleteAllBackedUpParamManagers(bool shouldAlsoEmptyVector = true);
506 void deleteAllBackedUpParamManagersWithClips();
507 void deleteAllOutputs(Output** prevPointer);
508 void setupClipIndexesForSaving();
509 void setBPMInner(float tempoBPM, bool shouldLogAction);
510 void clearTempoAutomation(float tempoBPM);
511 int32_t intBPM{0};
512};
513
514extern Song* currentSong;
515extern Song* preLoadedSong;
516// preLoadedSong is published while it is still being built (code that runs during loading looks at it), so a swap to it
517// must also wait for this, which the loader sets once the Song is complete. Cleared by doSongSwap().
518extern bool preLoadedSongIsComplete;
Definition action.h:78
Definition arpeggiator.h:49
Definition audio_clip.h:35
Definition audio_output.h:37
Definition clip_array.h:25
Definition clip.h:46
Definition drum.h:44
Definition global_effectable_for_song.h:22
Definition instrument_clip.h:52
Definition instrument.h:45
Definition kit.h:34
Definition learned_midi.h:30
A MIDI cable connection. Stores all state specific to a given cable and its contained ports and chann...
Definition midi_device.h:96
Definition midi_instrument.h:38
Definition mod_controllable_audio.h:47
Definition model_stack.h:129
Definition model_stack.h:123
Definition musical_key.h:10
Definition note_row.h:106
Definition note_set.h:20
Definition ordered_resizeable_array_with_multi_word_key.h:25
Definition output.h:81
Definition param_manager.h:156
Definition param_manager.h:45
This class represents the colour format most used by the Deluge globally.
Definition rgb.h:14
Definition scale_change.h:24
Definition song.h:78
Definition song.h:112
Scale getCurrentScale()
Returns current scale.
Definition song.cpp:3162
deluge::note_locks::Pool noteLocks
Parameter-lock sets for every Note in this Song's clips (Note::lockSet indexes into this)....
Definition song.h:118
Scale setScale(Scale newScale)
Returns CUSTOM_SCALE_WITH_MORE_THAN_7_NOTES we can't use the newScale.
Definition song.cpp:3094
void learnScaleFromCurrentNotes()
Learns a user scale from notes in scale mode clips.
NoteSet anchorsInScaleModeClips(const MusicalKey &lineageKey, InstrumentClip *clipToSkip=nullptr)
Definition song.cpp:621
ModelStackWithAutoParam * getModelStackWithParam(ModelStackWithThreeMainThings *modelStack, int32_t paramID)
Definition song.cpp:6150
void setRootNote(int32_t newRootNote, InstrumentClip *clipToAvoidAdjustingScrollFor=nullptr)
Definition song.cpp:631
bool hasUserScale()
Returns true if the song has a user scale.
Definition song.cpp:3158
void getNoteLengthName(StringBuf &buffer, uint32_t noteLength, char const *notesString="-notes", bool clarifyPerColumn=false) const
buffer must have at least 5 characters on 7seg, or 30 for OLED
Definition song.cpp:5390
NoteSet notesInScaleModeClips()
Definition song.cpp:611
int32_t getLastProcessedPos() const override
Get the tick at which this timeline counter last did anything.
Definition song.cpp:5910
void changeMusicalMode(uint8_t yVisualWithinOctave, int8_t change)
Flattens or sharpens one degree of the scale in all scale mode clips. Accidentals keep their pitch.
Definition song.cpp:752
bool setScaleNotes(NoteSet newScale)
Definition song.cpp:3107
uint32_t getLivePos() const override
Get the current tick of this timeline counter relative to the playback handler.
Definition song.cpp:5898
Scale cycleThroughScales()
Changes to next applicable scale.
Definition song.cpp:3078
void setRootNoteForClipEnteringScaleMode(int32_t newRootNote, InstrumentClip *clip)
Definition song.cpp:635
void rotateMusicalMode(int8_t change, int32_t pendingTranspose=0)
Definition song.cpp:699
void replaceMusicalMode(const ScaleChange &changes, bool affectMIDITranspose, deluge::accidentals::AccidentalHandling accidentalHandling, int32_t pendingTranspose=0)
Definition song.cpp:721
Definition sound_drum.h:28
Definition sound_instrument.h:30
Definition d_stringbuf.h:16
Definition d_string.h:41
The lock sets of every Note in one Song (or of the notes on the clipboard). Sets are only ever added.
Definition note_locks.h:113
Definition instrument_clip.h:46
AccidentalHandling
What a scale change which shifts scale degrees does with accidentals.
Definition accidentals.h:41
Kind
Definition param.h:42
Definition song.h:89
Definition song.h:105