Audio module

DSP and audio related code.

Classes

struct AutomationPoint
An automation point inside an AutomationTrack.
struct AutomationTracklist
Each track has an automation tracklist with automation tracks to be generated at runtime, and filled in with automation points/curves when loading projects.
struct Channel
A Channel is part of a Track (excluding Tracks that don't have Channels) and contains information related to routing and the Mixer.
struct ChannelSend
Channel send.
struct ChordDescriptor
A ChordDescriptor describes a chord and is not linked to any specific object by itself.
struct ChordObject
A ChordObject to be shown in the TimelineArrangerWidget.
struct AudioClip
Audio clips for the pool.
struct ControlRoom
The control room allows to specify how Listen will work on each Channel and to set overall volume after the Master Channel so you can change the volume without touching the Master Fader.
struct CurveOptions
Curve options.
struct AudioEncoder
Struct for holding info for encoding.
struct AudioEngineEvent
Audio engine event.
struct AudioEngine
The audio engine.
struct ExportSettings
Export settings to be passed to the exporter to use.
struct ExtPort
External port.
struct Fader
A Fader is a processor that is used for volume controls and pan.
struct Graph
Graph.
struct GraphNode
A node in the processing graph.
struct HardwareProcessor
Hardware processor.
struct Marker
Marker for the MarkerTrack.
struct Meter
A Meter used by a single GUI element.
struct Metronome
Metronome settings.
struct MidiEvent
Backend-agnostic MIDI event descriptor.
struct MidiEvents
Container for passing midi events through ports.
struct MidiEventHeader
Used by Windows MME and RtMidi when adding events to the ring.
struct MidiMapping
A mapping from a MIDI value to a destination.
struct MidiMappings
All MIDI mappings in Zrythm.
struct MidiNote
A MIDI note inside a ZRegion shown in the piano roll.
struct ModulatorMacroProcessor
Modulator macro button processor.
struct AudioPool
An audio pool is a pool of audio files and their corresponding float arrays in memory that are referenced by regions.
struct PortScalePoint
Scale point.
struct Port
Must ONLY be created via port_new()
struct StereoPorts
L & R port, for convenience.
struct PortIdentifier
Struct used to identify Ports in the project.
struct Position
A Position is made up of bars.beats.sixteenths.ticks.
struct RecordingEvent
A recording event.
struct ZRegion
A region (clip) is an object on the timeline that contains either MidiNote's or AudioClip's.
struct RegionIdentifier
Index/identifier for a Region, so we can get Region objects quickly with it without searching by name.
struct RegionLinkGroup
A group of linked regions.
struct RegionLinkGroupManager
Manager of region link groups.
struct SamplePlayback
A sample playback handle to be used by the engine.
struct SampleProcessor
A processor to be used in the routing graph for playing samples independent of the timeline.
struct MusicalScale
To be generated at the beginning, and then copied and reused.
struct ScaleObject
A ScaleObject to be shown in the TimelineArrangerWidget.
struct Stretcher
Stretcher interface.
struct Track
Track to be inserted into the Project's Tracklist.
struct TrackLane
A TrackLane belongs to a Track (can have many TrackLanes in a Track) and contains Regions.
struct TrackProcessor
A TrackProcessor is a processor that is used as the first entry point when processing a track.
struct Tracklist
The Tracklist contains all the tracks in the Project.
struct Transport
The transport.
struct Velocity
The MidiNote velocity.

Enums

enum BalanceControlAlgorithm { BALANCE_CONTROL_ALGORITHM_LINEAR }
See https://www.harmonycentral.com/articles/the-truth-about-panning-laws.
enum ChordType { CHORD_TYPE_MAJ, CHORD_TYPE_MIN, CHORD_TYPE_DIM, CHORD_TYPE_SUS4, CHORD_TYPE_SUS2, CHORD_TYPE_AUG, NUM_CHORD_TYPES }
Chord type.
enum ChordAccent { CHORD_ACC_NONE, CHORD_ACC_7, CHORD_ACC_j7, CHORD_ACC_b9, CHORD_ACC_9, CHORD_ACC_S9, CHORD_ACC_11, CHORD_ACC_b5_S11, CHORD_ACC_S5_b13, CHORD_ACC_6_13, NUM_CHORD_ACCENTS }
Chord accents.
enum CurveAlgorithm { CURVE_ALGORITHM_EXPONENT, CURVE_ALGORITHM_SUPERELLIPSE, CURVE_ALGORITHM_VITAL, CURVE_ALGORITHM_PULSE, NUM_CURVE_ALGORITHMS }
The algorithm to use for curves.
enum AudioEngineEventType { AUDIO_ENGINE_EVENT_BUFFER_SIZE_CHANGE, AUDIO_ENGINE_EVENT_SAMPLE_RATE_CHANGE }
Audio engine event type.
enum AudioEngineBufferSize { AUDIO_ENGINE_BUFFER_SIZE_16, AUDIO_ENGINE_BUFFER_SIZE_32, AUDIO_ENGINE_BUFFER_SIZE_64, AUDIO_ENGINE_BUFFER_SIZE_128, AUDIO_ENGINE_BUFFER_SIZE_256, AUDIO_ENGINE_BUFFER_SIZE_512, AUDIO_ENGINE_BUFFER_SIZE_1024, AUDIO_ENGINE_BUFFER_SIZE_2048, AUDIO_ENGINE_BUFFER_SIZE_4096, NUM_AUDIO_ENGINE_BUFFER_SIZES }
Buffer sizes to be used in combo boxes.
enum AudioEngineSamplerate { AUDIO_ENGINE_SAMPLERATE_22050, AUDIO_ENGINE_SAMPLERATE_32000, AUDIO_ENGINE_SAMPLERATE_44100, AUDIO_ENGINE_SAMPLERATE_48000, AUDIO_ENGINE_SAMPLERATE_88200, AUDIO_ENGINE_SAMPLERATE_96000, AUDIO_ENGINE_SAMPLERATE_192000, NUM_AUDIO_ENGINE_SAMPLERATES }
Samplerates to be used in comboboxes.
enum BounceMode { BOUNCE_OFF, BOUNCE_ON, BOUNCE_INHERIT }
Mode used when bouncing, either during exporting or when bouncing tracks or regions to audio.
enum AudioFormat { AUDIO_FORMAT_FLAC, AUDIO_FORMAT_OGG_VORBIS, AUDIO_FORMAT_OGG_OPUS, AUDIO_FORMAT_WAV, AUDIO_FORMAT_MP3, AUDIO_FORMAT_MIDI, AUDIO_FORMAT_RAW, NUM_AUDIO_FORMATS }
Audio format.
enum BitDepth { BIT_DEPTH_16, BIT_DEPTH_24, BIT_DEPTH_32 }
Bit depth.
enum ExportTimeRange { TIME_RANGE_LOOP, TIME_RANGE_SONG, TIME_RANGE_CUSTOM }
Time range to export.
enum ExportMode { EXPORT_MODE_FULL, EXPORT_MODE_TRACKS, EXPORT_MODE_REGIONS }
Export mode.
enum ExtPortType { EXT_PORT_TYPE_JACK, EXT_PORT_TYPE_ALSA, EXT_PORT_TYPE_WINDOWS_MME, EXT_PORT_TYPE_RTMIDI, EXT_PORT_TYPE_RTAUDIO }
External port type.
enum FaderType { FADER_TYPE_NONE, FADER_TYPE_MONITOR, FADER_TYPE_AUDIO_CHANNEL, FADER_TYPE_MIDI_CHANNEL, FADER_TYPE_GENERIC }
Fader type.
enum MidiFaderMode { MIDI_FADER_MODE_VEL_MULTIPLIER, MIDI_FADER_MODE_CC_VOLUME }
enum GraphExportType { NUM_GRAPH_EXPORT_TYPES }
Export type.
enum GraphNodeType { ROUTE_NODE_TYPE_PORT, ROUTE_NODE_TYPE_PLUGIN, ROUTE_NODE_TYPE_TRACK, ROUTE_NODE_TYPE_FADER, ROUTE_NODE_TYPE_MONITOR_FADER, ROUTE_NODE_TYPE_PREFADER, ROUTE_NODE_TYPE_SAMPLE_PROCESSOR, ROUTE_NODE_TYPE_INITIAL_PROCESSOR, ROUTE_NODE_TYPE_HW_PROCESSOR, ROUTE_NODE_TYPE_MODULATOR_MACRO_PROCESOR }
Graph nodes can be either ports or processors.
enum MarkerType { MARKER_TYPE_START, MARKER_TYPE_END, MARKER_TYPE_CUSTOM }
Marker type.
enum MeterAlgorithm { METER_ALGORITHM_AUTO, METER_ALGORITHM_DIGITAL_PEAK, METER_ALGORITHM_TRUE_PEAK, METER_ALGORITHM_RMS, METER_ALGORITHM_K }
enum MetronomeType { METRONOME_TYPE_NONE, METRONOME_TYPE_EMPHASIS, METRONOME_TYPE_NORMAL }
The type of the metronome sound.
enum MidiEventType { MIDI_EVENT_TYPE_PITCHBEND, MIDI_EVENT_TYPE_CONTROLLER, MIDI_EVENT_TYPE_NOTE_OFF, MIDI_EVENT_TYPE_NOTE_ON, MIDI_EVENT_TYPE_ALL_NOTES_OFF }
Type of MIDI event.
enum PortInternalType { INTERNAL_NONE, INTERNAL_LV2_PORT, INTERNAL_JACK_PORT, INTERNAL_PA_PORT, INTERNAL_ALSA_SEQ_PORT }
What the internal data is.
enum PortFlow { FLOW_UNKNOWN, FLOW_INPUT, FLOW_OUTPUT }
Direction of the signal.
enum PortType { TYPE_UNKNOWN, TYPE_CONTROL, TYPE_AUDIO, TYPE_EVENT, TYPE_CV }
Type of signals the Port handles.
enum PortUnit { PORT_UNIT_NONE, PORT_UNIT_HZ, PORT_UNIT_MHZ, PORT_UNIT_DB, PORT_UNIT_DEGREES, PORT_UNIT_SECONDS, PORT_UNIT_MS }
Port unit to be displayed in the UI.
enum PortOwnerType { PORT_OWNER_TYPE_BACKEND, PORT_OWNER_TYPE_PLUGIN, PORT_OWNER_TYPE_TRACK, PORT_OWNER_TYPE_FADER, PORT_OWNER_TYPE_CHANNEL_SEND, PORT_OWNER_TYPE_PREFADER, PORT_OWNER_TYPE_MONITOR_FADER, PORT_OWNER_TYPE_TRACK_PROCESSOR, PORT_OWNER_TYPE_SAMPLE_PROCESSOR, PORT_OWNER_TYPE_HW, PORT_OWNER_TYPE_TRANSPORT }
Type of owner.
enum PortFlags { PORT_FLAG_STEREO_L = 1 << 0, PORT_FLAG_STEREO_R = 1 << 1, PORT_FLAG_PIANO_ROLL = 1 << 2, PORT_FLAG_SIDECHAIN = 1 << 3, PORT_FLAG_MAIN_PORT = 1 << 4, PORT_FLAG_MANUAL_PRESS = 1 << 5, PORT_FLAG_AMPLITUDE = 1 << 6, PORT_FLAG_STEREO_BALANCE = 1 << 7, PORT_FLAG_WANT_POSITION = 1 << 8, PORT_FLAG_TRIGGER = 1 << 9, PORT_FLAG_TOGGLE = 1 << 10, PORT_FLAG_INTEGER = 1 << 11, PORT_FLAG_FREEWHEEL = 1 << 12, PORT_FLAG_REPORTS_LATENCY = 1 << 13, PORT_FLAG_NOT_ON_GUI = 1 << 14, PORT_FLAG_PLUGIN_ENABLED = 1 << 15, PORT_FLAG_PLUGIN_CONTROL = 1 << 16, PORT_FLAG_CHANNEL_MUTE = 1 << 17, PORT_FLAG_CHANNEL_FADER = 1 << 18, PORT_FLAG_AUTOMATABLE = 1 << 19, PORT_FLAG_MIDI_AUTOMATABLE = 1 << 20, PORT_FLAG_SEND_RECEIVABLE = 1 << 21, PORT_FLAG_BPM = 1 << 22, PORT_FLAG_GENERIC_PLUGIN_PORT = 1 << 23, PORT_FLAG_PLUGIN_GAIN = 1 << 24, PORT_FLAG_TP_MONO = 1 << 25, PORT_FLAG_TP_INPUT_GAIN = 1 << 26, PORT_FLAG_HW = 1 << 27, PORT_FLAG_MODULATOR_MACRO = 1 << 28, PORT_FLAG_LOGARITHMIC = 1 << 29, PORT_FLAG_IS_PROPERTY = 1 << 30 }
Port flags.
enum PortFlags2 { PORT_FLAG2_TRANSPORT_ROLL = 1 << 0, PORT_FLAG2_TRANSPORT_STOP = 1 << 1, PORT_FLAG2_TRANSPORT_BACKWARD = 1 << 2, PORT_FLAG2_TRANSPORT_FORWARD = 1 << 3, PORT_FLAG2_TRANSPORT_LOOP_TOGGLE = 1 << 4, PORT_FLAG2_TRANSPORT_REC_TOGGLE = 1 << 5, PORT_FLAG2_SUPPORTS_PATCH_MESSAGE = 1 << 6, PORT_FLAG2_ENUMERATION = 1 << 7, PORT_FLAG2_URI_PARAM = 1 << 8, PORT_FLAG2_SEQUENCE = 1 << 9, PORT_FLAG2_SUPPORTS_MIDI = 1 << 10, PORT_FLAG2_TP_OUTPUT_GAIN = 1 << 11, PORT_FLAG2_MIDI_PITCH_BEND = 1 << 12, PORT_FLAG2_MIDI_POLY_KEY_PRESSURE = 1 << 13, PORT_FLAG2_MIDI_CHANNEL_PRESSURE = 1 << 14, PORT_FLAG2_CHANNEL_SEND_ENABLED = 1 << 15, PORT_FLAG2_CHANNEL_SEND_AMOUNT = 1 << 16, PORT_FLAG2_BEATS_PER_BAR = 1 << 17, PORT_FLAG2_BEAT_UNIT = 1 << 18 }
enum RecordingEventType { RECORDING_EVENT_TYPE_START_TRACK_RECORDING, RECORDING_EVENT_TYPE_START_AUTOMATION_RECORDING, RECORDING_EVENT_TYPE_MIDI, RECORDING_EVENT_TYPE_AUDIO, RECORDING_EVENT_TYPE_AUTOMATION, RECORDING_EVENT_TYPE_PAUSE_TRACK_RECORDING, RECORDING_EVENT_TYPE_PAUSE_AUTOMATION_RECORDING, RECORDING_EVENT_TYPE_STOP_TRACK_RECORDING, RECORDING_EVENT_TYPE_STOP_AUTOMATION_RECORDING }
enum RegionMusicalMode { REGION_MUSICAL_MODE_INHERIT, REGION_MUSICAL_MODE_OFF, REGION_MUSICAL_MODE_ON }
Musical mode setting for audio regions.
enum RegionType { REGION_TYPE_MIDI = 1 << 0, REGION_TYPE_AUDIO = 1 << 1, REGION_TYPE_AUTOMATION = 1 << 2, REGION_TYPE_CHORD = 1 << 3 }
Type of Region.
enum MusicalScaleType { SCALE_CHROMATIC, SCALE_IONIAN, SCALE_AEOLIAN, SCALE_HARMONIC_MINOR, SCALE_ACOUSTIC, SCALE_ALGERIAN, SCALE_ALTERED, SCALE_AUGMENTED, SCALE_BEBOP_DOMINANT, SCALE_BLUES, SCALE_CHINESE, SCALE_DIMINISHED, SCALE_DOMINANT_DIMINISHED, SCALE_DORIAN, SCALE_DOUBLE_HARMONIC, SCALE_EIGHT_TONE_SPANISH, SCALE_ENIGMATIC, SCALE_EGYPTIAN, SCALE_FLAMENCO, SCALE_GEEZ, SCALE_GYPSY, SCALE_HALF_DIMINISHED, SCALE_HARMONIC_MAJOR, SCALE_HINDU, SCALE_HIRAJOSHI, SCALE_HUNGARIAN_GYPSY, SCALE_HUNGARIAN_MINOR, SCALE_IN, SCALE_INSEN, SCALE_ISTRIAN, SCALE_IWATO, SCALE_LOCRIAN, SCALE_LYDIAN_AUGMENTED, SCALE_LYDIAN, SCALE_MAJOR_LOCRIAN, SCALE_MAJOR_PENTATONIC, SCALE_MAQAM, SCALE_MELODIC_MINOR, SCALE_MINOR_PENTATONIC, SCALE_MIXOLYDIAN, SCALE_NEAPOLITAN_MAJOR, SCALE_NEAPOLITAN_MINOR, SCALE_OCTATONIC_HALF_WHOLE, SCALE_OCTATONIC_WHOLE_HALF, SCALE_ORIENTAL, SCALE_PERSIAN, SCALE_PHRYGIAN_DOMINANT, SCALE_PHRYGIAN, SCALE_PROMETHEUS, SCALE_ROMANIAN_MINOR, SCALE_TRITONE, SCALE_UKRANIAN_DORIAN, SCALE_WHOLE_TONE, SCALE_YO }
Scale type (name) eg Aeolian.
enum NoteType { NOTE_TYPE_NORMAL, NOTE_TYPE_DOTTED, NOTE_TYPE_TRIPLET }
enum NoteLengthType { NOTE_LENGTH_CUSTOM, NOTE_LENGTH_LINK, NOTE_LENGTH_LAST_OBJECT }
enum SnapGridType { SNAP_GRID_TYPE_TIMELINE, SNAP_GRID_TYPE_EDITOR }
Snap grid type.
enum StretcherBackend { STRETCHER_BACKEND_RUBBERBAND, STRETCHER_BACKEND_PAULSTRETCH, STRETCHER_BACKEND_SBSMS }
enum BeatUnit { BEAT_UNIT_2, BEAT_UNIT_4, BEAT_UNIT_8, BEAT_UNIT_16 }
Beat unit.
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 }
The Track's type.
enum TracklistPinOption { TRACKLIST_PIN_OPTION_PINNED_ONLY, TRACKLIST_PIN_OPTION_UNPINNED_ONLY, TRACKLIST_PIN_OPTION_BOTH }
Used in track search functions.
enum TransportDisplay { TRANSPORT_DISPLAY_BBT, TRANSPORT_DISPLAY_TIME }
Corrseponts to "transport-display" in the gsettings.
enum TransportRecordingMode { RECORDING_MODE_OVERWRITE_EVENTS, RECORDING_MODE_MERGE_EVENTS, RECORDING_MODE_TAKES, RECORDING_MODE_TAKES_MUTED }
Recording mode for MIDI and audio.

Typedefs

