tracktion-engine 3.0-10-g034fdde4aa5
Tracktion Engine — High level data model for audio applications

« « « Anklang Documentation
Loading...
Searching...
No Matches
Classes | Public Types | Public Member Functions | Static Public Member Functions | Public Attributes | Static Public Attributes | List of all members
tracktion::engine::MidiList Class Reference

Classes

struct  EventDelegate< MidiControllerEvent >
 
struct  EventDelegate< MidiNote >
 
struct  EventDelegate< MidiSysexEvent >
 

Public Types

enum class  NoteAutomationType { none , expression }
 
enum class  TimeBase { seconds , beats , beatsRaw }
 Determines MIDI event timing. More...
 

Public Member Functions

 MidiList (const juce::ValueTree &, juce::UndoManager *)
 
void copyFrom (const MidiList &, juce::UndoManager *)
 Clears the current list and copies the others contents and properties.
 
void addFrom (const MidiList &, juce::UndoManager *)
 Adds copies of the events in another list to this one.
 
const juce::Array< MidiNote * > & getNotes () const
 
const juce::Array< MidiControllerEvent * > & getControllerEvents () const
 
const juce::Array< MidiSysexEvent * > & getSysexEvents () const
 
bool isAttachedToClip () const noexcept
 
void setCompList (bool shouldBeComp) noexcept
 
bool isCompList () const noexcept
 
MidiChannel getMidiChannel () const
 Gets the list's midi channel number.
 
void setMidiChannel (MidiChannel chanNum)
 Gives the list a channel number that it'll use when generating real midi messages.
 
juce::String getImportedMidiTrackName () const noexcept
 If the data was pulled from a midi file then this may have a useful name describing its purpose.
 
juce::String getImportedFileName () const noexcept
 Set the imported file name if you want it to appear on the clip.
 
void setImportedFileName (const juce::String &n)
 
bool isEmpty () const noexcept
 
void clear (juce::UndoManager *)
 
void trimOutside (BeatPosition firstBeat, BeatPosition lastBeat, juce::UndoManager *)
 
void moveAllBeatPositions (BeatDuration deltaBeats, juce::UndoManager *)
 
void rescale (double factor, juce::UndoManager *)
 
int getNumNotes () const
 
MidiNotegetNote (int index) const
 
MidiNotegetNoteFor (const juce::ValueTree &)
 
juce::Range< intgetNoteNumberRange () const
 
BeatPosition getFirstBeatNumber () const
 Beat number of first event in the list.
 
BeatPosition getLastBeatNumber () const
 Beat number of last event in the list.
 
MidiNoteaddNote (const MidiNote &, juce::UndoManager *)
 
MidiNoteaddNote (int pitch, BeatPosition startBeat, BeatDuration lengthInBeats, int velocity, int colourIndex, juce::UndoManager *)
 
void removeNote (MidiNote &, juce::UndoManager *)
 
void removeAllNotes (juce::UndoManager *)
 
int getNumControllerEvents () const
 
MidiControllerEventgetControllerEvent (int index) const
 
MidiControllerEventgetControllerEventAt (BeatPosition, int controllerType) const
 
MidiControllerEventaddControllerEvent (const MidiControllerEvent &, juce::UndoManager *)
 
MidiControllerEventaddControllerEvent (BeatPosition, int controllerType, int controllerValue, juce::UndoManager *)
 
MidiControllerEventaddControllerEvent (BeatPosition, int controllerType, int controllerValue, int metadata, juce::UndoManager *)
 
void removeControllerEvent (MidiControllerEvent &, juce::UndoManager *)
 
void removeAllControllers (juce::UndoManager *)
 
bool containsController (int controllerType) const
 True if there are any controller events of this type.
 
void setControllerValueAt (int controllerType, BeatPosition beatNumber, int newValue, juce::UndoManager *)
 
void removeControllersBetween (int controllerType, BeatPosition beatNumberStart, BeatPosition beatNumberEnd, juce::UndoManager *)
 
void insertRepeatedControllerValue (int type, int startVal, int endVal, BeatRange rangeBeats, BeatDuration intervalBeats, juce::UndoManager *)
 Adds controller values over a specified time, at an even interval.
 
int getNumSysExEvents () const
 
MidiSysexEventgetSysexEvent (int index) const
 
MidiSysexEventgetSysexEventUnchecked (int index) const
 
MidiSysexEventgetSysexEventFor (const juce::ValueTree &) const
 
