Zrythm
a highly automated and intuitive digital audio workstation
Loading...
Searching...
No Matches
tracklist.h
Go to the documentation of this file.
1// SPDX-FileCopyrightText: © 2018-2023 Alexandros Theodotou <alex@zrythm.org>
2// SPDX-License-Identifier: LicenseRef-ZrythmLicense
3
10#ifndef __AUDIO_TRACKLIST_H__
11#define __AUDIO_TRACKLIST_H__
12
13#include "dsp/engine.h"
14#include "dsp/track.h"
15#include "gui/widgets/track.h"
16
17typedef struct Track Track;
18typedef struct _TracklistWidget TracklistWidget;
19typedef struct _PinnedTracklistWidget PinnedTracklistWidget;
20typedef struct Track ChordTrack;
21typedef struct SupportedFile SupportedFile;
22TYPEDEF_STRUCT_UNDERSCORED (FileImportInfo);
23
30#define TRACKLIST (PROJECT->tracklist)
31#define MAX_TRACKS 3000
32
33#define tracklist_is_in_active_project(self) \
34 (self->project == PROJECT \
35 || (self->sample_processor && sample_processor_is_in_active_project (self->sample_processor)))
36
37#define tracklist_is_auditioner(self) \
38 (self->sample_processor && tracklist_is_in_active_project (self))
39
44{
45 TRACKLIST_PIN_OPTION_PINNED_ONLY,
46 TRACKLIST_PIN_OPTION_UNPINNED_ONLY,
47 TRACKLIST_PIN_OPTION_BOTH,
49
125
129COLD NONNULL_ARGS (1) void tracklist_init_loaded (
130 Tracklist * self,
131 Project * project,
132 SampleProcessor * sample_processor);
133
134COLD Tracklist *
135tracklist_new (Project * project, SampleProcessor * sample_processor);
136
144NONNULL void
145tracklist_select_all (Tracklist * self, bool select, bool fire_events);
146
150void
152 Tracklist * self,
153 Track ** visible_tracks,
154 int * num_visible);
155
160Track *
161tracklist_find_track_by_name (Tracklist * self, const char * name);
162
167NONNULL OPTIMIZE_O3 Track *
169
170NONNULL int
171tracklist_contains_master_track (Tracklist * self);
172
173NONNULL int
174tracklist_contains_chord_track (Tracklist * self);
175
179NONNULL void
181
188NONNULL void
190 Tracklist * self,
191 Track * track,
192 int pos,
193 int publish_events,
194 int recalc_graph);
195
208NONNULL void
210 Tracklist * self,
211 Track * track,
212 bool rm_pl,
213 bool free_track,
214 bool publish_events,
215 bool recalc_graph);
216
232void
234 Tracklist * self,
235 Track * track,
236 int pos,
237 bool always_before_pos,
238 bool publish_events,
239 bool recalc_graph);
240
245void
247 Tracklist * self,
248 Track * track,
249 int publish_events,
250 int recalc_graph);
251
255void
257 Tracklist * self,
258 Track * track,
259 const int pinned,
260 int publish_events,
261 int recalc_graph);
262
263NONNULL bool
264tracklist_validate (Tracklist * self);
265
272NONNULL HOT Track *
274
278int
280
285Track *
287
288ChordTrack *
289tracklist_get_chord_track (const Tracklist * self);
290
297Track *
299
304Track *
306
314int
316 Tracklist * self,
317 const TracklistPinOption pin_opt,
318 const bool visible_only);
319
327Track *
329 Tracklist * self,
330 const TracklistPinOption pin_opt,
331 const int visible_only);
332
337Track *
339
348Track *
350 Tracklist * self,
351 Track * track,
352 int delta);
353
362int
364 Tracklist * self,
365 const Track * src,
366 const Track * dest);
367
374bool
376 Tracklist * self,
377 double multiplier,
378 bool visible_only,
379 bool check_only,
380 bool fire_events);
381
382bool
383tracklist_import_regions (
384 GPtrArray * region_arrays,
385 const FileImportInfo * import_info,
386 TracksReadyCallback ready_cb,
387 GError ** error);
388
402bool
404 Tracklist * self,
405 char ** uri_list,
406 const SupportedFile * orig_file,
407 Track * track,
408 TrackLane * lane,
409 int index,
410 const Position * pos,
411 TracksReadyCallback ready_cb,
412 GError ** error);
413
422void
424 Tracklist * self,
425 Track * this_track,
426 TrackWidgetHighlight location,
427 GdkDragAction action);
428
434bool
436 Tracklist * self,
437 const char * name,
438 Track * track_to_skip);
439
443NONNULL bool
445
449NONNULL bool
451
452NONNULL int
453tracklist_get_num_muted_tracks (const Tracklist * self);
454
455NONNULL int
456tracklist_get_num_soloed_tracks (const Tracklist * self);
457
458NONNULL int
459tracklist_get_num_listened_tracks (const Tracklist * self);
460
464int
466
472int
473tracklist_get_plugins (const Tracklist * const self, GPtrArray * arr);
474
481void
483
491void
493
497void
499
500void
501tracklist_get_total_bars (Tracklist * self, int * total_bars);
502
507NONNULL void
508tracklist_set_caches (Tracklist * self, CacheTypes types);
509
516Tracklist *
518
519void
520tracklist_free (Tracklist * self);
521
525void
527
532#endif
The audio engine.
The backend for a timeline track.
NONNULL_ARGS(1) int undo_manager_undo(UndoManager *self
Undo last action.
Track * tracklist_get_next_visible_track(Tracklist *self, Track *track)
Returns the next visible Track in the same Tracklist as the given one (ie, pinned or not).
Track * tracklist_get_visible_track_after_delta(Tracklist *self, Track *track, int delta)
Returns the Track after delta visible Track's.
void(* TracksReadyCallback)(const FileImportInfo *, const GError *)
Called when track(s) are actually imported into the project.
Definition track.h:1433
Track * tracklist_get_first_visible_track(Tracklist *self, const int pinned)
Returns the first visible Track.
NONNULL void tracklist_remove_track(Tracklist *self, Track *track, bool rm_pl, bool free_track, bool publish_events, bool recalc_graph)
Removes a track from the Tracklist and the TracklistSelections.
bool tracklist_multiply_track_heights(Tracklist *self, double multiplier, bool visible_only, bool check_only, bool fire_events)
Multiplies all tracks' heights and returns if the operation was valid.
void tracklist_expose_ports_to_backend(Tracklist *self)
Exposes each track's ports that should be exposed to the backend.
bool tracklist_import_files(Tracklist *self, char **uri_list, const SupportedFile *orig_file, Track *track, TrackLane *lane, int index, const Position *pos, TracksReadyCallback ready_cb, GError **error)
Begins file import Handles a file drop inside the timeline or in empty space in the tracklist.
NONNULL bool tracklist_has_soloed(const Tracklist *self)
Returns if the tracklist has soloed tracks.
Track * tracklist_find_track_by_name(Tracklist *self, const char *name)
Returns the Track matching the given name, if any.
Track * tracklist_get_track_by_type(Tracklist *self, TrackType type)
Returns the first track found with the given type.
NONNULL void tracklist_set_caches(Tracklist *self, CacheTypes types)
Set various caches (snapshots, track name hashes, plugin input/output ports, etc).
void tracklist_handle_move_or_copy(Tracklist *self, Track *this_track, TrackWidgetHighlight location, GdkDragAction action)
Handles a move or copy action based on a drag.
NONNULL void tracklist_select_all(Tracklist *self, bool select, bool fire_events)
Selects or deselects all tracks.
NONNULL OPTIMIZE_O3 Track * tracklist_find_track_by_name_hash(Tracklist *self, unsigned int hash)
Returns the Track matching the given name, if any.
bool tracklist_track_name_is_unique(Tracklist *self, const char *name, Track *track_to_skip)
Returns 1 if the track name is not taken.
void tracklist_append_track(Tracklist *self, Track *track, int publish_events, int recalc_graph)
Calls tracklist_insert_track with the given options.
void tracklist_get_visible_tracks(Tracklist *self, Track **visible_tracks, int *num_visible)
Finds visible tracks and puts them in given array.
int tracklist_get_num_visible_tracks(Tracklist *self, int visible)
NONNULL bool tracklist_has_listened(const Tracklist *self)
Returns if the tracklist has listened tracks.
int tracklist_get_visible_track_diff(Tracklist *self, const Track *src, const Track *dest)
Returns the number of visible Tracks between src and dest (negative if dest is before src).
TracklistPinOption
Used in track search functions.
Definition tracklist.h:44
int tracklist_get_track_pos(Tracklist *self, Track *track)
Returns the index of the given Track.
Tracklist * tracklist_clone(Tracklist *src)
Only clones what is needed for project save.
void tracklist_move_track(Tracklist *self, Track *track, int pos, bool always_before_pos, bool publish_events, bool recalc_graph)
Moves a track from its current position to the position given by pos.
int tracklist_get_last_pos(Tracklist *self, const TracklistPinOption pin_opt, const bool visible_only)
Returns the index of the last Track.
Track * tracklist_get_prev_visible_track(Tracklist *self, Track *track)
Returns the previous visible Track in the same Tracklist as the given one (ie, pinned or not).
void guile_tracklist_define_module(void)
Define guile module.
void tracklist_set_track_pinned(Tracklist *self, Track *track, const int pinned, int publish_events, int recalc_graph)
Pins or unpins the Track.
void tracklist_activate_all_plugins(Tracklist *self, bool activate)
Activate or deactivate all plugins.
NONNULL HOT Track * tracklist_get_track(Tracklist *self, int idx)
Returns the track at the given index or NULL if the index is invalid.
Track * tracklist_get_last_track(Tracklist *self, const TracklistPinOption pin_opt, const int visible_only)
Returns the last Track.
TrackType
The Track's type.
Definition track.h:82
NONNULL void tracklist_print_tracks(Tracklist *self)
Prints the tracks (for debugging).
int tracklist_get_plugins(const Tracklist *const self, GPtrArray *arr)
Fills in the given array (if non-NULL) with all plugins in the tracklist and returns the number of pl...
void tracklist_mark_all_tracks_for_bounce(Tracklist *self, bool bounce)
Marks or unmarks all tracks for bounce.
NONNULL void tracklist_insert_track(Tracklist *self, Track *track, int pos, int publish_events, int recalc_graph)
Adds given track to given spot in tracklist.
TrackWidgetHighlight
Highlight location.
Definition track.h:83
Track widget to be shown in the tracklist.
The PinnedTracklistWidget contains special tracks (chord, marker, etc.) as thin boxes above the norma...
A Position is made up of bars.beats.sixteenths.ticks.
Definition position.h:126
Contains all of the info that will be serialized into a project file.
Definition project.h:146
A processor to be used in the routing graph for playing samples independent of the timeline.
Metadata for a supported file.
A TrackLane belongs to a Track (can have many TrackLanes in a Track) and contains Regions.
Definition track_lane.h:41
Track to be inserted into the Project's Tracklist.
Definition track.h:177
The TracklistWidget holds all the Track's in the Project.
Definition tracklist.h:40
The Tracklist contains all the tracks in the Project.
Definition tracklist.h:61
Project * project
Pointer to owner project, if any.
Definition tracklist.h:120
bool swapping_tracks
When this is true, some tracks may temporarily be moved beyond num_tracks.
Definition tracklist.h:114
Track * tempo_track
The tempo track, for convenience.
Definition tracklist.h:91
Track * chord_track
The chord track, for convenience.
Definition tracklist.h:85
Track * marker_track
The marker track, for convenience.
Definition tracklist.h:88
PinnedTracklistWidget * pinned_widget
PinnedTracklistWidget.
Definition tracklist.h:103
Track * tracks[MAX_TRACKS]
All tracks that exist.
Definition tracklist.h:80
Track * modulator_track
The modulator track, for convenience.
Definition tracklist.h:94
int width
Width of track widgets.
Definition tracklist.h:123
int pinned_tracks_cutoff
Index starting from which tracks are unpinned.
Definition tracklist.h:110
TracklistWidget * widget
Non-pinned TracklistWidget.
Definition tracklist.h:100
Track * master_track
The master track, for convenience.
Definition tracklist.h:97
SampleProcessor * sample_processor
Pointer to owner sample processor, if any.
Definition tracklist.h:117