Deluge Firmware 1.3.0
Build date: 2025.04.16
Loading...
Searching...
No Matches
NoteRow Class Reference

#include <note_row.h>

Collaboration diagram for NoteRow:

Public Member Functions

 NoteRow (int16_t newY=-32768)
 
void renderRow (TimelineView *editorScreen, RGB, RGB, RGB, RGB *image, uint8_t[], bool, uint32_t, bool allowNoteTails, int32_t imageWidth, int32_t xScroll, uint32_t xZoom, int32_t xStart=0, int32_t xEnd=kDisplayWidth, bool drawRepeats=false)
 
void deleteNoteByPos (ModelStackWithNoteRow *modelStack, int32_t pos, Action *action)
 
void stopCurrentlyPlayingNote (ModelStackWithNoteRow *modelStack, bool actuallySoundChange=true, Note *note=nullptr)
 
bool generateRepeats (ModelStackWithNoteRow *modelStack, uint32_t oldLength, uint32_t newLength, int32_t numRepeatsRounded, Action *action)
 
void toggleMute (ModelStackWithNoteRow *modelStack, bool clipIsActiveAndPlaybackIsOn)
 
void maybeStartLateNote (ModelStackWithNoteRow *modelStack, int32_t effectiveActualCurrentPos)
 
bool hasNoNotes ()
 
void resumePlayback (ModelStackWithNoteRow *modelStack, bool clipMayMakeSound)
 
void writeToFile (Serializer &writer, int32_t drumIndex, InstrumentClip *clip)
 
Error readFromFile (Deserializer &reader, int32_t *, InstrumentClip *, Song *song, int32_t readAutomationUpToPos)
 
int32_t getNoteCode ()
 
void writeToFlash ()
 
void readFromFlash (InstrumentClip *parentClip)
 
uint32_t getNumNotes ()
 
void setDrum (Drum *newDrum, Kit *kit, ModelStackWithNoteRow *modelStack, InstrumentClip *favourClipForCloningParamManager=nullptr, ParamManager *paramManager=nullptr, bool backupOldParamManager=true)
 
int32_t getDistanceToNextNote (int32_t pos, ModelStackWithNoteRow const *modelStack, bool reversed=false)
 
uint32_t getLivePos (ModelStackWithNoteRow const *modelStack)
 
bool hasIndependentPlayPos ()
 
int32_t getDefaultProbability ()
 
Iterance getDefaultIterance ()
 
int32_t getDefaultFill (ModelStackWithNoteRow *modelStack)
 
int32_t attemptNoteAdd (int32_t pos, int32_t length, int32_t velocity, int32_t probability, Iterance iterance, int32_t fill, ModelStackWithNoteRow *modelStack, Action *action)
 
int32_t attemptNoteAddReversed (ModelStackWithNoteRow *modelStack, int32_t pos, int32_t velocity, bool allowingNoteTails)
 
Error addCorrespondingNotes (int32_t pos, int32_t length, uint8_t velocity, ModelStackWithNoteRow *modelStack, bool allowNoteTails, Action *action)
 
int32_t processCurrentPos (ModelStackWithNoteRow *modelStack, int32_t ticksSinceLast, PendingNoteOnList *pendingNoteOnList)
 
void initRowSquareInfo (SquareInfo rowSquareInfo[kDisplayWidth], bool anyNotes)
 
void initSquareInfo (SquareInfo &squareInfo, bool anyNotes, int32_t x)
 
void getRowSquareInfo (int32_t effectiveLength, SquareInfo rowSquareInfo[kDisplayWidth])
 get info about squares for display at current zoom level
 
void getSquareInfo (int32_t x, int32_t effectiveLength, SquareInfo &squareInfo)
 get info about the notes in this square at current zoom level
 
void addNotesToSquareInfo (int32_t effectiveLength, SquareInfo &squareInfo, int32_t &noteIndex, Note **note)
 
void calculateSquareAverages (SquareInfo &squareInfo)
 
uint8_t getSquareType (int32_t squareStart, int32_t squareWidth, Note **firstNote, Note **lastNote, ModelStackWithNoteRow *modelStack, bool allowNoteTails, int32_t desiredNoteLength, Action *action, bool clipCurrentlyPlaying, bool extendPreviousNoteIfPossible)
 
Error clearArea (int32_t areaStart, int32_t areaWidth, ModelStackWithNoteRow *modelStack, Action *action, uint32_t wrapEditLevel, bool actuallyExtendNoteAtStartOfArea=false)
 