MidiSysexEventaddSysExEvent (const juce::MidiMessage &, BeatPosition, juce::UndoManager *)
 
void removeSysExEvent (const MidiSysexEvent &, juce::UndoManager *)
 
void removeAllSysexes (juce::UndoManager *)
 
void importMidiSequence (const juce::MidiMessageSequence &, Edit *, TimePosition editTimeOfListTimeZero, juce::UndoManager *)
 Adds the contents of a MidiMessageSequence to this list.
 
void importFromEditTimeSequenceWithNoteExpression (const juce::MidiMessageSequence &, Edit *, TimePosition editTimeOfListTimeZero, juce::UndoManager *)
 Adds the contents of a MidiSequence to this list assigning MPE expression changes to EXP expression.
 
juce::MidiMessageSequence exportToPlaybackMidiSequence (MidiClip &, TimeBase, bool generateMPE) const
 Creates a juce::MidiMessageSequence from the list in order to be played back The sequence will be in terms of edit time, either in seconds or beats.
 

Static Public Member Functions

static juce::ValueTree createMidiList ()
 
static juce::MidiMessageSequence createDefaultPlaybackMidiSequence (const MidiList &, MidiClip &, TimeBase, bool generateMPE)
 Creates the default MIDI playback sequence.
 
static bool looksLikeMPEData (const juce::File &)
 
static bool fileHasTempoChanges (const juce::File &)
 
static bool readSeparateTracksFromFile (const juce::File &, juce::OwnedArray< MidiList > &lists, juce::Array< BeatPosition > &tempoChangeBeatNumbers, juce::Array< double > &bpms, juce::Array< int > &numerators, juce::Array< int > &denominators, BeatDuration &songLength, bool importAsNoteExpression)
 
template<typename Type >
static void sortMidiEventsByTime (juce::Array< Type > &notes)
 
template<typename Type >
static void sortMidiEventsByNoteNumber (juce::Array< Type > &notes)
 

Public Attributes

juce::ValueTree state
 

Static Public Attributes

static constexpr const double defaultInitialTimbreValue
 
static constexpr const double defaultInitialPitchBendValue
 
static constexpr const double defaultInitialPressureValue
 

Detailed Description

Definition at line 16 of file tracktion_MidiList.h.

Member Enumeration Documentation

◆ NoteAutomationType

Enumerator
none 

No automation, add the sequence as plain MIDI with the channel of the clip.

expression 

Add the automation as EXP assuming the source sequence is MPE MIDI.

Definition at line 32 of file tracktion_MidiList.h.

◆ TimeBase

Determines MIDI event timing.

Enumerator
beats 

Event times will be in seconds relative to the Edit timeline.

beatsRaw 

Event times will be in beats relative to the Edit timeline.

Event times will be in beats with no quantisation or groove.

Definition at line 137 of file tracktion_MidiList.h.

Constructor & Destructor Documentation

◆ MidiList() [1/2]

tracktion::engine::MidiList::MidiList ( )

Definition at line 1136 of file tracktion_MidiList.cpp.

◆ MidiList() [2/2]

tracktion::engine::MidiList::MidiList ( const juce::ValueTree v,
juce::UndoManager um 
)

Definition at line 1142 of file tracktion_MidiList.cpp.

◆ ~MidiList()

tracktion::engine::MidiList::~MidiList ( )

Definition at line 1152 of file tracktion_MidiList.cpp.

Member Function Documentation

◆ addControllerEvent() [1/3]

MidiControllerEvent * tracktion::engine::MidiList::addControllerEvent ( BeatPosition  beat,
int  controllerType,
int  controllerValue,
int  metadata,
juce::UndoManager um 
)

Definition at line 1410 of file tracktion_MidiList.cpp.

◆ addControllerEvent() [2/3]

MidiControllerEvent * tracktion::engine::MidiList::addControllerEvent ( BeatPosition  beat,
int  controllerType,
int  controllerValue,
juce::UndoManager um 
)

Definition at line 1403 of file tracktion_MidiList.cpp.

◆ addControllerEvent() [3/3]

MidiControllerEvent * tracktion::engine::MidiList::addControllerEvent ( const MidiControllerEvent event,
juce::UndoManager um 
)

Definition at line 1396 of file tracktion_MidiList.cpp.

◆ addFrom()

void tracktion::engine::MidiList::addFrom ( const MidiList other,
juce::UndoManager um 
)

Adds copies of the events in another list to this one.

