Deluge Firmware 1.3.0
Build date: 2025.04.16
Loading...
Searching...
No Matches
Song Class Referencefinal
Inheritance diagram for Song:
Collaboration diagram for Song:

Public Member Functions

bool mayDoubleTempo ()
 
bool ensureAtLeastOneSessionClip ()
 
void transposeAllScaleModeClips (int32_t interval)
 
void transposeAllScaleModeClips (int32_t offset, bool chromatic)
 
bool anyScaleModeClips ()
 
void changeMusicalMode (uint8_t yVisualWithinOctave, int8_t change)
 
void rotateMusicalMode (int8_t change)
 
void replaceMusicalMode (const ScaleChange &changes, bool affectMIDITranspose)
 
int32_t getYVisualFromYNote (int32_t yNote, bool inKeyMode)
 
int32_t getYVisualFromYNote (int32_t yNote, bool inKeyMode, const MusicalKey &key)
 
int32_t getYNoteFromYVisual (int32_t yVisual, bool inKeyMode)
 
int32_t getYNoteFromYVisual (int32_t yVisual, bool inKeyMode, const MusicalKey &key)
 
bool mayMoveModeNote (int16_t yVisualWithinOctave, int8_t newOffset)
 
ParamManagerForTimelinefindParamManagerForDrum (Kit *kit, Drum *drum, Clip *stopTraversalAtClip=nullptr)
 
void setupPatchingForAllParamManagersForDrum (SoundDrum *drum)
 
void setupPatchingForAllParamManagersForInstrument (SoundInstrument *sound)
 
void grabVelocityToLevelFromMIDICableAndSetupPatchingForAllParamManagersForInstrument (MIDICable &cable, SoundInstrument *instrument)
 
void grabVelocityToLevelFromMIDICableAndSetupPatchingForAllParamManagersForDrum (MIDICable &cable, SoundDrum *drum, Kit *kit)
 
void grabVelocityToLevelFromMIDICableAndSetupPatchingForEverything (MIDICable &cable)
 
void getCurrentRootNoteAndScaleName (StringBuf &buffer)
 
void displayCurrentRootNoteAndScaleName ()
 
Scale cycleThroughScales ()
 Changes to next applicable scale.
 
Scale getCurrentScale ()
 Returns current scale.
 
Scale setScale (Scale newScale)
 Returns CUSTOM_SCALE_WITH_MORE_THAN_7_NOTES we can't use the newScale.
 
bool setScaleNotes (NoteSet newScale)
 
void learnScaleFromCurrentNotes ()
 Learns a user scale from notes in scale mode clips.
 
bool hasUserScale ()
 Returns true if the song has a user scale.
 
void setRootNote (int32_t newRootNote, InstrumentClip *clipToAvoidAdjustingScrollFor=nullptr)
 
NoteSet notesInScaleModeClips ()
 Returns a NoteSet with all notes currently in used in scale mdoe clips.
 
void setTempoFromNumSamples (double newTempoSamples, bool shouldLogAction)
 
void setupDefault ()
 
void setBPM (float tempoBPM, bool shouldLogAction)
 
void setTempoFromParams (int32_t magnitude, int8_t whichValue, bool shouldLogAction)
 
void deleteSoundsWhichWontSound ()
 
void writeTemplateSong (const char *templateSong)
 
void deleteClipObject (Clip *clip, bool songBeingDestroyedToo=false, InstrumentRemoval instrumentRemovalInstruction=InstrumentRemoval::DELETE_OR_HIBERNATE_IF_UNUSED)
 
int32_t getMaxMIDIChannelSuffix (int32_t channel)
 
void addOutput (Output *output, bool atStart=true)
 
void deleteOutputThatIsInMainList (Output *output, bool stopAnyAuditioningFirst=true)
 
void markAllInstrumentsAsEdited ()
 
InstrumentgetInstrumentFromPresetSlot (OutputType outputType, int32_t presetNumber, int32_t presetSubSlotNumber, char const *name, char const *dirPath, bool searchHibernatingToo=true, bool searchNonHibernating=true)
 
AudioOutputgetAudioOutputFromName (String *name)
 
void setupPatchingForAllParamManagers ()
 
void replaceInstrument (Instrument *oldInstrument, Instrument *newInstrument, bool keepNoteRowsWithMIDIInput=true)
 
void stopAllMIDIAndGateNotesPlaying ()
 
void stopAllAuditioning ()
 
void deleteOrHibernateOutput (Output *output)
 