void trimToLength (uint32_t newLength, ModelStackWithNoteRow *modelStack, Action *action)
 
void trimNoteDataToNewClipLength (uint32_t newLength, InstrumentClip *clip, Action *action, int32_t noteRowId)
 
void recordNoteOff (uint32_t pos, ModelStackWithNoteRow *modelStack, Action *action, int32_t velocity)
 
int8_t getColourOffset (InstrumentClip *clip)
 
void rememberDrumName ()
 
void shiftHorizontally (int32_t amount, ModelStackWithNoteRow *modelStack, bool shiftAutomation, bool shiftSequenceAndMPE)
 
void clear (Action *action, ModelStackWithNoteRow *modelStack, bool clearAutomation, bool clearSequenceAndMPE)
 
bool doesProbabilityExist (int32_t apartFromPos, int32_t probability, int32_t secondProbability=-1)
 
bool paste (ModelStackWithNoteRow *modelStack, CopiedNoteRow *copiedNoteRow, float scaleFactor, int32_t screenEndPos, Action *action)
 
void giveMidiCommandsToDrum ()
 
void grabMidiCommandsFromDrum ()
 
void deleteParamManager (bool shouldUpdatePointer=true)
 
void deleteOldDrumNames (bool shouldUpdatePointer=true)
 
Error appendNoteRow (ModelStackWithNoteRow *thisModelStack, ModelStackWithNoteRow *otherModelStack, int32_t offset, int32_t whichRepeatThisIs, int32_t otherClipLength)
 
Error beenCloned (ModelStackWithNoteRow *modelStack, bool shouldFlattenReversing)
 
void resumeOriginalNoteRowFromThisClone (ModelStackWithNoteRow *modelStackOriginal, ModelStackWithNoteRow *modelStackClone)
 
void silentlyResumePlayback (ModelStackWithNoteRow *modelStack)
 
void trimParamManager (ModelStackWithNoteRow *modelStack)
 
void deleteNoteByIndex (int32_t index, Action *action, int32_t noteRowId, InstrumentClip *clip)
 
void complexSetNoteLength (Note *thisNote, uint32_t newLength, ModelStackWithNoteRow *modelStack, Action *action)
 
Error changeNotesAcrossAllScreens (int32_t editPos, ModelStackWithNoteRow *modelStack, Action *action, int32_t changeType, int32_t changeValue)
 
Error nudgeNotesAcrossAllScreens (int32_t editPos, ModelStackWithNoteRow *modelStack, Action *action, uint32_t wrapEditLevel, int32_t nudgeOffset)
 
Error quantize (ModelStackWithNoteRow *modelStack, int32_t increment, int32_t amount)
 
Error editNoteRepeatAcrossAllScreens (int32_t editPos, int32_t squareWidth, ModelStackWithNoteRow *modelStack, Action *action, uint32_t wrapEditLevel, int32_t newNumNotes)
 
void setLength (ModelStackWithNoteRow *modelStack, int32_t newLength, Action *actionToRecordTo, int32_t oldPos, bool hadIndependentPlayPosBefore)
 
void getMPEValues (ModelStackWithNoteRow *modelStack, int16_t *mpeValues)
 
void clearMPEUpUntilNextNote (ModelStackWithNoteRow *modelStack, int32_t pos, int32_t wrapEditLevel, bool shouldJustDeleteNodes=false)
 
SequenceDirection getEffectiveSequenceDirectionMode (ModelStackWithNoteRow const *modelStack)
 
bool recordPolyphonicExpressionEvent (ModelStackWithNoteRow *modelStackWithNoteRow, int32_t newValueBig, int32_t expressionDimension, bool forDrum)
 
void setSequenceDirectionMode (ModelStackWithNoteRow *modelStack, SequenceDirection newMode)
 
bool isAuditioning (ModelStackWithNoteRow *modelStack)
 
bool isDroning (int32_t effectiveLength)
 

Public Attributes

int16_t y
 
bool muted
 
int32_t loopLengthIfIndependent
 
int32_t lastProcessedPosIfIndependent
 
int32_t repeatCountIfIndependent
 
bool currentlyPlayingReversedIfIndependent
 
SequenceDirection sequenceDirectionMode
 
ParamManagerForTimeline paramManager
 
Drumdrum
 
