10#ifndef __AUDIO_TRACK_H__
11#define __AUDIO_TRACK_H__
26#include <glib/gi18n.h>
36typedef struct Automatable Automatable;
40typedef struct Modulator Modulator;
46enum class PassthroughProcessorType;
48typedef void MIDI_FILE;
59#define TRACK_MIN_HEIGHT 24
60#define TRACK_DEF_HEIGHT 48
62#define TRACK_MAGIC 21890135
63#define IS_TRACK(x) (((Track *) x)->magic == TRACK_MAGIC)
64#define IS_TRACK_AND_NONNULL(x) (x && IS_TRACK (x))
66#define TRACK_MAX_MODULATOR_MACROS 128
68#define TRACK_DND_PREFIX Z_DND_STRING_PREFIX "Track::"
70#define track_is_in_active_project(self) \
71 (self->tracklist && tracklist_is_in_active_project (self->tracklist))
75#define track_is_auditioner(self) \
76 (self->tracklist && tracklist_is_auditioner (self->tracklist))
162static const char * track_type_strings[] = {
163 N_ (
"Instrument"), N_ (
"Audio"), N_ (
"Master"), N_ (
"Chord"),
164 N_ (
"Marker"), N_ (
"Tempo"), N_ (
"Modulator"), N_ (
"Audio FX"),
165 N_ (
"Audio Group"), N_ (
"MIDI"), N_ (
"MIDI FX"), N_ (
"MIDI Group"),
262 int num_lane_snapshots;
344 int num_chord_regions;
345 size_t chord_regions_size;
349 int num_chord_region_snapshots;
362 int num_scale_snapshots;
374 int num_marker_snapshots;
410 size_t modulators_size;
414 int num_modulator_macros;
415 int num_visible_modulator_macros;
483 size_t children_size;
566track_type_can_have_direct_out (
TrackType type)
576 case RegionType::REGION_TYPE_AUDIO:
578 case RegionType::REGION_TYPE_MIDI:
581 case RegionType::REGION_TYPE_CHORD:
583 case RegionType::REGION_TYPE_AUTOMATION:
587 g_return_val_if_reached (
false);
613#define track_get_name_hash(self) g_str_hash (self->name)
650track_get_tracklist (
Track * self);
672track_multiply_heights (
740track_get_recording (
const Track *
const track);
783#define track_is_pinned(x) (x->pos < TRACKLIST->pinned_tracks_cutoff)
800#define track_add_region( \
801 self, region, at, lane_pos, gen_name, fire_events, error) \
802 track_insert_region ( \
803 self, region, at, lane_pos, -1, gen_name, fire_events, error)
853 bool lanes_as_tracks,
873track_contains_uninstantiated_plugin (const
Track * const self);
951 bool include_region_end);
980track_type_has_mono_compat_switch (const
TrackType tt)
986#define track_type_is_audio_group track_type_has_mono_compat_switch
999track_type_can_record (
const TrackType type)
1026track_get_automation_tracklist (
Track *
const track)
1028 g_return_val_if_fail (IS_TRACK (track), NULL);
1030 switch (track->
type)
1046 return &track->automation_tracklist;
1048 g_warn_if_reached ();
1059NONNULL
static inline Channel *
1060track_get_channel (
const Track *
const track)
1062 switch (track->
type)
1092track_type_has_piano_roll (
const TrackType type)
1103track_has_inputs (
const Track * track)
1111track_find_by_name (
const char * name);
1123 const Track * track,
1127 int * num_velocities,
1128 size_t * velocities_size,
1188 return type1 == type2
1265track_activate_all_plugins (
Track * track,
bool activate);
1293 const GdkRGBA * color,
1303 const char * icon_name,
1371 bool instantiate_plugin,
1372 bool replacing_plugin,
1375 bool gen_automatables,
1388 bool replacing_plugin,
1390 bool deleting_plugin,
1391 bool deleting_track,
1408track_is_enabled (
Track * self);
1418static inline const char *
1421 return track_type_strings[
static_cast<int> (type)];
1425track_type_get_from_string (
const char * str);
1428track_get_total_bars (
Track * self,
int * total_bars);
1456 int disable_track_idx,
1461track_create_empty_at_idx_with_action (
TrackType type,
int index, GError ** error);
1464track_create_for_plugin_at_idx_w_action (
1474#define track_create_empty_with_action(type, error) \
1475 track_create_empty_at_idx_with_action (type, TRACKLIST->num_tracks, error)
1478track_generate_edit_context_menu (
Track * track,
int num_selected);
Automation tracklist containing automation points and curves.
API for Channel, representing a channel strip on the mixer.
Chord object in the TimelineArranger.
A region in the timeline.
Scale object inside the chord Track in the TimelineArranger.
NONNULL_ARGS(1) int undo_manager_undo(UndoManager *self
Undo last action.
NONNULL bool track_get_listened(Track *self)
Returns if the track is listened.
NONNULL void track_set_monitor_audio(Track *self, bool monitor, bool auto_select, bool fire_events)
Sets whether monitor audio is on.
void(* TracksReadyCallback)(const FileImportInfo *, const GError *)
Called when track(s) are actually imported into the project.
GMenu * track_generate_channel_context_menu(Track *track)
Generates a menu to be used for channel-related items, eg, fader buttons, direct out,...
void track_remove_plugin(Track *self, ZPluginSlotType 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().
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)
NONNULL int track_is_selected(Track *self)
Returns if Track is in TracklistSelections.
void track_disconnect(Track *self, bool remove_pl, bool recalc_graph)
Disconnects the track from the processing chain.
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.
Track * track_get_direct_folder_parent(Track *track)
Returns the closest foldable parent or NULL.
Plugin * track_get_plugin_at_slot(Track *track, ZPluginSlotType slot_type, int slot)
Returns the plugin at the given slot, if any.
const char * track_get_name(Track *track)
Getter for the track name.
void track_add_folder_parents(const Track *self, GPtrArray *parents, bool prepend)
Adds the track's folder parents to the given array.
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 plugin...
Fader * track_get_fader(Track *track, bool post_fader)
Returns the Fader (if applicable).
void track_update_children(Track *self)
Updates the track's children.
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.
Region * track_get_region_at_pos(const Track *track, const Position *pos, bool include_region_end)
Returns the region at the given position, or NULL.
HOT NONNULL bool track_get_soloed(Track *self)
Returns if the track is soloed.
Region * track_get_last_region(Track *track)
Returns the last Region in the track, or NULL.
ZPortType
Type of signals the Port handles.
bool track_type_has_channel(TrackType type)
Returns if the given TrackType is a type of Track that has a Channel.
void track_set_lanes_visible(Track *track, const int visible)
Set track lanes visible and fire events.
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.
bool track_create_missing_lanes(Track *self, const int pos)
Creates missing TrackLane's until pos.
NONNULL bool track_set_name_with_action_full(Track *track, const char *name)
Internally called by track_set_name_with_action().
bool track_insert_region(Track *track, Region *region, AutomationTrack *at, int lane_pos, int idx, int gen_name, int fire_events, GError **error)
Inserts a Region to the given lane or AutomationTrack of the track, at the given index.
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_set_color(Track *self, const GdkRGBA *color, bool undoable, bool fire_events)
Sets the track color.
FaderType track_type_get_prefader_type(TrackType type)
Returns the prefader type corresponding to the given Track.
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.
void track_remove_from_folder_parents(Track *self)
Remove the track from all folders.
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.
void track_insert_plugin(Track *self, Plugin *pl, ZPluginSlotType 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_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 d...
FaderType track_get_fader_type(const Track *track)
Returns the FaderType corresponding to the given Track.
NONNULL double track_get_full_visible_height(Track *const self)
Returns the full visible height (main height + height of all visible automation tracks + height of al...
void track_remove_empty_last_lanes(Track *self)
Removes the empty last lanes of the Track (except the last one).
void track_set_name(Track *self, const char *name, bool pub_events)
Setter for the track name.
void track_setup(Track *track)
Wrapper.
void track_generate_automation_tracks(Track *track)
Generates automatables for the track.
NONNULL void track_unselect_all(Track *self)
Unselects all arranger objects in the track.
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_set_caches(Track *self, CacheTypes types)
Set various caches (snapshots, track name hash, plugin input/output ports, etc).
NONNULL void track_set_magic(Track *self)
Sets magic on objects recursively.
bool track_validate(Track *self)
Verifies the identifiers on a live Track (in the project, not a clone).
void track_set_name_with_action(Track *track, const char *name)
Setter to be used by the UI to create an undoable action.
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.
void track_free(Track *track)
Wrapper for each track type.
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.
void track_init(Track *self, const int add_lane)
Inits the Track, optionally adding a single lane.
const char * track_get_comment(void *track)
Comment getter.
NONNULL void track_clear(Track *self)
Removes all objects recursively from the track.
RegionType
Type of Region.
NONNULL bool track_get_monitor_audio(Track *self)
Returns whether monitor audio is on.
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 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...
NONNULL bool track_has_soloed_lanes(const Track *const self)
Returns whether the track has any soloed lanes.
void track_set_icon(Track *self, const char *icon_name, bool undoable, bool fire_events)
Sets the track icon.
void track_set_automation_visible(Track *track, const bool visible)
Set automation visible and fire events.
NONNULL void track_set_recording(Track *track, bool recording, bool fire_events)
Sets recording and connects/disconnects the JACK ports.
Track * track_get_from_name(const char *name)
Returns the Track from the Project matching name.
NONNULL bool track_get_should_be_visible(const Track *self)
Returns whether the track should be visible.
NONNULL void track_select(Track *self, bool select, bool exclusive, bool fire_events)
Appends the Track to the selections.
TrackType
The Track's type.
NONNULL void track_remove_region(Track *self, Region *region, bool fire_events, bool free)
Only removes the region from the track.
int track_get_regions_in_range(Track *self, Position *p1, Position *p2, Region **regions)
Returns all the regions inside the given range, or all the regions if both p1 and p2 are NULL.
void track_set_comment(Track *self, const char *comment, bool undoable)
NONNULL bool track_type_is_deletable(TrackType type)
Returns whether the track type is deletable by the user.
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.
Track * track_new(TrackType type, int pos, const char *label, const int with_lane)
Creates a track with the given label and returns it.
void track_comment_setter(void *track, const char *comment)
Comment setter.
NONNULL bool track_get_muted(Track *self)
Returns if the track is muted.
@ TRACK_TYPE_INSTRUMENT
Instrument tracks must have an Instrument plugin at the first slot and they produce audio output.
@ TRACK_TYPE_MIDI
Midi tracks can only have MIDI effects in the strip and produce MIDI output that can be routed to ins...
@ TRACK_TYPE_AUDIO
Audio tracks can record and contain audio clips.
@ TRACK_TYPE_MODULATOR
Special track to contain global Modulator's.
@ TRACK_TYPE_AUDIO_BUS
Buses are channels that receive audio input and have effects on their channel strip.
@ TRACK_TYPE_TEMPO
Special track for BPM (tempo) and time signature events.
@ TRACK_TYPE_MASTER
The master track is a special type of group track.
@ TRACK_TYPE_MARKER
Marker Track's contain named markers at specific Position's in the song.
@ TRACK_TYPE_AUDIO_GROUP
Group Tracks are used for grouping audio signals, for example routing multiple drum tracks to a "Drum...
@ TRACK_TYPE_MIDI_GROUP
Same with audio group but for MIDI signals.
@ TRACK_TYPE_FOLDER
Foldable track used for visual grouping.
@ TRACK_TYPE_MIDI_BUS
Same with audio bus but for MIDI signals.
@ TRACK_TYPE_CHORD
The chord track contains chords that can be used to modify midi in real time or to color the piano ro...
Modulator macro button processor.
An automation point inside an AutomationTrack.
Each track has an automation tracklist with automation tracks to be generated at runtime,...
A Channel is part of a Track (excluding Tracks that don't have Channels) and contains information rel...
A ChordObject to be shown in the TimelineArrangerWidget.
Common struct to pass around during processing to avoid repeating the data in function arguments.
A Fader is a processor that is used for volume controls and pan.
Marker for the MarkerTrack.
Container for passing midi events through ports.
Modulator macro button processor.
Musical scale descriptor.
A setting for a specific plugin descriptor.
The base plugin Inheriting plugins must have this as a child.
Must ONLY be created via port_new()
A Position is made up of bars.beats.sixteenths.ticks.
A region (clip) is an object on the timeline that contains either MidiNote's or AudioClip's.
A ScaleObject to be shown in the TimelineArrangerWidget.
L & R port, for convenience.
Metadata for a supported file.
A TrackLane belongs to a Track (can have many TrackLanes in a Track) and contains Regions.
A TrackProcessor is a processor that is used as the first entry point when processing a track.
Track to be inserted into the Project's Tracklist.
bool block_auto_creation_and_deletion
Block auto-creating or deleting lanes.
bool frozen
Whether the track is currently frozen.
bool drum_mode
Whether drum mode in the piano roll is enabled for this track.
char * name
Track name, used in channel too.
ZPortType in_signal_type
The input signal type (eg audio bus tracks have audio input signals).
bool automation_visible
Flag to set automations visible or not.
bool lanes_visible
Flag to set track lanes visible or not.
bool record_set_automatically
Whether record was set automatically when the channel was selected.
bool bounce
Set to ON during bouncing if this track should be included.
WrappedObjectWithChangeSignal * gobj
Used in Gtk.
ScaleObject ** scale_snapshots
Snapshots used during playback TODO unimplemented.
Region ** chord_region_snapshots
Snapshots used during playback.
bool recording_paused
This must only be set by the RecordingManager when temporarily pausing recording, eg when looping or ...
unsigned int * children
Name hashes of tracks that are routed to this track, if group track.
Plugin ** modulators
Modulators.
unsigned int name_hash
Cache calculated when adding to graph.
Port * beats_per_bar_port
Automatable beats per bar port.
char * comment
User comments.
Port * recording
Recording or not.
int last_lane_idx
Lane index of region before recording paused.
GdkRGBA color
Track color.
bool disconnecting
Whether currently disconnecting.
bool trigger_midi_activity
Flag to tell the UI that this channel had MIDI activity.
Port * bpm_port
Automatable BPM control.
Stretcher * rt_stretcher
Real-time time stretcher.
double main_height
Height of the main part (without lanes).
Region ** chord_regions
ChordObject's.
Region * recording_region
Region currently recording on.
uint8_t midi_ch
MIDI channel (MIDI/Instrument track only).
TrackType type
The type of track this is.
char * icon_name
Icon name of the track.
TrackProcessor * processor
The TrackProcessor, used for processing.
int size
Number of tracks inside this track.
Marker ** marker_snapshots
Snapshots used during playback TODO unimplemented.
bool bounce_to_master
Whether to temporarily route the output to master (e.g., when bouncing the track on its own without i...
TrackLane ** lanes
Lanes in this track containing Regions.
int pos
Position in the Tracklist.
ZPortType out_signal_type
The output signal type (eg midi tracks have MIDI output signals).
Port * beat_unit_port
Automatable beat unit port.
Tracklist * tracklist
Pointer to owner tracklist, if any.
bool folded
Whether currently folded.
bool recording_stop_sent
This is a flag to let the recording manager know that a STOP signal was already sent for recording.
ScaleObject ** scales
ScaleObject's.
bool recording_start_sent
This is a flag to let the recording manager know that a START signal was already sent for recording.
bool visible
Whole Track is visible or not.
TrackWidget * widget
Track Widget created dynamically.
int pool_id
Pool ID of the clip if track is frozen.
TrackLane ** lane_snapshots
Snapshots used during playback.
bool enabled
Active (enabled) or not.
TracklistSelections * ts
Pointer to owner tracklist selections, if any.
FolderChannelWidget * folder_ch_widget
Widget used for foldable tracks in the mixer.
ModulatorMacroProcessor * modulator_macros[TRACK_MAX_MODULATOR_MACROS]
Modulator macros.
bool filtered
Track will be hidden if true (temporary and not serializable).
Channel * channel
1 Track has 0 or 1 Channel.
int passthrough_midi_input
If set to 1, the input received will not be changed to the selected MIDI channel.
int last_lane_created
Last lane created during this drag.
Selections to be used for the tracklist's current selections, copying, undoing, etc.
The Tracklist contains all the tracks in the Project.
A GObject-ified normal C object with a signal that interested parties can listen to for changes.
Track lanes for each track.