Definition at line 1184 of file tracktion_MidiList.cpp.

◆ addNote() [1/2]

MidiNote * tracktion::engine::MidiList::addNote ( const MidiNote note,
juce::UndoManager um 
)

Definition at line 1344 of file tracktion_MidiList.cpp.

◆ addNote() [2/2]

MidiNote * tracktion::engine::MidiList::addNote ( int  pitch,
BeatPosition  startBeat,
BeatDuration  lengthInBeats,
int  velocity,
int  colourIndex,
juce::UndoManager um 
)

Definition at line 1351 of file tracktion_MidiList.cpp.

◆ addSysExEvent()

MidiSysexEvent & tracktion::engine::MidiList::addSysExEvent ( const juce::MidiMessage message,
BeatPosition  beat,
juce::UndoManager um 
)

Definition at line 1511 of file tracktion_MidiList.cpp.

◆ clear()

void tracktion::engine::MidiList::clear ( juce::UndoManager um)

Definition at line 1168 of file tracktion_MidiList.cpp.

◆ containsController()

bool tracktion::engine::MidiList::containsController ( int  controllerType) const

True if there are any controller events of this type.

Definition at line 1387 of file tracktion_MidiList.cpp.

◆ copyFrom()

void tracktion::engine::MidiList::copyFrom ( const MidiList other,
juce::UndoManager um 
)

Clears the current list and copies the others contents and properties.

Definition at line 1174 of file tracktion_MidiList.cpp.

◆ createDefaultPlaybackMidiSequence()

juce::MidiMessageSequence tracktion::engine::MidiList::createDefaultPlaybackMidiSequence ( const MidiList list,
MidiClip clip,
TimeBase  timeBase,
bool  generateMPE 
)
static

Creates the default MIDI playback sequence.

Definition at line 1887 of file tracktion_MidiList.cpp.

◆ createMidiList()

juce::ValueTree tracktion::engine::MidiList::createMidiList ( )
static

Definition at line 1129 of file tracktion_MidiList.cpp.

◆ exportToPlaybackMidiSequence()

juce::MidiMessageSequence tracktion::engine::MidiList::exportToPlaybackMidiSequence ( MidiClip clip,
TimeBase  tb,
bool  generateMPE 
) const

Creates a juce::MidiMessageSequence from the list in order to be played back The sequence will be in terms of edit time, either in seconds or beats.

Parameters
MidiClipThe clip boundries to use and the groove template if the clip contains one
TimeBaseThe format the exported MIDI event times will be in
generateMPEWhether the sequence should create MPE or standard MIDI

Definition at line 1882 of file tracktion_MidiList.cpp.

◆ fileHasTempoChanges()

bool tracktion::engine::MidiList::fileHasTempoChanges ( const juce::File f)
static

Definition at line 1533 of file tracktion_MidiList.cpp.

◆ getControllerEvent()

MidiControllerEvent * tracktion::engine::MidiList::getControllerEvent ( int  index) const

Definition at line 92 of file tracktion_MidiList.h.

◆ getControllerEventAt()

MidiControllerEvent * tracktion::engine::MidiList::getControllerEventAt ( BeatPosition  beatNumber,
int  controllerType 
) const

Definition at line 1372 of file tracktion_MidiList.cpp.

◆ getControllerEvents()

const juce::Array< MidiControllerEvent * > & tracktion::engine::MidiList::getControllerEvents ( ) const

Definition at line 1220 of file tracktion_MidiList.cpp.

◆ getFirstBeatNumber()

BeatPosition tracktion::engine::MidiList::getFirstBeatNumber ( ) const

Beat number of first event in the list.

Definition at line 1296 of file tracktion_MidiList.cpp.

◆ getImportedFileName()

juce::String tracktion::engine::MidiList::getImportedFileName ( ) const
noexcept

Set the imported file name if you want it to appear on the clip.

Definition at line 60 of file tracktion_MidiList.h.

◆ getImportedMidiTrackName()

juce::String tracktion::engine::MidiList::getImportedMidiTrackName ( ) const
noexcept

If the data was pulled from a midi file then this may have a useful name describing its purpose.

Definition at line 57 of file tracktion_MidiList.h.

◆ getLastBeatNumber()

BeatPosition tracktion::engine::MidiList::getLastBeatNumber ( ) const

Beat number of last event in the list.

Definition at line 1307 of file tracktion_MidiList.cpp.

◆ getMidiChannel()

MidiChannel tracktion::engine::MidiList::getMidiChannel ( ) const

