4#ifndef __AUDIO_VELOCITY_H__
5#define __AUDIO_VELOCITY_H__
7#include "gui/dsp/arranger_object.h"
8#include "gui/dsp/region_owned_object.h"
9#include "utils/icloneable.h"
28class Velocity final :
public QObject,
public ICloneable<Velocity>
32 Q_PROPERTY (
int value READ getValue WRITE setValue NOTIFY valueChanged)
35 Velocity (QObject * parent =
nullptr);
41 int getValue ()
const {
return static_cast<int> (
vel_); }
43 void setValue (
int ival)
45 const auto vel =
static_cast<VelocityValueT
> (ival);
49 Q_EMIT valueChanged ();
52 Q_SIGNAL
void valueChanged ();
69 static const char * setting_enum_to_str (
size_t index);
71 static size_t setting_str_to_enum (
const char * str);
78 static constexpr std::string_view kVelocityKey =
"value";
79 friend void to_json (nlohmann::json &j,
const Velocity &velocity)
81 j[kVelocityKey] = velocity.
vel_;
83 friend void from_json (
const nlohmann::json &j,
Velocity &velocity)
85 j.at (kVelocityKey).get_to (velocity.
vel_);
A MIDI note inside a Region shown in the piano roll.
A Region containing MIDI events.
void init_after_cloning(const Velocity &other, ObjectCloneType clone_type) override
Returns the owner MidiNote.
VelocityValueT vel_
Pointer back to the MIDI note (this is also the QObject parent).
void set_val(int val)
Sets the velocity to the given value.
VelocityValueT vel_at_start_
Velocity at drag begin - used for ramp actions only.
constexpr uint8_t VELOCITY_DEFAULT
Default velocity.
uint8_t midi_byte_t
MIDI byte.