Zrythm v2.0.0-DEV
a highly automated and intuitive digital audio workstation
Loading...
Searching...
No Matches
zrythm::structure::arrangement::MidiNote Class Reference

A MIDI note inside a Region shown in the piano roll. More...

#include <src/structure/arrangement/midi_note.h>

Inheritance diagram for zrythm::structure::arrangement::MidiNote:
Collaboration diagram for zrythm::structure::arrangement::MidiNote:

Public Types

enum class  Notation : std::uint8_t { Musical , Pitch }
Public Types inherited from zrythm::structure::arrangement::ArrangerObject
enum class  Type : basic_enum_base_type_t {
  MidiRegion , AudioRegion , ChordRegion , AutomationRegion ,
  MidiNote , ChordObject , ScaleObject , Marker ,
  AutomationPoint , AudioSourceObject , TempoObject , TimeSignatureObject
}
 The type of the object. More...

Public Member Functions

 MidiNote (const dsp::TempoMap &tempo_map, QObject *parent=nullptr)
int pitch () const
void setPitch (int ipitch)
Q_INVOKABLE void shift_pitch (int delta)
 Shifts the pitch by delta amount.
Q_SIGNAL void pitchChanged (int ipitch)
Q_INVOKABLE QString pitchAsRichText () const
int velocity () const
void setVelocity (int ivelocity)
Q_SIGNAL void velocityChanged (int ivelocity)
Public Member Functions inherited from zrythm::structure::arrangement::ArrangerObject
bool is_start_hit_by_range (const units::sample_t frames_start, const units::sample_t frames_end, bool range_start_inclusive=true, bool range_end_inclusive=false) const
auto type () const
dsp::AtomicPositionQmlAdapterposition () const
ArrangerObjectBoundsbounds () const
ArrangerObjectLoopRangeloopRange () const
ArrangerObjectNamename () const
ArrangerObjectColorcolor () const
ArrangerObjectMuteFunctionalitymute () const
ArrangerObjectFadeRangefadeRange () const
Q_SIGNAL void propertiesChanged ()
 Emitted when any of the properties of the object changed.
ArrangerObjectparentObject () const
void setParentObject (ArrangerObject *object)
Q_SIGNAL void parentObjectChanged (QObject *parentObject)
auto & get_tempo_map () const
Public Member Functions inherited from zrythm::utils::UuidIdentifiableObject< ArrangerObject >
UuidIdentifiableObject & operator= (const UuidIdentifiableObject &other)=default
auto get_uuid () const

Static Public Member Functions

static utils::Utf8String pitch_to_string (uint8_t pitch, Notation notation, bool rich_text)
 Gets the MIDI note's value as a string (eg "C#4").

Static Public Attributes

static constexpr midi_byte_t DEFAULT_VELOCITY = 90

Properties

int pitch
int velocity
Properties inherited from zrythm::structure::arrangement::ArrangerObject
QML_ELEMENT zrythm::structure::arrangement::ArrangerObjectparentObject
zrythm::structure::arrangement::ArrangerObject::Type type
zrythm::dsp::AtomicPositionQmlAdapterposition
zrythm::structure::arrangement::ArrangerObjectBoundsbounds
zrythm::structure::arrangement::ArrangerObjectLoopRangeloopRange
zrythm::structure::arrangement::ArrangerObjectNamename
zrythm::structure::arrangement::ArrangerObjectColorcolor
zrythm::structure::arrangement::ArrangerObjectMuteFunctionalitymute
zrythm::structure::arrangement::ArrangerObjectFadeRangefadeRange

Friends

template<RangeOfMidiNotePointers Range>
MidiNote * get_first_midi_note (const Range &range)
 Returns the note starting first, or nullptr.
template<RangeOfMidiNotePointers Range>
MidiNote * get_last_midi_note (const Range &range)
 Gets last midi note.
template<RangeOfMidiNotePointers Range>
auto get_pitch_range (const Range &range) -> std::optional< std::pair< midi_byte_t, midi_byte_t > >
 Returns the minimum and maximum pitches in the given range.
