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

Piano roll serializable backend. More...

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

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

Public Types

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

Public Member Functions

 PianoRoll (QObject *parent=nullptr)
auto getEditorSettings () const
int getKeyHeight () 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_highlighting (Highlighting highlighting)
 Updates the highlighting and notifies the UI.
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 PianoRoll.

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

utils::QObjectUniquePtr< EditorSettingseditor_settings_
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.
Highlighting highlighting_ = Highlighting::None
 Highlighting notes depending on the current chord or scale.
std::vector< MidiNoteDescriptordrum_descriptors_
 Drum mode descriptors.

Properties

QML_ELEMENT zrythm::structure::arrangement::EditorSettingseditorSettings
int keyHeight

Friends

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

Detailed Description

Piano roll serializable backend.

The actual widgets should reflect the information here.

Definition at line 74 of file piano_roll.h.

Member Enumeration Documentation

◆ Highlighting

Highlighting for the piano roll.

Definition at line 86 of file piano_roll.h.

Member Function Documentation

◆ get_visible_notes()

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

Gets the visible notes.

Definition at line 183 of file piano_roll.h.

◆ getEditorSettings()

auto zrythm::structure::arrangement::PianoRoll::getEditorSettings ( ) const
inline

Definition at line 107 of file piano_roll.h.

◆ getKeyHeight()

int zrythm::structure::arrangement::PianoRoll::getKeyHeight ( ) const
inline

Definition at line 109 of file piano_roll.h.

◆ isBlackKey()

Q_INVOKABLE constexpr bool zrythm::structure::arrangement::PianoRoll::isBlackKey ( int note)
inlinestaticconstexpr

Returns if the key is black.

Definition at line 117 of file piano_roll.h.

◆ isNextKeyBlack()

Q_INVOKABLE constexpr bool zrythm::structure::arrangement::PianoRoll::isNextKeyBlack ( int note)
inlinestaticconstexpr

Definition at line 127 of file piano_roll.h.

◆ isNextKeyWhite()

Q_INVOKABLE constexpr bool zrythm::structure::arrangement::PianoRoll::isNextKeyWhite ( int note)
inlinestaticconstexpr

Definition at line 131 of file piano_roll.h.

◆ isPrevKeyBlack()

Q_INVOKABLE constexpr bool zrythm::structure::arrangement::PianoRoll::isPrevKeyBlack ( int note)
inlinestaticconstexpr

Definition at line 136 of file piano_roll.h.

◆ isPrevKeyWhite()

Q_INVOKABLE constexpr bool zrythm::structure::arrangement::PianoRoll::isPrevKeyWhite ( int note)
inlinestaticconstexpr

Definition at line 140 of file piano_roll.h.

◆ isWhiteKey()

Q_INVOKABLE constexpr bool zrythm::structure::arrangement::PianoRoll::isWhiteKey ( int note)
inlinestaticconstexpr

Definition at line 122 of file piano_roll.h.

◆ from_json

void from_json ( const nlohmann::json & j,
PianoRoll & piano_roll )
friend

Definition at line 226 of file piano_roll.h.

◆ init_from

void init_from ( PianoRoll & obj,
const PianoRoll & other,
utils::ObjectCloneType clone_type )
friend

Definition at line 207 of file piano_roll.h.

◆ to_json

void to_json ( nlohmann::json & j,
const PianoRoll & piano_roll )
friend

Definition at line 220 of file piano_roll.h.

Field Documentation

◆ current_notes_

std::vector<int> zrythm::structure::arrangement::PianoRoll::current_notes_

Currently pressed notes (used only at runtime).

Definition at line 254 of file piano_roll.h.

◆ drum_descriptors_

std::vector<MidiNoteDescriptor> zrythm::structure::arrangement::PianoRoll::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 278 of file piano_roll.h.

◆ editor_settings_

utils::QObjectUniquePtr<EditorSettings> zrythm::structure::arrangement::PianoRoll::editor_settings_

Definition at line 242 of file piano_roll.h.

◆ highlighting_

Highlighting zrythm::structure::arrangement::PianoRoll::highlighting_ = Highlighting::None

Highlighting notes depending on the current chord or scale.

Definition at line 268 of file piano_roll.h.

◆ midi_modifier_

MidiModifier zrythm::structure::arrangement::PianoRoll::midi_modifier_ = MidiModifier::Velocity

Selected MidiModifier.

Definition at line 251 of file piano_roll.h.

◆ note_height_

int zrythm::structure::arrangement::PianoRoll::note_height_ { 16 }

Visual height per key in pixels.

Definition at line 248 of file piano_roll.h.

◆ notes_zoom_

float zrythm::structure::arrangement::PianoRoll::notes_zoom_ = 1.0f

Notes zoom level.

Definition at line 245 of file piano_roll.h.

◆ piano_descriptors_

std::vector<MidiNoteDescriptor> zrythm::structure::arrangement::PianoRoll::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 262 of file piano_roll.h.

Property Documentation

◆ editorSettings

QML_ELEMENT zrythm::structure::arrangement::EditorSettings * zrythm::structure::arrangement::PianoRoll::editorSettings
read

Definition at line 78 of file piano_roll.h.

◆ keyHeight

int zrythm::structure::arrangement::PianoRoll::keyHeight
read

Definition at line 79 of file piano_roll.h.


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