4#ifndef __AUDIO_SCALE_OBJECT_H__
5#define __AUDIO_SCALE_OBJECT_H__
7#include "dsp/musical_scale.h"
8#include "gui/dsp/bounded_object.h"
9#include "gui/dsp/muteable_object.h"
10#include "gui/dsp/timeline_object.h"
11#include "utils/icloneable.h"
12#include "utils/serialization.h"
20using namespace zrythm;
24 public TimelineObject,
25 public MuteableObject,
26 public ICloneable<ScaleObject>
31 Q_PROPERTY (QString name READ getName NOTIFY nameChanged)
37 DECLARE_FINAL_ARRANGER_OBJECT_CONSTRUCTORS (
ScaleObject)
44 Q_SIGNAL
void nameChanged (
const QString &name);
51 void set_scale (
const MusicalScale &scale) {
scale_ = scale; }
55 ArrangerObjectPtrVariant
64 static constexpr std::string_view kScaleKey =
"scale";
65 friend void to_json (nlohmann::json &j,
const ScaleObject &so)
67 to_json (j,
static_cast<const ArrangerObject &
> (so));
68 to_json (j,
static_cast<const MuteableObject &
> (so));
71 friend void from_json (
const nlohmann::json &j,
ScaleObject &so)
75 j.at (kScaleKey).get_to (so.
scale_);
84 return fmt::format (
"ScaleObject[position: {}]", so.
get_position ());
Base class for all objects in the arranger.
auto get_position() const
Getter.
bool validate(bool is_project, dsp::FramesPerTick frames_per_tick) const override
Validates the arranger object.
ArrangerObjectPtrVariant insert_clone_to_project() const override
Inserts the object where it belongs in the project (eg, a Track).
utils::Utf8String gen_human_friendly_name() const override
Generates a human readable name for the object.
MusicalScale scale_
The scale descriptor.
void init_after_cloning(const ScaleObject &other, ObjectCloneType clone_type) override
Initializes the cloned object.
ArrangerObjectPtrVariant add_clone_to_project(bool fire_events) const override
Appends the ArrangerObject to where it belongs in the project (eg, a Track), without taking into acco...
Musical scale descriptor.
Lightweight UTF-8 string wrapper with safe conversions.
#define DEFINE_OBJECT_FORMATTER(obj_type, function_prefix, formatter_func)
Defines a formatter for the given object type.