void init_from (MidiNote &obj, const MidiNote &other, utils::ObjectCloneType clone_type)
void to_json (nlohmann::json &j, const MidiNote &note)
void from_json (const nlohmann::json &j, MidiNote &note)

Additional Inherited Members

Protected Types inherited from zrythm::structure::arrangement::ArrangerObject
enum class  ArrangerObjectFeatures : std::uint8_t {
  Bounds = 1 << 0 , LoopingBit = 1 << 1 , Name = 1 << 2 , Color = 1 << 3 ,
  Mute = 1 << 4 , Fading = 1 << 5 , Looping = LoopingBit | Bounds , Region = Looping | Name | Color | Mute
}
Protected Member Functions inherited from zrythm::structure::arrangement::ArrangerObject
 ArrangerObject (Type type, const dsp::TempoMap &tempo_map, ArrangerObjectFeatures features, QObject *parent=nullptr) noexcept
 Construct a new ArrangerObject.

Detailed Description

A MIDI note inside a Region shown in the piano roll.

Definition at line 19 of file midi_note.h.

Member Enumeration Documentation

◆ Notation

enum class zrythm::structure::arrangement::MidiNote::Notation : std::uint8_t
strong

Definition at line 34 of file midi_note.h.

Member Function Documentation

◆ pitch()

int zrythm::structure::arrangement::MidiNote::pitch ( ) const
inline

Definition at line 44 of file midi_note.h.

◆ pitch_to_string()

utils::Utf8String zrythm::structure::arrangement::MidiNote::pitch_to_string ( uint8_t pitch,
Notation notation,
bool rich_text )
static

Gets the MIDI note's value as a string (eg "C#4").

Parameters
rich_textUse QML rich text to show the octave as a superscript.

◆ pitchAsRichText()

Q_INVOKABLE QString zrythm::structure::arrangement::MidiNote::pitchAsRichText ( ) const
inline

Definition at line 63 of file midi_note.h.

◆ setPitch()

void zrythm::structure::arrangement::MidiNote::setPitch ( int ipitch)
inline

Definition at line 45 of file midi_note.h.

◆ setVelocity()

void zrythm::structure::arrangement::MidiNote::setVelocity ( int ivelocity)
inline

Definition at line 69 of file midi_note.h.

◆ shift_pitch()

Q_INVOKABLE void zrythm::structure::arrangement::MidiNote::shift_pitch ( int delta)
inline

Shifts the pitch by delta amount.

Definition at line 58 of file midi_note.h.

◆ velocity()

int zrythm::structure::arrangement::MidiNote::velocity ( ) const
inline

Definition at line 68 of file midi_note.h.

◆ from_json

void from_json ( const nlohmann::json & j,
MidiNote & note )
friend

Definition at line 150 of file midi_note.h.

◆ get_first_midi_note

template<RangeOfMidiNotePointers Range>
MidiNote * get_first_midi_note ( const Range & range)
friend

Returns the note starting first, or nullptr.

Definition at line 96 of file midi_note.h.

◆ get_last_midi_note

template<RangeOfMidiNotePointers Range>
MidiNote * get_last_midi_note ( const Range & range)
friend

Gets last midi note.

Definition at line 108 of file midi_note.h.

◆ get_pitch_range

template<RangeOfMidiNotePointers Range>
auto get_pitch_range ( const Range & range) ->std::optional< std::pair< midi_byte_t, midi_byte_t > >
friend

Returns the minimum and maximum pitches in the given range.

Definition at line 125 of file midi_note.h.

◆ to_json

void to_json ( nlohmann::json & j,
const MidiNote & note )
friend

Definition at line 144 of file midi_note.h.

Field Documentation

◆ DEFAULT_VELOCITY

midi_byte_t zrythm::structure::arrangement::MidiNote::DEFAULT_VELOCITY = 90
staticconstexpr

Definition at line 32 of file midi_note.h.

Property Documentation

◆ pitch

int zrythm::structure::arrangement::MidiNote::pitch
readwrite

Definition at line 22 of file midi_note.h.

◆ velocity

int zrythm::structure::arrangement::MidiNote::velocity
readwrite

Definition at line 23 of file midi_note.h.


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