InstrumentgetNonAudioInstrumentToSwitchTo (OutputType newOutputType, Availability availabilityRequirement, int16_t newSlot, int8_t newSubSlot, bool *instrumentWasAlreadyInSong)
 
void removeSessionClipLowLevel (Clip *clip, int32_t clipIndex)
 
void changeSwingInterval (int32_t newValue)
 
int32_t convertSyncLevelFromFileValueToInternalValue (int32_t fileValue)
 
int32_t convertSyncLevelFromInternalValueToFileValue (int32_t internalValue)
 
String getSongFullPath ()
 
void setSongFullPath (const char *fullPath)
 
int32_t getInputTickMagnitude () const
 
bool getAnyClipsSoloing () const
 
ClipgetCurrentClip ()
 
void setCurrentClip (Clip *clip)
 
uint32_t getInputTickScale ()
 
ClipgetSyncScalingClip ()
 
void setInputTickScaleClip (Clip *clip)
 
bool isFillModeActive ()
 
void changeFillMode (bool on)
 
void loadNextSong ()
 
void setClipLength (Clip *clip, uint32_t newLength, Action *action, bool mayReSyncClip=true)
 
void doubleClipLength (InstrumentClip *clip, Action *action=nullptr)
 
ClipgetClipWithOutput (Output *output, bool mustBeActive=false, Clip *excludeClip=nullptr)
 
Error readFromFile (Deserializer &reader)
 
void writeToFile ()
 
void loadAllSamples (bool mayActuallyReadFiles=true)
 
void renderAudio (std::span< StereoSample > outputBuffer, int32_t *reverbBuffer, int32_t sideChainHitPending)
 
bool isYNoteAllowed (int32_t yNote, bool inKeyMode)
 
void setTimePerTimerTick (uint64_t newTimeBig, bool shouldLogAction=false)
 
bool hasAnySwing ()
 
void resyncLFOs ()
 
void ensureInaccessibleParamPresetValuesWithoutKnobsAreZero (Sound *sound)
 
bool areAllClipsInSectionPlaying (int32_t section)
 
void removeYNoteFromMode (int32_t yNoteWithinOctave)
 
void turnSoloingIntoJustPlaying (bool getRidOfArmingToo=true)
 
void reassessWhetherAnyClipsSoloing ()
 
float getTimePerTimerTickFloat ()
 
uint32_t getTimePerTimerTickRounded ()
 
int32_t getNumOutputs ()
 
ClipgetNextSessionClipWithOutput (int32_t offset, Output *output, Clip *prevClip)
 
ParamManagergetBackedUpParamManagerForExactClip (ModControllableAudio *modControllable, Clip *clip, ParamManager *stealInto=nullptr)
 
ParamManagergetBackedUpParamManagerPreferablyWithClip (ModControllableAudio *modControllable, Clip *clip, ParamManager *stealInto=nullptr)
 
void backUpParamManager (ModControllableAudio *modControllable, Clip *clip, ParamManagerForTimeline *paramManager, bool shouldStealExpressionParamsToo=false)
 
void moveInstrumentToHibernationList (Instrument *instrument)
 
void deleteOrHibernateOutputIfNoClips (Output *output)
 
void removeInstrumentFromHibernationList (Instrument *instrument)
 
bool doesOutputHaveActiveClipInSession (Output *output)
 
bool doesNonAudioSlotHaveActiveClipInSession (OutputType outputType, int32_t slot, int32_t subSlot=-1)
 
bool doesOutputHaveAnyClips (Output *output)
 
void deleteBackedUpParamManagersForClip (Clip *clip)
 
void deleteBackedUpParamManagersForModControllable (ModControllableAudio *modControllable)
 
void deleteHibernatingInstrumentWithSlot (OutputType outputType, char const *name)
 
void loadCrucialSamplesOnly ()
 
ClipgetSessionClipWithOutput (Output *output, int32_t requireSection=-1, Clip *excludeClip=nullptr, int32_t *clipIndex=nullptr, bool excludePendingOverdubs=false)
 
void restoreClipStatesBeforeArrangementPlay ()
 
void deleteOrAddToHibernationListOutput (Output *output)
 
int32_t getLowestSectionWithNoSessionClipForOutput (Output *output)
 
void assertActiveness (ModelStackWithTimelineCounter *modelStack, int32_t endInstanceAtTime=-1)
 
bool isClipActive (Clip const *clip) const
 
void sendAllMIDIPGMs ()
 
void sortOutWhichClipsAreActiveWithoutSendingPGMs (ModelStack *modelStack, int32_t playbackWillStartInArrangerAtPos)
 
