Zrythm
a highly automated and intuitive digital audio workstation
Loading...
Searching...
No Matches
timeline_selections.h
Go to the documentation of this file.
1// SPDX-FileCopyrightText: © 2019-2022 Alexandros Theodotou <alex@zrythm.org>
2// SPDX-License-Identifier: LicenseRef-ZrythmLicense
3
10#ifndef __GUI_BACKEND_TL_SELECTIONS_H__
11#define __GUI_BACKEND_TL_SELECTIONS_H__
12
13#include "dsp/marker.h"
14#include "dsp/midi_region.h"
15#include "dsp/region.h"
16#include "dsp/scale_object.h"
18#include "utils/yaml.h"
19
26#define TL_SELECTIONS_SCHEMA_VERSION 1
27
28#define TL_SELECTIONS (PROJECT->timeline_selections)
29
36typedef struct TimelineSelections
37{
40
41 int schema_version;
42
45 int num_regions;
46 size_t regions_size;
47
48 ScaleObject ** scale_objects;
49 int num_scale_objects;
50 size_t scale_objects_size;
51
52 Marker ** markers;
53 int num_markers;
54 size_t markers_size;
55
58
61
65
66static const cyaml_schema_field_t timeline_selections_fields_schema[] = {
69 base,
70 arranger_selections_fields_schema),
71 YAML_FIELD_INT (TimelineSelections, schema_version),
74 regions,
75 region_schema),
78 scale_objects,
79 scale_object_schema),
82 markers,
83 marker_schema),
84 YAML_FIELD_INT (TimelineSelections, region_track_vis_index),
85 YAML_FIELD_INT (TimelineSelections, chord_track_vis_index),
86 YAML_FIELD_INT (TimelineSelections, marker_track_vis_index),
87
88 CYAML_FIELD_END
89};
90
91static const cyaml_schema_value_t timeline_selections_schema = {
94 timeline_selections_fields_schema),
95};
96
108 Position * start_pos,
109 Position * end_pos,
110 bool clone_objs);
111
115Track *
117
121Track *
123
130void
132 TimelineSelections * ts);
133
143int
146 Position * pos,
147 const int idx);
148
153void
156 bool with_parents);
157
163bool
165 TimelineSelections * self,
166 const int vis_at_diff);
167
175bool
177 TimelineSelections * self,
178 const int diff);
179
188bool
190 TimelineSelections * self,
191 const int vis_track_diff);
192
197void
199 TimelineSelections * self);
200
201NONNULL bool
202timeline_selections_contains_only_regions (
203 const TimelineSelections * self);
204
205NONNULL bool
206timeline_selections_contains_only_region_types (
207 const TimelineSelections * self,
208 RegionType types);
209
213NONNULL bool
215 const TimelineSelections * self,
216 const char * full_path,
217 int midi_version,
218 const bool export_full_regions,
219 const bool lanes_as_tracks);
220
221#define timeline_selections_move_w_action( \
222 sel, ticks, delta_tracks, delta_lanes, already_moved) \
223 arranger_selections_move_w_action ( \
224 sel, ticks, 0, 0, delta_tracks, delta_lanes, 0, \
225 already_moved)
226
227#define timeline_selections_duplicate_w_action( \
228 sel, ticks, delta_tracks, delta_lanes, already_moved) \
229 arranger_selections_duplicate_w_action ( \
230 sel, ticks, 0, 0, delta_tracks, delta_lanes, 0, \
231 already_moved)
232
237#endif
Marker related code.
A region in the timeline.
Scale object inside the chord Track in the TimelineArranger.
RegionType
Type of Region.
int timeline_selections_can_be_pasted(TimelineSelections *ts, Position *pos, const int idx)
Returns whether the selections can be pasted.
void timeline_selections_mark_for_bounce(TimelineSelections *ts, bool with_parents)
bool timeline_selections_move_regions_to_new_lanes(TimelineSelections *self, const int diff)
Move the selected Regions to new lanes.
Track * timeline_selections_get_first_track(TimelineSelections *ts)
Gets highest track in the selections.
void timeline_selections_set_index_in_prev_lane(TimelineSelections *self)
Sets the regions' ZRegion::index_in_prev_lane.
NONNULL bool timeline_selections_export_to_midi_file(const TimelineSelections *self, const char *full_path, int midi_version, const bool export_full_regions, const bool lanes_as_tracks)
Exports the selections to the given MIDI file.
Track * timeline_selections_get_last_track(TimelineSelections *ts)
Gets lowest track in the selections.
TimelineSelections * timeline_selections_new_for_range(Position *start_pos, Position *end_pos, bool clone_objs)
Creates a new TimelineSelections instance for the given range.
void timeline_selections_set_vis_track_indices(TimelineSelections *ts)
Replaces the track positions in each object with visible track indices starting from 0.
bool timeline_selections_move_regions_to_new_ats(TimelineSelections *self, const int vis_at_diff)
Move the selected regions to new automation tracks.
bool timeline_selections_move_regions_to_new_tracks(TimelineSelections *self, const int vis_track_diff)
Move the selected Regions to the new Track.
#define YAML_FIELD_MAPPING_EMBEDDED(owner, member, schema)
Mapping embedded inside the struct.
Definition yaml.h:32
#define YAML_FIELD_DYN_ARRAY_VAR_COUNT(owner, member, schema)
Dynamic-width (reallocated) array of structs with variable count.
Definition yaml.h:123
#define YAML_VALUE_PTR(cc, fields_schema)
Schema to be used as a pointer.
Definition yaml.h:221
Common data structures and functions for *ArrangerSelections.
API for Region's specific to instrument Track's.
Marker for the MarkerTrack.
Definition marker.h:59
A Position is made up of bars.beats.sixteenths.ticks.
Definition position.h:137
A ScaleObject to be shown in the TimelineArrangerWidget.
Selections to be used for the timeline's current selections, copying, undoing, etc.
int chord_track_vis_index
Visible track index, used during copying.
int marker_track_vis_index
Visible track index, used during copying.
ArrangerSelections base
Base struct.
ZRegion ** regions
Selected TrackLane Region's.
int region_track_vis_index
Visible track index, used during copying.
Track to be inserted into the Project's Tracklist.
Definition track.h:193
A region (clip) is an object on the timeline that contains either MidiNote's or AudioClip's.
Definition region.h:78
YAML utils.