10#ifndef __AUDIO_AUTOMATION_TRACK_H__
11#define __AUDIO_AUTOMATION_TRACK_H__
13#include "zrythm-config.h"
35#define AUTOMATION_TRACK_SCHEMA_VERSION 2
37#define MAX_AUTOMATION_POINTS 1200
40#define AUTOMATION_RECORDING_TOUCH_REL_MS 800
42typedef enum AutomationMode
45 AUTOMATION_MODE_RECORD,
50static const cyaml_strval_t automation_mode_strings[] = {
51 {
"Read", AUTOMATION_MODE_READ },
52 {
"Rec", AUTOMATION_MODE_RECORD},
53 {
"Off", AUTOMATION_MODE_OFF },
54 {
"<invalid>", NUM_AUTOMATION_MODES },
57typedef enum AutomationRecordMode
59 AUTOMATION_RECORD_MODE_TOUCH,
60 AUTOMATION_RECORD_MODE_LATCH,
61 NUM_AUTOMATION_RECORD_MODES,
62} AutomationRecordMode;
64static const cyaml_strval_t automation_record_mode_strings[] = {
65 {
"Touch", AUTOMATION_RECORD_MODE_TOUCH},
66 {
"Latch", AUTOMATION_RECORD_MODE_LATCH},
67 {
"<invalid>", NUM_AUTOMATION_RECORD_MODES },
92 int num_region_snapshots;
153 int num_top_right_buttons;
155 int num_top_left_buttons;
157 int num_bot_right_buttons;
163 int num_bot_left_buttons;
173static const cyaml_schema_field_t automation_track_fields_schema[] = {
179 port_identifier_fields_schema),
182 YAML_FIELD_ENUM (
AutomationTrack, automation_mode, automation_mode_strings),
183 YAML_FIELD_ENUM (
AutomationTrack, record_mode, automation_record_mode_strings),
190static const cyaml_schema_value_t automation_track_schema = {
242automation_track_set_automation_mode (
247NONNULL static inline
void
250 self->
record_mode = (self->record_mode + 1) % NUM_AUTOMATION_RECORD_MODES;
292 const gint64 cur_time,
293 const bool record_aps);
433 float normalized_val);
438automation_track_get_port (
A region in the timeline.
ZRegion * automation_track_get_region_before_pos(const AutomationTrack *self, const Position *pos, bool ends_after, bool use_snapshots)
Returns the ZRegion that starts before given Position, if any.
NONNULL void automation_track_remove_region(AutomationTrack *self, ZRegion *region)
Removes a region from the automation track.
AutomationTracklist * atl
Pointer to owner automation tracklist, if any.
NONNULL AutomationTrack * automation_track_clone(AutomationTrack *src)
Clones the AutomationTrack.
NONNULL float automation_track_get_val_at_pos(AutomationTrack *self, Position *pos, bool normalized, bool ends_after, bool use_snapshots)
Returns the actual parameter value at the given position.
bool created
Whether it has been created by the user yet or not.
bool recording_paused
This must only be set by the RecordingManager when temporarily pausing recording, eg when looping or ...
HOT AutomationTrack * automation_track_find_from_port(Port *port, Track *track, bool basic_search)
Finds the AutomationTrack associated with port.
NONNULL int automation_track_get_y_px_from_normalized_val(AutomationTrack *self, float normalized_val)
Returns the y pixels from the value based on the allocation of the automation track.
AutomationRecordMode record_mode
Automation record mode, when AutomationTrack::automation_mode is set to record.
AutomationModeWidget * am_widget
Automation mode button group.
int index
Index in parent AutomationTracklist.
NONNULL void automation_track_set_index(AutomationTrack *self, int index)
Sets the index of the AutomationTrack in the AutomationTracklist.
Port * port
Cache used during DSP.
ZRegion * recording_region
Region currently recording to.
bool recording_start_sent
This is a flag to let the recording manager know that a START signal was already sent for recording.
NONNULL AutomationTrack * automation_track_new(Port *port)
Creates an automation track for the given Port.
NONNULL void automation_track_add_region(AutomationTrack *self, ZRegion *region)
Adds an automation ZRegion to the AutomationTrack.
ZRegion ** regions
The automation Region's.
NONNULL ZRegion * automation_track_get_last_region(AutomationTrack *self)
Gets the last ZRegion in the AutomationTrack.
ZRegion ** region_snapshots
Snapshots used during playback TODO unimplemented.
NONNULL void automation_track_insert_region(AutomationTrack *self, ZRegion *region, int idx)
Inserts an automation ZRegion to the AutomationTrack at the given index.
NONNULL void automation_track_clear(AutomationTrack *self)
Removes and frees all arranger objects recursively.
double height
Position of multipane handle.
NONNULL void automation_track_free(AutomationTrack *at)
Frees the automation track.
NONNULL void automation_track_update_positions(AutomationTrack *self, bool from_ticks, bool bpm_change)
Returns the visible y offset from the top of the track widget.
void automation_record_mode_get_localized(AutomationRecordMode mode, char *buf)
Gets the automation mode as a localized string.
NONNULL AutomationTrack * automation_track_find_from_port_id(PortIdentifier *id, bool basic_search)
NONNULL void automation_track_unselect_all(AutomationTrack *self)
Unselects all arranger objects.
HOT NONNULL bool automation_track_should_be_recording(const AutomationTrack *const at, const gint64 cur_time, const bool record_aps)
Returns if the automation track should currently be recording data.
CustomButtonWidget * top_right_buttons[8]
Buttons used by the track widget.
AutomationMode automation_mode
Automation mode.
PortIdentifier port_id
Identifier of the Port this AutomationTrack is for.
void automation_mode_get_localized(AutomationMode mode, char *buf)
Gets the automation mode as a localized string.
NONNULL AutomationPoint * automation_track_get_ap_before_pos(const AutomationTrack *self, const Position *pos, bool ends_after, bool use_snapshots)
Returns the automation point before the Position on the timeline.
bool recording_started
To be set to true when recording starts (when the first change is received) and false when recording ...
COLD NONNULL_ARGS(1) void automation_track_init_loaded(AutomationTrack *self
Inits a loaded AutomationTracklist.
float last_recorded_value
Last value recorded in this automation track.
HOT NONNULL bool automation_track_should_read_automation(AutomationTrack *at, gint64 cur_time)
Returns whether the automation in the automation track should be read.
bool visible
Whether visible or not.
#define YAML_FIELD_MAPPING_EMBEDDED(owner, member, schema)
Mapping embedded inside the struct.
#define YAML_VALUE_PTR(cc, fields_schema)
Schema to be used as a pointer.
#define YAML_FIELD_DYN_PTR_ARRAY_VAR_COUNT_OPT(owner, member, schema)
Dynamic-width (reallocated) array of pointers with variable count, nullable.
Ports that transfer audio/midi/other signals to one another.
An automation point inside an AutomationTrack.
Each track has an automation tracklist with automation tracks to be generated at runtime,...
Struct used to identify Ports in the project.
Must ONLY be created via port_new()
A Position is made up of bars.beats.sixteenths.ticks.
Track to be inserted into the Project's Tracklist.
A region (clip) is an object on the timeline that contains either MidiNote's or AudioClip's.