DrumNamefirstOldDrumName
 
NoteVector notes
 
uint8_t probabilityValue
 
Iterance iteranceValue
 
uint8_t fillValue
 
LearnedMIDI muteMIDICommand
 
LearnedMIDI midiInput
 
int8_t colourOffset
 
bool sequenced
 
uint32_t ignoreNoteOnsBefore_
 

Private Member Functions

void playNote (bool, ModelStackWithNoteRow *modelStack, Note *, int32_t ticksLate=0, uint32_t samplesLate=0, bool noteMightBeConstant=false, PendingNoteOnList *pendingNoteOnList=nullptr)
 
void playNextNote (InstrumentClip *, bool, bool noteMightBeConstant=false, PendingNoteOnList *pendingNoteOnList=nullptr)
 
void findNextNoteToPlay (uint32_t)
 
void attemptLateStartOfNextNoteToPlay (ModelStackWithNoteRow *modelStack, Note *note)
 
bool noteRowMayMakeSound (bool)
 
void drawTail (int32_t startTail, int32_t endTail, uint8_t squareColour[], bool overwriteExisting, uint8_t image[][3], uint8_t occupancyMask[])
 

Private Attributes

bool ignoredNoteOn {false}
 
int32_t ignoreUntil {0}
 
int32_t ignoredTicks {0}
 

Detailed Description

An ordered list of notes which all share the same nominal y value.

In kits, the y value represents the row within the kit directly. In other types of clips, the y value maps to a MIDI pitch value.

Notes within the row must not overlap – the end location of each note (described by note.pos + note.length) must be strictly less than the start location of the next note. The length of the last note in the row can exceed the loop length of this NoteRow (either loopLengthIfIndependent if that value is nonzero, or the loop length of the clip containing this NoteRow).

Member Function Documentation

◆ addNotesToSquareInfo()

void NoteRow::addNotesToSquareInfo ( int32_t effectiveLength,
SquareInfo & squareInfo,
int32_t & noteIndex,
Note ** note )

iterate through a specific square returns whether a note square on the grid is: 1) empty (SQUARE_NO_NOTE) 2) has one note which is aligned to the very first position in the square (SQUARE_NOTE_HEAD) 3) has multiple notes or one note which is not aligned to the very first position (SQUARE_BLURRED) 4) the square is part of a tail of a previous note (SQUARE_NOTE_TAIL) returns number of notes in a square returns average velocity for a square

◆ calculateSquareAverages()

void NoteRow::calculateSquareAverages ( SquareInfo & squareInfo)

calculate average velocity for this square based on info on notes previously obtained by calling NoteRow::getRowSquareInfo or NoteRow::getSquareInfo and NoteRow::addNotesToSquareInfo

◆ isDroning()

bool NoteRow::isDroning ( int32_t effectiveLength)

check to see if this note row has only one note and that note is a drone note drone note = note at position 0 with length equal to the note row's length

◆ nudgeNotesAcrossAllScreens()

Error NoteRow::nudgeNotesAcrossAllScreens ( int32_t editPos,
ModelStackWithNoteRow * modelStack,
Action * action,
uint32_t wrapEditLevel,
int32_t nudgeOffset )

Nudge the note at editPos by either +1 (if nudgeOffset > 0) or -1 (if nudgeOffset < 0)

The caller must call Clip::expectEvent on the clip containing this NoteRow after this.

◆ quantize()

Error NoteRow::quantize ( ModelStackWithNoteRow * modelStack,
int32_t increment,
int32_t amount )

Quantize the notes in this NoteRow so their positions are within (kQuantizationPrecision - amount) * / increment/kQuantizationPrecision of the grid defined by n * increment. If amount is negative, the row is instead "humanized" by jittering the note positions to ±amount * increment / kQuantizationPrecision sequencer ticks of the n * increment grid.

The caller must call Clip::expectEvent on the clip containing this NoteRow after this.

Member Data Documentation

◆ ignoreNoteOnsBefore_

uint32_t NoteRow::ignoreNoteOnsBefore_

Time before which all note events should be ignored during live playback. 0 means all notes should play (i.e. a note event at the time stored here should be allowed to sound). When doing quantized recording, we might have quantized the note to a later point in time so this is used to inhibit re-sounding of the quantized note.

This is always stored in "forward time", so even when playback is reversed this can only be meaningfully be compared with the time since this NoteRow started (i.e., time from the end during reversed playback).


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