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

A list model of chord descriptors for the chord pad panel. More...

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

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

Public Types

enum  Roles { ChordDescriptorRole = Qt::UserRole + 1 }

Public Member Functions

 ChordPadBank (QObject *parent=nullptr)
QHash< int, QByteArray > roleNames () const override
int rowCount (const QModelIndex &parent={}) const override
QVariant data (const QModelIndex &index, int role) const override
void addChord (dsp::MusicalNote root, dsp::ChordType type, dsp::ChordAccent accent=dsp::ChordAccent::None, int inversion=0, std::optional< dsp::MusicalNote > bass=std::nullopt)
void insertChord (int index, dsp::MusicalNote root, dsp::ChordType type, dsp::ChordAccent accent=dsp::ChordAccent::None, int inversion=0, std::optional< dsp::MusicalNote > bass=std::nullopt)
void removeChord (int index)
void moveChord (int from, int to)
void transposeChords (bool up)
void applyPresetFromScale (dsp::MusicalScale::ScaleType scale, dsp::MusicalNote root_note)
void applyPreset (ChordPreset *preset)
void apply_preset (const ChordPreset &preset)
std::optional< dsp::ChordDescriptor::ChordPitchesget_pitches_for_note (midi_byte_t note_number) noexcept
 Returns the pre-computed MIDI pitches for a pad triggered by the given MIDI note number.
Q_INVOKABLE dsp::ChordDescriptorchordAt (int index)

Friends

void to_json (nlohmann::json &j, const ChordPadBank &bank)
void from_json (const nlohmann::json &j, ChordPadBank &bank)

Detailed Description

A list model of chord descriptors for the chord pad panel.

Provides a variable-length collection of ChordDescriptors that can be used for auditioning, MIDI expansion, and composition shortcuts. Owned by ProjectUiState and serialized as UI state.

QML accesses individual chords via the chordDescriptor role.

Definition at line 32 of file chord_pad_bank.h.

Member Enumeration Documentation

◆ Roles

enum zrythm::structure::project::ChordPadBank::Roles

Definition at line 39 of file chord_pad_bank.h.

Member Function Documentation

◆ get_pitches_for_note()

std::optional< dsp::ChordDescriptor::ChordPitches > zrythm::structure::project::ChordPadBank::get_pitches_for_note ( midi_byte_t note_number)
noexcept

Returns the pre-computed MIDI pitches for a pad triggered by the given MIDI note number.

Maps notes 60-71 (C3-B3) to chord pad indices 0-11. Returns std::nullopt if out of range or no chord at that index.

Realtime-safe: reads from a lock-free snapshot updated by the main thread.


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