Gets the list's midi channel number.

Value is 1 to 16.

Definition at line 51 of file tracktion_MidiList.h.

◆ getNote()

MidiNote * tracktion::engine::MidiList::getNote ( int  index) const

Definition at line 73 of file tracktion_MidiList.h.

◆ getNoteFor()

MidiNote * tracktion::engine::MidiList::getNoteFor ( const juce::ValueTree s)

Definition at line 1318 of file tracktion_MidiList.cpp.

◆ getNoteNumberRange()

juce::Range< int > tracktion::engine::MidiList::getNoteNumberRange ( ) const

Definition at line 1327 of file tracktion_MidiList.cpp.

◆ getNotes()

const juce::Array< MidiNote * > & tracktion::engine::MidiList::getNotes ( ) const

Definition at line 1214 of file tracktion_MidiList.cpp.

◆ getNumControllerEvents()

int tracktion::engine::MidiList::getNumControllerEvents ( ) const

Definition at line 90 of file tracktion_MidiList.h.

◆ getNumNotes()

int tracktion::engine::MidiList::getNumNotes ( ) const

Definition at line 72 of file tracktion_MidiList.h.

◆ getNumSysExEvents()

int tracktion::engine::MidiList::getNumSysExEvents ( ) const

Definition at line 114 of file tracktion_MidiList.h.

◆ getSysexEvent()

MidiSysexEvent * tracktion::engine::MidiList::getSysexEvent ( int  index) const

Definition at line 116 of file tracktion_MidiList.h.

◆ getSysexEventFor()

MidiSysexEvent * tracktion::engine::MidiList::getSysexEventFor ( const juce::ValueTree v) const

Definition at line 1502 of file tracktion_MidiList.cpp.

◆ getSysexEvents()

const juce::Array< MidiSysexEvent * > & tracktion::engine::MidiList::getSysexEvents ( ) const

Definition at line 1226 of file tracktion_MidiList.cpp.

◆ getSysexEventUnchecked()

MidiSysexEvent * tracktion::engine::MidiList::getSysexEventUnchecked ( int  index) const

Definition at line 117 of file tracktion_MidiList.h.

◆ importFromEditTimeSequenceWithNoteExpression()

void tracktion::engine::MidiList::importFromEditTimeSequenceWithNoteExpression ( const juce::MidiMessageSequence sequence,
Edit edit,
TimePosition  editTimeOfListTimeZero,
juce::UndoManager um 
)

Adds the contents of a MidiSequence to this list assigning MPE expression changes to EXP expression.

Definition at line 1815 of file tracktion_MidiList.cpp.

◆ importMidiSequence()

void tracktion::engine::MidiList::importMidiSequence ( const juce::MidiMessageSequence sequence,
Edit edit,
TimePosition  editTimeOfListTimeZero,
juce::UndoManager um 
)

Adds the contents of a MidiMessageSequence to this list.

If an Edit is provided, it'll be used to convert the timestamps from possible seconds to beats

Definition at line 1746 of file tracktion_MidiList.cpp.

◆ insertRepeatedControllerValue()

void tracktion::engine::MidiList::insertRepeatedControllerValue ( int  type,
int  startVal,
int  endVal,
BeatRange  rangeBeats,
BeatDuration  intervalBeats,
juce::UndoManager um 
)

Adds controller values over a specified time, at an even interval.

Definition at line 1452 of file tracktion_MidiList.cpp.

◆ isAttachedToClip()

bool tracktion::engine::MidiList::isAttachedToClip ( ) const
noexcept

Definition at line 44 of file tracktion_MidiList.h.

◆ isCompList()

bool tracktion::engine::MidiList::isCompList ( ) const
noexcept

Definition at line 47 of file tracktion_MidiList.h.

◆ isEmpty()

bool tracktion::engine::MidiList::isEmpty ( ) const
noexcept

Definition at line 64 of file tracktion_MidiList.h.

◆ looksLikeMPEData()

bool tracktion::engine::MidiList::looksLikeMPEData ( const juce::File f)
static

Definition at line 1551 of file tracktion_MidiList.cpp.

◆ moveAllBeatPositions()

void tracktion::engine::MidiList::moveAllBeatPositions ( BeatDuration  deltaBeats,
juce::UndoManager um 
)

Definition at line 1233 of file tracktion_MidiList.cpp.

◆ readSeparateTracksFromFile()