void deactivateAnyArrangementOnlyClips ()
 
ClipgetLongestClip (bool includePlayDisabled, bool includeArrangementOnly)
 
ClipgetLongestActiveClipWithMultipleOrFactorLength (int32_t targetLength, bool revertToAnyActiveClipIfNone=true, Clip *excludeClip=nullptr)
 
int32_t getOutputIndex (Output *output)
 
void setHibernatingMIDIInstrument (MIDIInstrument *newInstrument)
 
void deleteHibernatingMIDIInstrument ()
 
MIDIInstrumentgrabHibernatingMIDIInstrument (int32_t newSlot, int32_t newSubSlot)
 
NoteRowfindNoteRowForDrum (Kit *kit, Drum *drum, Clip *stopTraversalAtClip=nullptr)
 
bool getAnyOutputsSoloingInArrangement ()
 
void reassessWhetherAnyOutputsSoloingInArrangement ()
 
bool isOutputActiveInArrangement (Output *output)
 
OutputgetOutputFromIndex (int32_t index)
 
void ensureAllInstrumentsHaveAClipOrBackedUpParamManager (char const *errorMessageNormal, char const *errorMessageHibernating)
 
Error placeFirstInstancesOfActiveClips (int32_t pos)
 
void endInstancesOfActiveClips (int32_t pos, bool detachClipsToo=false)
 
void clearArrangementBeyondPos (int32_t pos, Action *action)
 
void deletingClipInstanceForClip (Output *output, Clip *clip, Action *action, bool shouldPickNewActiveClip)
 
bool arrangementHasAnyClipInstances ()
 
void resumeClipsClonedForArrangementRecording ()
 
void setParamsInAutomationMode (bool newState)
 
bool shouldOldOutputBeReplaced (Clip *clip, Availability *availabilityRequirement=nullptr)
 
OutputnavigateThroughPresetsForInstrument (Output *output, int32_t offset)
 
void instrumentSwapped (Instrument *newInstrument)
 
InstrumentchangeOutputType (Instrument *oldInstrument, OutputType newOutputType)
 
AudioOutputgetFirstAudioOutput ()
 
AudioOutputcreateNewAudioOutput (Output *replaceOutput=nullptr)
 
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
 
void replaceOutputLowLevel (Output *newOutput, Output *oldOutput)
 
void removeSessionClip (Clip *clip, int32_t clipIndex, bool forceClipsAboveToMoveVertically=false)
 
bool deletePendingOverdubs (Output *onlyWithOutput=nullptr, int32_t *originalClipIndex=nullptr, bool createConsequencesForOtherLinearlyRecordingClips=false)
 
ClipgetPendingOverdubWithOutput (Output *output)
 
ClipgetClipWithOutputAboutToBeginLinearRecording (Output *output)
 
ClipcreatePendingNextOverdubBelowClip (Clip *clip, int32_t clipIndex, OverDubType newOverdubNature)
 
bool hasAnyPendingNextOverdubs ()
 
OutputgetNextAudioOutput (int32_t offset, Output *oldOutput, Availability availabilityRequirement)
 
void deleteOutput (Output *output)
 
void cullAudioClipVoice ()
 
int32_t getYScrollSongViewWithoutPendingOverdubs ()
 
int32_t removeOutputFromMainList (Output *output, bool stopAnyAuditioningFirst=true)
 
void swapClips (Clip *newClip, Clip *oldClip, int32_t clipIndex)
 
ClipreplaceInstrumentClipWithAudioClip (Clip *oldClip, int32_t clipIndex)
 
void setDefaultVelocityForAllInstruments (uint8_t newDefaultVelocity)
 
void midiCableBendRangeUpdatedViaMessage (ModelStack *modelStack, MIDICable &cable, int32_t channelOrZone, int32_t whichBendRange, int32_t bendSemitones)
 
Error addInstrumentsToFileItems (OutputType outputType)
 
uint32_t getQuarterNoteLength ()
 
uint32_t getBarLength ()
 
uint32_t getSixteenthNoteLength ()
 
ModelStackWithThreeMainThingssetupModelStackWithSongAsTimelineCounter (void *memory)
 
ModelStackWithTimelineCountersetupModelStackWithCurrentClip (void *memory)
 
ModelStackWithThreeMainThingsaddToModelStack (ModelStack *modelStack)
 
ModelStackWithAutoParamgetModelStackWithParam (ModelStackWithThreeMainThings *modelStack, int32_t paramID)
 
