Zrythm v2.0.0-DEV
a highly automated and intuitive digital audio workstation
Loading...
Searching...
No Matches
midi_region.h
1// SPDX-FileCopyrightText: © 2019-2025 Alexandros Theodotou <alex@zrythm.org>
2// SPDX-License-Identifier: LicenseRef-ZrythmLicense
3
4#pragma once
5
6#include "dsp/midi_event.h"
7#include "structure/arrangement/arranger_object_owner.h"
8#include "structure/arrangement/midi_note.h"
9
10namespace zrythm::structure::arrangement
11{
19class MidiRegion final : public ArrangerObject, public ArrangerObjectOwner<MidiNote>
20{
21 Q_OBJECT
22 DEFINE_ARRANGER_OBJECT_OWNER_QML_PROPERTIES (MidiRegion, midiNotes, MidiNote)
23 QML_ELEMENT
24 QML_UNCREATABLE ("")
25
26 friend class ArrangerObjectFactory;
27
28public:
29 MidiRegion (
30 const dsp::TempoMap &tempo_map,
31 ArrangerObjectRegistry &object_registry,
32 dsp::FileAudioSourceRegistry &file_audio_source_registry,
33 QObject * parent = nullptr);
34
35 // ========================================================================
36 // QML Interface
37 // ========================================================================
38
39 Q_SIGNAL void contentChanged ();
40
41 // ========================================================================
42
43 std::string get_field_name_for_serialization (const MidiNote *) const override
44 {
45 return "midiNotes";
46 }
47
48private:
49 friend void init_from (
50 MidiRegion &obj,
51 const MidiRegion &other,
52 utils::ObjectCloneType clone_type);
53
54 friend void to_json (nlohmann::json &j, const MidiRegion &region)
55 {
56 to_json (j, static_cast<const ArrangerObject &> (region));
57 to_json (j, static_cast<const ArrangerObjectOwner &> (region));
58 }
59 friend void from_json (const nlohmann::json &j, MidiRegion &region)
60 {
61 from_json (j, static_cast<ArrangerObject &> (region));
62 from_json (j, static_cast<ArrangerObjectOwner &> (region));
63 }
64
65private:
66 BOOST_DESCRIBE_CLASS (
67 MidiRegion,
68 (ArrangerObject, ArrangerObjectOwner<MidiNote>),
69 (),
70 (),
71 ())
72};
73}
ArrangerObject(Type type, const dsp::TempoMap &tempo_map, ArrangerObjectFeatures features, QObject *parent=nullptr) noexcept
Construct a new ArrangerObject.
A MIDI note inside a Region shown in the piano roll.
Definition midi_note.h:21