using AutomationPoint = struct AutomationPoint
An automation point inside an AutomationTrack.
using AutomationTracklist = struct AutomationTracklist
Each track has an automation tracklist with automation tracks to be generated at runtime, and filled in with automation points/curves when loading projects.
using BalanceControlAlgorithm = enum BalanceControlAlgorithm
See https://www.harmonycentral.com/articles/the-truth-about-panning-laws.
using Channel = struct Channel
A Channel is part of a Track (excluding Tracks that don't have Channels) and contains information related to routing and the Mixer.
using ChannelSend = struct ChannelSend
Channel send.
using ChordType = enum ChordType
Chord type.
using ChordAccent = enum ChordAccent
Chord accents.
using ChordDescriptor = struct ChordDescriptor
A ChordDescriptor describes a chord and is not linked to any specific object by itself.
using ChordObject = struct ChordObject
A ChordObject to be shown in the TimelineArrangerWidget.
using AudioClip = struct AudioClip
Audio clips for the pool.
using ControlRoom = struct ControlRoom
The control room allows to specify how Listen will work on each Channel and to set overall volume after the Master Channel so you can change the volume without touching the Master Fader.
using CurveAlgorithm = enum CurveAlgorithm
The algorithm to use for curves.
using CurveOptions = struct CurveOptions
Curve options.
using AudioEncoder = struct AudioEncoder
Struct for holding info for encoding.
using AudioEngineEventType = enum AudioEngineEventType
Audio engine event type.
using AudioEngineEvent = struct AudioEngineEvent
Audio engine event.
using AudioEngineBufferSize = enum AudioEngineBufferSize
Buffer sizes to be used in combo boxes.
using AudioEngineSamplerate = enum AudioEngineSamplerate
Samplerates to be used in comboboxes.
using BounceMode = enum BounceMode
Mode used when bouncing, either during exporting or when bouncing tracks or regions to audio.
using AudioEngine = struct AudioEngine
The audio engine.
using AudioFormat = enum AudioFormat
Audio format.
using BitDepth = enum BitDepth
Bit depth.
using ExportTimeRange = enum ExportTimeRange
Time range to export.
using ExportMode = enum ExportMode
Export mode.
using ExportSettings = struct ExportSettings
Export settings to be passed to the exporter to use.
using ExtPortType = enum ExtPortType
External port type.
using ExtPort = struct ExtPort
External port.
using FaderType = enum FaderType
Fader type.
using Fader = struct Fader
A Fader is a processor that is used for volume controls and pan.
using Graph = struct Graph
Graph.
using GraphExportType = enum GraphExportType
Export type.
using GraphNodeType = enum GraphNodeType
Graph nodes can be either ports or processors.
using GraphNode = struct GraphNode
A node in the processing graph.
using HardwareProcessor = struct HardwareProcessor
Hardware processor.
using MarkerType = enum MarkerType
Marker type.
using Marker = struct Marker
Marker for the MarkerTrack.
using MarkerTrack = struct Track
MarkerTrack is just a Track.
using Meter = struct Meter
A Meter used by a single GUI element.
using MetronomeType = enum MetronomeType
The type of the metronome sound.
using Metronome = struct Metronome
Metronome settings.
using MidiEventType = enum MidiEventType
Type of MIDI event.
using MidiEvent = struct MidiEvent
Backend-agnostic MIDI event descriptor.
using MidiEvents = struct MidiEvents
Container for passing midi events through ports.
using MidiEventHeader = struct MidiEventHeader
Used by Windows MME and RtMidi when adding events to the ring.
using MidiMapping = struct MidiMapping
A mapping from a MIDI value to a destination.
using MidiMappings = struct MidiMappings
All MIDI mappings in Zrythm.
using MidiNote = struct MidiNote
A MIDI note inside a ZRegion shown in the piano roll.
using ModulatorMacroProcessor = struct ModulatorMacroProcessor
Modulator macro button processor.
using AudioPool = struct AudioPool
An audio pool is a pool of audio files and their corresponding float arrays in memory that are referenced by regions.
using PortInternalType = enum PortInternalType
What the internal data is.
using PortScalePoint = struct PortScalePoint
Scale point.
using Port = struct Port
Must ONLY be created via port_new()
using StereoPorts = struct StereoPorts
L & R port, for convenience.
using PortFlow = enum PortFlow
Direction of the signal.
using PortType = enum PortType
Type of signals the Port handles.
using PortUnit = enum PortUnit
Port unit to be displayed in the UI.
using PortOwnerType = enum PortOwnerType
Type of owner.
using PortFlags = enum PortFlags
Port flags.
using PortIdentifier = struct PortIdentifier
Struct used to identify Ports in the project.
using Position = struct Position
A Position is made up of bars.beats.sixteenths.ticks.
using RecordingEvent = struct RecordingEvent
A recording event.
using RegionMusicalMode = enum RegionMusicalMode
Musical mode setting for audio regions.
using ZRegion = struct ZRegion
A region (clip) is an object on the timeline that contains either MidiNote's or AudioClip's.
using RegionType = enum RegionType
Type of Region.
using RegionIdentifier = struct RegionIdentifier
Index/identifier for a Region, so we can get Region objects quickly with it without searching by name.
using RegionLinkGroup = struct RegionLinkGroup
A group of linked regions.
using RegionLinkGroupManager = struct RegionLinkGroupManager
Manager of region link groups.
using SamplePlayback = struct SamplePlayback
A sample playback handle to be used by the engine.
using SampleProcessor = struct SampleProcessor
A processor to be used in the routing graph for playing samples independent of the timeline.
using MusicalScaleType = enum MusicalScaleType
Scale type (name) eg Aeolian.
using MusicalScale = struct MusicalScale
To be generated at the beginning, and then copied and reused.
using ScaleObject = struct ScaleObject
A ScaleObject to be shown in the TimelineArrangerWidget.
using SnapGridType = enum SnapGridType
Snap grid type.
using Stretcher = struct Stretcher
Stretcher interface.
using BeatUnit = enum BeatUnit
Beat unit.
using TrackType = enum TrackType
The Track's type.
using Track = struct Track
Track to be inserted into the Project's Tracklist.
using TrackLane = struct TrackLane
A TrackLane belongs to a Track (can have many TrackLanes in a Track) and contains Regions.
using TrackProcessor = struct TrackProcessor
A TrackProcessor is a processor that is used as the first entry point when processing a track.
using TracklistPinOption = enum TracklistPinOption
Used in track search functions.
using Tracklist = struct Tracklist
The Tracklist contains all the tracks in the Project.
using TransportDisplay = enum TransportDisplay
Corrseponts to "transport-display" in the gsettings.
using TransportRecordingMode = enum TransportRecordingMode
Recording mode for MIDI and audio.
using Transport = struct Transport
The transport.
using Velocity = struct Velocity
The MidiNote velocity.
using GraphNode = struct GraphNode
A node in the processing graph.
using MidiEvents = struct MidiEvents
Container for passing midi events through ports.

Functions

auto audio_function_apply(ArrangerSelections* sel, AudioFunctionType type) -> int
Applies the given action to the given selections.
auto audio_region_new(const int pool_id, const char* filename, const float* frames, const long nframes, const char* clip_name, const channels_t channels, const Position* start_pos, int track_pos, int lane_pos, int idx_inside_lane) -> ZRegion*
Creates a ZRegion for audio data.
auto audio_region_get_clip(const ZRegion* self) -> AudioClip*
Returns the audio clip associated with the Region.
void audio_region_set_clip_id(ZRegion* self, int clip_id)
Sets the clip ID on the region and updates any references.
void audio_region_replace_frames(ZRegion* self, float* frames, size_t start_frame, size_t num_frames, bool duplicate_clip)
Replaces the region's frames from start_frames with frames.
auto audio_region_fill_stereo_ports(ZRegion* self, long g_start_frames, nframes_t local_start_frame, nframes_t nframes, StereoPorts* stereo_ports) -> REALTIME void
Fills audio data from the region.
void audio_region_free_members(ZRegion* self)
Frees members only but not the audio region itself.
void automation_function_apply(ArrangerSelections* sel, AutomationFunctionType type)
Applies the given action to the given selections.
auto automation_point_new_float(const float value, const float normalized_val, const Position* pos) -> AutomationPoint*
Creates an AutomationPoint in the given AutomationTrack at the given Position.
void automation_point_set_fvalue(AutomationPoint* self, float real_val, bool is_normalized, bool pub_events)
Sets the value from given real or normalized value and notifies interested parties.
void automation_point_set_region_and_index(AutomationPoint* _ap, ZRegion* region, int index)
Sets the ZRegion and the index in the region that the AutomationPoint belongs to, in all its counterparts.
auto automation_point_get_normalized_value_in_curve(AutomationPoint* ap, double x) -> HOT double
The function to return a point on the curve.
void automation_point_set_curviness(AutomationPoint* ap, const curviness_t curviness)
Sets the curviness of the AutomationPoint.
auto automation_point_get_port(AutomationPoint* self) -> Port*
Convenience function to return the control port that this AutomationPoint is for.
auto automation_point_get_automation_track(AutomationPoint* self) -> AutomationTrack*
Convenience function to return the AutomationTrack that this AutomationPoint is in.
auto automation_point_get_y(AutomationPoint* self, int height) -> int
Returns Y in pixels from the value based on the given height of the parent.
auto automation_point_curves_up(AutomationPoint* self) -> bool
Returns if the curve of the AutomationPoint curves upwards as you move right on the x axis.
auto automation_region_new(const Position* start_pos, const Position* end_pos, int track_pos, int at_idx, int idx_inside_at) -> ZRegion*
Creates a new ZRegion for automation.
void automation_region_print_automation(ZRegion* self)
Prints the automation in this Region.
void automation_region_force_sort(ZRegion* self)
Forces sort of the automation points.
void automation_region_add_ap(ZRegion* self, AutomationPoint* ap, int pub_events)
Adds an AutomationPoint to the Region.
auto automation_region_get_prev_ap(ZRegion* self, AutomationPoint* ap) -> AutomationPoint*
Returns the AutomationPoint before the given one.
auto automation_region_get_next_ap(ZRegion* self, AutomationPoint* ap, bool check_positions, bool check_transients) -> HOT AutomationPoint*
Returns the AutomationPoint after the given one.
void automation_region_remove_ap(ZRegion* self, AutomationPoint* ap, bool freeing_region, int free)
Removes the AutomationPoint from the ZRegion, optionally freeing it.
void automation_region_get_aps_since_last_recorded(ZRegion* self, Position* pos, AutomationPoint** aps, int* num_aps)
Returns the automation points since the last recorded automation point (if the last recorded automation point was before the current pos).
auto automation_region_get_ap_around(ZRegion* self, Position* _pos, double delta_ticks, bool before_only) -> AutomationPoint*
Returns an automation point found within +/- delta_ticks from the position, or NULL.
auto automation_region_free_members(ZRegion* self) -> NONNULL void
Frees members only but not the ZRegion itself.
auto automation_track_new(Port* port) -> NONNULL AutomationTrack*
Creates an automation track for the given Port.
void automation_mode_get_localized(AutomationMode mode, char* buf)
Gets the automation mode as a localized string.
void automation_record_mode_get_localized(AutomationRecordMode mode, char* buf)
Gets the automation mode as a localized string.
auto automation_track_find_from_port_id(PortIdentifier* id, bool basic_search) -> NONNULL AutomationTrack*
auto automation_track_find_from_port(Port* port, Track* track, bool basic_search) -> AutomationTrack*
Finds the AutomationTrack associated with port.
auto automation_track_should_read_automation(AutomationTrack* at, gint64 cur_time) -> HOT NONNULL bool
Returns whether the automation in the automation track should be read.
auto automation_track_should_be_recording(AutomationTrack* at, gint64 cur_time, bool record_aps) -> NONNULL bool
Returns if the automation track should currently be recording data.
auto automation_track_add_region(AutomationTrack* self, ZRegion* region) -> NONNULL void
Adds an automation ZRegion to the AutomationTrack.
auto automation_track_insert_region(AutomationTrack* self, ZRegion* region, int idx) -> NONNULL void
Inserts an automation ZRegion to the AutomationTrack at the given index.
auto automation_track_update_frames(AutomationTrack* self) -> NONNULL void
Returns the visible y offset from the top of the track widget.
auto automation_track_set_index(AutomationTrack* self, int index) -> NONNULL void
Sets the index of the AutomationTrack in the AutomationTracklist.
auto automation_track_clone(AutomationTrack* src) -> NONNULL AutomationTrack*
Clones the AutomationTrack.
auto automation_track_get_ap_before_pos(const AutomationTrack* self, const Position* pos, bool ends_after) -> NONNULL AutomationPoint*
Returns the automation point before the Position on the timeline.
auto automation_track_get_region_before_pos(const AutomationTrack* self, const Position* pos, bool ends_after) -> ZRegion*
Returns the ZRegion that starts before given Position, if any.
auto automation_track_unselect_all(AutomationTrack* self) -> NONNULL void
Unselects all arranger objects.
auto automation_track_remove_region(AutomationTrack* self, ZRegion* region) -> NONNULL void
Removes a region from the automation track.
auto automation_track_clear(AutomationTrack* self) -> NONNULL void
Removes and frees all arranger objects recursively.
auto automation_track_get_val_at_pos(AutomationTrack* at, Position* pos, bool normalized, bool ends_after) -> NONNULL float
Returns the actual parameter value at the given position.
auto automation_track_get_y_px_from_normalized_val(AutomationTrack* self, float normalized_val) -> NONNULL int
Returns the y pixels from the value based on the allocation of the automation track.
auto automation_track_get_last_region(AutomationTrack* self) -> NONNULL ZRegion*
Updates automation track & its GUI.
auto automation_track_free(AutomationTrack* at) -> NONNULL void
Frees the automation track.
void automation_tracklist_init_loaded(AutomationTracklist* self)
Inits a loaded AutomationTracklist.
void automation_tracklist_print_ats(AutomationTracklist* self)
Prints info about all the automation tracks.
void automation_tracklist_update_frames(AutomationTracklist* self)
Updates the frames of each position in each child of the automation tracklist recursively.
void automation_tracklist_get_visible_tracks(AutomationTracklist* self, AutomationTrack** visible_tracks, int* num_visible)
Gets the currently visible AutomationTrack's (regardless of whether the automation tracklist is visible in the UI or not.
void automation_tracklist_update_track_pos(AutomationTracklist* self, Track* track)
Updates the Track position of the Automatable's and AutomationTrack's.
void automation_tracklist_remove_at(AutomationTracklist* self, AutomationTrack* at, bool free, bool fire_events)
Updates the automation tracks.
void automation_tracklist_remove_channel_ats(AutomationTracklist* self, Channel* ch)
Removes the AutomationTrack's associated with this channel from the AutomationTracklist in the corresponding Track.
void automation_tracklist_clone(AutomationTracklist* src, AutomationTracklist* dest)
Clones the automation tracklist elements from src to dest.
auto automation_tracklist_get_at_from_port(AutomationTracklist* self, Port* port) -> AutomationTrack*
Returns the AutomationTrack corresponding to the given Port.
void automation_tracklist_unselect_all(AutomationTracklist* self)
Unselects all arranger objects.
void automation_tracklist_clear(AutomationTracklist* self)
Removes all objects recursively.
void automation_tracklist_set_at_index(AutomationTracklist* self, AutomationTrack* at, int index, bool push_down)
Sets the index of the AutomationTrack and swaps it with the AutomationTrack at that index or pushes the other AutomationTrack's down.
auto automation_tracklist_get_plugin_at(AutomationTracklist* self, PluginSlotType slot_type, const int plugin_slot, const char* label) -> AutomationTrack*
Gets the automation track with the given label.
auto automation_tracklist_get_num_visible(AutomationTracklist* self) -> int
Returns the number of visible AutomationTrack's.
auto automation_tracklist_validate(AutomationTracklist* self) -> bool
Verifies the identifiers on a live automation tracklist (in the project, not a clone).
void balance_control_get_calc_lr(BalanceControlAlgorithm algo, float pan, float* calc_l, float* calc_r)
Returns the coefficients to multiply the L and R signal with.
auto channel_handle_recording(Channel* self, const long g_frames_start, const nframes_t nframes) -> NONNULL void
Handles the recording logic inside the process cycle.
void channel_append_all_ports(Channel* ch, Port*** ports, int* size, bool is_dynamic, size_t* max_size, bool include_plugins)
Appends all channel ports and optionally plugin ports to the array.
auto channel_expose_ports_to_backend(Channel* ch) -> NONNULL void
Exposes the channel's ports to the backend.
auto channel_connect(Channel* ch) -> NONNULL void
Connects the channel's ports.
auto channel_add_balance_control(void* _channel, float pan) -> NONNULL void
Adds to (or subtracts from) the pan.
auto channel_reset_fader(Channel* channel) -> NONNULL void
Sets fader to 0.0.
auto channel_prepare_process(Channel* channel) -> NONNULL void
Prepares the channel for processing.
auto channel_new(Track* track) -> NONNULL Channel*
Creates a channel of the given type with the given label.
auto channel_process(Channel* channel) -> NONNULL void
The process function prototype.
auto channel_add_plugin(Channel* channel, PluginSlotType slot_type, int pos, Plugin* plugin, bool confirm, bool moving_plugin, bool gen_automatables, bool recalc_graph, bool pub_events) -> NONNULL int
Adds given plugin to given position in the strip.
auto channel_reconnect_ext_input_ports(Channel* ch) -> NONNULL void
Called when the input has changed for Midi, Instrument or Audio tracks.
auto channel_reattach_midi_editor_manual_press_port(Channel* channel, int connect, const int recalc_graph) -> NONNULL void
Connects or disconnects the MIDI editor key press port to the channel's first plugin.
auto channel_get_automation_track(Channel* channel, PortFlags port_flags) -> NONNULL AutomationTrack*
Convenience function to get the automation track of the given type for the channel.
auto channel_remove_plugin(Channel* channel, PluginSlotType slot_type, int slot, bool moving_plugin, bool deleting_plugin, bool deleting_channel, bool recalc_graph) -> NONNULL void
Removes a plugin at pos from the channel.
auto channel_update_track_pos(Channel* self, int pos) -> NONNULL void
Updates the track position in the channel and all related ports and identifiers.
auto channel_get_mono_compat_enabled(Channel* self) -> NONNULL bool
Gets whether mono compatibility is enabled.
auto channel_set_mono_compat_enabled(Channel* self, bool enabled, bool fire_events) -> NONNULL void
Sets whether mono compatibility is enabled.
auto channel_clone(Channel* ch, Track* track, bool src_is_project) -> NONNULL Channel*
Clones the channel recursively.
auto channel_disconnect(Channel* channel, bool remove_pl) -> NONNULL void
Disconnects the channel from the processing chain.
auto channel_free(Channel* channel) -> NONNULL void
Frees the channel.
auto channel_send_new(int track_pos, int slot) -> ChannelSend*
Creates a channel send instance.
auto channel_send_get_track(ChannelSend* self) -> NONNULL Track*
Gets the owner track.
auto channel_send_is_target_sidechain(ChannelSend* self) -> NONNULL bool
Returns whether the channel send target is a sidechain port (rather than a target track).
auto channel_send_get_target_track(ChannelSend* self, Track* owner) -> Track*
Gets the target track.
auto channel_send_get_target_sidechain(ChannelSend* self) -> NONNULL StereoPorts*
Gets the target sidechain port.
auto channel_send_get_amount_for_widgets(ChannelSend* self) -> NONNULL float
Gets the amount to be used in widgets (0.0-1.0).
auto channel_send_set_amount_from_widget(ChannelSend* self, float val) -> NONNULL void
Sets the amount from a widget amount (0.0-1.0).
void channel_send_connect_stereo(ChannelSend* self, StereoPorts* stereo, Port* l, Port* r, bool sidechain)
Connects a send to stereo ports.
auto channel_send_connect_midi(ChannelSend* self, Port* port) -> NONNULL void
Connects a send to a midi port.
auto channel_send_disconnect(ChannelSend* self) -> NONNULL void
Removes the connection at the given send.
auto channel_send_get_dest_name(ChannelSend* self, char* buf) -> NONNULL void
Get the name of the destination.
auto channel_send_update_connections(ChannelSend* self) -> NONNULL void
Connects the ports if not connected and updates the multiplier amounts on the port connections.
auto channel_send_find(ChannelSend* self) -> NONNULL ChannelSend*
Finds the project send from a given send instance.
auto chord_descriptor_new(MusicalNote root, int has_bass, MusicalNote bass, ChordType type, ChordAccent accent, int inversion) -> ChordDescriptor*
Creates a ChordDescriptor.
auto chord_descriptor_is_key_in_chord(ChordDescriptor* chord, MusicalNote key) -> int
Returns if the given key is in the chord represented by the given ChordDescriptor.
auto chord_descriptor_clone(ChordDescriptor* src) -> ChordDescriptor*
Clones the given ChordDescriptor.
auto chord_descriptor_chord_type_to_string(ChordType type) -> const char*
Returns the chord type as a string (eg.
auto chord_descriptor_chord_accent_to_string(ChordAccent accent) -> const char*
Returns the chord accent as a string (eg.
auto chord_descriptor_note_to_string(MusicalNote note) -> const char*
Returns the musical note as a string (eg.
auto chord_descriptor_to_new_string(const ChordDescriptor* chord) -> char*
Returns the chord in human readable string.
void chord_descriptor_to_string(const ChordDescriptor* chord, char* str)
Returns the chord in human readable string.
void chord_descriptor_update_notes(ChordDescriptor* self)
Updates the notes array based on the current settings.
void chord_descriptor_free(ChordDescriptor* self)
Frees the ChordDescriptor.
auto chord_object_new(RegionIdentifier* region_id, int chord_index, int index) -> ChordObject*
Creates a ChordObject.
void chord_object_set_region_and_index(ChordObject* self, ZRegion* region, int idx)
Sets the region and index of the chord.
auto chord_object_get_chord_descriptor(ChordObject* self) -> ChordDescriptor*
Returns the ChordDescriptor associated with this ChordObject.
auto chord_object_find_by_pos(ChordObject* clone) -> ChordObject*
Finds the ChordObject in the project corresponding to the given one's position.
auto chord_region_new(const Position* start_pos, const Position* end_pos, int idx) -> NONNULL ZRegion*
Creates a new ZRegion for chords.
auto chord_region_insert_chord_object(ZRegion* self, ChordObject* chord, int pos, bool fire_events) -> NONNULL void
Inserts a ChordObject to the Region.
auto chord_region_add_chord_object(ZRegion* self, ChordObject* chord, bool fire_events) -> NONNULL void
Adds a ChordObject to the Region.
auto chord_region_remove_chord_object(ZRegion* self, ChordObject* chord, int free, bool fire_events) -> NONNULL void
Removes a ChordObject from the Region.
auto chord_region_free_members(ZRegion* self) -> NONNULL void
Frees members only but not the ZRegion itself.
auto chord_track_new(int track_pos) -> ChordTrack*
Creates a new chord Track.
void chord_track_init(Track* track)
Inits a chord track (e.g.
void chord_track_insert_chord_region(ChordTrack* track, ZRegion* region, int idx)
Inserts a chord region to the Track at the given index.
void chord_track_insert_scale(ChordTrack* track, ScaleObject* scale, int pos)
Inserts a scale to the track.
void chord_track_add_scale(ChordTrack* track, ScaleObject* scale)
Adds a scale to the track.
void chord_track_remove_scale(ChordTrack* self, ScaleObject* scale, bool free)
Removes a scale from the chord Track.
void chord_track_remove_region(ChordTrack* self, ZRegion* region)
Removes a region from the chord track.
auto chord_track_get_chord_at_pos(const Track* ct, const Position* pos) -> ChordObject*
Returns the ChordObject at the given Position in the TimelineArranger.
auto chord_track_get_scale_at_pos(const Track* ct, const Position* pos) -> ScaleObject*
Returns the ScaleObject at the given Position in the TimelineArranger.
void chord_track_clear(ChordTrack* self)
Removes all objects from the chord track.
auto audio_clip_init_loaded(AudioClip* self) -> NONNULL void
Inits after loading a Project.
auto audio_clip_new_from_file(const char* full_path) -> NONNULL AudioClip*
Creates an audio clip from a file.
auto audio_clip_new_from_float_array(const float* arr, const long nframes, const channels_t channels, const char* name) -> AudioClip*
Creates an audio clip by copying the given float array.
auto audio_clip_new_recording(const channels_t channels, const long nframes, const char* name) -> AudioClip*
Create an audio clip while recording.
auto audio_clip_update_channel_caches(AudioClip* self, size_t start_from) -> NONNULL void
Updates the channel caches.
auto audio_clip_write_to_file(AudioClip* self, const char* filepath, bool parts) -> NONNULL int
Writes the given audio clip data to a file.
auto audio_clip_write_to_pool(AudioClip* self, bool parts) -> NONNULL void
Writes the clip to the pool as a wav file.
auto audio_clip_is_in_use(AudioClip* self) -> NONNULL bool
Returns whether the clip is used inside the project (in actual project regions only, not in undo stack).
auto audio_clip_remove_and_free(AudioClip* self) -> NONNULL void
To be called by audio_pool_remove_clip().
auto audio_clip_free(AudioClip* self) -> NONNULL void
Frees the audio clip.
auto control_port_normalized_val_to_real(Port* self, float normalized_val) -> float
Converts normalized value (0.0 to 1.0) to real value (eg.
auto control_port_real_val_to_normalized(Port* self, float real_val) -> float
Converts real value (eg.
auto control_port_is_toggled(Port* self) -> bool
Returns if the control port is toggled.
auto control_port_is_val_toggled(float val) -> bool
Checks if the given value is toggled.
auto control_port_get_int(Port* self) -> int
Gets the control value for an integer port.
auto control_port_get_int_from_val(float val) -> int
Gets the control value for an integer port.
auto control_port_get_snapped_val(Port* self) -> float
Returns the snapped value (eg, if toggle, returns 0.f or 1.f).
auto control_port_get_snapped_val_from_val(Port* self, float val) -> float
Returns the snapped value (eg, if toggle, returns 0.f or 1.f).
auto control_port_get_val(Port* self) -> float
Get the current real value of the control.
auto control_port_get_unsnapped_val(Port* self) -> float
Get the current real unsnapped value of the control.
auto control_port_get_default_val(Port* self) -> float
Get the default real value of the control.
void control_port_set_real_val(Port* self, float val)
Get the default real value of the control.
void control_port_set_real_val_w_events(Port* self, float val)
Get the default real value of the control and sends UI events.
void control_port_set_val_from_normalized(Port* self, float val, bool automating)
Updates the actual value.
void control_room_init_loaded(ControlRoom* self)
Inits the control room from a project.
auto control_room_new(void) -> ControlRoom*
Creates a new control room.
void control_room_set_dim_output(ControlRoom* self, int dim_output)
Sets dim_output to on/off and notifies interested parties.
void curve_algorithm_get_localized_name(CurveAlgorithm algo, char* buf)
Stores the localized name of the algorithm in buf.
auto curve_get_normalized_y(double x, CurveOptions* opts, int start_higher) -> HOT double
Returns the Y value on a curve spcified by algo.
auto audio_encoder_new_from_file(const char* filepath) -> AudioEncoder*
Creates a new instance of an AudioEncoder from the given file, that can be used for encoding.
void audio_encoder_decode(AudioEncoder* self, int samplerate, bool show_progress)
Decodes the information in the AudioEncoder instance and stores the results there.
void audio_encoder_free(AudioEncoder* self)
Free's the AudioEncoder and its members.
auto engine_new(Project* project) -> AudioEngine*
Create a new audio engine.
void engine_wait_for_pause(AudioEngine* self, EngineState* state, bool force_pause)
void engine_pre_setup(AudioEngine* self)
Sets up the audio engine before the project is initialized/loaded.
void engine_setup(AudioEngine* self)
Sets up the audio engine after the project is initialized/loaded.
void engine_activate(AudioEngine* self, bool activate)
Activates the audio engine to start processing and receiving events.
void engine_update_frames_per_tick(AudioEngine* self, const int beats_per_bar, const bpm_t bpm, const sample_rate_t sample_rate, bool thread_check)
Updates frames per tick based on the time sig, the BPM, and the sample rate.
auto engine_process_events(AudioEngine* self) -> int
GSourceFunc to be added using idle add.
void engine_process_prepare(AudioEngine* self, nframes_t nframes)
To be called by each implementation to prepare the structures before processing.
auto engine_process(AudioEngine* self, nframes_t nframes) -> int
Processes current cycle.
void engine_post_process(AudioEngine* self, const nframes_t nframes)
To be called after processing for common logic.
void engine_fill_out_bufs(AudioEngine* self, const nframes_t nframes)
Called to fill in the external buffers at the end of the processing cycle.
auto engine_buffer_size_enum_to_int(AudioEngineBufferSize buffer_size) -> int
Returns the int value correesponding to the given AudioEngineBufferSize.
auto engine_samplerate_enum_to_int(AudioEngineSamplerate samplerate) -> int
Returns the int value correesponding to the given AudioEngineSamplerate.
void engine_set_buffer_size(AudioEngine* self, uint32_t buf_size)
Request the backend to set the buffer size.
auto engine_audio_backend_to_string(AudioBackend backend) -> const char*
Returns the audio backend as a string.
static auto engine_midi_backend_to_string(MidiBackend backend) -> const char*
Returns the MIDI backend as a string.
void engine_reset_bounce_mode(AudioEngine* self)
Reset the bounce mode on the engine, all tracks and regions to OFF.
void engine_free(AudioEngine* self)
Closes any connections and free's data.
auto export_settings_default(void) -> ExportSettings*
Returns an instance of default ExportSettings.
void export_settings_set_bounce_defaults(ExportSettings* self, const char* filepath, const char* bounce_name)
Sets the defaults for bouncing.
auto exporter_generic_export_thread(ExportSettings* info) -> void*
Generic export thread to be used for simple exporting.
void exporter_create_audio_track_after_bounce(ExportSettings* settings, const Position* pos)
To be called to create and perform an undoable action for creating an audio track with the bounced material.
auto exporter_stringize_audio_format(AudioFormat format, bool extension) -> const char*
Returns the audio format as string.
auto exporter_export(ExportSettings* info) -> int
Exports an audio file based on the given settings.
void ext_port_init_loaded(ExtPort* ext_port)
Inits the ExtPort after loading a project.
void ext_port_print(ExtPort* self)
Prints the port info.
auto ext_port_matches_backend(ExtPort* self) -> bool
Returns if the ext port matches the current backend.
auto ext_port_get_id(ExtPort* ext_port) -> char*
Returns a unique identifier (full name prefixed with backend type).
auto ext_port_get_buffer(ExtPort* ext_port, nframes_t nframes) -> float*
Returns the buffer of the external port.
void ext_port_clear_buffer(ExtPort* ext_port, nframes_t nframes)
Clears the buffer of the external port.
void ext_port_connect(ExtPort* ext_port, Port* port, int src)
Exposes the given Port if not exposed and makes the connection from the Port to the ExtPort (eg in JACK) or backwards.
void ext_port_disconnect(ExtPort* ext_port, Port* port, int src)
Disconnects the Port from the ExtPort.
void ext_port_activate(ExtPort* self, Port* port, bool activate)
Activates the port (starts receiving data) or deactivates it.
auto ext_port_get_enabled(ExtPort* self) -> bool
Checks in the GSettings whether this port is marked as enabled by the user.
void ext_ports_get(PortType type, PortFlow flow, bool hw, ExtPort** ports, int* size)
Collects external ports of the given type.
auto ext_port_clone(ExtPort* ext_port) -> ExtPort*
Creates a shallow clone of the port.
void ext_ports_free(ExtPort** ext_port, int size)
Frees an array of ExtPort pointers.
void ext_port_free(ExtPort* ext_port)
Frees the ext_port.
auto fade_get_y_normalized(double x, CurveOptions* opts, int fade_in) -> double
Gets the normalized Y for a normalized X.
void fader_init_loaded(Fader* self, bool is_project)
Inits fader after a project is loaded.
auto fader_new(FaderType type, Channel* ch, bool passthrough) -> Fader*
Creates a new fader.
void fader_set_amp(void* self, float amp)
Sets the amplitude of the fader.
void fader_add_amp(void* self, float amp)
Adds (or subtracts if negative) to the amplitude of the fader (clamped at 0.0 to 2.0).
void fader_set_muted(Fader* self, bool mute, bool trigger_undo, bool fire_events)
Sets track muted and optionally adds the action to the undo stack.
auto fader_get_muted(Fader* self) -> bool
Returns if the fader is muted.
auto fader_get_soloed(Fader* self) -> bool
Returns if the track is soloed.
auto fader_get_implied_soloed(Fader* self) -> bool
Returns whether the fader is not soloed on its own but its direct out (or its direct out's direct out, etc.) or its child (or its children's child, etc.) is soloed.
auto fader_get_listened(Fader* self) -> NONNULL bool
Returns if the fader is listened.
void fader_set_listened(Fader* self, bool listen, bool trigger_undo, bool fire_events)
Sets fader listen and optionally adds the action to the undo stack.
void fader_set_soloed(Fader* self, bool solo, bool trigger_undo, bool fire_events)
Sets track soloed and optionally adds the action to the undo stack.
auto fader_get_amp(void* self) -> float
Gets the fader amplitude (not db) FIXME is void * necessary? do it in the caller.
auto fader_get_mono_compat_enabled(Fader* self) -> bool
Gets whether mono compatibility is enabled.
void fader_set_mono_compat_enabled(Fader* self, bool enabled, bool fire_events)
Sets whether mono compatibility is enabled.
void fader_clear_buffers(Fader* self)
Clears all buffers.
void fader_set_fader_val(Fader* self, float fader_val)
Sets the fader levels from a normalized value 0.0-1.0 (such as in widgets).
void fader_disconnect_all(Fader* self)
Disconnects all ports connected to the fader.
void fader_copy_values(Fader* src, Fader* dest)
Copy the fader values from source to dest.
void fader_process(Fader* self, long g_start_frames, nframes_t start_frame, const nframes_t nframes)
Process the Fader.
void fader_update_track_pos(Fader* self, int pos)
Updates the track pos of the fader.
void fader_free(Fader* self)
Frees the fader members.
auto graph_create_node(Graph* graph, GraphNodeType type, void* data) -> GraphNode*
Creates a new node, adds it to the graph and returns it.
auto graph_get_max_route_playback_latency(Graph* graph, bool use_setup_nodes) -> nframes_t
Returns the max playback latency of the trigger nodes.
auto graph_validate_with_connection(Graph* self, const Port* src, const Port* dest) -> bool
Adds a new connection for the given src and dest ports and validates the graph.
auto graph_start(Graph* graph) -> int
Starts as many threads as there are cores.
auto graph_new(Router* router) -> Graph*
Returns a new graph.
void graph_terminate(Graph* self)
Tell all threads to terminate.
void graph_free(Graph* self)
Frees the graph and its members.
void graph_export_as(Graph* graph, GraphExportType type, const char* path)
Exports the graph at the given path.
auto graph_node_get_name(GraphNode* node) -> char*
Returns a human friendly name of the node.
auto graph_node_process(GraphNode* node, nframes_t nframes) -> HOT void
Processes the GraphNode.
auto graph_node_get_single_playback_latency(GraphNode* node) -> nframes_t
Returns the latency of only the given port, without adding the previous/next latencies.
void graph_node_set_route_playback_latency(GraphNode* node, nframes_t dest_latency)
Sets the playback latency of the given node recursively.
auto graph_node_trigger(GraphNode* self) -> HOT void
Called by an upstream node when it has completed processing.
auto graph_thread_new(const int id, const bool is_main, Graph* graph) -> GraphThread*
Creates a thread.
auto hardware_processor_new(bool input) -> HardwareProcessor*
Returns a new empty instance.
auto hardware_processor_rescan_ext_ports(HardwareProcessor* self) -> bool
Rescans the hardware ports and appends any missing ones.
auto hardware_processor_find_ext_port(HardwareProcessor* self, const char* id) -> ExtPort*
Finds an ext port from its ID (type + full name).
auto hardware_processor_find_port(HardwareProcessor* self, const char* id) -> Port*
Finds a port from its ID (type + full name).
auto hardware_processor_setup(HardwareProcessor* self) -> int
Sets up the ports but does not start them.
void hardware_processor_activate(HardwareProcessor* self, bool activate)
Starts or stops the ports.
auto hardware_processor_process(HardwareProcessor* self, nframes_t nframes) -> REALTIME void
Processes the data.
void instrument_track_init(Track* track)
Initializes an instrument track.
auto instrument_track_is_plugin_visible(Track* self) -> int
Returns if the first plugin's UI in the instrument track is visible.
void instrument_track_toggle_plugin_visible(Track* self)
Toggles whether the first plugin's UI in the instrument Track is visible.
auto marker_new(const char* name) -> Marker*
Creates a Marker.
auto marker_is_equal(Marker* a, Marker* b) -> int
Returns if the two Marker's are equal.
void marker_set_track_pos(Marker* marker, int track_pos)
Sets the Track of the Marker.
auto marker_track_default(int track_pos) -> MarkerTrack*
Creates the default marker track.
void marker_track_init(Track* track)
Inits the marker track.
void marker_track_insert_marker(MarkerTrack* self, Marker* marker, int pos)
Inserts a marker to the track.
void marker_track_add_marker(MarkerTrack* self, Marker* marker)
Adds a marker to the track.
void marker_track_clear(MarkerTrack* self)
Removes all objects from the marker track.
void marker_track_remove_marker(MarkerTrack* self, Marker* marker, int free)
Removes a marker, optionally freeing it.
auto marker_track_get_start_marker(const Track* track) -> Marker*
Returns the start marker.
auto marker_track_get_end_marker(const Track* track) -> Marker*
Returns the end marker.
void meter_get_value(Meter* self, AudioValueFormat format, float* val, float* max)
Get the current meter value.
auto metronome_new(void) -> Metronome*
Initializes the Metronome by loading the samples into memory.
auto metronome_queue_events(AudioEngine* self, const nframes_t loffset, const nframes_t nframes) -> NONNULL void
Queues metronome events (if any) within the current processing cycle.
auto midi_get_cc_name(uint8_t cc) -> const char*
Return the name of the given cc (0-127).
auto midi_combine_bytes_to_int(midi_byte_t lsb, midi_byte_t msb) -> int
Used for MIDI controls whose values are split between MSB/LSB.
void midi_get_bytes_from_int(int val, midi_byte_t* lsb, midi_byte_t* msb)
Used for MIDI controls whose values are split between MSB/LSB.
auto midi_ctrl_change_get_ch_and_description(midi_byte_t* ctrl_change, char* buf) -> int
Saves a string representation of the given control change event in the given buffer.
void midi_panic_all(int queued)
Queues MIDI note off to event queues.
auto midi_get_msg_length(uint8_t status_byte) -> int
Returns the length of the MIDI message based on the status byte.
void midi_events_init(MidiEvents* self)
Inits the MidiEvents struct.
auto midi_events_new(Port* port) -> MidiEvents*
Allocates and inits a MidiEvents struct.
static void midi_event_copy(MidiEvent* dest, MidiEvent* src)
Copies the members from one MidiEvent to another.
void midi_events_sort_by_time(MidiEvents* self)
Sorts the MIDI events by time ascendingly.
void midi_events_append(MidiEvents* src, MidiEvents* dest, const nframes_t start_frame, const nframes_t nframes, bool queued)
Appends the events from src to dest.
void midi_events_append_w_filter(MidiEvents* src, MidiEvents* dest, int* channels, const nframes_t start_frame, const nframes_t nframes, bool queued)
Appends the events from src to dest.
void midi_events_add_note_on(MidiEvents* self, midi_byte_t channel, midi_byte_t note_pitch, midi_byte_t velocity, midi_time_t time, int queued)
Adds a note on event to the given MidiEvents.
void midi_events_add_note_ons_from_chord_descr(MidiEvents* self, ChordDescriptor* descr, midi_byte_t channel, midi_byte_t velocity, midi_time_t time, bool queued)
Adds a note on for each note in the chord.
void midi_events_add_note_offs_from_chord_descr(MidiEvents* self, ChordDescriptor* descr, midi_byte_t channel, midi_time_t time, bool queued)
Adds a note off for each note in the chord.
void midi_events_add_cc_volume(MidiEvents* self, midi_byte_t channel, midi_byte_t volume, midi_time_t time, bool queued)
Add CC volume event.
auto midi_events_has_note_on(MidiEvents* self, int check_main, int check_queued) -> int
Returrns if the MidiEvents have any note on events.
void midi_events_add_event_from_buf(MidiEvents* self, midi_time_t time, midi_byte_t* buf, int buf_size, int queued)
Parses a MidiEvent from a raw MIDI buffer.
void midi_events_add_note_off(MidiEvents* self, midi_byte_t channel, midi_byte_t note_pitch, midi_time_t time, int queued)
Adds a note off event to the given MidiEvents.
void midi_events_add_control_change(MidiEvents* self, midi_byte_t channel, midi_byte_t controller, midi_byte_t control, midi_time_t time, int queued)
Adds a control event to the given MidiEvents.
void midi_events_add_pitchbend(MidiEvents* self, midi_byte_t channel, int pitchbend, midi_time_t time, int queued)
Adds a control event to the given MidiEvents.
void midi_events_add_all_notes_off(MidiEvents* self, midi_byte_t channel, midi_time_t time, bool queued)
Queues MIDI note off to event queue.
void midi_events_clear(MidiEvents* midi_events, int queued)
Clears midi events.
void midi_events_clear_duplicates(MidiEvents* midi_events, const int queued)
Clears duplicates.
void midi_events_dequeue(MidiEvents* midi_events)
Copies the queue contents to the original struct.
auto midi_events_check_for_note_on(MidiEvents* midi_events, int note, int queued) -> int
Returns if a note on event for the given note exists in the given events.
auto midi_events_delete_note_on(MidiEvents* midi_events, int note, int queued) -> int
Deletes the midi event with a note on signal from the queue, and returns if it deleted or not.
void midi_events_sort(MidiEvents* self, const bool queued)
Sorts the MidiEvents by time.
void midi_events_set_channel(MidiEvents* self, const int queued, const midi_byte_t channel)
Sets the given MIDI channel on all applicable MIDI events.
void midi_events_free(MidiEvents* self)
Frees the MIDI events.
auto midi_file_track_has_data(const char* abs_path, int track_idx) -> bool
Returns whether the given track in the midi file has data.
auto midi_file_get_num_tracks(const char* abs_path, bool non_empty_only) -> int
Returns the number of tracks in the MIDI file.
void midi_function_apply(ArrangerSelections* sel, MidiFunctionType type)
Applies the given action to the given selections.
void midi_mappings_init_loaded(MidiMappings* self)
Initializes the MidiMappings after a Project is loaded.
auto midi_mappings_new(void) -> MidiMappings*
Returns a newly allocated MidiMappings.
void midi_mappings_bind_at(MidiMappings* self, midi_byte_t* buf, ExtPort* device_port, Port* dest_port, int idx, bool fire_events)
Binds the CC represented by the given raw buffer (must be size 3) to the given Port.
void midi_mappings_unbind(MidiMappings* self, int idx, bool fire_events)
Unbinds the given binding.
void midi_mappings_apply(MidiMappings* self, midi_byte_t* buf)
Applies the given buffer to the matching ports.
auto midi_mappings_get_for_port(MidiMappings* self, Port* dest_port, int* size) -> MidiMapping**
Get MIDI mappings for the given port.
void midi_note_get_global_start_pos(MidiNote* self, Position* pos)
Gets the global Position of the MidiNote's start_pos.
auto midi_note_new(RegionIdentifier* region_id, Position* start_pos, Position* end_pos, uint8_t val, uint8_t vel) -> MidiNote*
Creates a new MidiNote.
void midi_note_set_region_and_index(MidiNote* self, ZRegion* region, int idx)
Sets the region the MidiNote belongs to.
auto midi_note_is_equal(MidiNote* src, MidiNote* dest) -> int
Returns 1 if the MidiNotes match, 0 if not.
void midi_note_get_val_as_string(MidiNote* self, char* buf, const int use_markup)
Gets the MIDI note's value as a string (eg "C#4").
void midi_note_print(MidiNote* mn)
For debugging.
void midi_note_listen(MidiNote* mn, int listen)
Listen to the given MidiNote.
void midi_note_shift_pitch(MidiNote* self, const int delta)
Shifts MidiNote's position and/or value.
auto midi_note_hit(MidiNote* midi_note, const long gframes) -> int
Returns if the MIDI note is hit at given pos (in the timeline).
void midi_note_notes_to_events(MidiNote** midi_notes, int num_notes, Position* pos, MidiEvents* events)
Converts an array of MIDI notes to MidiEvents.
void midi_note_set_val(MidiNote* midi_note, const uint8_t val)
Sends a note off if currently playing and sets the pitch of the MidiNote.
auto midi_region_new(const Position* start_pos, const Position* end_pos, int track_pos, int lane_pos, int idx_inside_lane) -> ZRegion*
Creates a new ZRegion for MIDI notes.
auto midi_region_new_from_midi_file(const Position* start_pos, const char* abs_path, int track_pos, int lane_pos, int idx_inside_lane, int idx) -> ZRegion*
Creates a MIDI region from the given MIDI file path, starting at the given Position.
auto midi_region_new_from_chord_descr(const Position* pos, ChordDescriptor* descr, int track_pos, int lane_pos, int idx_inside_lane) -> ZRegion*
Create a region from the chord descriptor.
void midi_region_insert_midi_note(ZRegion* region, MidiNote* midi_note, int idx, int pub_events)
Inserts the MidiNote to the given ZRegion.
void midi_region_start_unended_note(ZRegion* self, Position* start_pos, Position* end_pos, int pitch, int vel, int pub_events)
Starts an unended note with the given pitch and velocity and adds it to ZRegion::midi_notes.
auto midi_region_pop_unended_note(ZRegion* self, int pitch) -> MidiNote*
Returns the midi note with the given pitch from the unended notes.
auto midi_region_fill_midi_events(ZRegion* self, long g_start_frames, nframes_t local_start_frame, nframes_t nframes, bool note_off_at_end, MidiEvents* midi_events) -> REALTIME void
Fills MIDI event queue from the region.
void midi_region_print_midi_notes(ZRegion* self)
Prints the MidiNotes in the Region.
auto midi_region_get_first_midi_note(ZRegion* region) -> MidiNote*
Gets first midi note.
auto midi_region_get_last_midi_note(ZRegion* region) -> MidiNote*
Gets last midi note.
auto midi_region_get_highest_midi_note(ZRegion* region) -> MidiNote*
Gets highest midi note.
auto midi_region_get_lowest_midi_note(ZRegion* region) -> MidiNote*
Gets lowest midi note.
void midi_region_remove_midi_note(ZRegion* region, MidiNote* midi_note, int free, int pub_event)
Removes the MIDI note from the Region.
void midi_region_remove_all_midi_notes(ZRegion* region)
Removes all MIDI ntoes and their components completely.
void midi_region_write_to_midi_file(ZRegion* self, MIDI_FILE* mf, const int add_region_start, bool export_full, bool use_track_pos)
Returns the midi note at given position with the given pitch.
void midi_region_export_to_midi_file(ZRegion* self, const char* full_path, int midi_version, const int export_full)
Exports the ZRegion to a specified MIDI file.
auto midi_region_get_midi_ch(const ZRegion* self) -> uint8_t
Returns the MIDI channel that this region should be played on, starting from 1.
auto midi_region_get_as_events(ZRegion* self, const int add_region_start, const int full) -> MidiEvents*
Returns a newly initialized MidiEvents with the contents of the region converted into events.
void midi_region_free_members(ZRegion* self)
Frees members only but not the midi region itself.
void midi_track_init(Track* track)
Initializes an midi track.
auto midi_track_fill_midi_events(Track* track, const long g_start_frames, const nframes_t local_start_frame, nframes_t nframes, MidiEvents* midi_events) -> REALTIME void
Fills MIDI event queue from track.
void midi_track_free(Track* track)
Frees the track.
void modulator_macro_processor_process(ModulatorMacroProcessor* self, long g_start_frames, nframes_t start_frame, const nframes_t nframes)
Process.
void modulator_track_insert_modulator(Track* self, int slot, Plugin* modulator, bool replace_mode, bool confirm, bool gen_automatables, bool recalc_graph, bool pub_events)
Inserts and connects a Modulator to the Track.
void modulator_track_remove_modulator(Track* self, int slot, bool replacing, bool deleting_modulator, bool deleting_track, bool recalc_graph)
Removes a plugin at pos from the track.
auto modulator_track_default(int track_pos) -> Track*
Creates the default modulator track.
void modulator_track_init(Track* track)
Inits the modulator track.
void audio_pool_init_loaded(AudioPool* self)
Inits after loading a project.
auto audio_pool_new(void) -> AudioPool*
Creates a new audio pool.
auto audio_pool_add_clip(AudioPool* self, AudioClip* clip) -> int
Adds an audio clip to the pool.
auto audio_pool_duplicate_clip(AudioPool* self, int clip_id, bool write_file) -> int
Duplicates the clip with the given ID and returns the duplicate.
auto audio_pool_get_clip(AudioPool* self, int clip_id) -> AudioClip*
Returns the clip for the given ID.
void audio_pool_remove_clip(AudioPool* self, int clip_id, bool free_and_remove_file)
Removes the clip with the given ID from the pool and optionally frees it (and removes the file).
void audio_pool_ensure_unique_clip_name(AudioPool* pool, AudioClip* clip)
Ensures that the name of the clip is unique.
auto audio_pool_gen_name_for_recording_clip(AudioPool* pool, Track* track, int lane) -> char*
Generates a name for a recording clip.
void audio_pool_reload_clip_frame_bufs(AudioPool* self)
Loads the frame buffers of clips currently in use in the project from their files and frees the buffers of clips not currently in use.
void audio_pool_write_to_disk(AudioPool* self)
Writes all the clips to disk.
auto port_init_loaded(Port* self, bool is_project) -> NONNULL void
This function finds the Ports corresponding to the PortIdentifiers for srcs and dests.
auto port_new_with_type(PortType type, PortFlow flow, const char* label) -> NONNULL Port*
Creates port.
auto stereo_ports_new_from_existing(Port* l, Port* r) -> NONNULL StereoPorts*
Creates blank stereo ports.
auto stereo_ports_new_generic(int in, const char* name, PortOwnerType owner_type, void* owner) -> StereoPorts*
Creates stereo ports for generic use.
auto stereo_ports_connect(StereoPorts* src, StereoPorts* dest, int locked) -> NONNULL void
Connects the internal ports using port_connect().
auto port_get_value_from_symbol(const char* port_sym, void* user_data, uint32_t* size, uint32_t* type) -> const void*
Function to get a port's value from its string symbol.
auto port_has_sound(Port* self) -> NONNULL bool
If MIDI port, returns if there are any events, if audio port, returns if there is sound in the buffer.
auto port_get_full_designation(Port* self, char* buf) -> NONNULL void
Copies a full designation of self in the format "Track/Port" or "Track/Plugin/Port" in buf.
void port_get_all(Port*** ports, size_t* max_size, bool is_dynamic, int* size)
Gathers all ports in the project and puts them in the given array and size.
void port_update_identifier(Port* self, Track* track, bool update_automation_track)
To be called when the port's identifier changes to update corresponding identifiers.
static auto port_get_dest_index(Port* self, Port* dest) -> NONNULL int
Returns the index of the destination in the dest array.
static auto port_get_src_index(Port* self, Port* src) -> NONNULL int
Returns the index of the source in the source array.
static auto port_set_multiplier_by_index(Port* port, int idx, float val) -> NONNULL void
Set the multiplier for a destination by its index in the dest array.
static auto port_set_src_multiplier_by_index(Port* port, int idx, float val) -> NONNULL void
Set the multiplier for a destination by its index in the dest array.
static auto port_get_multiplier_by_index(Port* port, int idx) -> NONNULL float
Get the multiplier for a destination by its index in the dest array.
auto port_disconnect_hw_inputs(Port* self) -> NONNULL void
Disconnects all hardware inputs from the port.
auto port_free(Port* port) -> NONNULL void
Deletes port, doing required cleanup and updating counters.
auto port_set_expose_to_backend(Port* self, int expose) -> NONNULL void
Sets whether to expose the port to the backend and exposes it or removes it.
auto port_is_exposed_to_backend(const Port* self) -> NONNULL int
Returns if the port is exposed to the backend.
auto port_rename_backend(Port* self) -> NONNULL void
Renames the port on the backend side.
auto port_set_control_value(Port* self, const float val, const bool is_normalized, const bool forward_event) -> NONNULL void
Sets the given control value to the corresponding underlying structure in the Port.
auto port_get_control_value(Port* self, const bool normalize) -> NONNULL HOT float
Gets the given control value from the corresponding underlying structure in the Port.
auto port_connect(Port* src, Port* dest, const int locked) -> NONNULL int
Connets src to dest.
auto port_disconnect(Port* src, Port* dest) -> NONNULL int
Disconnects src from dest.
static auto port_disconnect_dests(Port* src) -> NONNULL int
Disconnects dests of port.
auto port_get_num_unlocked_srcs(Port* port) -> NONNULL int
Returns the number of unlocked (user-editable) sources.
auto port_get_num_unlocked_dests(Port* port) -> NONNULL int
Returns the number of unlocked (user-editable) destinations.
void port_update_track_pos(Port* port, Track* track, int pos)
Updates the track pos on a track port and all its source/destination identifiers.
static auto port_apply_fader(Port* port, float amp, nframes_t start_frame, const nframes_t nframes) -> NONNULL void
Apply given fader value to port.
auto port_process(Port* port, const long g_start_frames, const nframes_t start_frame, const nframes_t nframes, const bool noroll) -> HOT NONNULL void
First sets port buf to 0, then sums the given port signal from its inputs.
auto port_set_owner_track(Port* port, Track* track) -> NONNULL void
Sets the owner track & its ID.
auto port_set_owner_track_from_channel(Port* port, Channel* ch) -> NONNULL void
Sets the owner track & its ID.
auto port_set_owner_track_processor(Port* port, TrackProcessor* track_processor) -> NONNULL void
Sets the owner track & its ID.
auto port_set_owner_sample_processor(Port* port, SampleProcessor* sample_processor) -> NONNULL void
Sets the owner sample processor.
auto port_set_owner_fader(Port* port, Fader* fader) -> NONNULL void
Sets the owner fader & its ID.
auto port_set_owner_channel_send(Port* port, ChannelSend* send) -> NONNULL void
Sets the channel send as the port's owner.
auto port_set_owner_plugin(Port* port, Plugin* pl) -> NONNULL void
Sets the owner plugin & its ID.
auto port_is_connection_locked(Port* src, Port* dest) -> NONNULL int
Returns if the connection from src to dest is locked or not.
auto ports_connected(Port* src, Port* dest) -> NONNULL bool
Returns if the two ports are connected or not.
auto ports_can_be_connected(const Port* src, const Port* dest) -> NONNULL bool
Returns whether the Port's can be connected (if the connection will be valid and won't break the acyclicity of the graph).
auto ports_disconnect(Port** ports, int num_ports, int deleting) -> NONNULL void
Disconnects all the given ports.
auto port_copy_metadata_from_project(Port* self, Port* project_port) -> NONNULL void
Copies the metadata from a project port to the given port.
auto port_restore_from_non_project(Port* self, Port* non_project) -> NONNULL void
Reverts the data on the corresponding project port for the given non-project port.
void port_print_connections_all(void)
Prints all connections.
auto port_clear_buffer(Port* port) -> HOT NONNULL void
Clears the port buffer.
auto port_disconnect_all(Port* port) -> NONNULL int
Disconnects all srcs and dests from port.
auto port_verify_src_and_dests(Port* self) -> NONNULL void
Verifies that the srcs and dests are correct for project ports.
auto port_apply_pan_stereo(Port* l, Port* r, float pan, PanLaw pan_law, PanAlgorithm pan_algo) -> NONNULL void
Applies the pan to the given L/R ports.
auto port_apply_pan(Port* port, float pan, PanLaw pan_law, PanAlgorithm pan_algo, nframes_t start_frame, const nframes_t nframes) -> NONNULL void
Applies the pan to the given port.
auto port_identifier_copy(PortIdentifier* dest, PortIdentifier* src) -> NONNULL void
Copy the identifier content from src to dest.
auto port_identifier_is_equal(PortIdentifier* src, PortIdentifier* dest) -> HOT NONNULL bool
Returns if the 2 PortIdentifier's are equal.
void position_set_to_bar(Position* self, int bar)
Sets position to given bar.
void position_sort_array(Position* array, const size_t size)
Sorts an array of Position's.
auto __attribute__((access(read_write, 1))) void position_add_frames(Position *pos -> HOT
Adds the frames to the position and updates the rest of the fields, and makes sure the frames are still accurate.
void position_from_seconds(Position* position, double secs)
Converts seconds to position and puts the result in the given Position.
auto position_from_ticks(Position* pos, double ticks) -> HOT NONNULL void
Sets position to the given total tick count.
auto position_to_ms(const Position* pos) -> long
Returns the Position in milliseconds.
void position_snap(Position* start_pos, Position* pos, Track* track, ZRegion* region, const SnapGrid* sg)
Snaps position using given options.
void position_set_min_size(const Position* start_pos, Position* end_pos, SnapGrid* snap)
Sets the end position to be 1 snap point away from the start pos.
auto position_update_ticks_from_frames(Position* position) -> HOT NONNULL void
Updates ticks.
auto position_update_frames_from_ticks(Position* position) -> HOT NONNULL void
Updates frames.
void position_get_midway_pos(Position* start_pos, Position* end_pos, Position* pos)
Calculates the midway point between the two Positions and sets it on pos.
auto position_get_ticks_diff(const Position* end_pos, const Position* start_pos, const SnapGrid* sg) -> double
Returns the difference in ticks between the two Position's, snapped based on the given SnapGrid (if any).
auto position_to_string_alloc(const Position* pos) -> NONNULL char*
Creates a string in the form of "0.0.0.0" from the given position.
auto position_to_string(const Position* pos, char* buf) -> NONNULL void
Creates a string in the form of "0.0.0.0" from the given position.
auto position_print(const Position* pos) -> NONNULL void
Prints the Position in the "0.0.0.0" form.
auto position_get_total_bars(const Position* pos, bool include_current) -> NONNULL int
Returns the total number of beats.
auto position_get_total_beats(const Position* pos, bool include_current) -> NONNULL int
Returns the total number of beats.
auto position_get_total_sixteenths(const Position* pos, bool include_current) -> NONNULL int
Returns the total number of sixteenths not including the current one.
auto position_change_sign(Position* pos) -> NONNULL void
Changes the sign of the position.
auto position_get_bars(const Position* pos, bool start_at_one) -> NONNULL int
Gets the bars of the position.
auto position_get_beats(const Position* pos, bool start_at_one) -> NONNULL int
Gets the beats of the position.
auto position_get_sixteenths(const Position* pos, bool start_at_one) -> NONNULL int
Gets the sixteenths of the position.
auto position_get_ticks(const Position* pos) -> NONNULL double
Gets the ticks of the position.
void quantize_options_update_quantize_points(QuantizeOptions* self)
Updates snap points.
auto quantize_options_stringize(NoteLength note_length, NoteType note_type) -> char*
Returns the grid intensity as a human-readable string.
auto quantize_options_clone(const QuantizeOptions* src) -> QuantizeOptions*
Clones the QuantizeOptions.
auto quantize_options_quantize_position(QuantizeOptions* self, Position* pos) -> double
Quantizes the given Position using the given QuantizeOptions.
void quantize_options_free(QuantizeOptions* self)
Free's the QuantizeOptions.
auto recording_manager_handle_recording(RecordingManager* self, TrackProcessor* track_processor, const long g_start_frames, const nframes_t local_offset, const nframes_t nframes) -> HOT void
Handles the recording logic inside the process cycle.
auto recording_manager_process_events(RecordingManager* self) -> int
GSourceFunc to be added using idle add.
auto recording_manager_new(void) -> RecordingManager*
Creates the event queue and starts the event loop.
void region_init(ZRegion* region, const Position* start_pos, const Position* end_pos, int track_pos, int lane_pos, int idx_inside_lane)
Only to be used by implementing structs.
auto region_find(RegionIdentifier* id) -> ZRegion*
Looks for the ZRegion matching the identifier.
void region_print(const ZRegion* region)
Print region info for debugging.
auto region_get_link_group(ZRegion* self) -> RegionLinkGroup*
Returns the region's link group.
void region_set_link_group(ZRegion* region, int group_idx, bool update_identifier)
Sets the link group to the region.
auto region_find_midi_note(ZRegion* r, MidiNote* _mn) -> MidiNote*
Returns the MidiNote matching the properties of the given MidiNote.
auto region_timeline_frames_to_local(ZRegion* self, const long timeline_frames, const bool normalize) -> long
Converts frames on the timeline (global) to local frames (in the clip).
void region_get_frames_till_next_loop_or_end(ZRegion* self, long timeline_frames, long* ret_frames, bool* is_loop)
Returns the number of frames until the next loop end point or the end of the region.
void region_set_lane(ZRegion* region, TrackLane* lane)
Sets the track lane.
void region_gen_name(ZRegion* region, const char* base_name, AutomationTrack* at, Track* track)
Generates a name for the ZRegion, either using the given AutomationTrack or Track, or appending to the given base name.
void region_stretch(ZRegion* self, double ratio)
Stretch the region's contents.
void region_update_identifier(ZRegion* self)
To be called every time the identifier changes to update the region's children.
void region_update_link_group(ZRegion* self)
Updates all other regions in the region link group, if any.
void region_move_to_lane(ZRegion* region, TrackLane* lane, int index_in_lane)
Moves the given ZRegion to the given TrackLane.
void region_move_to_track(ZRegion* region, Track* track, int index_in_lane)
Moves the ZRegion to the given Track, maintaining the selection status of the ZRegion and the TrackLane position.
auto region_type_has_lane(const RegionType type) -> int
Returns if the given ZRegion type can exist in TrackLane's.
void region_set_automation_track(ZRegion* region, AutomationTrack* at)
Sets the automation track.
auto region_get_automation_track(ZRegion* region) -> AutomationTrack*
Gets the AutomationTrack using the saved index.
void region_copy(ZRegion* src, ZRegion* dest)
Copies the data from src to dest.
auto region_is_hit(const ZRegion* region, const long gframes, const int inclusive) -> int
Returns if the position is inside the region or not.
auto region_is_hit_by_range(const ZRegion* region, const long gframes_start, const long gframes_end, const bool end_inclusive) -> int
Returns if any part of the ZRegion is inside the given range, inclusive.
auto region_at_position(Track* track, AutomationTrack* at, Position* pos) -> ZRegion*
Returns the region at the given position in the given Track.
auto region_generate_filename(ZRegion* region) -> char*
Generates the filename for this region.
void region_set_name(ZRegion* region, const char* name, bool fire_events)
Sets ZRegion name (without appending anything to it) to all associated regions.
auto region_is_recording(ZRegion* self) -> bool
Returns if this region is currently being recorded onto.
auto region_get_musical_mode(ZRegion* self) -> bool
Returns whether the region is effectively in musical mode.
void region_add_arranger_object(ZRegion* self, ArrangerObject* obj, bool fire_events)
Wrapper for adding an arranger object.
void region_unlink(ZRegion* region)
Removes the link group from the region, if any.
void region_remove_all_children(ZRegion* region)
Removes all children objects from the region.
void region_copy_children(ZRegion* dest, ZRegion* src)
Clones and copies all children from src to dest.
auto region_get_arranger_selections(ZRegion* self) -> ArrangerSelections*
Returns the ArrangerSelections based on the given region type.
auto region_validate(ZRegion* self, bool is_project) -> bool
Sanity checking.
void region_disconnect(ZRegion* self)
Disconnects the region and anything using it.
auto region_link_group_remove_region(RegionLinkGroup* self, ZRegion* region, bool autoremove_last_region_and_group, bool update_identifier) -> NONNULL void
Remove the region from the link group.
auto region_link_group_update(RegionLinkGroup* self, ZRegion* region) -> NONNULL void
Updates all other regions in the link group.
auto region_link_group_move(RegionLinkGroup* dest, RegionLinkGroup* src) -> NONNULL void
Moves the regions from src to dest.
auto region_link_group_manager_add_group(RegionLinkGroupManager* self) -> int
Adds a group and returns its index.
void region_link_group_manager_remove_group(RegionLinkGroupManager* self, int group_id)
Removes the group.
void router_recalc_graph(Router* self, bool soft)
Recalculates the process acyclic directed graph.
void router_start_cycle(Router* self, const nframes_t nsamples, const nframes_t local_offset, const Position* pos)
Starts a new cycle.
auto router_get_max_route_playback_latency(Router* router) -> nframes_t
Returns the max playback latency of the trigger nodes.
auto router_is_processing_thread(Router* router) -> bool
Returns if the current thread is a processing thread.
void sample_playback_init(SamplePlayback* self, sample_t** buf, long buf_size, channels_t channels, float vol, nframes_t start_offset)
Initializes a SamplePlayback with a sample to play back.
auto sample_processor_new(void) -> SampleProcessor*
Initializes a SamplePlayback with a sample to play back.
void sample_processor_prepare_process(SampleProcessor* self, const nframes_t nframes)
Clears the buffers.
void sample_processor_process(SampleProcessor* self, const nframes_t offset, const nframes_t nframes)
Process the samples for the given number of frames.
void sample_processor_remove_sample_playback(SampleProcessor* self, SamplePlayback* sp)
Removes a SamplePlayback from the array.
void sample_processor_queue_metronome(SampleProcessor* self, MetronomeType type, nframes_t offset)
Queues a metronomem tick at the given local offset.
void sample_processor_queue_sample_from_file(SampleProcessor* self, const char* path)
Adds a sample to play to the queue from a file path.
auto musical_scale_new(MusicalScaleType type, MusicalNote root) -> MusicalScale*
Creates new scale using type and root note.
auto musical_scale_clone(MusicalScale* src) -> MusicalScale*
Clones the scale.
auto musical_scale_to_string(MusicalScale* scale) -> char*
Prints the MusicalScale to a string.
void musical_scale_strcpy(MusicalScale* scale, char* buf)
Same as above but uses a buffer instead of allocating.
static auto musical_scale_is_equal(MusicalScale* a, MusicalScale* b) -> int
Returns 1 if the scales are equal.
auto musical_scale_is_chord_in_scale(MusicalScale* scale, ChordDescriptor* chord) -> int
Returns if all of the chord's notes are in the scale.
auto musical_scale_is_accent_in_scale(MusicalScale* scale, MusicalNote chord_root, ChordType type, ChordAccent chord_accent) -> int
Returns if the accent is in the scale.
auto musical_scale_is_key_in_scale(MusicalScale* scale, MusicalNote key) -> int
Returns if the given key is in the given MusicalScale.
auto musical_scale_as_string(MusicalScale* scale) -> char*
Returns the scale in human readable string.
void musical_scale_free(MusicalScale* scale)
Frees the MusicalScale.
auto scale_object_new(MusicalScale* descr) -> ScaleObject*
Creates a ScaleObject.
void snap_grid_update_snap_points(SnapGrid* self, int max_bars)
Updates snap points.
auto snap_grid_get_snap_ticks(SnapGrid* self) -> int
Gets a snap point's length in ticks.
auto snap_grid_get_default_ticks(SnapGrid* self) -> int
Gets a the default length in ticks.
auto snap_grid_stringize(NoteLength note_length, NoteType note_type) -> char*
Returns the grid intensity as a human-readable string.
auto snap_grid_get_nearby_snap_point(SnapGrid* self, const Position* pos, const int return_prev) -> Position*
Returns the next or previous SnapGrid point.
auto stretcher_new_rubberband(unsigned int samplerate, unsigned int channels, double time_ratio, double pitch_ratio, bool realtime) -> Stretcher*
Create a new Stretcher using the rubberband backend.
auto stretcher_stretch(Stretcher* self, float* in_samples_l, float* in_samples_r, size_t in_samples_size, float* out_samples_l, float* out_samples_r, size_t out_samples_wanted) -> ssize_t
Perform stretching.
auto stretcher_get_latency(Stretcher* self) -> unsigned int
Get latency in number of samples.
auto stretcher_stretch_interleaved(Stretcher* self, float* in_samples, size_t in_samples_size, float** _out_samples) -> ssize_t
Perform stretching.
void stretcher_free(Stretcher* self)
Frees the resampler.
auto tempo_track_default(int track_pos) -> Track*
Creates the default tempo track.
void tempo_track_init(Track* track)
Inits the tempo track.
void tempo_track_clear(Track* self)
Removes all objects from the tempo track.
auto tempo_track_get_bpm_at_pos(Track* track, Position* pos) -> bpm_t
Returns the BPM at the given pos.
auto tempo_track_get_current_bpm(Track* self) -> bpm_t
Returns the current BPM.
void tempo_track_set_bpm(Track* self, bpm_t bpm, bpm_t start_bpm, bool temporary, bool fire_events)
Sets the BPM.
void tempo_track_set_beats_per_bar(Track* self, int beats_per_bar)
Updates beat unit and anything depending on it.
void track_init(Track* self, const int add_lane)
Inits the Track, optionally adding a single lane.
auto track_new(TrackType type, int pos, const char* label, const int with_lane) -> Track*
Creates a track with the given label and returns it.
auto track_clone(Track* track, bool src_is_project) -> Track*
Clones the track and returns the clone.
auto track_type_has_channel(TrackType type) -> bool
Returns if the given TrackType is a type of Track that has a Channel.
auto track_set_magic(Track* self) -> NONNULL void
Sets magic on objects recursively.
auto track_set_muted(Track* track, bool mute, bool trigger_undo, bool auto_select, bool fire_events) -> NONNULL void
Sets track muted and optionally adds the action to the undo stack.
auto track_type_is_deletable(TrackType type) -> NONNULL bool
Returns whether the track type is deletable by the user.
auto track_get_full_visible_height(Track* self) -> NONNULL double
Returns the full visible height (main height + height of all visible automation tracks + height of all visible lanes).
auto track_get_soloed(Track* self) -> NONNULL bool
Returns if the track is soloed.
auto track_get_implied_soloed(Track* self) -> NONNULL bool
Returns whether the track is not soloed on its own but its direct out (or its direct out's direct out, etc.) is soloed.
auto track_get_muted(Track* self) -> NONNULL bool
Returns if the track is muted.
auto track_get_listened(Track* self) -> NONNULL bool
Returns if the track is listened.
auto track_set_listened(Track* self, bool listen, bool trigger_undo, bool auto_select, bool fire_events) -> NONNULL void
Sets track soloed, updates UI and optionally adds the action to the undo stack.
auto track_set_recording(Track* track, bool recording, bool fire_events) -> NONNULL void
Sets recording and connects/disconnects the JACK ports.
auto track_set_soloed(Track* self, bool solo, bool trigger_undo, bool auto_select, bool fire_events) -> NONNULL void
Sets track soloed, updates UI and optionally adds the action to the undo stack.
auto track_is_selected(Track* self) -> NONNULL int
Returns if Track is in TracklistSelections.
auto track_is_pinned(Track* self) -> NONNULL bool
Returns whether the track is pinned.
void track_add_region(Track* track, ZRegion* region, AutomationTrack* at, int lane_pos, int gen_name, int fire_events)
Adds a ZRegion to the given lane or AutomationTrack of the track.
void track_insert_region(Track* track, ZRegion* region, AutomationTrack* at, int lane_pos, int idx, int gen_name, int fire_events)
Inserts a ZRegion to the given lane or AutomationTrack of the track, at the given index.
auto track_write_to_midi_file(Track* self, MIDI_FILE* mf) -> NONNULL void
Writes the track to the given MIDI file.
auto track_select(Track* self, bool select, bool exclusive, bool fire_events) -> NONNULL void
Appends the Track to the selections.
auto track_unselect_all(Track* self) -> NONNULL void
Unselects all arranger objects in the track.
auto track_clear(Track* self) -> NONNULL void
Removes all objects recursively from the track.
auto track_remove_region(Track* self, ZRegion* region, bool fire_events, bool free) -> NONNULL void
Only removes the region from the track.
void track_fill_events(Track* track, const long g_start_frames, const nframes_t local_start_frame, nframes_t nframes, MidiEvents* midi_events, StereoPorts* stereo_ports)
Wrapper for audio and MIDI/instrument tracks to fill in MidiEvents or StereoPorts from the timeline data.
auto track_validate(Track* self) -> bool
Verifies the identifiers on a live Track (in the project, not a clone).
auto track_get_region_at_pos(const Track* track, const Position* pos, bool include_region_end) -> ZRegion*
Returns the region at the given position, or NULL.
auto track_get_last_region(Track* track) -> ZRegion*
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.
auto track_type_can_host_region_type(const TrackType tt, const RegionType rt) -> int
Returns if the given TrackType can host the given RegionType.
static auto track_type_can_record(const TrackType type) -> int
Returns if the Track can record.
void track_generate_automation_tracks(Track* track)
Generates automatables for the track.
void track_setup(Track* track)
Wrapper.
auto track_get_automation_tracklist(Track* track) -> AutomationTracklist*
Returns the automation tracklist if the track type has one, or NULL if it doesn't (like chord tracks).
auto track_get_channel(Track* track) -> Channel*
Returns the channel of the track, if the track type has a channel, or NULL if it doesn't.
void track_update_children(Track* self)
Updates the track's children.
void track_set_pos(Track* track, int pos)
Updates position in the tracklist and also updates the information in the lanes.
auto track_type_has_piano_roll(const TrackType type) -> bool
Returns if the Track should have a piano roll.
static auto track_has_inputs(const Track* track) -> int
Returns if the Track should have an inputs selector.
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.
auto track_get_name(Track* track) -> const char*
Getter for the track name.
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* track, const char* _name, bool pub_events)
Setter for the track name.
auto track_get_from_name(const char* name) -> Track*
Returns the Track from the Project matching name.
static auto track_type_is_compatible_for_moving(const TrackType type1, const TrackType type2) -> int
Returns if regions in tracks from type1 can be moved to type2.
void track_update_frames(Track* track)
Updates the frames of each position in each child of the track recursively.
auto track_get_fader(Track* track, bool post_fader) -> Fader*
Returns the Fader (if applicable).
auto track_get_fader_type(const Track* track) -> FaderType
Returns the FaderType corresponding to the given Track.
auto track_type_get_prefader_type(TrackType type) -> FaderType
Returns the prefader type corresponding to the given Track.
void track_create_missing_lanes(Track* track, const int pos)
Creates missing TrackLane's until pos.
void track_remove_empty_last_lanes(Track* track)
Removes the empty last lanes of the Track (except the last one).
auto track_get_regions_in_range(Track* self, Position* p1, Position* p2, ZRegion** regions) -> int
Returns all the regions inside the given range, or all the regions if both p1 and p2 are NULL.
void track_comment_setter(void* track, const char* comment)
Comment setter.
void track_set_comment(Track* self, const char* comment, bool undoable)
auto track_get_comment(void* track) -> const char*
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.
void track_set_is_project(Track* self, bool is_project)
Recursively marks the track and children as project objects or not.
auto track_get_plugin_at_slot(Track* track, PluginSlotType slot_type, int slot) -> Plugin*
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_all_ports(Track* self, Port*** ports, int* size, bool is_dynamic, size_t* max_size, bool include_plugins)
Appends all channel ports and optionally plugin ports to the array.
void track_freeze(Track* self, bool freeze)
Freezes or unfreezes the track.
void track_insert_plugin(Track* self, Plugin* pl, PluginSlotType slot_type, int slot, 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_add_plugin(Track* self, PluginSlotType slot_type, int slot, Plugin* pl, bool replacing_plugin, bool moving_plugin, 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.
void track_free(Track* track)
Wrapper for each track type.
auto track_lane_new(Track* track, int pos) -> TrackLane*
Creates a new TrackLane at the given pos in the given Track.
void track_lane_insert_region(TrackLane* self, ZRegion* region, int idx)
Inserts a ZRegion to the given TrackLane at the given index.
void track_lane_add_region(TrackLane* self, ZRegion* region)
Adds a ZRegion to the given TrackLane.
void track_lane_remove_region(TrackLane* self, ZRegion* region)
Removes but does not free the region.
void track_lane_unselect_all(TrackLane* self)
Unselects all arranger objects.
void track_lane_clear(TrackLane* self)
Removes all objects recursively from the track lane.
void track_lane_update_frames(TrackLane* self)
Updates the frames of each position in each child of the track recursively.
void track_lane_set_track_pos(TrackLane* self, const int pos)
Sets the track position to the lane and all its members recursively.
auto track_lane_clone(TrackLane* lane) -> TrackLane*
Clones the TrackLane.
void track_lane_write_to_midi_file(TrackLane* self, MIDI_FILE* mf)
Writes the lane to the given MIDI file.
void track_lane_free(TrackLane* lane)
Frees the TrackLane.
void track_processor_init_loaded(TrackProcessor* self, bool is_project)
Inits a TrackProcessor after a project is loaded.
auto track_processor_new(Track* track) -> TrackProcessor*
Creates a new track processor for the given track.
void track_processor_copy_values(TrackProcessor* dest, TrackProcessor* src)
Copy port values from src to dest.
void track_processor_clear_buffers(TrackProcessor* self)
Clears all buffers.
void track_processor_disconnect_all(TrackProcessor* self)
Disconnects all ports connected to the TrackProcessor.
auto track_processor_process(TrackProcessor* self, const long g_start_frames, const nframes_t local_offset, const nframes_t nframes) -> HOT void
Process the TrackProcessor.
void track_processor_disconnect_from_prefader(TrackProcessor* self)
Disconnect the TrackProcessor's stereo out ports from the prefader.
void track_processor_connect_to_prefader(TrackProcessor* self)
Connects the TrackProcessor's stereo out ports to the Channel's prefader in ports.
void track_processor_disconnect_from_plugin(TrackProcessor* self, Plugin* pl)
Disconnect the TrackProcessor's out ports from the Plugin's input ports.
void track_processor_connect_to_plugin(TrackProcessor* self, Plugin* pl)
Connect the TrackProcessor's out ports to the Plugin's input ports.
void track_processor_free(TrackProcessor* self)
Frees the TrackProcessor.
auto tracklist_init_loaded(Tracklist* self) -> NONNULL void
Initializes the tracklist when loading a project.
auto tracklist_select_all(Tracklist* self, bool select, bool fire_events) -> NONNULL void
Selects or deselects all tracks.
void tracklist_get_visible_tracks(Tracklist* self, Track** visible_tracks, int* num_visible)
Finds visible tracks and puts them in given array.
auto tracklist_find_track_by_name(Tracklist* self, const char* name) -> Track*
Returns the Track matching the given name, if any.
auto tracklist_print_tracks(Tracklist* self) -> NONNULL void
Prints the tracks (for debugging).
auto tracklist_insert_track(Tracklist* self, Track* track, int pos, int publish_events, int recalc_graph) -> NONNULL void
Adds given track to given spot in tracklist.
auto tracklist_remove_track(Tracklist* self, Track* track, bool rm_pl, bool free_track, bool publish_events, bool recalc_graph) -> NONNULL void
Removes a track from the Tracklist and the TracklistSelections.
void tracklist_move_track(Tracklist* self, Track* track, int pos, int publish_events, int recalc_graph)
Moves a track from its current position to the position given by pos.
void tracklist_append_track(Tracklist* self, Track* track, int publish_events, int recalc_graph)
Calls tracklist_insert_track with the given options.
void tracklist_set_track_pinned(Tracklist* self, Track* track, const int pinned, int publish_events, int recalc_graph)
Pins or unpins the Track.
auto tracklist_get_track_pos(Tracklist* self, Track* track) -> int
Returns the index of the given Track.
auto tracklist_get_first_visible_track(Tracklist* self, const int pinned) -> Track*
Returns the first visible Track.
auto tracklist_get_prev_visible_track(Tracklist* self, Track* track) -> Track*
Returns the previous visible Track in the same Tracklist as the given one (ie, pinned or not).
auto tracklist_get_last_pos(Tracklist* self, const TracklistPinOption pin_opt, const bool visible_only) -> int
Returns the index of the last Track.
auto tracklist_get_last_track(Tracklist* self, const TracklistPinOption pin_opt, const int visible_only) -> Track*
Returns the last Track.
auto tracklist_get_next_visible_track(Tracklist* self, Track* track) -> Track*
Returns the next visible Track in the same Tracklist as the given one (ie, pinned or not).
auto tracklist_get_visible_track_after_delta(Tracklist* self, Track* track, int delta) -> Track*
Returns the Track after delta visible Track's.
auto tracklist_get_visible_track_diff(Tracklist* self, const Track* src, const Track* dest) -> int
Returns the number of visible Tracks between src and dest (negative if dest is before src).
auto tracklist_multiply_track_heights(Tracklist* self, double multiplier, bool visible_only, bool check_only, bool fire_events) -> bool
Multiplies all tracks' heights and returns if the operation was valid.
void tracklist_handle_file_drop(Tracklist* self, char** uri_list, SupportedFile* orig_file, Track* track, TrackLane* lane, Position* pos, bool perform_actions)
Handles a file drop inside the timeline or in empty space in the tracklist.
auto tracklist_track_name_is_unique(Tracklist* self, const char* name, Track* track_to_skip) -> int
Returns 1 if the track name is not taken.
auto tracklist_has_soloed(const Tracklist* self) -> NONNULL bool
Returns if the tracklist has soloed tracks.
auto tracklist_has_listened(const Tracklist* self) -> NONNULL bool
Returns if the tracklist has listened tracks.
auto tracklist_get_num_visible_tracks(Tracklist* self, int visible) -> int
void tracklist_activate_all_plugins(Tracklist* self, bool activate)
Activate or deactivate all plugins.
void tracklist_expose_ports_to_backend(Tracklist* self)
Exposes each track's ports that should be exposed to the backend.
void tracklist_mark_all_tracks_for_bounce(Tracklist* self, bool bounce)
Marks or unmarks all tracks for bounce.
void guile_tracklist_define_module(void)
Define guile module.
auto transport_new(AudioEngine* engine) -> Transport*
Initialize transport.
auto transport_clone(Transport* self) -> Transport*
Clones the transport values.
void transport_prepare_audio_regions_for_stretch(Transport* self, TimelineSelections* sel)
Prepares audio regions for stretching (sets the ZRegion::before_length).
void transport_stretch_audio_regions(Transport* self, TimelineSelections* sel, bool with_fixed_ratio, double time_ratio)
Stretches audio regions.
void transport_set_metronome_enabled(Transport* self, const int enabled)
Sets whether metronome is enabled or not.
void transport_add_to_playhead(Transport* self, const long nframes)
Moves the playhead by the time corresponding to given samples, taking into account the loop end point.
void transport_set_playhead_pos(Transport* self, Position* pos)
Setter for playhead Position.
void transport_get_playhead_pos(Transport* self, Position* pos)
Getter for playhead Position.
void transport_move_backward(Transport* self)
Move to the previous snap point on the timeline.
void transport_move_forward(Transport* self)
Move to the next snap point on the timeline.
void transport_move_playhead(Transport* self, Position* target, bool panic, bool set_cue_point, bool fire_events)
Moves playhead to given pos.
void transport_set_loop(Transport* self, bool enabled)
Enables or disables loop.
void transport_goto_prev_marker(Transport* self)
Moves the playhead to the prev Marker.
void transport_goto_next_marker(Transport* self)
Moves the playhead to the next Marker.
void transport_update_position_frames(Transport* self)
Updates the frames in all transport positions.
void transport_position_add_frames(const Transport* self, Position* pos, const long frames)
Adds frames to the given position similar to position_add_frames, except that it adjusts the new Position if the loop end point was crossed.
auto transport_get_ppqn(Transport* self) -> double
Returns the PPQN (Parts/Ticks Per Quarter Note).
void transport_get_range_pos(Transport* self, bool first, Position* pos)
Stores the position of the range in pos.
void transport_set_has_range(Transport* self, bool has_range)
Sets if the project has range and updates UI.
auto transport_is_loop_point_met(const Transport* self, const long g_start_frames, const nframes_t nframes) -> HOT nframes_t
Returns the number of processable frames until and excluding the loop end point as a positive number (>= 1) if the loop point was met between g_start_frames and (g_start_frames + nframes), otherwise returns 0;.
void transport_recalculate_total_bars(Transport* self)
Recalculates the total bars based on the last object's position.
void transport_update_total_bars(Transport* self, int total_bars, bool fire_events)
Updates the total bars.
void transport_set_recording(Transport* self, bool record, bool fire_events)
Sets recording on/off.
auto velocity_new(MidiNote* midi_note, const uint8_t vel) -> Velocity*
Creates a new Velocity with the given value.
void velocity_set_midi_note(Velocity* velocity, MidiNote* midi_note)
Sets the MidiNote the Velocity belongs to.
auto velocity_is_equal(Velocity* src, Velocity* dest) -> int
Returns 1 if the Velocity's match, 0 if not.
void velocity_shift(Velocity* self, const int delta)
Changes the Velocity by the given amount of values (delta).
void velocity_set_val(Velocity* self, const int val)
Sets the velocity to the given value.
auto velocity_get_midi_note(Velocity* self) -> MidiNote*
Returns the owner MidiNote.

Variables

int index
Index in parent AutomationTracklist.
PortIdentifier port_id
Identifier of the Port this AutomationTrack is for.
bool created
Whether it has been created by the user yet or not.
ZRegion** regions
The automation Region's.
bool visible
Whether visible or not.
int y
Y local to track.
double height
Position of multipane handle.
float last_recorded_value
Last value recorded in this automation track.
AutomationMode automation_mode
Automation mode.
AutomationRecordMode record_mode
Automation record mode, when AutomationTrack::automation_mode is set to record.
bool recording_started
To be set to true when recording starts (when the first change is received) and false when recording ends.
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.
bool recording_paused
This must only be set by the RecordingManager when temporarily pausing recording, eg when looping or leaving the punch range.
CustomButtonWidget* top_right_buttons
Buttons used by the track widget.
AutomationModeWidget* am_widget
Automation mode button group.
Port* port
Port associated with this meter.
TruePeakDsp* true_peak_processor
True peak processor.
float true_peak
Current true peak.
KMeterDsp* kmeter_processor
K RMS processor, if K meter.
MeterAlgorithm algorithm
Algorithm to use.
float prev_max
Previous max, used when holding the max value.
float last_amp
Last meter value (in amplitude), used to show a falloff and avoid sudden dips.
gint64 last_draw_time
Time the last val was taken at (last draw time).
static const Position POSITION_START
Start Position to be used in calculations.
static const cyaml_strval_t note_type_short_strings
These are not meant to be serialized, they are only used for convenience.

Defines

#define AUTOMATION_RECORDING_TOUCH_REL_MS
Relase time in ms when in touch record mode.
#define CHANNEL_MAGIC
Magic number to identify channels.
#define CHANNEL_SEND_POST_FADER_START_SLOT
The slot where post-fader sends begin (starting from 0).
#define chord_track_get_chord_at_playhead(ct)
Returns the current chord.
#define chord_track_get_scale_at_playhead(ct)
Returns the current scale.
#define CURVE_SUPERELLIPSE_CURVINESS_BOUND
Bounds for each algorithm.
#define engine_set_run(engine, _run)
Set whether engine should process (true) or skip (false).
#define ENGINE_EVENTS_PUSH(et, _arg, _uint_arg, _float_arg)
Push events.
#define engine_is_port_own(self, port)
Returns 1 if the port is an engine port or control room port, otherwise 0.
#define EXT_PORTS_MAX
Maximum external ports.
#define marker_set_name(_self, _name)
Sets the name to all the Marker's counterparts.
#define MAX_MIDI_EVENTS
Max events to hold in queues.
#define midi_region_add_midi_note(region, midi_note, pub_events)
Adds the MidiNote to the given ZRegion.
#define PORT_NOT_OWNED
Special ID for owner_pl, owner_ch, etc.
#define position_between_frames_excl2(pos, f1, f2)
Whether the position starts on or after f1 and before f2.
#define position_compare(p1, p2)
Compares 2 positions based on their frames.
#define position_is_before(_pos, _cmp)
Checks if _pos is before _cmp.
#define position_is_before_or_equal(_pos, _cmp)
Checks if _pos is before or equal to _cmp.
#define position_is_equal(_pos, _cmp)
Checks if _pos is equal to _cmp.
#define position_is_after(_pos, _cmp)
Checks if _pos is after _cmp.
#define position_is_after_or_equal(_pos, _cmp)
Checks if _pos is after or equal to _cmp.
#define position_compare_ticks(p1, p2)
Compares 2 positions based on their total ticks.
#define position_is_between(_pos, _start, _end)
Returns if _pos is after or equal to _start and before _end.
#define position_is_between_excl_start(_pos, _start, _end)
Returns if _pos is after _start and before _end.
#define POSITION_INIT_ON_STACK(name)
Inits the default position on the stack.
#define position_init(__pos)
Initializes given position.
#define position_set_to_pos(_pos, _target)
Sets position to target position.
#define position_to_frames(x)
Deprecated - added for compatibility.
#define RECORDING_EVENTS_PUSH_AUDIO(et, _arg)
Push events.
#define recording_event_init(re)
Inits an already allocated recording event.
#define region_type_can_fade(rtype)
Returns if the given ZRegion type can have fades.
#define VELOCITY_DEFAULT
Default velocity.

Enum documentation

enum BalanceControlAlgorithm

See https://www.harmonycentral.com/articles/the-truth-about-panning-laws.

Enumerators
BALANCE_CONTROL_ALGORITHM_LINEAR

Classic "Balance" mode.

Attennuates one channel only with no positive gain.

Examples: hard left: mute right channel, left channel untouched. mid left: attenuate right channel by (signal * pan - 0.5), left channel untouched.

enum ChordAccent

Chord accents.

Enumerators
CHORD_ACC_NONE
CHORD_ACC_7

b7 is 10 semitones from chord root, or 9 if the chord is diminished.

CHORD_ACC_j7

Maj7 is 11 semitones from the root.

CHORD_ACC_b9

13 semitones.

CHORD_ACC_9

14 semitones.

CHORD_ACC_S9

15 semitones.

CHORD_ACC_11

17 semitones.

CHORD_ACC_b5_S11

6 and 18 semitones.

CHORD_ACC_S5_b13

8 and 16 semitones.

CHORD_ACC_6_13

9 and 21 semitones.

NUM_CHORD_ACCENTS

enum CurveAlgorithm

The algorithm to use for curves.

See https://www.desmos.com/calculator/typjsyykvb

Enumerators
CURVE_ALGORITHM_EXPONENT

y = x^n 0 < n <= 1, where the whole thing is tilting up and 0 is full tilt and 1 is straight line (when starting at lower point).

CURVE_ALGORITHM_SUPERELLIPSE

y = 1 - (1 - x^n)^(1/n) 0 < n <= 1, where the whole thing is tilting up and 0 is full tilt and 1 is straight line (when starting at lower point).

See https://stackoverflow.com/questions/17623152/how-map-tween-a-number-based-on-a-dynamic-curve

CURVE_ALGORITHM_VITAL

(e^(nx) - 1) / (e^n - 1) -10 <= n <= 10 where positive tilts down and negative tilts up (when starting at lower point).

See https://www.desmos.com/calculator/2dnuiptiqc.

CURVE_ALGORITHM_PULSE

Pulse (square).

NUM_CURVE_ALGORITHMS

enum BounceMode

Mode used when bouncing, either during exporting or when bouncing tracks or regions to audio.

Enumerators
BOUNCE_OFF

Don't bounce.

BOUNCE_ON

Bounce.

BOUNCE_INHERIT

Bounce if parent is bouncing.

To be used on regions to bounce if their track is bouncing.

enum ExportMode

Export mode.

If this is anything other than EXPORT_MODE_FULL, the Track::bounce or ZRegion.bounce_mode should be set.

Enumerators
EXPORT_MODE_FULL

Export everything within the range normally.

EXPORT_MODE_TRACKS

Export selected tracks within the range only.

EXPORT_MODE_REGIONS

Export selected regions within the range only.

enum FaderType

Fader type.

Enumerators
FADER_TYPE_NONE
FADER_TYPE_MONITOR

Audio fader for the monitor.

FADER_TYPE_AUDIO_CHANNEL

Audio fader for Channel's.

FADER_TYPE_MIDI_CHANNEL
FADER_TYPE_GENERIC

For generic uses.

enum MidiFaderMode

Enumerators
MIDI_FADER_MODE_VEL_MULTIPLIER

Multiply velocity of all MIDI note ons.

MIDI_FADER_MODE_CC_VOLUME

Send CC volume event on change TODO.

enum GraphExportType

Export type.

enum GraphNodeType

Graph nodes can be either ports or processors.

Processors can be plugins, faders, etc.

Enumerators
ROUTE_NODE_TYPE_PORT

Port.

ROUTE_NODE_TYPE_PLUGIN

Plugin processor.

ROUTE_NODE_TYPE_TRACK

Track processor.

ROUTE_NODE_TYPE_FADER

Fader/pan processor.

ROUTE_NODE_TYPE_MONITOR_FADER

Fader/pan processor for monitor.

ROUTE_NODE_TYPE_PREFADER

Pre-Fader passthrough processor.

ROUTE_NODE_TYPE_SAMPLE_PROCESSOR

Sample processor.

ROUTE_NODE_TYPE_INITIAL_PROCESSOR

Initial processor.

The initial processor is a dummy processor in the chain processed before anything else.

ROUTE_NODE_TYPE_HW_PROCESSOR

Hardware processor.

ROUTE_NODE_TYPE_MODULATOR_MACRO_PROCESOR

enum MarkerType

Marker type.

Enumerators
MARKER_TYPE_START

Song start Marker that cannot be deleted.

MARKER_TYPE_END

Song end Marker that cannot be deleted.

MARKER_TYPE_CUSTOM

Custom Marker.

enum MeterAlgorithm

Enumerators
METER_ALGORITHM_AUTO

Use default algorithm for the port.

METER_ALGORITHM_DIGITAL_PEAK
METER_ALGORITHM_TRUE_PEAK
METER_ALGORITHM_RMS
METER_ALGORITHM_K

enum MetronomeType

The type of the metronome sound.

enum MidiEventType

Type of MIDI event.

These are in order of precedence.

enum PortInternalType

What the internal data is.

Enumerators
INTERNAL_NONE
INTERNAL_LV2_PORT

Pointer to Lv2Port.

INTERNAL_JACK_PORT

Pointer to jack_port_t.

INTERNAL_PA_PORT

TODO.

INTERNAL_ALSA_SEQ_PORT

Pointer to snd_seq_port_info_t.

enum PortUnit

Port unit to be displayed in the UI.

Enumerators
PORT_UNIT_NONE
PORT_UNIT_HZ
PORT_UNIT_MHZ
PORT_UNIT_DB
PORT_UNIT_DEGREES
PORT_UNIT_SECONDS
PORT_UNIT_MS

Milliseconds.

enum PortFlags

Port flags.

Enumerators
PORT_FLAG_STEREO_L
PORT_FLAG_STEREO_R
PORT_FLAG_PIANO_ROLL
PORT_FLAG_SIDECHAIN

See http://lv2plug.in/ns/ext/port-groups/port-groups.html#sideChainOf.

PORT_FLAG_MAIN_PORT

See http://lv2plug.in/ns/ext/port-groups/port-groups.html#mainInput and http://lv2plug.in/ns/ext/port-groups/port-groups.html#mainOutput.

PORT_FLAG_MANUAL_PRESS
PORT_FLAG_AMPLITUDE

Amplitude port.

PORT_FLAG_STEREO_BALANCE

Port controls the stereo balance.

This is used in channels for the balance control.

PORT_FLAG_WANT_POSITION

Whether the port wants to receive position events.

This is only applicable for LV2 Atom ports.

PORT_FLAG_TRIGGER

Trigger ports will be set to 0 at the end of each cycle.

This mostly applies to LV2 Control Input ports.

PORT_FLAG_TOGGLE

Whether the port is a toggle (on/off).

PORT_FLAG_INTEGER

Whether the port is an integer.

PORT_FLAG_FREEWHEEL

Whether port is for letting the plugin know that we are in freewheeling (export) mode.

PORT_FLAG_REPORTS_LATENCY

Used for plugin ports.

PORT_FLAG_NOT_ON_GUI

Port should not be visible to users.

PORT_FLAG_PLUGIN_ENABLED

Port is a switch for plugin enabled.

PORT_FLAG_PLUGIN_CONTROL

Port is a plugin control.

PORT_FLAG_CHANNEL_MUTE

Port is for channel mute.

PORT_FLAG_CHANNEL_FADER

Port is for channel fader.

PORT_FLAG_AUTOMATABLE

Port has an automation track.

If this is set, it is assumed that the automation track at PortIdentifier::port_index is for this port.

PORT_FLAG_MIDI_AUTOMATABLE

MIDI automatable control, such as modwheel or pitch bend.

PORT_FLAG_SEND_RECEIVABLE

Channels can send to this port (ie, this port is a track procesor midi/stereo in or a plugin sidechain in).

PORT_FLAG_BPM

This is a BPM port.

PORT_FLAG_GENERIC_PLUGIN_PORT

Generic plugin port not belonging to the underlying plugin.

This is for ports that are added by Zrythm such as Enabled and Gain.

PORT_FLAG_PLUGIN_GAIN

This is the plugin gain.

PORT_FLAG_TP_MONO

Track processor input mono switch.

PORT_FLAG_TP_INPUT_GAIN

Track processor input gain.

PORT_FLAG_HW

Port is a hardware port.

PORT_FLAG_MODULATOR_MACRO

Port is part of a modulator macro processor.

Which of the ports it is can be determined by checking flow/type.

PORT_FLAG_LOGARITHMIC

Logarithmic.

PORT_FLAG_IS_PROPERTY

Plugin control is a property (changes are set via atom message on the plugin's control port), as opposed to conventional float control ports.

An input Port is created for each parameter declared as either writable or readable (or both).

@seealso http://lv2plug.in/ns/lv2core#Parameter.

enum PortFlags2

Enumerators
PORT_FLAG2_TRANSPORT_ROLL

Transport ports.

PORT_FLAG2_TRANSPORT_STOP
PORT_FLAG2_TRANSPORT_BACKWARD
PORT_FLAG2_TRANSPORT_FORWARD
PORT_FLAG2_TRANSPORT_LOOP_TOGGLE
PORT_FLAG2_TRANSPORT_REC_TOGGLE
PORT_FLAG2_SUPPORTS_PATCH_MESSAGE

LV2 control atom port supports patch messages.

PORT_FLAG2_ENUMERATION

Port's only reasonable values are its scale points.

PORT_FLAG2_URI_PARAM

Parameter port's value type is URI.

PORT_FLAG2_SEQUENCE

Atom port buffer type is sequence.

PORT_FLAG2_SUPPORTS_MIDI

Atom or event port supports MIDI.

PORT_FLAG2_TP_OUTPUT_GAIN

Track processor output gain.

PORT_FLAG2_MIDI_PITCH_BEND

MIDI pitch bend.

PORT_FLAG2_MIDI_POLY_KEY_PRESSURE

MIDI poly key pressure.

PORT_FLAG2_MIDI_CHANNEL_PRESSURE

MIDI channel pressure.

PORT_FLAG2_CHANNEL_SEND_ENABLED

Channel send enabled.

PORT_FLAG2_CHANNEL_SEND_AMOUNT

Channel send amount.

PORT_FLAG2_BEATS_PER_BAR

Beats per bar.

PORT_FLAG2_BEAT_UNIT

Beat unit.

enum RegionMusicalMode

Musical mode setting for audio regions.

Enumerators
REGION_MUSICAL_MODE_INHERIT

Inherit from global musical mode setting.

REGION_MUSICAL_MODE_OFF

Musical mode off - don't auto-stretch when BPM changes.

REGION_MUSICAL_MODE_ON

Musical mode on - auto-stretch when BPM changes.

enum RegionType

Type of Region.

Bitfield instead of plain enum so multiple values can be passed to some functions (eg to collect all Regions of the given types in a Track).

enum MusicalScaleType

Scale type (name) eg Aeolian.

Enumerators
SCALE_CHROMATIC

all keys

SCALE_IONIAN

major

SCALE_AEOLIAN

natural minor

SCALE_HARMONIC_MINOR
SCALE_ACOUSTIC
SCALE_ALGERIAN
SCALE_ALTERED
SCALE_AUGMENTED
SCALE_BEBOP_DOMINANT
SCALE_BLUES
SCALE_CHINESE
SCALE_DIMINISHED
SCALE_DOMINANT_DIMINISHED
SCALE_DORIAN
SCALE_DOUBLE_HARMONIC
SCALE_EIGHT_TONE_SPANISH
SCALE_ENIGMATIC
SCALE_EGYPTIAN
SCALE_FLAMENCO
SCALE_GEEZ
SCALE_GYPSY
SCALE_HALF_DIMINISHED
SCALE_HARMONIC_MAJOR
SCALE_HINDU
SCALE_HIRAJOSHI
SCALE_HUNGARIAN_GYPSY
SCALE_HUNGARIAN_MINOR
SCALE_IN
SCALE_INSEN
SCALE_ISTRIAN
SCALE_IWATO
SCALE_LOCRIAN
SCALE_LYDIAN_AUGMENTED
SCALE_LYDIAN
SCALE_MAJOR_LOCRIAN
SCALE_MAJOR_PENTATONIC
SCALE_MAQAM
SCALE_MELODIC_MINOR
SCALE_MINOR_PENTATONIC
SCALE_MIXOLYDIAN
SCALE_NEAPOLITAN_MAJOR
SCALE_NEAPOLITAN_MINOR
SCALE_OCTATONIC_HALF_WHOLE
SCALE_OCTATONIC_WHOLE_HALF
SCALE_ORIENTAL
SCALE_PERSIAN
SCALE_PHRYGIAN_DOMINANT
SCALE_PHRYGIAN
SCALE_PROMETHEUS
SCALE_ROMANIAN_MINOR
SCALE_TRITONE
SCALE_UKRANIAN_DORIAN
SCALE_WHOLE_TONE
SCALE_YO

enum NoteType

Enumerators
NOTE_TYPE_NORMAL
NOTE_TYPE_DOTTED

2/3 of its original size

NOTE_TYPE_TRIPLET

3/2 of its original size

enum NoteLengthType

Enumerators
NOTE_LENGTH_CUSTOM

Custom length.

NOTE_LENGTH_LINK

Link length with snap setting.

NOTE_LENGTH_LAST_OBJECT

Use last created object's length.

enum StretcherBackend

Enumerators
STRETCHER_BACKEND_RUBBERBAND

Lib rubberband.

STRETCHER_BACKEND_PAULSTRETCH

Paulstretch.

STRETCHER_BACKEND_SBSMS

SBSMS - Subband Sinusoidal Modeling Synthesis.

enum BeatUnit

Beat unit.

enum TrackType

The Track's type.

Enumerators
TRACK_TYPE_INSTRUMENT

Instrument tracks must have an Instrument plugin at the first slot and they produce audio output.

TRACK_TYPE_AUDIO

Audio tracks can record and contain audio clips.

Other than that their channel strips are similar to buses.

TRACK_TYPE_MASTER

The master track is a special type of group track.

TRACK_TYPE_CHORD

The chord track contains chords that can be used to modify midi in real time or to color the piano roll.

TRACK_TYPE_MARKER

Marker Track's contain named markers at specific Position's in the song.

TRACK_TYPE_TEMPO

Special track for BPM (tempo) and time signature events.

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.

They are similar to Group Tracks, except that they cannot be routed to directly. Buses are used for send effects.

TRACK_TYPE_AUDIO_GROUP

Group Tracks are used for grouping audio signals, for example routing multiple drum tracks to a "Drums" group track.

Like buses, they only contain effects but unlike buses they can be routed to.

TRACK_TYPE_MIDI

Midi tracks can only have MIDI effects in the strip and produce MIDI output that can be routed to instrument channels or hardware.

TRACK_TYPE_MIDI_BUS

Same with audio bus but for MIDI signals.

TRACK_TYPE_MIDI_GROUP

Same with audio group but for MIDI signals.

enum TransportRecordingMode

Recording mode for MIDI and audio.

In all cases, only objects created during the current recording cycle can be changed. Previous objects shall not be touched.

Enumerators
RECORDING_MODE_OVERWRITE_EVENTS

Overwrite events in first recorded region.

In the case of MIDI, this will remove existing MIDI notes during recording.

In the case of audio, this will act exactly the same as RECORDING_MODE_TAKES_MUTED.

RECORDING_MODE_MERGE_EVENTS

Merge events in existing region.

In the case of MIDI, this will append MIDI notes.

In the case of audio, this will act exactly the same as RECORDING_MODE_TAKES.

RECORDING_MODE_TAKES

Events get put in new lanes each time recording starts/resumes (eg, when looping or entering/leaving the punch range).

RECORDING_MODE_TAKES_MUTED

Same as RECORDING_MODE_TAKES, except previous takes (since recording started) are muted.

Typedef documentation

typedef struct ChordDescriptor ChordDescriptor

A ChordDescriptor describes a chord and is not linked to any specific object by itself.

Chord objects should include a ChordDescriptor.

typedef struct AudioClip AudioClip

Audio clips for the pool.

These should be loaded in the project's sample rate.

typedef enum CurveAlgorithm CurveAlgorithm

The algorithm to use for curves.

See https://www.desmos.com/calculator/typjsyykvb

typedef struct AudioEncoder AudioEncoder

Struct for holding info for encoding.

typedef enum ExportMode ExportMode

Export mode.

If this is anything other than EXPORT_MODE_FULL, the Track::bounce or ZRegion.bounce_mode should be set.

typedef struct Fader Fader

A Fader is a processor that is used for volume controls and pan.

It does not necessarily have to correspond to a FaderWidget. It can be used as a backend to KnobWidget's.

typedef struct Graph Graph

Graph.

typedef enum GraphExportType GraphExportType

Export type.

typedef enum GraphNodeType GraphNodeType

Graph nodes can be either ports or processors.

Processors can be plugins, faders, etc.

typedef struct GraphNode GraphNode

A node in the processing graph.

typedef struct Track MarkerTrack

MarkerTrack is just a Track.

typedef struct Meter Meter

A Meter used by a single GUI element.

typedef enum MetronomeType MetronomeType

The type of the metronome sound.

typedef struct Metronome Metronome

Metronome settings.

typedef enum MidiEventType MidiEventType

Type of MIDI event.

These are in order of precedence.

typedef struct MidiEvent MidiEvent

Backend-agnostic MIDI event descriptor.

typedef struct MidiEvents MidiEvents

Container for passing midi events through ports.

This should be passed in the data field of MIDI Ports

typedef struct MidiEventHeader MidiEventHeader

Used by Windows MME and RtMidi when adding events to the ring.

typedef struct ModulatorMacroProcessor ModulatorMacroProcessor

Modulator macro button processor.

Has 1 control input, many CV inputs and 1 CV output.

Can only belong to modulator track.

typedef struct AudioPool AudioPool

An audio pool is a pool of audio files and their corresponding float arrays in memory that are referenced by regions.

Instead of associating audio files with regions, all audio files (and their edited counterparts after some hard editing like stretching) are saved in the pool.

typedef struct StereoPorts StereoPorts

L & R port, for convenience.

Must ONLY be created via stereo_ports_new()

typedef struct PortIdentifier PortIdentifier

Struct used to identify Ports in the project.

This should include some members of the original struct enough to identify the port. To be used for sources and dests.

This must be filled in before saving and read from while loading to fill in the srcs/dests.

typedef struct RecordingEvent RecordingEvent

A recording event.

During recording, a recording event must be sent in each cycle for all record-enabled tracks.

typedef struct ZRegion ZRegion

A region (clip) is an object on the timeline that contains either MidiNote's or AudioClip's.

It is uniquely identified using its name, so it must be unique throughout the Project.

typedef enum RegionType RegionType

Type of Region.

Bitfield instead of plain enum so multiple values can be passed to some functions (eg to collect all Regions of the given types in a Track).

typedef struct SamplePlayback SamplePlayback

A sample playback handle to be used by the engine.

typedef struct Stretcher Stretcher

Stretcher interface.

typedef enum BeatUnit BeatUnit

Beat unit.

typedef struct Track Track

Track to be inserted into the Project's Tracklist.

Each Track contains a Channel with Plugins.

Tracks shall be identified by ther position (index) in the Tracklist.

typedef struct TrackLane TrackLane

A TrackLane belongs to a Track (can have many TrackLanes in a Track) and contains Regions.

Only Tracks that have Regions can have TrackLanes, such as InstrumentTrack and AudioTrack.

typedef struct Tracklist Tracklist

The Tracklist contains all the tracks in the Project.

There should be a clear separation between the Tracklist and the Mixer. The Tracklist should be concerned with Tracks in the arranger, and the Mixer should be concerned with Channels, routing and Port connections.

typedef enum TransportRecordingMode TransportRecordingMode

Recording mode for MIDI and audio.

In all cases, only objects created during the current recording cycle can be changed. Previous objects shall not be touched.

typedef struct GraphNode GraphNode

A node in the processing graph.

typedef struct MidiEvents MidiEvents

Container for passing midi events through ports.

This should be passed in the data field of MIDI Ports

Function documentation

int audio_function_apply(ArrangerSelections* sel, AudioFunctionType type)

Applies the given action to the given selections.

Parameters
sel Selections to edit.
type Function type.

ZRegion* audio_region_new(const int pool_id, const char* filename, const float* frames, const long nframes, const char* clip_name, const channels_t channels, const Position* start_pos, int track_pos, int lane_pos, int idx_inside_lane)

Creates a ZRegion for audio data.

Parameters
pool_id The pool ID. This is used when creating clone regions (non-main) and must be -1 when creating a new clip.
filename Filename, if loading from file, otherwise NULL.
frames Float array, if loading from float array, otherwise NULL.
nframes Number of frames per channel.
clip_name Name of audio clip, if not loading from file.
channels
start_pos
track_pos
lane_pos
idx_inside_lane

FIXME First create the audio on the pool and then pass the pool id here.

AudioClip* audio_region_get_clip(const ZRegion* self)

Returns the audio clip associated with the Region.

void audio_region_set_clip_id(ZRegion* self, int clip_id)

Sets the clip ID on the region and updates any references.

void audio_region_replace_frames(ZRegion* self, float* frames, size_t start_frame, size_t num_frames, bool duplicate_clip)

Replaces the region's frames from start_frames with frames.

Parameters
self
frames Frames, interleaved.
start_frame
num_frames
duplicate_clip Whether to duplicate the clip (eg, when other regions refer to it).

REALTIME void audio_region_fill_stereo_ports(ZRegion* self, long g_start_frames, nframes_t local_start_frame, nframes_t nframes, StereoPorts* stereo_ports)

Fills audio data from the region.

Parameters
self
g_start_frames Global start frame.
local_start_frame The start frame offset from 0 in this cycle.
nframes Number of frames at start Position.
stereo_ports StereoPorts to fill.

void audio_region_free_members(ZRegion* self)

Frees members only but not the audio region itself.

Regions should be free'd using region_free.

void automation_function_apply(ArrangerSelections* sel, AutomationFunctionType type)

Applies the given action to the given selections.

Parameters
sel Selections to edit.
type Function type.

void automation_point_set_fvalue(AutomationPoint* self, float real_val, bool is_normalized, bool pub_events)

Sets the value from given real or normalized value and notifies interested parties.

Parameters
self
real_val
is_normalized Whether the given value is normalized.
pub_events

HOT double automation_point_get_normalized_value_in_curve(AutomationPoint* ap, double x)

The function to return a point on the curve.

Parameters
ap The start point (0, 0).
x Normalized x.

See https://stackoverflow.com/questions/17623152/how-map-tween-a-number-based-on-a-dynamic-curve

ZRegion* automation_region_new(const Position* start_pos, const Position* end_pos, int track_pos, int at_idx, int idx_inside_at)

Creates a new ZRegion for automation.

void automation_region_print_automation(ZRegion* self)

Prints the automation in this Region.

void automation_region_force_sort(ZRegion* self)

Forces sort of the automation points.

void automation_region_add_ap(ZRegion* self, AutomationPoint* ap, int pub_events)

Adds an AutomationPoint to the Region.

HOT AutomationPoint* automation_region_get_next_ap(ZRegion* self, AutomationPoint* ap, bool check_positions, bool check_transients)

Returns the AutomationPoint after the given one.

Parameters
self
ap
check_positions Compare positions instead of just getting the next index.
check_transients Also check the transient of each object. This only matters if check_positions is true.

void automation_region_remove_ap(ZRegion* self, AutomationPoint* ap, bool freeing_region, int free)

Removes the AutomationPoint from the ZRegion, optionally freeing it.

Parameters
self
ap
freeing_region
free Free the AutomationPoint after removing it.

void automation_region_get_aps_since_last_recorded(ZRegion* self, Position* pos, AutomationPoint** aps, int* num_aps)

Returns the automation points since the last recorded automation point (if the last recorded automation point was before the current pos).

AutomationPoint* automation_region_get_ap_around(ZRegion* self, Position* _pos, double delta_ticks, bool before_only)

Returns an automation point found within +/- delta_ticks from the position, or NULL.

Parameters
self
_pos
delta_ticks
before_only Only check previous automation points.

NONNULL void automation_region_free_members(ZRegion* self)

Frees members only but not the ZRegion itself.

Regions should be free'd using region_free.

NONNULL AutomationTrack* automation_track_find_from_port_id(PortIdentifier* id, bool basic_search)

Parameters
id
basic_search If true, only basic port identifier members are checked.

AutomationTrack* automation_track_find_from_port(Port* port, Track* track, bool basic_search)

Finds the AutomationTrack associated with port.

Parameters
port
track The track that owns the port, if known.
basic_search

HOT NONNULL bool automation_track_should_read_automation(AutomationTrack* at, gint64 cur_time)

Returns whether the automation in the automation track should be read.

Parameters
at
cur_time Current time from g_get_monotonic_time() passed here to ensure the same timestamp is used in sequential calls.

NONNULL bool automation_track_should_be_recording(AutomationTrack* at, gint64 cur_time, bool record_aps)

Returns if the automation track should currently be recording data.

Parameters
at
cur_time Current time from g_get_monotonic_time() passed here to ensure the same timestamp is used in sequential calls.
record_aps If set to true, this function will return whether we should be recording automation point data. If set to false, this function will return whether we should be recording a region (eg, if an automation point was already created before and we are still recording inside a region regardless of whether we should create/edit automation points or not.

Returns false if in touch mode after the release time has passed.

This function assumes that the transport will be rolling.

NONNULL void automation_track_add_region(AutomationTrack* self, ZRegion* region)

Adds an automation ZRegion to the AutomationTrack.

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_update_frames(AutomationTrack* self)

Returns the visible y offset from the top of the track widget.

Updates the frames of each position in each child of the automation track recursively.

NONNULL AutomationPoint* automation_track_get_ap_before_pos(const AutomationTrack* self, const Position* pos, bool ends_after)

Returns the automation point before the Position on the timeline.

Parameters
self
pos
ends_after Whether to only check in regions that also end after pos (ie, the region surrounds pos), otherwise check in the region that ends last.

ZRegion* automation_track_get_region_before_pos(const AutomationTrack* self, const Position* pos, bool ends_after)

Returns the ZRegion that starts before given Position, if any.

Parameters
self
pos
ends_after Whether to only check for regions that also end after pos (ie, the region surrounds pos), otherwise get the region that ends last.

NONNULL float automation_track_get_val_at_pos(AutomationTrack* at, Position* pos, bool normalized, bool ends_after)

Returns the actual parameter value at the given position.

Parameters
at
pos
normalized Whether to return the value normalized.
ends_after Whether to only check in regions that also end after pos (ie, the region surrounds pos), otherwise check in the region that ends last.

If there is no automation point/curve during the position, it returns the current value of the parameter it is automating.

NONNULL ZRegion* automation_track_get_last_region(AutomationTrack* self)

Updates automation track & its GUI.

Gets the last ZRegion in the AutomationTrack.

void automation_tracklist_print_ats(AutomationTracklist* self)

Prints info about all the automation tracks.

Used for debugging.

void automation_tracklist_update_track_pos(AutomationTracklist* self, Track* track)

Updates the Track position of the Automatable's and AutomationTrack's.

Parameters
self
track The Track to update to.

void automation_tracklist_remove_at(AutomationTracklist* self, AutomationTrack* at, bool free, bool fire_events)

Updates the automation tracks.

(adds missing)

Builds an automation track for each automatable in the channel and its plugins, unless it already exists. Removes the AutomationTrack from the AutomationTracklist, optionally freeing it.

void automation_tracklist_set_at_index(AutomationTracklist* self, AutomationTrack* at, int index, bool push_down)

Sets the index of the AutomationTrack and swaps it with the AutomationTrack at that index or pushes the other AutomationTrack's down.

Parameters
self
at
index
push_down False to swap positions with the current AutomationTrack, or true to push down all the tracks below.

A special case is when Documentation == AutomationTracklist.num_ats. In this case, the given automation track is set last and all the other automation tracks are pushed upwards.

AutomationTrack* automation_tracklist_get_plugin_at(AutomationTracklist* self, PluginSlotType slot_type, const int plugin_slot, const char* label)

Gets the automation track with the given label.

Only works for plugin port labels and mainly used in tests.

bool automation_tracklist_validate(AutomationTracklist* self)

Verifies the identifiers on a live automation tracklist (in the project, not a clone).

Returns True if pass.

void balance_control_get_calc_lr(BalanceControlAlgorithm algo, float pan, float* calc_l, float* calc_r)

Returns the coefficients to multiply the L and R signal with.

NONNULL void channel_handle_recording(Channel* self, const long g_frames_start, const nframes_t nframes)

Handles the recording logic inside the process cycle.

Parameters
self
g_frames_start Global start frames.
nframes Number of frames to process.

The MidiEvents are already dequeued at this point.

void channel_append_all_ports(Channel* ch, Port*** ports, int* size, bool is_dynamic, size_t* max_size, bool include_plugins)

Appends all channel ports and optionally plugin ports to the array.

Parameters
ch
ports
size Current array count.
is_dynamic Whether the array can be dynamically resized.
max_size Current array size, if dynamic.
include_plugins

NONNULL void channel_connect(Channel* ch)

Connects the channel's ports.

This should only be called on new tracks.

NONNULL void channel_prepare_process(Channel* channel)

Prepares the channel for processing.

To be called before the main cycle each time on all channels.

NONNULL void channel_process(Channel* channel)

The process function prototype.

Channels must implement this. It is used to perform processing of the audio signal at every cycle.

Normally, the channel will call the process func on each of its plugins in order.

NONNULL int channel_add_plugin(Channel* channel, PluginSlotType slot_type, int pos, Plugin* plugin, bool confirm, bool moving_plugin, bool gen_automatables, bool recalc_graph, bool pub_events)

Adds given plugin to given position in the strip.

Parameters
channel The Channel.
slot_type
pos The position in the strip starting from 0.
plugin The plugin to add.
confirm Confirm if an existing plugin will be overwritten.
moving_plugin Whether or not we are moving the plugin.
gen_automatables Generatate plugin automatables. To be used when creating a new plugin only.
recalc_graph Recalculate mixer graph.
pub_events Publish events.
Returns 1 if plugin added, 0 if not.

The plugin must be already instantiated at this point.

NONNULL void channel_remove_plugin(Channel* channel, PluginSlotType slot_type, int slot, bool moving_plugin, bool deleting_plugin, bool deleting_channel, bool recalc_graph)

Removes a plugin at pos from the channel.

Parameters
channel
slot_type
slot
moving_plugin Whether or not we are moving the plugin.
deleting_plugin Whether or not we are deleting the plugin.
deleting_channel If true, the automation tracks associated with the plugin are not deleted at this time.
recalc_graph Recalculate mixer graph.

FIXME this is the same as modulator_track_remove_modulator(). TODO refactor into track_remove_plugin().

NONNULL Channel* channel_clone(Channel* ch, Track* track, bool src_is_project)

Clones the channel recursively.

Parameters
ch
track The track to use for getting the name. @bool src_is_project Whether ch is a project channel.
src_is_project

NONNULL void channel_disconnect(Channel* channel, bool remove_pl)

Disconnects the channel from the processing chain.

Parameters
channel
remove_pl Remove the Plugin from the Channel. Useful when deleting the channel.

This should be called immediately when the channel is getting deleted, and channel_free should be designed to be called later after an arbitrary delay.

NONNULL void channel_free(Channel* channel)

Frees the channel.

Track* channel_send_get_target_track(ChannelSend* self, Track* owner)

Gets the target track.

Parameters
self
owner The owner track of the send (optional).

NONNULL StereoPorts* channel_send_get_target_sidechain(ChannelSend* self)

Gets the target sidechain port.

Returned StereoPorts instance must be free'd.

void channel_send_connect_stereo(ChannelSend* self, StereoPorts* stereo, Port* l, Port* r, bool sidechain)

Connects a send to stereo ports.

This function takes either stereo or both l and r.

int chord_descriptor_is_key_in_chord(ChordDescriptor* chord, MusicalNote key)

Returns if the given key is in the chord represented by the given ChordDescriptor.

Parameters
chord
key A note inside a single octave (0-11).

const char* chord_descriptor_chord_type_to_string(ChordType type)

Returns the chord type as a string (eg.

"aug").

const char* chord_descriptor_chord_accent_to_string(ChordAccent accent)

Returns the chord accent as a string (eg.

"j7").

const char* chord_descriptor_note_to_string(MusicalNote note)

Returns the musical note as a string (eg.

"C3").

char* chord_descriptor_to_new_string(const ChordDescriptor* chord)

Returns the chord in human readable string.

MUST be free'd by caller.

NONNULL ZRegion* chord_region_new(const Position* start_pos, const Position* end_pos, int idx)

Creates a new ZRegion for chords.

Parameters
start_pos
end_pos
idx Index inside chord track.

NONNULL void chord_region_insert_chord_object(ZRegion* self, ChordObject* chord, int pos, bool fire_events)

Inserts a ChordObject to the Region.

NONNULL void chord_region_add_chord_object(ZRegion* self, ChordObject* chord, bool fire_events)

Adds a ChordObject to the Region.

NONNULL void chord_region_remove_chord_object(ZRegion* self, ChordObject* chord, int free, bool fire_events)

Removes a ChordObject from the Region.

Parameters
self
chord
free Optionally free the ChordObject.
fire_events

NONNULL void chord_region_free_members(ZRegion* self)

Frees members only but not the ZRegion itself.

Regions should be free'd using region_free.

ChordTrack* chord_track_new(int track_pos)

Creates a new chord Track.

void chord_track_init(Track* track)

Inits a chord track (e.g.

when cloning).

void chord_track_insert_chord_region(ChordTrack* track, ZRegion* region, int idx)

Inserts a chord region to the Track at the given index.

void chord_track_insert_scale(ChordTrack* track, ScaleObject* scale, int pos)

Inserts a scale to the track.

void chord_track_add_scale(ChordTrack* track, ScaleObject* scale)

Adds a scale to the track.

void chord_track_remove_scale(ChordTrack* self, ScaleObject* scale, bool free)

Removes a scale from the chord Track.

void chord_track_remove_region(ChordTrack* self, ZRegion* region)

Removes a region from the chord track.

ChordObject* chord_track_get_chord_at_pos(const Track* ct, const Position* pos)

Returns the ChordObject at the given Position in the TimelineArranger.

ScaleObject* chord_track_get_scale_at_pos(const Track* ct, const Position* pos)

Returns the ScaleObject at the given Position in the TimelineArranger.

void chord_track_clear(ChordTrack* self)

Removes all objects from the chord track.

Mainly used in testing.

NONNULL AudioClip* audio_clip_new_from_file(const char* full_path)

Creates an audio clip from a file.

The name used is the basename of the file.

AudioClip* audio_clip_new_from_float_array(const float* arr, const long nframes, const channels_t channels, const char* name)

Creates an audio clip by copying the given float array.

Parameters
arr Interleaved array.
nframes
channels
name A name for this clip.

AudioClip* audio_clip_new_recording(const channels_t channels, const long nframes, const char* name)

Create an audio clip while recording.

Parameters
channels
nframes Number of frames to allocate. This should be the current cycle's frames when called during recording.
name

The frames will keep getting reallocated until the recording is finished.

NONNULL void audio_clip_update_channel_caches(AudioClip* self, size_t start_from)

Updates the channel caches.

Parameters
self
start_from Frames to start from (per channel. The previous frames will be kept.

See AudioClip::ch_frames.

NONNULL int audio_clip_write_to_file(AudioClip* self, const char* filepath, bool parts)

Writes the given audio clip data to a file.

Parameters
self
filepath
parts If true, only write new data.
Returns Non-zero if fail.

NONNULL void audio_clip_write_to_pool(AudioClip* self, bool parts)

Writes the clip to the pool as a wav file.

Parameters
self
parts If true, only write new data.

NONNULL void audio_clip_remove_and_free(AudioClip* self)

To be called by audio_pool_remove_clip().

Removes the file associated with the clip and frees the instance.

float control_port_normalized_val_to_real(Port* self, float normalized_val)

Converts normalized value (0.0 to 1.0) to real value (eg.

-10.0 to 100.0).

float control_port_real_val_to_normalized(Port* self, float real_val)

Converts real value (eg.

-10.0 to 100.0) to normalized value (0.0 to 1.0).

bool control_port_is_toggled(Port* self)

Returns if the control port is toggled.

bool control_port_is_val_toggled(float val)

Checks if the given value is toggled.

int control_port_get_int(Port* self)

Gets the control value for an integer port.

int control_port_get_int_from_val(float val)

Gets the control value for an integer port.

float control_port_get_snapped_val(Port* self)

Returns the snapped value (eg, if toggle, returns 0.f or 1.f).

float control_port_get_snapped_val_from_val(Port* self, float val)

Returns the snapped value (eg, if toggle, returns 0.f or 1.f).

float control_port_get_val(Port* self)

Get the current real value of the control.

TODO "normalize" parameter.

float control_port_get_unsnapped_val(Port* self)

Get the current real unsnapped value of the control.

float control_port_get_default_val(Port* self)

Get the default real value of the control.

void control_port_set_real_val(Port* self, float val)

Get the default real value of the control.

void control_port_set_real_val_w_events(Port* self, float val)

Get the default real value of the control and sends UI events.

void control_port_set_val_from_normalized(Port* self, float val, bool automating)

Updates the actual value.

Parameters
self
val
automating Whether this is from an automation event. This will set Lv2Port's automating field to true, which will cause the plugin to receive a UI event for this change.

The given value is always a normalized 0.0-1.0 value and must be translated to the actual value before setting it.

HOT double curve_get_normalized_y(double x, CurveOptions* opts, int start_higher)

Returns the Y value on a curve spcified by algo.

Parameters
x X-coordinate, normalized.
opts Curve options.
start_higher Start at higher point.

AudioEncoder* audio_encoder_new_from_file(const char* filepath)

Creates a new instance of an AudioEncoder from the given file, that can be used for encoding.

It converts the file into a float array in its original sample rate and prepares the instance for decoding it into the project's sample rate.

void audio_encoder_decode(AudioEncoder* self, int samplerate, bool show_progress)

Decodes the information in the AudioEncoder instance and stores the results there.

Parameters
self
samplerate
show_progress Display a progress dialog.

Resamples the input float array to match the project's sample rate.

Assumes that the input array is already filled in.

void audio_encoder_free(AudioEncoder* self)

Free's the AudioEncoder and its members.

AudioEngine* engine_new(Project* project)

Create a new audio engine.

This only initializes the engine and doe snot connect to the backend.

void engine_wait_for_pause(AudioEngine* self, EngineState* state, bool force_pause)

Parameters
self
state
force_pause Whether to force transport pause, otherwise for engine to process and handle the pause request.

void engine_activate(AudioEngine* self, bool activate)

Activates the audio engine to start processing and receiving events.

Parameters
self
activate Activate or deactivate.

void engine_update_frames_per_tick(AudioEngine* self, const int beats_per_bar, const bpm_t bpm, const sample_rate_t sample_rate, bool thread_check)

Updates frames per tick based on the time sig, the BPM, and the sample rate.

Parameters
self
beats_per_bar
bpm
sample_rate
thread_check Whether to throw a warning if not called from GTK thread.

int engine_process_events(AudioEngine* self)

GSourceFunc to be added using idle add.

This will loop indefinintely.

void engine_process_prepare(AudioEngine* self, nframes_t nframes)

To be called by each implementation to prepare the structures before processing.

Clears buffers, marks all as unprocessed, etc.

int engine_process(AudioEngine* self, nframes_t nframes)

Processes current cycle.

To be called by each implementation in its callback.

void engine_set_buffer_size(AudioEngine* self, uint32_t buf_size)

Request the backend to set the buffer size.

The backend is expected to call the buffer size change callbacks.

@seealso jack_set_buffer_size().

ExportSettings* export_settings_default(void)

Returns an instance of default ExportSettings.

It must be free'd with export_settings_free().

void export_settings_set_bounce_defaults(ExportSettings* self, const char* filepath, const char* bounce_name)

Sets the defaults for bouncing.

Parameters
self
filepath Path to bounce to. If NULL, this will generate a temporary filepath.
bounce_name Name used for the file if filepath is NULL.

void* exporter_generic_export_thread(ExportSettings* info)

Generic export thread to be used for simple exporting.

See bounce_dialog for an example.

void exporter_create_audio_track_after_bounce(ExportSettings* settings, const Position* pos)

To be called to create and perform an undoable action for creating an audio track with the bounced material.

Parameters
settings
pos Position to place the audio region at.

const char* exporter_stringize_audio_format(AudioFormat format, bool extension)

Returns the audio format as string.

Parameters
format
extension Whether to return the extension for this format, or a human friendly label.

int exporter_export(ExportSettings* info)

Exports an audio file based on the given settings.

Returns Non-zero if fail.

void ext_port_connect(ExtPort* ext_port, Port* port, int src)

Exposes the given Port if not exposed and makes the connection from the Port to the ExtPort (eg in JACK) or backwards.

Parameters
ext_port
port
src 1 if the ext_port is the source, 0 if it is the destination.

void ext_port_disconnect(ExtPort* ext_port, Port* port, int src)

Disconnects the Port from the ExtPort.

Parameters
ext_port
port
src 1 if the ext_port is the source, 0 if it is the destination.

void ext_port_activate(ExtPort* self, Port* port, bool activate)

Activates the port (starts receiving data) or deactivates it.

Parameters
self
port Port to send the output to.
activate

bool ext_port_get_enabled(ExtPort* self)

Checks in the GSettings whether this port is marked as enabled by the user.

Returns Whether the port is enabled.

void ext_ports_get(PortType type, PortFlow flow, bool hw, ExtPort** ports, int* size)

Collects external ports of the given type.

Parameters
type
flow The signal flow. Note that this is inverse to what Zrythm sees. E.g., to get MIDI inputs like MIDI keyboards, pass FLOW_OUTPUT here.
hw Hardware or not.
ports An array of ExtPort pointers to fill in. The array should be preallocated.
size Size of the array to fill in.

double fade_get_y_normalized(double x, CurveOptions* opts, int fade_in)

Gets the normalized Y for a normalized X.

Parameters
x Normalized x.
opts
fade_in 1 for in, 0 for out.

Fader* fader_new(FaderType type, Channel* ch, bool passthrough)

Creates a new fader.

Parameters
type The FaderType.
ch Channel, if this is a channel Fader.
passthrough

This assumes that the channel has no plugins.

void fader_set_amp(void* self, float amp)

Sets the amplitude of the fader.

(0.0 to 2.0)

void fader_copy_values(Fader* src, Fader* dest)

Copy the fader values from source to dest.

Used when cloning channels.

void fader_process(Fader* self, long g_start_frames, nframes_t start_frame, const nframes_t nframes)

Process the Fader.

Parameters
self
g_start_frames Global frames.
start_frame The local offset in this cycle.
nframes The number of frames to process.

GraphNode* graph_create_node(Graph* graph, GraphNodeType type, void* data)

Creates a new node, adds it to the graph and returns it.

nframes_t graph_get_max_route_playback_latency(Graph* graph, bool use_setup_nodes)

Returns the max playback latency of the trigger nodes.

bool graph_validate_with_connection(Graph* self, const Port* src, const Port* dest)

Adds a new connection for the given src and dest ports and validates the graph.

Returns True if ok, false if invalid.

int graph_start(Graph* graph)

Starts as many threads as there are cores.

Returns 1 if graph started, 0 otherwise.

Graph* graph_new(Router* router)

Returns a new graph.

void graph_terminate(Graph* self)

Tell all threads to terminate.

void graph_free(Graph* self)

Frees the graph and its members.

void graph_export_as(Graph* graph, GraphExportType type, const char* path)

Exports the graph at the given path.

char* graph_node_get_name(GraphNode* node)

Returns a human friendly name of the node.

Must be free'd.

HOT void graph_node_process(GraphNode* node, nframes_t nframes)

Processes the GraphNode.

nframes_t graph_node_get_single_playback_latency(GraphNode* node)

Returns the latency of only the given port, without adding the previous/next latencies.

It returns the plugin's latency if plugin, otherwise 0.

void graph_node_set_route_playback_latency(GraphNode* node, nframes_t dest_latency)

Sets the playback latency of the given node recursively.

Parameters
node
dest_latency The total destination latency so far.

Used only when (re)creating the graph.

HOT void graph_node_trigger(GraphNode* self)

Called by an upstream node when it has completed processing.

GraphThread* graph_thread_new(const int id, const bool is_main, Graph* graph)

Creates a thread.

Parameters
id The index of the thread.
is_main 1 if main thread.
graph The graph to set to the thread.

ExtPort* hardware_processor_find_ext_port(HardwareProcessor* self, const char* id)

Finds an ext port from its ID (type + full name).

Port* hardware_processor_find_port(HardwareProcessor* self, const char* id)

Finds a port from its ID (type + full name).

int hardware_processor_setup(HardwareProcessor* self)

Sets up the ports but does not start them.

Returns Non-zero on fail.

void hardware_processor_activate(HardwareProcessor* self, bool activate)

Starts or stops the ports.

Parameters
self
activate True to activate, false to deactivate

void instrument_track_init(Track* track)

Initializes an instrument track.

int instrument_track_is_plugin_visible(Track* self)

Returns if the first plugin's UI in the instrument track is visible.

void instrument_track_toggle_plugin_visible(Track* self)

Toggles whether the first plugin's UI in the instrument Track is visible.

MarkerTrack* marker_track_default(int track_pos)

Creates the default marker track.

void marker_track_init(Track* track)

Inits the marker track.

void marker_track_insert_marker(MarkerTrack* self, Marker* marker, int pos)

Inserts a marker to the track.

void marker_track_add_marker(MarkerTrack* self, Marker* marker)

Adds a marker to the track.

void marker_track_clear(MarkerTrack* self)

Removes all objects from the marker track.

Mainly used in testing.

void marker_track_remove_marker(MarkerTrack* self, Marker* marker, int free)

Removes a marker, optionally freeing it.

Marker* marker_track_get_start_marker(const Track* track)

Returns the start marker.

Marker* marker_track_get_end_marker(const Track* track)

Returns the end marker.

void meter_get_value(Meter* self, AudioValueFormat format, float* val, float* max)

Get the current meter value.

This should only be called once in a draw cycle.

Metronome* metronome_new(void)

Initializes the Metronome by loading the samples into memory.

NONNULL void metronome_queue_events(AudioEngine* self, const nframes_t loffset, const nframes_t nframes)

Queues metronome events (if any) within the current processing cycle.

Parameters
self
loffset Local offset in this cycle.
nframes

const char* midi_get_cc_name(uint8_t cc)

Return the name of the given cc (0-127).

int midi_combine_bytes_to_int(midi_byte_t lsb, midi_byte_t msb)

Used for MIDI controls whose values are split between MSB/LSB.

Parameters
lsb First byte (pos 1).
msb Second byte (pos 2).

void midi_get_bytes_from_int(int val, midi_byte_t* lsb, midi_byte_t* msb)

Used for MIDI controls whose values are split between MSB/LSB.

Parameters
val
lsb First byte (pos 1).
msb Second byte (pos 2).

int midi_ctrl_change_get_ch_and_description(midi_byte_t* ctrl_change, char* buf)

Saves a string representation of the given control change event in the given buffer.

Returns The MIDI channel

void midi_panic_all(int queued)

Queues MIDI note off to event queues.

Parameters
queued Send the event to queues instead of main events.

int midi_get_msg_length(uint8_t status_byte)

Returns the length of the MIDI message based on the status byte.

void midi_events_init(MidiEvents* self)

Inits the MidiEvents struct.

MidiEvents* midi_events_new(Port* port)

Allocates and inits a MidiEvents struct.

Parameters
port Owner Port.

static void midi_event_copy(MidiEvent* dest, MidiEvent* src)

Copies the members from one MidiEvent to another.

void midi_events_sort_by_time(MidiEvents* self)

Sorts the MIDI events by time ascendingly.

void midi_events_append(MidiEvents* src, MidiEvents* dest, const nframes_t start_frame, const nframes_t nframes, bool queued)

Appends the events from src to dest.

Parameters
src
dest
start_frame The start frame offset from 0 in this cycle.
nframes Number of frames to process.
queued Append queued events instead of main events.

void midi_events_append_w_filter(MidiEvents* src, MidiEvents* dest, int* channels, const nframes_t start_frame, const nframes_t nframes, bool queued)

Appends the events from src to dest.

Parameters
src
dest
channels Allowed channels (array of 16 booleans).
start_frame The start frame offset from 0 in this cycle.
nframes Number of frames to process.
queued Append queued events instead of main events.

void midi_events_add_note_on(MidiEvents* self, midi_byte_t channel, midi_byte_t note_pitch, midi_byte_t velocity, midi_time_t time, int queued)

Adds a note on event to the given MidiEvents.

Parameters
self
channel MIDI channel starting from 1.
note_pitch
velocity
time
queued Add to queued events instead.

void midi_events_add_note_ons_from_chord_descr(MidiEvents* self, ChordDescriptor* descr, midi_byte_t channel, midi_byte_t velocity, midi_time_t time, bool queued)

Adds a note on for each note in the chord.

void midi_events_add_note_offs_from_chord_descr(MidiEvents* self, ChordDescriptor* descr, midi_byte_t channel, midi_time_t time, bool queued)

Adds a note off for each note in the chord.

void midi_events_add_cc_volume(MidiEvents* self, midi_byte_t channel, midi_byte_t volume, midi_time_t time, bool queued)

Add CC volume event.

TODO

int midi_events_has_note_on(MidiEvents* self, int check_main, int check_queued)

Returrns if the MidiEvents have any note on events.

Parameters
self
check_main Check the main events.
check_queued Check the queued events.

void midi_events_add_event_from_buf(MidiEvents* self, midi_time_t time, midi_byte_t* buf, int buf_size, int queued)

Parses a MidiEvent from a raw MIDI buffer.

This must be a full 3-byte message. If in 'running status' mode, the caller is responsible for prepending the status byte.

void midi_events_add_note_off(MidiEvents* self, midi_byte_t channel, midi_byte_t note_pitch, midi_time_t time, int queued)

Adds a note off event to the given MidiEvents.

Parameters
self
channel MIDI channel starting from 1.
note_pitch
time
queued Add to queued events instead.

void midi_events_add_control_change(MidiEvents* self, midi_byte_t channel, midi_byte_t controller, midi_byte_t control, midi_time_t time, int queued)

Adds a control event to the given MidiEvents.

Parameters
self
channel MIDI channel starting from 1.
controller
control
time
queued Add to queued events instead.

void midi_events_add_pitchbend(MidiEvents* self, midi_byte_t channel, int pitchbend, midi_time_t time, int queued)

Adds a control event to the given MidiEvents.

Parameters
self
channel MIDI channel starting from 1.
pitchbend -8192 to 8191
time
queued Add to queued events instead.

void midi_events_add_all_notes_off(MidiEvents* self, midi_byte_t channel, midi_time_t time, bool queued)

Queues MIDI note off to event queue.

void midi_events_clear(MidiEvents* midi_events, int queued)

Clears midi events.

Parameters
midi_events
queued Clear queued events instead.

void midi_events_clear_duplicates(MidiEvents* midi_events, const int queued)

Clears duplicates.

Parameters
midi_events
queued Clear duplicates from queued events instead.

void midi_events_dequeue(MidiEvents* midi_events)

Copies the queue contents to the original struct.

int midi_events_check_for_note_on(MidiEvents* midi_events, int note, int queued)

Returns if a note on event for the given note exists in the given events.

int midi_events_delete_note_on(MidiEvents* midi_events, int note, int queued)

Deletes the midi event with a note on signal from the queue, and returns if it deleted or not.

void midi_events_sort(MidiEvents* self, const bool queued)

Sorts the MidiEvents by time.

void midi_events_set_channel(MidiEvents* self, const int queued, const midi_byte_t channel)

Sets the given MIDI channel on all applicable MIDI events.

void midi_events_free(MidiEvents* self)

Frees the MIDI events.

bool midi_file_track_has_data(const char* abs_path, int track_idx)

Returns whether the given track in the midi file has data.

int midi_file_get_num_tracks(const char* abs_path, bool non_empty_only)

Returns the number of tracks in the MIDI file.

void midi_function_apply(ArrangerSelections* sel, MidiFunctionType type)

Applies the given action to the given selections.

Parameters
sel Selections to edit.
type Function type.

void midi_mappings_bind_at(MidiMappings* self, midi_byte_t* buf, ExtPort* device_port, Port* dest_port, int idx, bool fire_events)

Binds the CC represented by the given raw buffer (must be size 3) to the given Port.

Parameters
self
buf
device_port
dest_port
idx Index to insert at.
fire_events

void midi_mappings_unbind(MidiMappings* self, int idx, bool fire_events)

Unbinds the given binding.

MidiMapping** midi_mappings_get_for_port(MidiMappings* self, Port* dest_port, int* size)

Get MIDI mappings for the given port.

Parameters
self
dest_port
size Size to set.
Returns a newly allocated array that must be free'd with free().

void midi_note_get_global_start_pos(MidiNote* self, Position* pos)

Gets the global Position of the MidiNote's start_pos.

Parameters
self
pos Position to fill in.

void midi_note_get_val_as_string(MidiNote* self, char* buf, const int use_markup)

Gets the MIDI note's value as a string (eg "C#4").

Parameters
self
buf
use_markup Use markup to show the octave as a superscript.

void midi_note_listen(MidiNote* mn, int listen)

Listen to the given MidiNote.

Parameters
mn
listen Turn note on if 1, or turn it off if 0.

void midi_note_shift_pitch(MidiNote* self, const int delta)

Shifts MidiNote's position and/or value.

Parameters
self
delta Y (0-127)

void midi_note_notes_to_events(MidiNote** midi_notes, int num_notes, Position* pos, MidiEvents* events)

Converts an array of MIDI notes to MidiEvents.

Parameters
midi_notes Array of MidiNote's.
num_notes Number of notes in array.
pos Position to offset time from.
events Preallocated struct to fill.

ZRegion* midi_region_new(const Position* start_pos, const Position* end_pos, int track_pos, int lane_pos, int idx_inside_lane)

Creates a new ZRegion for MIDI notes.

ZRegion* midi_region_new_from_midi_file(const Position* start_pos, const char* abs_path, int track_pos, int lane_pos, int idx_inside_lane, int idx)

Creates a MIDI region from the given MIDI file path, starting at the given Position.

Parameters
start_pos
abs_path
track_pos
lane_pos
idx_inside_lane
idx The index of this track, starting from 0. This will be sequential, ie, if idx 1 is requested and the MIDI file only has tracks 5 and 7, it will use track 7.

ZRegion* midi_region_new_from_chord_descr(const Position* pos, ChordDescriptor* descr, int track_pos, int lane_pos, int idx_inside_lane)

Create a region from the chord descriptor.

Default size will be timeline snap and default notes size will be editor snap.

void midi_region_insert_midi_note(ZRegion* region, MidiNote* midi_note, int idx, int pub_events)

Inserts the MidiNote to the given ZRegion.

Parameters
region
midi_note
idx Index to insert at.
pub_events Publish UI events or not.

void midi_region_start_unended_note(ZRegion* self, Position* start_pos, Position* end_pos, int pitch, int vel, int pub_events)

Starts an unended note with the given pitch and velocity and adds it to ZRegion::midi_notes.

Parameters
self
start_pos
end_pos If this is NULL, it will be set to 1 tick after the start_pos.
pitch
vel
pub_events

MidiNote* midi_region_pop_unended_note(ZRegion* self, int pitch)

Returns the midi note with the given pitch from the unended notes.

Parameters
self
pitch The pitch. If -1, it returns any unended note. This is useful when the loop point is met and we want to end them all.

Used when recording.

REALTIME void midi_region_fill_midi_events(ZRegion* self, long g_start_frames, nframes_t local_start_frame, nframes_t nframes, bool note_off_at_end, MidiEvents* midi_events)

Fills MIDI event queue from the region.

Parameters
self
g_start_frames Global start frame.
local_start_frame The start frame offset from 0 in this cycle.
nframes Number of frames at start Position.
note_off_at_end Whether a note off should be added at the end frame (eg, when the caller knows there is a region loop or the region ends).
midi_events MidiEvents to fill (from Piano Roll Port for example).

The events are dequeued right after the call to this function.

void midi_region_print_midi_notes(ZRegion* self)

Prints the MidiNotes in the Region.

Used for debugging.

MidiNote* midi_region_get_first_midi_note(ZRegion* region)

Gets first midi note.

MidiNote* midi_region_get_last_midi_note(ZRegion* region)

Gets last midi note.

MidiNote* midi_region_get_highest_midi_note(ZRegion* region)

Gets highest midi note.

MidiNote* midi_region_get_lowest_midi_note(ZRegion* region)

Gets lowest midi note.

void midi_region_remove_midi_note(ZRegion* region, MidiNote* midi_note, int free, int pub_event)

Removes the MIDI note from the Region.

Parameters
region
midi_note
free Also free the MidiNote.
pub_event Publish an event.

void midi_region_remove_all_midi_notes(ZRegion* region)

Removes all MIDI ntoes and their components completely.

void midi_region_write_to_midi_file(ZRegion* self, MIDI_FILE* mf, const int add_region_start, bool export_full, bool use_track_pos)

Returns the midi note at given position with the given pitch.

Parameters
self
mf
add_region_start Add the region start offset to the positions.
export_full Traverse loops and export the MIDI file as it would be played inside Zrythm. If this is 0, only the original region (from true start to true end) is exported.
use_track_pos Whether to use the track position in the MIDI data. The track will be set to 1 if false.

Used when recording. Exports the ZRegion to an existing MIDI file instance.

void midi_region_export_to_midi_file(ZRegion* self, const char* full_path, int midi_version, const int export_full)

Exports the ZRegion to a specified MIDI file.

Parameters
self
full_path Absolute path to the MIDI file.
midi_version
export_full Traverse loops and export the MIDI file as it would be played inside Zrythm. If this is 0, only the original region (from true start to true end) is exported.

uint8_t midi_region_get_midi_ch(const ZRegion* self)

Returns the MIDI channel that this region should be played on, starting from 1.

MidiEvents* midi_region_get_as_events(ZRegion* self, const int add_region_start, const int full)

Returns a newly initialized MidiEvents with the contents of the region converted into events.

Parameters
self
add_region_start Add the region start offset to the positions.
full

Must be free'd with midi_events_free ().

void midi_region_free_members(ZRegion* self)

Frees members only but not the midi region itself.

Regions should be free'd using region_free.

REALTIME void midi_track_fill_midi_events(Track* track, const long g_start_frames, const nframes_t local_start_frame, nframes_t nframes, MidiEvents* midi_events)

Fills MIDI event queue from track.

Parameters
track
g_start_frames Global start frame.
local_start_frame The start frame offset from 0 in this cycle.
nframes Number of frames at start Position.
midi_events MidiEvents to fill (from Piano Roll Port for example).

The events are dequeued right after the call to this function.

Caveats:

  • This will not work properly if the loop sizes (region or transport) are smaller than nframes, so small sizes should not be allowed.

void midi_track_free(Track* track)

Frees the track.

TODO

void modulator_macro_processor_process(ModulatorMacroProcessor* self, long g_start_frames, nframes_t start_frame, const nframes_t nframes)

Process.

Parameters
self
g_start_frames Global frames.
start_frame The local offset in this cycle.
nframes The number of frames to process.

void modulator_track_insert_modulator(Track* self, int slot, Plugin* modulator, bool replace_mode, bool confirm, bool gen_automatables, bool recalc_graph, bool pub_events)

Inserts and connects a Modulator to the Track.

Parameters
self
slot
modulator
replace_mode Whether to perform the operation in replace mode (replace current modulator if true, not touching other modulators, or push other modulators forward if false).
confirm
gen_automatables
recalc_graph
pub_events

void modulator_track_remove_modulator(Track* self, int slot, bool replacing, bool deleting_modulator, bool deleting_track, bool recalc_graph)

Removes a plugin at pos from the track.

Parameters
self
slot
replacing Whether replacing the modulator. If this is false, modulators after this slot will be pushed back.
deleting_modulator
deleting_track If true, the automation tracks associated with the plugin are not deleted at this time.
recalc_graph Recalculate mixer graph.

Track* modulator_track_default(int track_pos)

Creates the default modulator track.

void modulator_track_init(Track* track)

Inits the modulator track.

int audio_pool_add_clip(AudioPool* self, AudioClip* clip)

Adds an audio clip to the pool.

Returns The ID in the pool.

Changes the name of the clip if another clip with the same name already exists.

int audio_pool_duplicate_clip(AudioPool* self, int clip_id, bool write_file)

Duplicates the clip with the given ID and returns the duplicate.

Parameters
self
clip_id
write_file Whether to also write the file.
Returns The ID in the pool.

void audio_pool_ensure_unique_clip_name(AudioPool* pool, AudioClip* clip)

Ensures that the name of the clip is unique.

The clip must not be part of the pool yet.

If the clip name is not unique, it will be replaced by a unique name.

void audio_pool_reload_clip_frame_bufs(AudioPool* self)

Loads the frame buffers of clips currently in use in the project from their files and frees the buffers of clips not currently in use.

This should be called whenever there is a relevant change in the project (eg, object added/removed).

void audio_pool_write_to_disk(AudioPool* self)

Writes all the clips to disk.

Used when saving a project elsewhere.

NONNULL void port_init_loaded(Port* self, bool is_project)

This function finds the Ports corresponding to the PortIdentifiers for srcs and dests.

Should be called after the ports are loaded from yml.

StereoPorts* stereo_ports_new_generic(int in, const char* name, PortOwnerType owner_type, void* owner)

Creates stereo ports for generic use.

Parameters
in 1 for in, 0 for out.
name
owner_type
owner Pointer to the owner. The type is determined by owner_type.

NONNULL void stereo_ports_connect(StereoPorts* src, StereoPorts* dest, int locked)

Connects the internal ports using port_connect().

Parameters
src
dest
locked Lock the connection.
Returns Non-zero if error.

const void* port_get_value_from_symbol(const char* port_sym, void* user_data, uint32_t* size, uint32_t* type)

Function to get a port's value from its string symbol.

Used when saving the LV2 state. This function MUST set size and type appropriately.

void port_get_all(Port*** ports, size_t* max_size, bool is_dynamic, int* size)

Gathers all ports in the project and puts them in the given array and size.

Parameters
ports
max_size Current array size, if dynamic.
is_dynamic Whether the array can be dynamically resized.
size Current array count.

void port_update_identifier(Port* self, Track* track, bool update_automation_track)

To be called when the port's identifier changes to update corresponding identifiers.

Parameters
self
track The track that owns this port.
update_automation_track Whether to update the identifier in the corresponding automation track as well. This should be false when moving a plugin.

NONNULL void port_set_expose_to_backend(Port* self, int expose)

Sets whether to expose the port to the backend and exposes it or removes it.

It checks what the backend is using the engine's audio backend or midi backend settings.

NONNULL void port_set_control_value(Port* self, const float val, const bool is_normalized, const bool forward_event)

Sets the given control value to the corresponding underlying structure in the Port.

Parameters
self
val
is_normalized Whether the given value is normalized between 0 and 1.
forward_event Whether to forward a port control change event to the plugin UI. Only applicable for plugin control ports. If the control is being changed manually or from within Zrythm, this should be true to notify the plugin of the change.

Note: this is only for setting the base values (eg when automating via an automation lane). For CV automations this should not be used.

NONNULL HOT float port_get_control_value(Port* self, const bool normalize)

Gets the given control value from the corresponding underlying structure in the Port.

Parameters
self
normalize Whether to get the value normalized or not.

NONNULL int port_connect(Port* src, Port* dest, const int locked)

Connets src to dest.

Parameters
src
dest
locked Lock the connection or not.

void port_update_track_pos(Port* port, Track* track, int pos)

Updates the track pos on a track port and all its source/destination identifiers.

Parameters
port
track The track that owns this port.
pos

static NONNULL void port_apply_fader(Port* port, float amp, nframes_t start_frame, const nframes_t nframes)

Apply given fader value to port.

Parameters
port
amp
start_frame The start frame offset from 0 in this cycle.
nframes The number of frames to process.

HOT NONNULL void port_process(Port* port, const long g_start_frames, const nframes_t start_frame, const nframes_t nframes, const bool noroll)

First sets port buf to 0, then sums the given port signal from its inputs.

Parameters
port
g_start_frames
start_frame The start frame offset from 0 in this cycle.
nframes The number of frames to process.
noroll Clear the port buffer in this range.

NONNULL void port_copy_metadata_from_project(Port* self, Port* project_port)

Copies the metadata from a project port to the given port.

Used when doing delete actions so that ports can be restored on undo.

NONNULL void port_restore_from_non_project(Port* self, Port* non_project)

Reverts the data on the corresponding project port for the given non-project port.

Parameters
self Project port.
non_project Non-project port.

This restores src/dest connections and the control value.

NONNULL void port_apply_pan(Port* port, float pan, PanLaw pan_law, PanAlgorithm pan_algo, nframes_t start_frame, const nframes_t nframes)

Applies the pan to the given port.

Parameters
port
pan
pan_law
pan_algo
start_frame The start frame offset from 0 in this cycle.
nframes The number of frames to process.

NONNULL void port_identifier_copy(PortIdentifier* dest, PortIdentifier* src)

Copy the identifier content from src to dest.

void position_snap(Position* start_pos, Position* pos, Track* track, ZRegion* region, const SnapGrid* sg)

Snaps position using given options.

Parameters
start_pos The previous position (ie, the position the drag started at. This is only used when the "keep offset" setting is on.
pos Position to edit.
track Track, used when moving things in the timeline. If keep offset is on and this is passed, the objects in the track will be taken into account. If keep offset is on and this is NULL, all applicable objects will be taken into account. Not used if keep offset is off.
region Region, used when moving things in the editor. Same behavior as track.
sg SnapGrid options.

void position_set_min_size(const Position* start_pos, Position* end_pos, SnapGrid* snap)

Sets the end position to be 1 snap point away from the start pos.

Parameters
start_pos Start Position.
end_pos End Position.
snap SnapGrid.

FIXME rename to something more meaningful.

void position_get_midway_pos(Position* start_pos, Position* end_pos, Position* pos)

Calculates the midway point between the two Positions and sets it on pos.

Parameters
start_pos
end_pos
pos Position to set to.

double position_get_ticks_diff(const Position* end_pos, const Position* start_pos, const SnapGrid* sg)

Returns the difference in ticks between the two Position's, snapped based on the given SnapGrid (if any).

Parameters
end_pos End position.
start_pos Start Position.
sg SnapGrid to snap with, or NULL to not snap.

NONNULL char* position_to_string_alloc(const Position* pos)

Creates a string in the form of "0.0.0.0" from the given position.

Must be free'd by caller.

NONNULL int position_get_total_bars(const Position* pos, bool include_current)

Returns the total number of beats.

Parameters
pos
include_current Whether to count the current beat if it is at the beat start.

NONNULL int position_get_total_beats(const Position* pos, bool include_current)

Returns the total number of beats.

Parameters
pos
include_current Whether to count the current beat if it is at the beat start.

NONNULL void position_change_sign(Position* pos)

Changes the sign of the position.

For example, 4.2.1.21 would become -4.2.1.21.

NONNULL int position_get_bars(const Position* pos, bool start_at_one)

Gets the bars of the position.

Parameters
pos
start_at_one Start at 1 or -1 instead of 0.

Ie, if the position is equivalent to 4.1.2.42, this will return 4.

NONNULL int position_get_beats(const Position* pos, bool start_at_one)

Gets the beats of the position.

Parameters
pos
start_at_one Start at 1 or -1 instead of 0.

Ie, if the position is equivalent to 4.1.2.42, this will return 1.

NONNULL int position_get_sixteenths(const Position* pos, bool start_at_one)

Gets the sixteenths of the position.

Parameters
pos
start_at_one Start at 1 or -1 instead of 0.

Ie, if the position is equivalent to 4.1.2.42, this will return 2.

NONNULL double position_get_ticks(const Position* pos)

Gets the ticks of the position.

Ie, if the position is equivalent to 4.1.2.42, this will return 42.

char* quantize_options_stringize(NoteLength note_length, NoteType note_type)

Returns the grid intensity as a human-readable string.

Must be free'd.

double quantize_options_quantize_position(QuantizeOptions* self, Position* pos)

Quantizes the given Position using the given QuantizeOptions.

Returns The amount of ticks moved (negative for backwards).

This assumes that the start/end check has been done already and it ignores the adjust_start and adjust_end options.

HOT void recording_manager_handle_recording(RecordingManager* self, TrackProcessor* track_processor, const long g_start_frames, const nframes_t local_offset, const nframes_t nframes)

Handles the recording logic inside the process cycle.

Parameters
self
track_processor
g_start_frames
local_offset
nframes Number of frames to process. If this is zero, a pause will be added. See RECORDING_EVENT_TYPE_PAUSE_TRACK_RECORDING and RECORDING_EVENT_TYPE_PAUSE_AUTOMATION_RECORDING.

The MidiEvents are already dequeued at this point.

int recording_manager_process_events(RecordingManager* self)

GSourceFunc to be added using idle add.

This will loop indefinintely.

It can also be called to process the events immediately. Should only be called from the GTK thread.

RecordingManager* recording_manager_new(void)

Creates the event queue and starts the event loop.

Must be called from a GTK thread.

void region_set_link_group(ZRegion* region, int group_idx, bool update_identifier)

Sets the link group to the region.

Parameters
region
group_idx If -1, the region will be removed from its current link group, if any.
update_identifier

MidiNote* region_find_midi_note(ZRegion* r, MidiNote* _mn)

Returns the MidiNote matching the properties of the given MidiNote.

Used to find the actual MidiNote in the region from a cloned MidiNote (e.g. when doing/undoing).

long region_timeline_frames_to_local(ZRegion* self, const long timeline_frames, const bool normalize)

Converts frames on the timeline (global) to local frames (in the clip).

Parameters
self
timeline_frames Timeline position in frames.
normalize
Returns The local frames.

If normalize is 1 it will only return a position from 0 to loop_end (it will traverse the loops to find the appropriate position), otherwise it may exceed loop_end.

void region_get_frames_till_next_loop_or_end(ZRegion* self, long timeline_frames, long* ret_frames, bool* is_loop)

Returns the number of frames until the next loop end point or the end of the region.

Parameters
self
timeline_frames in Global frames at start.
ret_frames out Return frames.
is_loop out Whether the return frames are for a loop (if false, the return frames are for the region's end).

void region_stretch(ZRegion* self, double ratio)

Stretch the region's contents.

Parameters
self
ratio The ratio to stretch by.

This should be called right after changing the region's size.

void region_move_to_lane(ZRegion* region, TrackLane* lane, int index_in_lane)

Moves the given ZRegion to the given TrackLane.

Parameters
region
lane
index_in_lane Index in lane in the new track to insert the region to, or -1 to append.

Works with TrackLane's of other Track's as well.

Maintains the selection status of the Region.

Assumes that the ZRegion is already in a TrackLane.

void region_move_to_track(ZRegion* region, Track* track, int index_in_lane)

Moves the ZRegion to the given Track, maintaining the selection status of the ZRegion and the TrackLane position.

Parameters
region
track
index_in_lane Index in lane in the new track to insert the region to, or -1 to append.

Assumes that the ZRegion is already in a TrackLane.

void region_copy(ZRegion* src, ZRegion* dest)

Copies the data from src to dest.

Used when doing/undoing changes in name, clip start point, loop start point, etc.

int region_is_hit(const ZRegion* region, const long gframes, const int inclusive)

Returns if the position is inside the region or not.

Parameters
region
gframes Global position in frames.
inclusive Whether the last frame should be counted as part of the region.

FIXME move to arranger object

int region_is_hit_by_range(const ZRegion* region, const long gframes_start, const long gframes_end, const bool end_inclusive)

Returns if any part of the ZRegion is inside the given range, inclusive.

FIXME move to arranger object

ZRegion* region_at_position(Track* track, AutomationTrack* at, Position* pos)

Returns the region at the given position in the given Track.

Parameters
track The track to look in, if at is NULL.
at The automation track to look in.
pos The position.

char* region_generate_filename(ZRegion* region)

Generates the filename for this region.

MUST be free'd.

bool region_get_musical_mode(ZRegion* self)

Returns whether the region is effectively in musical mode.

bool region_validate(ZRegion* self, bool is_project)

Sanity checking.

Parameters
self
is_project Whether this region ispart of the project (as opposed to a clone in the undo stack, etc.).

void region_disconnect(ZRegion* self)

Disconnects the region and anything using it.

Does not free the ZRegion or its children's resources.

NONNULL void region_link_group_remove_region(RegionLinkGroup* self, ZRegion* region, bool autoremove_last_region_and_group, bool update_identifier)

Remove the region from the link group.

Parameters
self
region
autoremove_last_region_and_group Automatically remove the last region left in the group, and the group itself when empty.
update_identifier

NONNULL void region_link_group_update(RegionLinkGroup* self, ZRegion* region)

Updates all other regions in the link group.

Parameters
self
region The region where the change happened.

void router_recalc_graph(Router* self, bool soft)

Recalculates the process acyclic directed graph.

Parameters
self
soft If true, only readjusts latencies.

void router_start_cycle(Router* self, const nframes_t nsamples, const nframes_t local_offset, const Position* pos)

Starts a new cycle.

Parameters
self
nsamples
local_offset The local offset to start playing from in this cycle: (0 - <engine buffer size>)
pos

nframes_t router_get_max_route_playback_latency(Router* router)

Returns the max playback latency of the trigger nodes.

bool router_is_processing_thread(Router* router)

Returns if the current thread is a processing thread.

void sample_playback_init(SamplePlayback* self, sample_t** buf, long buf_size, channels_t channels, float vol, nframes_t start_offset)

Initializes a SamplePlayback with a sample to play back.

void sample_processor_process(SampleProcessor* self, const nframes_t offset, const nframes_t nframes)

Process the samples for the given number of frames.

Parameters
self
offset The local offset in the processing cycle.
nframes

char* musical_scale_to_string(MusicalScale* scale)

Prints the MusicalScale to a string.

MUST be free'd.

int musical_scale_is_key_in_scale(MusicalScale* scale, MusicalNote key)

Returns if the given key is in the given MusicalScale.

Parameters
scale
key A note inside a single octave (0-11).

char* musical_scale_as_string(MusicalScale* scale)

Returns the scale in human readable string.

MUST be free'd by caller.

char* snap_grid_stringize(NoteLength note_length, NoteType note_type)

Returns the grid intensity as a human-readable string.

Must be free'd.

Position* snap_grid_get_nearby_snap_point(SnapGrid* self, const Position* pos, const int return_prev)

Returns the next or previous SnapGrid point.

Parameters
self Snap grid to search in.
pos Position to search for.
return_prev 1 to return the previous element or 0 to return the next.

Must not be free'd.

Stretcher* stretcher_new_rubberband(unsigned int samplerate, unsigned int channels, double time_ratio, double pitch_ratio, bool realtime)

Create a new Stretcher using the rubberband backend.

Parameters
samplerate The new samplerate.
channels
time_ratio The ratio to multiply time by (eg if the BPM is doubled, this will be 0.5).
pitch_ratio The ratio to pitch by. This will normally be 1.0 when time-stretching).
realtime Whether to perform realtime stretching (lower quality but fast enough to be used real-time).

ssize_t stretcher_stretch(Stretcher* self, float* in_samples_l, float* in_samples_r, size_t in_samples_size, float* out_samples_l, float* out_samples_r, size_t out_samples_wanted)

Perform stretching.

Parameters
self
in_samples_l The left samples.
in_samples_r The right channel samples. If this is NULL, the audio is assumed to be mono.
in_samples_size The number of input samples per channel.
out_samples_l
out_samples_r
out_samples_wanted
Returns The number of output samples generated per channel.

unsigned int stretcher_get_latency(Stretcher* self)

Get latency in number of samples.

ssize_t stretcher_stretch_interleaved(Stretcher* self, float* in_samples, size_t in_samples_size, float** _out_samples)

Perform stretching.

Parameters
self
in_samples
in_samples_size The number of input samples per channel.
_out_samples
Returns The number of output samples generated per channel.

void stretcher_free(Stretcher* self)

Frees the resampler.

Track* tempo_track_default(int track_pos)

Creates the default tempo track.

void tempo_track_init(Track* track)

Inits the tempo track.

void tempo_track_clear(Track* self)

Removes all objects from the tempo track.

Mainly used in testing.

bpm_t tempo_track_get_bpm_at_pos(Track* track, Position* pos)

Returns the BPM at the given pos.

bpm_t tempo_track_get_current_bpm(Track* self)

Returns the current BPM.

void tempo_track_set_bpm(Track* self, bpm_t bpm, bpm_t start_bpm, bool temporary, bool fire_events)

Sets the BPM.

Parameters
self
bpm
start_bpm The BPM at the start of the action, if not temporary.
temporary
fire_events

void tempo_track_set_beats_per_bar(Track* self, int beats_per_bar)

Updates beat unit and anything depending on it.

void track_init(Track* self, const int add_lane)

Inits the Track, optionally adding a single lane.

Parameters
self
add_lane Add a lane. This should be used for new Tracks. When cloning, the lanes should be cloned so this should be 0.

Track* track_new(TrackType type, int pos, const char* label, const int with_lane)

Creates a track with the given label and returns it.

Parameters
type
pos Position in the Tracklist.
label
with_lane Init the Track with a lane.

If the TrackType is one that needs a Channel, then a Channel is also created for the track.

Track* track_clone(Track* track, bool src_is_project)

Clones the track and returns the clone.

@bool src_is_project Whether track is a project track.

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.

Parameters
self
listen
trigger_undo Create and perform an undoable action.
auto_select Makes this track the only selection in the tracklist. Useful when listening to a single track.
fire_events Fire UI events.

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.

Parameters
self
solo
trigger_undo Create and perform an undoable action.
auto_select Makes this track the only selection in the tracklist. Useful when soloing a single track.
fire_events Fire UI events.

void track_add_region(Track* track, ZRegion* region, AutomationTrack* at, int lane_pos, int gen_name, int fire_events)

Adds a ZRegion to the given lane or AutomationTrack of the track.

Parameters
track
region
at The AutomationTrack of this ZRegion, if automation region.
lane_pos The position of the lane to add to, if applicable.
gen_name Generate a unique region name or not. This will be 0 if the caller already generated a unique name.
fire_events

The ZRegion must be the main region (see ArrangerObjectInfo).

void track_insert_region(Track* track, ZRegion* region, AutomationTrack* at, int lane_pos, int idx, int gen_name, int fire_events)

Inserts a ZRegion to the given lane or AutomationTrack of the track, at the given index.

Parameters
track
region
at The AutomationTrack of this ZRegion, if automation region.
lane_pos The position of the lane to add to, if applicable.
idx The index to insert the region at inside its parent, or -1 to append.
gen_name Generate a unique region name or not. This will be 0 if the caller already generated a unique name.
fire_events

The ZRegion must be the main region (see ArrangerObjectInfo).

NONNULL void track_select(Track* self, bool select, bool exclusive, bool fire_events)

Appends the Track to the selections.

Parameters
self
select
exclusive Select only this track.
fire_events Fire events to update the UI.

NONNULL void track_remove_region(Track* self, ZRegion* region, bool fire_events, bool free)

Only removes the region from the track.

@pararm free Also free the Region.

void track_fill_events(Track* track, const long g_start_frames, const nframes_t local_start_frame, nframes_t nframes, MidiEvents* midi_events, StereoPorts* stereo_ports)

Wrapper for audio and MIDI/instrument tracks to fill in MidiEvents or StereoPorts from the timeline data.

Parameters
track
g_start_frames
local_start_frame The start frame offset from 0 in this cycle.
nframes Number of frames at start Position.
midi_events MidiEvents to fill (from Piano Roll Port for example).
stereo_ports StereoPorts to fill.

bool track_validate(Track* self)

Verifies the identifiers on a live Track (in the project, not a clone).

Returns True if pass.

ZRegion* track_get_region_at_pos(const Track* track, const Position* pos, bool include_region_end)

Returns the region at the given position, or NULL.

Parameters
track
pos
include_region_end Whether to include the region's end in the calculation.

void track_generate_automation_tracks(Track* track)

Generates automatables for the track.

Should be called as soon as the track is created.

void track_update_children(Track* self)

Updates the track's children.

Used when changing track positions.

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.

Parameters
track
start_pos
end_pos
velocities
num_velocities
velocities_size
inside Whether to find velocities inside the range (1) or outside (0).

void track_set_name(Track* track, const char* _name, bool pub_events)

Setter for the track name.

If a track with that name already exists, it adds a number at the end.

Must only be called from the GTK thread.

Track* track_get_from_name(const char* name)

Returns the Track from the Project matching name.

Parameters
name Name to search for.

Fader* track_get_fader(Track* track, bool post_fader)

Returns the Fader (if applicable).

Parameters
track
post_fader True to get post fader, false to get pre fader.

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.

Returns The number of regions returned.

void track_comment_setter(void* track, const char* comment)

Comment setter.

void track_set_comment(Track* self, const char* comment, bool undoable)

Parameters
self
comment
undoable Create an undable action.

Plugin* track_get_plugin_at_slot(Track* track, PluginSlotType slot_type, int slot)

Returns the plugin at the given slot, if any.

Parameters
track
slot_type
slot The slot (ignored if instrument is selected.

void track_mark_for_bounce(Track* self, bool bounce, bool mark_regions, bool mark_children, bool mark_parents)

Marks the track for bouncing.

Parameters
self
bounce
mark_regions
mark_children Whether to mark all children tracks as well. Used when exporting stems on the specific track stem only.
mark_parents Whether to mark all parent tracks as well.

void track_append_all_ports(Track* self, Port*** ports, int* size, bool is_dynamic, size_t* max_size, bool include_plugins)

Appends all channel ports and optionally plugin ports to the array.

Parameters
self
ports
size Current array count.
is_dynamic Whether the array can be dynamically resized.
max_size Current array size, if dynamic.
include_plugins

void track_freeze(Track* self, bool freeze)

Freezes or unfreezes the track.

When a track is frozen, it is bounced with effects to a temporary file in the pool, which is played back directly from disk.

When the track is unfrozen, this file will be removed from the pool and the track will be played normally again.

void track_disconnect(Track* self, bool remove_pl, bool recalc_graph)

Disconnects the track from the processing chain.

Parameters
self
remove_pl Remove the Plugin from the Channel. Useful when deleting the channel.
recalc_graph Recalculate mixer graph.

This should be called immediately when the track is getting deleted, and track_free should be designed to be called later after an arbitrary delay.

TrackLane* track_lane_new(Track* track, int pos)

Creates a new TrackLane at the given pos in the given Track.

Parameters
track The Track to create the TrackLane for.
pos The position (index) in the Track that this lane will be placed in.

TrackLane* track_lane_clone(TrackLane* lane)

Clones the TrackLane.

Mainly used when cloning Track's.

HOT void track_processor_process(TrackProcessor* self, const long g_start_frames, const nframes_t local_offset, const nframes_t nframes)

Process the TrackProcessor.

Parameters
self
g_start_frames The global start frames.
local_offset The local start frames.
nframes The number of frames to process.

void track_processor_disconnect_from_prefader(TrackProcessor* self)

Disconnect the TrackProcessor's stereo out ports from the prefader.

Used when there is no plugin in the channel.

void track_processor_connect_to_prefader(TrackProcessor* self)

Connects the TrackProcessor's stereo out ports to the Channel's prefader in ports.

Used when deleting the only plugin left.

NONNULL void tracklist_select_all(Tracklist* self, bool select, bool fire_events)

Selects or deselects all tracks.

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.

Parameters
self
track
pos
publish_events Publish UI events.
recalc_graph Recalculate routing graph.

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.

Parameters
self
track
rm_pl Remove plugins or not.
free_track
publish_events Push a track deleted event to the UI.
recalc_graph Recalculate the mixer graph.

Also disconnects the channel.

void tracklist_move_track(Tracklist* self, Track* track, int pos, int publish_events, int recalc_graph)

Moves a track from its current position to the position given by pos.

Parameters
self
track
pos
publish_events Push UI update events or not.
recalc_graph Recalculate routing graph.

Track* tracklist_get_first_visible_track(Tracklist* self, const int pinned)

Returns the first visible Track.

Parameters
self
pinned 1 to check the pinned tracklist, 0 to check the non-pinned tracklist.

int tracklist_get_last_pos(Tracklist* self, const TracklistPinOption pin_opt, const bool visible_only)

Returns the index of the last Track.

Parameters
self
pin_opt Pin option.
visible_only Only consider visible Track's.

Track* tracklist_get_last_track(Tracklist* self, const TracklistPinOption pin_opt, const int visible_only)

Returns the last Track.

Parameters
self
pin_opt Pin option.
visible_only Only consider visible Track's.

Track* tracklist_get_visible_track_after_delta(Tracklist* self, Track* track, int delta)

Returns the Track after delta visible Track's.

Negative delta searches backwards.

This function searches tracks only in the same Tracklist as the given one (ie, pinned or not).

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).

The caller is responsible for checking that both tracks are in the same tracklist (ie, pinned or not).

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.

Parameters
self
multiplier
visible_only Only apply to visible tracks.
check_only
fire_events

void tracklist_handle_file_drop(Tracklist* self, char** uri_list, SupportedFile* orig_file, Track* track, TrackLane* lane, Position* pos, bool perform_actions)

Handles a file drop inside the timeline or in empty space in the tracklist.

Parameters
self
uri_list URI list, if URI list was dropped.
orig_file
track Track, if any.
lane TrackLane, if any.
pos Position the file was dropped at, if inside track.
perform_actions Whether to perform undoable actions in addition to creating the regions/tracks.

int tracklist_track_name_is_unique(Tracklist* self, const char* name, Track* track_to_skip)

Returns 1 if the track name is not taken.

Parameters
self
name
track_to_skip Track to skip when searching.

int tracklist_get_num_visible_tracks(Tracklist* self, int visible)

Parameters
self
visible 1 for visible, 0 for invisible.

void tracklist_activate_all_plugins(Tracklist* self, bool activate)

Activate or deactivate all plugins.

This is useful for exporting: deactivating and reactivating a plugin will reset its state.

void tracklist_expose_ports_to_backend(Tracklist* self)

Exposes each track's ports that should be exposed to the backend.

This should be called after setting up the engine.

Transport* transport_clone(Transport* self)

Clones the transport values.

void transport_stretch_audio_regions(Transport* self, TimelineSelections* sel, bool with_fixed_ratio, double time_ratio)

Stretches audio regions.

Parameters
self
sel
with_fixed_ratio Stretch all regions with a fixed ratio. If this is off, the current region length and ZRegion::before_length will be used to calculate the ratio.
time_ratio

void transport_move_playhead(Transport* self, Position* target, bool panic, bool set_cue_point, bool fire_events)

Moves playhead to given pos.

Parameters
self
target Position to set to.
panic Send MIDI panic or not.
set_cue_point Also set the cue point at this position.
fire_events

This is only for moves other than while playing and for looping while playing.

void velocity_set_val(Velocity* self, const int val)

Sets the velocity to the given value.

The given value may exceed the bounds 0-127, and will be clamped.

Variable documentation

bool visible

Whether visible or not.

Being created is a precondition for this.

bool recording_start_sent

This is a flag to let the recording manager know that a START signal was already sent for recording.

This is because AutomationTrack::recording_region takes a cycle or 2 to become non-NULL.

bool recording_paused

This must only be set by the RecordingManager when temporarily pausing recording, eg when looping or leaving the punch range.

See RECORDING_EVENT_TYPE_PAUSE_AUTOMATION_RECORDING.

Port* port

Port associated with this meter.

TruePeakDsp* true_peak_processor

True peak processor.

float true_peak

Current true peak.

KMeterDsp* kmeter_processor

K RMS processor, if K meter.

MeterAlgorithm algorithm

Algorithm to use.

Auto by default.

float prev_max

Previous max, used when holding the max value.

float last_amp

Last meter value (in amplitude), used to show a falloff and avoid sudden dips.

gint64 last_draw_time

Time the last val was taken at (last draw time).

Define documentation

#define chord_track_get_chord_at_playhead(ct)

Returns the current chord.

#define chord_track_get_scale_at_playhead(ct)

Returns the current scale.

#define EXT_PORTS_MAX

Maximum external ports.

Used for fixed-size arrays.

#define MAX_MIDI_EVENTS

Max events to hold in queues.

#define midi_region_add_midi_note(region, midi_note, pub_events)

Adds the MidiNote to the given ZRegion.

Parameters
region
midi_note
pub_events Publish UI events or not.

#define PORT_NOT_OWNED

Special ID for owner_pl, owner_ch, etc.

to indicate that the port is not owned.

#define position_compare(p1, p2)

Compares 2 positions based on their frames.

negative = p1 is earlier 0 = equal positive = p2 is earlier

#define position_compare_ticks(p1, p2)

Compares 2 positions based on their total ticks.

negative = p1 is earlier 0 = equal positive = p2 is earlier

#define position_init(__pos)

Initializes given position.

Assumes the given argument is a Pointer *.

#define position_set_to_pos(_pos, _target)

Sets position to target position.

Assumes each position is Position *.

#define RECORDING_EVENTS_PUSH_AUDIO(et, _arg)

Push events.

#define recording_event_init(re)

Inits an already allocated recording event.