int32_t getLastProcessedPos () const override
 Get the tick at which this timeline counter last did anything.
 
uint32_t getLivePos () const override
 Get the current tick of this timeline counter relative to the playback handler.
 
int32_t getLoopLength () const override
 
bool isPlayingAutomationNow () const override
 
bool backtrackingCouldLoopBackToEnd () const override
 
int32_t getPosAtWhichPlaybackWillCut (ModelStackWithTimelineCounter const *modelStack) const override
 
void getActiveModControllable (ModelStackWithTimelineCounter *modelStack) override
 
void expectEvent () override
 
TimelineCountergetTimelineCounterToRecordTo () override
 
void transpose (int32_t interval)
 
void adjustMasterTransposeInterval (int32_t interval)
 
void displayMasterTransposeInterval ()
 
int32_t countAudioClips () const
 
void clearTempoAutomation ()
 
void updateBPMFromAutomation ()
 
float calculateBPM ()
 
float calculateBPM (float timePerTimerTick)
 
void changeThresholdRecordingMode (int8_t offset)
 
void displayThresholdRecordingMode ()
 
- Public Member Functions inherited from TimelineCounter
virtual bool possiblyCloneForArrangementRecording (ModelStackWithTimelineCounter *modelStack)
 
virtual void instrumentBeenEdited ()
 

Public Attributes

GlobalEffectableForSong globalEffectable
 
ClipArray sessionClips
 
ClipArray arrangementOnlyClips
 
OutputfirstOutput = nullptr
 
InstrumentfirstHibernatingInstrument
 
OrderedResizeableArrayWithMultiWordKey backedUpParamManagers
 
uint32_t xZoom [2]
 
int32_t xScroll [2] = {0}
 
int32_t xScrollForReturnToSongView = 0
 
int32_t xZoomForReturnToSongView
 
bool tripletsOn = false
 
uint32_t tripletsLevel
 
uint64_t timePerTimerTickBig
 
int32_t divideByTimePerTimerTick
 
int32_t insideWorldTickMagnitude = FlashStorage::defaultMagnitude
 
int32_t insideWorldTickMagnitudeOffsetFromBPM = 0
 
int8_t swingAmount = 0
 
uint8_t swingInterval = FlashStorage::defaultSwingInterval
 
Section sections [kMaxNumSections]
 
MusicalKey key
 
std::bitset< NUM_PRESET_SCALES > disabledPresetScales = FlashStorage::defaultDisabledPresetScales
 
uint16_t slot = std::numeric_limits<int16_t>::max()
 
int8_t subSlot = -1
 
String name
 
bool affectEntire = false
 
SessionLayoutType sessionLayout = FlashStorage::defaultSessionLayout
 
int32_t songGridScrollX = 0
 
int32_t songGridScrollY = 0
 
int32_t songViewYScroll = 1 - kDisplayHeight
 
int32_t arrangementYScroll = -kDisplayHeight
 
uint8_t sectionToReturnToAfterSongEnd
 
bool wasLastInArrangementEditor
 
int32_t lastClipInstanceEnteredStartPos = -1
 
bool arrangerAutoScrollModeActive = false
 
MIDIInstrumenthibernatingMIDIInstrument = nullptr
 
bool outputClipInstanceListIsCurrentlyInvalid = false
 
bool paramsInAutomationMode = false
 
bool inClipMinderViewOnLoad
 
int32_t unautomatedParamValues [deluge::modulation::params::kMaxNumUnpatchedParams]
 
String dirPath
 
std::array< SessionMacro, 8 > sessionMacros {}
 
ClipsyncScalingClip = nullptr
 
bool anyClipsSoloing = false
 
bool anyOutputsSoloingInArrangement = false
 
dsp::Reverb::Model model = deluge::dsp::Reverb::Model::MUTABLE
 
float reverbRoomSize = 30 / 50.f
 
float reverbHPF = 0
 
float reverbLPF = 1
 
float reverbDamp = 36 / 50.f
 
float reverbWidth = 1
 
int32_t reverbPan = 0
 
int32_t reverbSidechainVolume
 
int32_t reverbSidechainShape = -601295438
 
int32_t reverbSidechainAttack
 
int32_t reverbSidechainRelease
 
SyncLevel reverbSidechainSync = SYNC_LEVEL_8TH
 
int32_t lastSelectedParamID = kNoSelection
 
deluge::modulation::params::Kind lastSelectedParamKind
 
int32_t lastSelectedParamShortcutX = kNoSelection
 
int32_t lastSelectedParamShortcutY = kNoSelection
 