bool tracktion::engine::MidiList::readSeparateTracksFromFile ( const juce::File f,
juce::OwnedArray< MidiList > &  lists,
juce::Array< BeatPosition > &  tempoChangeBeatNumbers,
juce::Array< double > &  bpms,
juce::Array< int > &  numerators,
juce::Array< int > &  denominators,
BeatDuration songLength,
bool  importAsNoteExpression 
)
static

Definition at line 1589 of file tracktion_MidiList.cpp.

◆ removeAllControllers()

void tracktion::engine::MidiList::removeAllControllers ( juce::UndoManager um)

Definition at line 1422 of file tracktion_MidiList.cpp.

◆ removeAllNotes()

void tracktion::engine::MidiList::removeAllNotes ( juce::UndoManager um)

Definition at line 1364 of file tracktion_MidiList.cpp.

◆ removeAllSysexes()

void tracktion::engine::MidiList::removeAllSysexes ( juce::UndoManager um)

Definition at line 1525 of file tracktion_MidiList.cpp.

◆ removeControllerEvent()

void tracktion::engine::MidiList::removeControllerEvent ( MidiControllerEvent e,
juce::UndoManager um 
)

Definition at line 1417 of file tracktion_MidiList.cpp.

◆ removeControllersBetween()

void tracktion::engine::MidiList::removeControllersBetween ( int  controllerType,
BeatPosition  beatNumberStart,
BeatPosition  beatNumberEnd,
juce::UndoManager um 
)

Definition at line 1489 of file tracktion_MidiList.cpp.

◆ removeNote()

void tracktion::engine::MidiList::removeNote ( MidiNote note,
juce::UndoManager um 
)

Definition at line 1359 of file tracktion_MidiList.cpp.

◆ removeSysExEvent()

void tracktion::engine::MidiList::removeSysExEvent ( const MidiSysexEvent event,
juce::UndoManager um 
)

Definition at line 1520 of file tracktion_MidiList.cpp.

◆ rescale()

void tracktion::engine::MidiList::rescale ( double  factor,
juce::UndoManager um 
)

Definition at line 1248 of file tracktion_MidiList.cpp.

◆ setCompList()

void tracktion::engine::MidiList::setCompList ( bool  shouldBeComp)
noexcept

Definition at line 46 of file tracktion_MidiList.h.

◆ setControllerValueAt()

void tracktion::engine::MidiList::setControllerValueAt ( int  controllerType,
BeatPosition  beatNumber,
int  newValue,
juce::UndoManager um 
)

Definition at line 1429 of file tracktion_MidiList.cpp.

◆ setImportedFileName()

void tracktion::engine::MidiList::setImportedFileName ( const juce::String n)

Definition at line 61 of file tracktion_MidiList.h.

◆ setMidiChannel()

void tracktion::engine::MidiList::setMidiChannel ( MidiChannel  chanNum)

Gives the list a channel number that it'll use when generating real midi messages.

Value is 1 to 16.

Definition at line 1191 of file tracktion_MidiList.cpp.

◆ sortMidiEventsByNoteNumber()

template<typename Type >
static void tracktion::engine::MidiList::sortMidiEventsByNoteNumber ( juce::Array< Type > &  notes)
static

Definition at line 182 of file tracktion_MidiList.h.

◆ sortMidiEventsByTime()

template<typename Type >
static void tracktion::engine::MidiList::sortMidiEventsByTime ( juce::Array< Type > &  notes)
static

Definition at line 175 of file tracktion_MidiList.h.

◆ trimOutside()

void tracktion::engine::MidiList::trimOutside ( BeatPosition  firstBeat,
BeatPosition  lastBeat,
juce::UndoManager um 
)

Definition at line 1264 of file tracktion_MidiList.cpp.

Member Data Documentation

◆ defaultInitialPitchBendValue

constexpr const double tracktion::engine::MidiList::defaultInitialPitchBendValue
staticconstexpr

Definition at line 159 of file tracktion_MidiList.h.

◆ defaultInitialPressureValue

constexpr const double tracktion::engine::MidiList::defaultInitialPressureValue
staticconstexpr

Definition at line 160 of file tracktion_MidiList.h.

◆ defaultInitialTimbreValue

constexpr const double tracktion::engine::MidiList::defaultInitialTimbreValue
staticconstexpr

Definition at line 158 of file tracktion_MidiList.h.

◆ state

juce::ValueTree tracktion::engine::MidiList::state

Definition at line 189 of file tracktion_MidiList.h.


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