Zrythm v2.0.0-alpha.1+31.4967fd053471
a highly automated and intuitive digital audio workstation
Loading...
Searching...
No Matches
zrythm::structure::project::MidiEditor Class Reference

MIDI editor serializable backend. More...

#include <src/structure/project/midi_editor.h>

Inheritance diagram for zrythm::structure::project::MidiEditor:
Collaboration diagram for zrythm::structure::project::MidiEditor:

Public Types

enum class  Highlighting : std::uint8_t { None , Chord , Scale , Both }
 Highlighting for the piano roll. More...

Public Member Functions

 MidiEditor (QObject *parent=nullptr)
int keyHeight () const
Q_SIGNAL void keyHeightChanged ()
Q_INVOKABLE int getKeyAtY (double y) const
void add_current_note (int note)
 Adds the note if it doesn't exist in current_notes_.
void remove_current_note (int note)
 Removes the note if it exists in current_notes_.
bool contains_current_note (int note)
 Returns whether the note exists in current_notes_.
void set_notes_zoom (float notes_zoom, bool fire_events)
const MidiNoteDescriptorfind_midi_note_descriptor_by_val (bool drum_mode, uint8_t val)
 Returns the MidiNoteDescriptor matching the value (0-127).
void set_midi_modifier (MidiModifier modifier)
 Sets the MIDI modifier.
void get_visible_notes (bool drum_mode, std::vector< MidiNoteDescriptor > &vec)
 Gets the visible notes.
void init ()
 Initializes the MidiEditor.
Public Member Functions inherited from zrythm::structure::project::EditorSettings
 EditorSettings (QObject *parent=nullptr)
double getX () const
void setX (double x)
Q_SIGNAL void xChanged (double x)
double getY () const
void setY (double y)
Q_SIGNAL void yChanged (double y)
double getHorizontalZoomLevel () const
void setHorizontalZoomLevel (double hzoom_level)
Q_SIGNAL void horizontalZoomLevelChanged (double hzoom_level)
double clamp_scroll_start_x (double x)
double clamp_scroll_start_y (double y)
void append_scroll (double dx, double dy, bool validate)
 Appends the given deltas to the scroll x/y values.

Static Public Member Functions

static Q_INVOKABLE constexpr bool isBlackKey (int note)
 Returns if the key is black.
static Q_INVOKABLE constexpr bool isWhiteKey (int note)
static Q_INVOKABLE constexpr bool isNextKeyBlack (int note)
static Q_INVOKABLE constexpr bool isNextKeyWhite (int note)
static Q_INVOKABLE constexpr bool isPrevKeyBlack (int note)
static Q_INVOKABLE constexpr bool isPrevKeyWhite (int note)

Data Fields

float notes_zoom_ = 1.0f
 Notes zoom level.
int note_height_ { 16 }
 Visual height per key in pixels.
MidiModifier midi_modifier_ = MidiModifier::Velocity
 Selected MidiModifier.
std::vector< int > current_notes_
 Currently pressed notes (used only at runtime).
std::vector< MidiNoteDescriptorpiano_descriptors_
 Piano roll mode descriptors.
std::vector< MidiNoteDescriptordrum_descriptors_
 Drum mode descriptors.

Properties

QML_ELEMENT int keyHeight
Properties inherited from zrythm::structure::project::EditorSettings
QML_ELEMENT double x
double y
double horizontalZoomLevel

Friends

void init_from (MidiEditor &obj, const MidiEditor &other, utils::ObjectCloneType clone_type)
void to_json (nlohmann::json &j, const MidiEditor &midi_editor)
void from_json (const nlohmann::json &j, MidiEditor &midi_editor)

Detailed Description

MIDI editor serializable backend.

The actual widgets should reflect the information here.

Definition at line 79 of file midi_editor.h.

Member Enumeration Documentation

◆ Highlighting

enum class zrythm::structure::project::MidiEditor::Highlighting : std::uint8_t
strong

Highlighting for the piano roll.

Definition at line 90 of file midi_editor.h.

Member Function Documentation

◆ get_visible_notes()

void zrythm::structure::project::MidiEditor::get_visible_notes ( bool drum_mode,
std::vector< MidiNoteDescriptor > & vec )
inline

Gets the visible notes.

Definition at line 181 of file midi_editor.h.

◆ isBlackKey()

Q_INVOKABLE constexpr bool zrythm::structure::project::MidiEditor::isBlackKey ( int note)
inlinestaticconstexpr

Returns if the key is black.

Definition at line 120 of file midi_editor.h.

◆ isNextKeyBlack()

Q_INVOKABLE constexpr bool zrythm::structure::project::MidiEditor::isNextKeyBlack ( int note)
inlinestaticconstexpr

Definition at line 130 of file midi_editor.h.

◆ isNextKeyWhite()

Q_INVOKABLE constexpr bool zrythm::structure::project::MidiEditor::isNextKeyWhite ( int note)
inlinestaticconstexpr

Definition at line 134 of file midi_editor.h.

◆ isPrevKeyBlack()

Q_INVOKABLE constexpr bool zrythm::structure::project::MidiEditor::isPrevKeyBlack ( int note)
inlinestaticconstexpr

Definition at line 139 of file midi_editor.h.

◆ isPrevKeyWhite()

Q_INVOKABLE constexpr bool zrythm::structure::project::MidiEditor::isPrevKeyWhite ( int note)
inlinestaticconstexpr

Definition at line 143 of file midi_editor.h.

◆ isWhiteKey()

Q_INVOKABLE constexpr bool zrythm::structure::project::MidiEditor::isWhiteKey ( int note)
inlinestaticconstexpr

Definition at line 125 of file midi_editor.h.

◆ keyHeight()

int zrythm::structure::project::MidiEditor::keyHeight ( ) const
inline

Definition at line 112 of file midi_editor.h.

Field Documentation

◆ current_notes_

std::vector<int> zrythm::structure::project::MidiEditor::current_notes_

Currently pressed notes (used only at runtime).

Definition at line 236 of file midi_editor.h.

◆ drum_descriptors_

std::vector<MidiNoteDescriptor> zrythm::structure::project::MidiEditor::drum_descriptors_
Initial value:
=
std::vector<MidiNoteDescriptor> (128)

Drum mode descriptors.

These must be sorted by index at all times.

For performance purposes, invisible notes must be sorted at the end of the array.

Definition at line 255 of file midi_editor.h.

◆ midi_modifier_

MidiModifier zrythm::structure::project::MidiEditor::midi_modifier_ = MidiModifier::Velocity

Selected MidiModifier.

Definition at line 233 of file midi_editor.h.

◆ note_height_

int zrythm::structure::project::MidiEditor::note_height_ { 16 }

Visual height per key in pixels.

Definition at line 230 of file midi_editor.h.

◆ notes_zoom_

float zrythm::structure::project::MidiEditor::notes_zoom_ = 1.0f

Notes zoom level.

Definition at line 227 of file midi_editor.h.

◆ piano_descriptors_

std::vector<MidiNoteDescriptor> zrythm::structure::project::MidiEditor::piano_descriptors_
Initial value:
=
std::vector<MidiNoteDescriptor> (128)

Piano roll mode descriptors.

For performance purposes, invisible notes must be sorted at the end of the array.

Definition at line 244 of file midi_editor.h.

Property Documentation

◆ keyHeight

QML_ELEMENT int zrythm::structure::project::MidiEditor::keyHeight
read

Definition at line 83 of file midi_editor.h.


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