int32_t lastSelectedParamArrayPosition = 0
 
int32_t masterTransposeInterval = 0
 
bool hasBeenTransposed = 0
 
int16_t transposeOffset = 0
 
uint8_t chordMemNoteCount [kDisplayHeight] = {0}
 
uint8_t chordMem [kDisplayHeight][MAX_NOTES_CHORD_MEM] = {0}
 
int8_t defaultAudioClipOverdubOutputCloning = -1
 
ThresholdRecordingMode thresholdRecordingMode = FlashStorage::defaultThresholdRecordingMode
 
- Public Attributes inherited from TimelineCounter
ParamManagerForTimeline paramManager
 
bool armedForRecording {true}
 

Private Member Functions

void inputTickScalePotentiallyJustChanged (uint32_t oldScale)
 
Error readClipsFromFile (Deserializer &reader, ClipArray *clipArray)
 
void addInstrumentToHibernationList (Instrument *instrument)
 
void deleteAllBackedUpParamManagers (bool shouldAlsoEmptyVector=true)
 
void deleteAllBackedUpParamManagersWithClips ()
 
void deleteAllOutputs (Output **prevPointer)
 
void setupClipIndexesForSaving ()
 
void setBPMInner (float tempoBPM, bool shouldLogAction)
 
void clearTempoAutomation (float tempoBPM)
 

Private Attributes

ScaleMapper scaleMapper
 
NoteSet userScaleNotes
 
bool fillModeActive = false
 
ClipcurrentClip = nullptr
 
ClippreviousClip = nullptr
 
int32_t intBPM {0}
 

Member Function Documentation

◆ backtrackingCouldLoopBackToEnd()

bool Song::backtrackingCouldLoopBackToEnd ( ) const
nodiscardoverridevirtual

Implements TimelineCounter.

◆ expectEvent()

void Song::expectEvent ( )
overridevirtual

Implements TimelineCounter.

◆ getActiveModControllable()

void Song::getActiveModControllable ( ModelStackWithTimelineCounter * modelStack)
overridevirtual

Implements TimelineCounter.

◆ getLastProcessedPos()

int32_t Song::getLastProcessedPos ( ) const
nodiscardoverridevirtual

Get the tick at which this timeline counter last did anything.

Implements TimelineCounter.

◆ getLivePos()

uint32_t Song::getLivePos ( ) const
nodiscardoverridevirtual

Get the current tick of this timeline counter relative to the playback handler.

Implements TimelineCounter.

◆ getLoopLength()

int32_t Song::getLoopLength ( ) const
nodiscardoverridevirtual

Implements TimelineCounter.

◆ getModelStackWithParam()

ModelStackWithAutoParam * Song::getModelStackWithParam ( ModelStackWithThreeMainThings * modelStack,
int32_t paramID )

Gets a modelstack with the song-global unpatched param paramID. used in performance view and in automation arranger view

◆ getPosAtWhichPlaybackWillCut()

int32_t Song::getPosAtWhichPlaybackWillCut ( ModelStackWithTimelineCounter const * modelStack) const
nodiscardoverridevirtual

Implements TimelineCounter.

◆ getTimelineCounterToRecordTo()

TimelineCounter * Song::getTimelineCounterToRecordTo ( )
overridevirtual

Implements TimelineCounter.

◆ isPlayingAutomationNow()

bool Song::isPlayingAutomationNow ( ) const
nodiscardoverridevirtual

Implements TimelineCounter.

◆ setRootNote()

void Song::setRootNote ( int32_t newRootNote,
InstrumentClip * clipToAvoidAdjustingScrollFor = nullptr )

Sets root note of key. If the previous scale no longer fits, changes to a new implied scale, which can result in a new user scale being set.

◆ setScale()

Scale Song::setScale ( Scale newScale)

Returns CUSTOM_SCALE_WITH_MORE_THAN_7_NOTES we can't use the newScale.

Changes to requested scale, will return the scale if successfull, or NO_SCALE if change could not be completed.

◆ setScaleNotes()

bool Song::setScaleNotes ( NoteSet newScale)

Changes scale to the requested notes. Returns true if successful. If the notes are not a preset scale, defines the scale as the new user scale.

Member Data Documentation

◆ firstHibernatingInstrument

Instrument* Song::firstHibernatingInstrument
Initial value:
=
nullptr

◆ lastSelectedParamKind

deluge::modulation::params::Kind Song::lastSelectedParamKind
Initial value:
=
deluge::modulation::params::Kind::NONE

The documentation for this class was generated from the following files: