Zrythm
a highly automated and intuitive digital audio workstation
Loading...
Searching...
No Matches
track.h File Reference

The backend for a timeline track. More...

#include "dsp/automation_tracklist.h"
#include "dsp/channel.h"
#include "dsp/chord_object.h"
#include "dsp/marker.h"
#include "dsp/modulator_macro_processor.h"
#include "dsp/region.h"
#include "dsp/scale.h"
#include "dsp/scale_object.h"
#include "dsp/track_lane.h"
#include "dsp/track_processor.h"
#include "plugins/plugin.h"
#include "utils/yaml.h"
#include <glib/gi18n.h>
Include dependency graph for track.h:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Data Structures

struct  InstrumentTrack
 Track to be inserted into the Project's Tracklist. More...
 

Macros

#define TRACK_MIN_HEIGHT   24
 
#define TRACK_DEF_HEIGHT   48
 
#define TRACK_MAGIC   21890135
 
#define IS_TRACK(x)   (((Track *) x)->magic == TRACK_MAGIC)
 
#define IS_TRACK_AND_NONNULL(x)   (x && IS_TRACK (x))
 
#define TRACK_MAX_MODULATOR_MACROS   128
 
#define TRACK_DND_PREFIX   Z_DND_STRING_PREFIX "Track::"
 
#define track_is_in_active_project(self)    (self->tracklist && tracklist_is_in_active_project (self->tracklist))
 
#define track_is_auditioner(self)    (self->tracklist && tracklist_is_auditioner (self->tracklist))
 Whether this track is part of the SampleProcessor auditioner tracklist.
 
#define track_get_name_hash(self)   g_str_hash (self->name)
 
#define track_is_pinned(x)   (x->pos < TRACKLIST->pinned_tracks_cutoff)
 Returns whether the track is pinned.
 
#define track_add_region(self, region, at, lane_pos, gen_name, fire_events, error)
 Adds a ZRegion to the given lane or AutomationTrack of the track.
 
#define track_type_is_audio_group   track_type_has_mono_compat_switch
 
#define track_create_empty_with_action(type, error)    track_create_empty_at_idx_with_action (type, TRACKLIST->num_tracks, error)
 Creates a new empty track at the end of the tracklist.
 

Typedefs

typedef struct _TrackWidget TrackWidget
 
typedef struct _FolderChannelWidget FolderChannelWidget
 
typedef struct Automatable Automatable
 
typedef struct Modulator Modulator
 
typedef enum PassthroughProcessorType PassthroughProcessorType
 
typedef enum FaderType FaderType
 
typedef void MIDI_FILE
 
typedef struct _WrappedObjectWithChangeSignal WrappedObjectWithChangeSignal
 
typedef void(* TracksReadyCallback) (const FileImportInfo *, const GError *)
 Called when track(s) are actually imported into the project.
 

Enumerations

enum  TrackType {
  TRACK_TYPE_INSTRUMENT , TRACK_TYPE_AUDIO , TRACK_TYPE_MASTER , TRACK_TYPE_CHORD ,
  TRACK_TYPE_MARKER , TRACK_TYPE_TEMPO , TRACK_TYPE_MODULATOR , TRACK_TYPE_AUDIO_BUS ,
  TRACK_TYPE_AUDIO_GROUP , TRACK_TYPE_MIDI , TRACK_TYPE_MIDI_BUS , TRACK_TYPE_MIDI_GROUP ,
  TRACK_TYPE_FOLDER
}
 The Track's type. More...
 

Functions

 TYPEDEF_STRUCT_UNDERSCORED (FileImportInfo)
 
COLD NONNULL_ARGS (1) void automation_tracklist_init_loaded(AutomationTracklist *self
 Inits a loaded AutomationTracklist.
 
void track_init (Track *self, const int add_lane)
 Inits the Track, optionally adding a single lane.
 
Tracktrack_new (TrackType type, int pos, const char *label, const int with_lane)
 Creates a track with the given label and returns it.
 
bool track_type_has_channel (TrackType type)
 Returns if the given TrackType is a type of Track that has a Channel.
 
NONNULL void track_set_magic (Track *self)
 Sets magic on objects recursively.
 
NONNULL void track_set_muted (Track *track, bool mute, bool trigger_undo, bool auto_select, bool fire_events)
 Sets track muted and optionally adds the action to the undo stack.
 
NONNULL void track_set_folded (Track *self, bool folded, bool trigger_undo, bool auto_select, bool fire_events)
 Sets track folded and optionally adds the action to the undo stack.
 
NONNULL TrackType track_get_type_from_plugin_descriptor (PluginDescriptor *descr)
 
NONNULL bool track_type_is_deletable (TrackType type)
 Returns whether the track type is deletable by the user.
 
NONNULL Tracklisttrack_get_tracklist (Track *self)
 
NONNULL bool track_get_should_be_visible (const Track *self)
 Returns whether the track should be visible.
 
bool track_multiply_heights (Track *self, double multiplier, bool visible_only, bool check_only)
 
HOT NONNULL bool track_get_soloed (Track *self)
 Returns if the track is soloed.
 
NONNULL bool track_get_implied_soloed (Track *self)
 Returns whether the track is not soloed on its own but its direct out (or its direct out's direct out, etc.) is soloed.
 
NONNULL bool track_get_muted (Track *self)
 Returns if the track is muted.
 
NONNULL bool track_get_listened (Track *self)
 Returns if the track is listened.
 
NONNULL bool track_get_monitor_audio (Track *self)
 Returns whether monitor audio is on.
 
NONNULL void track_set_monitor_audio (Track *self, bool monitor, bool auto_select, bool fire_events)
 Sets whether monitor audio is on.
 
NONNULL void track_set_listened (Track *self, bool listen, bool trigger_undo, bool auto_select, bool fire_events)
 Sets track soloed, updates UI and optionally adds the action to the undo stack.
 
HOT NONNULL bool track_get_recording (const Track *const track)
 
NONNULL void track_set_recording (Track *track, bool recording, bool fire_events)
 Sets recording and connects/disconnects the JACK ports.
 
NONNULL void track_set_soloed (Track *self, bool solo, bool trigger_undo, bool auto_select, bool fire_events)
 Sets track soloed, updates UI and optionally adds the action to the undo stack.
 
NONNULL bool track_has_soloed_lanes (const Track *const self)
 Returns whether the track has any soloed lanes.
 
NONNULL int track_is_selected (Track *self)
 Returns if Track is in TracklistSelections.
 
bool track_insert_region (Track *track, ZRegion *region, AutomationTrack *at, int lane_pos, int idx, int gen_name, int fire_events, GError **error)
 Inserts a ZRegion to the given lane or AutomationTrack of the track, at the given index.
 
void track_write_to_midi_file (const Track *self, MIDI_FILE *mf, MidiEvents *events, const Position *start, const Position *end, bool lanes_as_tracks, bool use_track_pos)
 Writes the track to the given MIDI file.
 
NONNULL void track_select (Track *self, bool select, bool exclusive, bool fire_events)
 Appends the Track to the selections.
 
NONNULL void track_unselect_all (Track *self)
 Unselects all arranger objects in the track.
 
NONNULL bool track_contains_uninstantiated_plugin (const Track *const self)
 
NONNULL void track_clear (Track *self)
 Removes all objects recursively from the track.
 
NONNULL void track_remove_region (Track *self, ZRegion *region, bool fire_events, bool free)
 Only removes the region from the track.
 
void track_fill_events (const Track *self, const EngineProcessTimeInfo *const time_nfo, MidiEvents *midi_events, StereoPorts *stereo_ports)
 Wrapper for audio and MIDI/instrument tracks to fill in MidiEvents or StereoPorts from the timeline data.
 
bool track_validate (Track *self)
 Verifies the identifiers on a live Track (in the project, not a clone).
 
void track_add_folder_parents (const Track *self, GPtrArray *parents, bool prepend)
 Adds the track's folder parents to the given array.
 
Tracktrack_get_direct_folder_parent (Track *track)
 Returns the closest foldable parent or NULL.
 
void track_remove_from_folder_parents (Track *self)
 Remove the track from all folders.
 
ZRegiontrack_get_region_at_pos (const Track *track, const Position *pos, bool include_region_end)
 Returns the region at the given position, or NULL.
 
ZRegiontrack_get_last_region (Track *track)
 Returns the last ZRegion in the track, or NULL.
 
void track_set_lanes_visible (Track *track, const int visible)
 Set track lanes visible and fire events.
 
void track_set_automation_visible (Track *track, const bool visible)
 Set automation visible and fire events.
 
int track_type_can_host_region_type (const TrackType tt, const RegionType rt)
 Returns if the given TrackType can host the given RegionType.
 
void track_generate_automation_tracks (Track *track)
 Generates automatables for the track.
 
void track_setup (Track *track)
 Wrapper.
 
void track_update_children (Track *self)
 Updates the track's children.
 
Tracktrack_find_by_name (const char *name)
 
void track_get_velocities_in_range (const Track *track, const Position *start_pos, const Position *end_pos, Velocity ***velocities, int *num_velocities, size_t *velocities_size, int inside)
 Fills in the array with all the velocities in the project that are within or outside the range given.
 
const char * track_get_name (Track *track)
 Getter for the track name.
 
NONNULL bool track_set_name_with_action_full (Track *track, const char *name)
 Internally called by track_set_name_with_action().
 
void track_set_name_with_action (Track *track, const char *name)
 Setter to be used by the UI to create an undoable action.
 
void track_set_name (Track *self, const char *name, bool pub_events)
 Setter for the track name.
 
char * track_get_unique_name (Track *track_to_skip, const char *name)
 Returns a unique name for a new track based on the given name.
 
Tracktrack_get_from_name (const char *name)
 Returns the Track from the Project matching name.
 
const char * track_stringize_type (TrackType type)
 
void track_update_positions (Track *self, bool from_ticks, bool bpm_change)
 Updates the frames/ticks of each position in each child of the track recursively.
 
Fadertrack_get_fader (Track *track, bool post_fader)
 Returns the Fader (if applicable).
 
FaderType track_get_fader_type (const Track *track)
 Returns the FaderType corresponding to the given Track.
 
FaderType track_type_get_prefader_type (TrackType type)
 Returns the prefader type corresponding to the given Track.
 
bool track_create_missing_lanes (Track *self, const int pos)
 Creates missing TrackLane's until pos.
 
void track_remove_empty_last_lanes (Track *self)
 Removes the empty last lanes of the Track (except the last one).
 
int track_get_regions_in_range (Track *self, Position *p1, Position *p2, ZRegion **regions)
 Returns all the regions inside the given range, or all the regions if both p1 and p2 are NULL.
 
int track_get_plugins (const Track *const self, GPtrArray *arr)
 Fills in the given array (if non-NULL) with all plugins in the track and returns the number of plugins.
 
void track_activate_all_plugins (Track *track, bool activate)
 
void track_comment_setter (void *track, const char *comment)
 Comment setter.
 
void track_set_comment (Track *self, const char *comment, bool undoable)
 
const char * track_get_comment (void *track)
 Comment getter.
 
void track_set_color (Track *self, const GdkRGBA *color, bool undoable, bool fire_events)
 Sets the track color.
 
void track_set_icon (Track *self, const char *icon_name, bool undoable, bool fire_events)
 Sets the track icon.
 
Plugintrack_get_plugin_at_slot (Track *track, PluginSlotType slot_type, int slot)
 Returns the plugin at the given slot, if any.
 
void track_mark_for_bounce (Track *self, bool bounce, bool mark_regions, bool mark_children, bool mark_parents)
 Marks the track for bouncing.
 
void track_append_ports (Track *self, GPtrArray *ports, bool include_plugins)
 Appends all channel ports and optionally plugin ports to the array.
 
bool track_freeze (Track *self, bool freeze, GError **error)
 Freezes or unfreezes the track.
 
void track_insert_plugin (Track *self, Plugin *pl, PluginSlotType slot_type, int slot, bool instantiate_plugin, bool replacing_plugin, bool moving_plugin, bool confirm, bool gen_automatables, bool recalc_graph, bool fire_events)
 Wrapper over channel_add_plugin() and modulator_track_insert_modulator().
 
void track_remove_plugin (Track *self, PluginSlotType slot_type, int slot, bool replacing_plugin, bool moving_plugin, bool deleting_plugin, bool deleting_track, bool recalc_graph)
 Wrapper over channel_remove_plugin() and modulator_track_remove_modulator().
 
void track_disconnect (Track *self, bool remove_pl, bool recalc_graph)
 Disconnects the track from the processing chain.
 
NONNULL bool track_is_enabled (Track *self)
 
NONNULL void track_set_enabled (Track *self, bool enabled, bool trigger_undo, bool auto_select, bool fire_events)
 
TrackType track_type_get_from_string (const char *str)
 
void track_get_total_bars (Track *self, int *total_bars)
 
void track_set_caches (Track *self, CacheTypes types)
 Set various caches (snapshots, track name hash, plugin input/output ports, etc).
 
bool track_create_with_action (TrackType type, const PluginSetting *pl_setting, const SupportedFile *file_descr, const Position *pos, int index, int num_tracks, int disable_track_idx, TracksReadyCallback ready_cb, GError **error)
 
Tracktrack_create_empty_at_idx_with_action (TrackType type, int index, GError **error)
 
Tracktrack_create_for_plugin_at_idx_w_action (TrackType type, const PluginSetting *pl_setting, int index, GError **error)
 
GMenu * track_generate_edit_context_menu (Track *track, int num_selected)
 
GMenu * track_generate_channel_context_menu (Track *track)
 Generates a menu to be used for channel-related items, eg, fader buttons, direct out, etc.
 
void track_free (Track *track)
 Wrapper for each track type.
 

Variables

COLD Tracklisttracklist
 
COLD Tracklist TracklistSelectionsts
 
GError ** error
 

Detailed Description

The backend for a timeline track.

Definition in file track.h.

Typedef Documentation

◆ Automatable

typedef struct Automatable Automatable

Definition at line 36 of file track.h.

◆ FaderType

typedef enum FaderType FaderType

Definition at line 47 of file track.h.

◆ FolderChannelWidget

typedef struct _FolderChannelWidget FolderChannelWidget

Definition at line 32 of file track.h.

◆ MIDI_FILE

typedef void MIDI_FILE

Definition at line 48 of file track.h.

◆ Modulator

typedef struct Modulator Modulator

Definition at line 40 of file track.h.

◆ PassthroughProcessorType

typedef enum PassthroughProcessorType PassthroughProcessorType

Definition at line 46 of file track.h.

◆ TrackWidget

typedef struct _TrackWidget TrackWidget

Definition at line 31 of file track.h.

◆ WrappedObjectWithChangeSignal

typedef struct _WrappedObjectWithChangeSignal WrappedObjectWithChangeSignal

Definition at line 49 of file track.h.