Audio module

DSP and audio related code.

Classes

struct AutomationPoint
An automation point inside an AutomationTrack.
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 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 AudioPool
An audio pool is a pool of audio files and their corresponding float arrays in memory that are referenced by regions.
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 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, 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 }
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 }
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_PREFADER, PORT_OWNER_TYPE_MONITOR_FADER, PORT_OWNER_TYPE_TRACK_PROCESSOR, PORT_OWNER_TYPE_SAMPLE_PROCESSOR, PORT_OWNER_TYPE_HW }
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_TIME_SIG = 1 << 23, PORT_FLAG_GENERIC_PLUGIN_PORT = 1 << 24, PORT_FLAG_PLUGIN_GAIN = 1 << 25, PORT_FLAG_TP_MONO = 1 << 26, PORT_FLAG_TP_INPUT_GAIN = 1 << 27, PORT_FLAG_HW = 1 << 28 }
Port flags.
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 StretcherBackend { STRETCHER_BACKEND_RUBBERBAND, STRETCHER_BACKEND_PAULSTRETCH, STRETCHER_BACKEND_SBSMS }
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 TrackProcessorMidiAutomatable { MIDI_AUTOMATABLE_MOD_WHEEL, MIDI_AUTOMATABLE_PITCH_BEND, NUM_MIDI_AUTOMATABLES }
Automatable MIDI signals.
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 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 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 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 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 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 Stretcher = struct Stretcher
Stretcher interface.
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 TrackProcessorMidiAutomatable = enum TrackProcessorMidiAutomatable
Automatable MIDI signals.
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_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.
void audio_region_init_frame_caches(AudioRegion* self, AudioClip* clip)
Allocates the frame caches from the frames in the clip.
void audio_region_update_channel_caches(ZRegion* self, AudioClip* clip)
Updates the region's channel caches from the region's frames.
auto audio_region_get_clip(const ZRegion* self) -> AudioClip*
Returns the audio clip associated with the Region.
void audio_region_free_members(ZRegion* self)
Frees members only but not the audio region itself.
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)
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) -> 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) -> AutomationPoint*
Returns the AutomationPoint after the given one.
void automation_region_remove_ap(ZRegion* self, AutomationPoint* ap, 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.
void automation_region_free_members(ZRegion* self)
Frees members only but not the ZRegion itself.
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.
void channel_handle_recording(Channel* self, const long g_frames_start, const nframes_t nframes)
Handles the recording logic inside the process cycle.
void channel_append_all_ports(Channel* ch, Port*** ports, int* size, bool is_dynamic, int* max_size, bool include_plugins)
Appends all channel ports and optionally plugin ports to the array.
void channel_expose_ports_to_backend(Channel* ch)
Exposes the channel's ports to the backend.
void channel_connect(Channel* ch)
Connects the channel's ports.
void channel_add_balance_control(void* _channel, float pan)
Adds to (or subtracts from) the pan.
void channel_reset_fader(Channel* channel)
Sets fader to 0.0.
void channel_prepare_process(Channel* channel)
Prepares the channel for processing.
auto channel_new(Track* track) -> Channel*
Creates a channel of the given type with the given label.
void channel_process(Channel* channel)
The process function prototype.
auto channel_add_plugin(Channel* channel, PluginSlotType slot_type, int pos, Plugin* plugin, bool confirm, bool gen_automatables, bool recalc_graph, bool pub_events) -> int
Adds given plugin to given position in the strip.
void channel_reconnect_ext_input_ports(Channel* ch)
Called when the input has changed for Midi, Instrument or Audio tracks.
void channel_reattach_midi_editor_manual_press_port(Channel* channel, int connect, const int recalc_graph)
Connects or disconnects the MIDI editor key press port to the channel's first plugin.
auto channel_get_automation_track(Channel* channel, PortFlags type) -> AutomationTrack*
Convenience function to get the automation track of the given type for the channel.
void channel_remove_plugin(Channel* channel, PluginSlotType slot_type, int slot, bool deleting_plugin, bool deleting_channel, bool recalc_graph)
Removes a plugin at pos from the channel.
void channel_update_track_pos(Channel* self, int pos)
Updates the track position in the channel and all related ports and identifiers.
auto channel_get_mono_compat_enabled(Channel* self) -> bool
Gets whether mono compatibility is enabled.
void channel_set_mono_compat_enabled(Channel* self, bool enabled, bool fire_events)
Sets whether mono compatibility is enabled.
auto channel_clone(Channel* ch, Track* track, bool src_is_project) -> Channel*
Clones the channel recursively.
void channel_disconnect(Channel* channel, bool remove_pl)
Disconnects the channel from the processing chain.
void channel_free(Channel* channel)
Frees the channel.
void channel_send_init(ChannelSend* self, int track_pos, int slot)
Inits a channel send.
auto channel_send_get_track(ChannelSend* self) -> Track*
Gets the owner track.
auto channel_send_get_target_track(ChannelSend* self) -> Track*
Gets the target track.
auto channel_send_get_amount_for_widgets(ChannelSend* self) -> float
Gets the amount to be used in widgets (0.0-1.0).
void channel_send_set_amount_from_widget(ChannelSend* self, float val)
Sets the amount from a widget amount (0.0-1.0).
void channel_send_connect_stereo(ChannelSend* self, StereoPorts* stereo, Port* l, Port* r)
Connects a send to stereo ports.
void channel_send_connect_midi(ChannelSend* self, Port* port)
Connects a send to a midi port.
void channel_send_disconnect(ChannelSend* self)
Removes the connection at the given send.
void channel_send_get_dest_name(ChannelSend* self, char* buf)
Get the name of the destination.
auto channel_send_find(ChannelSend* self) -> 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) -> ZRegion*
Creates a new ZRegion for chords.
void chord_region_add_chord_object(ZRegion* self, ChordObject* chord, bool fire_events)
Adds a ChordObject to the Region.
void chord_region_remove_chord_object(ZRegion* self, ChordObject* chord, int free, bool fire_events)
Removes a ChordObject from the Region.
void chord_region_free_members(ZRegion* self)
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_add_scale(ChordTrack* track, ScaleObject* chord)
Adds a ChordObject to the Track.
void chord_track_remove_scale(ChordTrack* self, ScaleObject* scale, bool free)
Removes a scale 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.
void audio_clip_init_loaded(AudioClip* self)
Inits after loading a Project.
auto audio_clip_new_from_file(const char* full_path) -> 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.
void audio_clip_write_to_file(const AudioClip* self, const char* filepath)
Writes the given audio clip data to a file.
void audio_clip_write_to_pool(const AudioClip* self)
Writes the clip to the pool as a wav file.
void audio_clip_free(AudioClip* self)
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.
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) -> 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, const int 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_setup(AudioEngine* self)
Set up the audio engine, ie, connect to the backend but does not start processing yet.
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 float bpm, const sample_rate_t sample_rate)
Updates frames per tick based on the time sig, the BPM, and the sample rate.
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.
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) -> 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.) is soloed.
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, nframes_t local_offset, 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.
void graph_node_process(GraphNode* node, const nframes_t nframes)
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.
void graph_node_trigger(GraphNode* self)
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(Marker* marker, Track* track)
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_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.
void metronome_queue_events(AudioEngine* self, const nframes_t loffset, const nframes_t nframes)
Queues metronome events (if any) within the current processing cycle.
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* src, MidiEvent* dest)
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_byte_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_byte_t time, bool queued)
Adds a note off for each note in the chord.
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, uint32_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, uint32_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_panic(MidiEvents* self, int 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 int 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_get_num_tracks(const char* abs_path) -> 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.
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_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.
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 port_init_loaded(Port* self, bool is_project)
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) -> Port*
Creates port.
auto stereo_ports_new_from_existing(Port* l, Port* r) -> 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.
void stereo_ports_connect(StereoPorts* src, StereoPorts* dest, int locked)
Connects the internal ports using port_connect().
void port_get_full_designation(Port* self, char* buf)
Copies a full designation of self in the format "Track/Port" or "Track/Plugin/Port" in buf.
void port_get_all(Port*** ports, int* 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)
To be called when the port's identifier changes to update corresponding identifiers.
static auto port_get_dest_index(Port* self, Port* dest) -> int
Returns the index of the destination in the dest array.
static auto port_get_src_index(Port* self, Port* src) -> int
Returns the index of the source in the source array.
static void port_set_multiplier_by_index(Port* port, int idx, float val)
Set the multiplier for a destination by its index in the dest array.
static void port_set_src_multiplier_by_index(Port* port, int idx, float val)
Set the multiplier for a destination by its index in the dest array.
static auto port_get_multiplier_by_index(Port* port, int idx) -> float
Get the multiplier for a destination by its index in the dest array.
void port_disconnect_hw_inputs(Port* self)
Disconnects all hardware inputs from the port.
void port_free(Port* port)
Deletes port, doing required cleanup and updating counters.
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.
auto port_is_exposed_to_backend(const Port* self) -> int
Returns if the port is exposed to the backend.
void port_rename_backend(Port* self)
Renames the port on the backend side.
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.
auto port_get_control_value(Port* self, const bool normalize) -> float
Gets the given control value from the corresponding underlying structure in the Port.
auto port_connect(Port* src, Port* dest, const int locked) -> int
Connets src to dest.
auto port_disconnect(Port* src, Port* dest) -> int
Disconnects src from dest.
static auto port_disconnect_dests(Port* src) -> int
Disconnects dests of port.
auto port_get_num_unlocked_srcs(Port* port) -> int
Returns the number of unlocked (user-editable) sources.
auto port_get_num_unlocked_dests(Port* port) -> 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 void port_apply_fader(Port* port, float amp, nframes_t start_frame, const nframes_t nframes)
Apply given fader value to port.
void port_sum_signal_from_inputs(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.
void port_set_owner_track(Port* port, Track* track)
Sets the owner track & its ID.
void port_set_owner_track_from_channel(Port* port, Channel* ch)
Sets the owner track & its ID.
void port_set_owner_track_processor(Port* port, TrackProcessor* track_processor)
Sets the owner track & its ID.
void port_set_owner_sample_processor(Port* port, SampleProcessor* sample_processor)
Sets the owner sample processor.
void port_set_owner_fader(Port* port, Fader* fader)
Sets the owner fader & its ID.
void port_set_owner_plugin(Port* port, Plugin* pl)
Sets the owner plugin & its ID.
auto port_is_connection_locked(Port* src, Port* dest) -> int
Returns if the connection from src to dest is locked or not.
auto ports_connected(Port* src, Port* dest) -> bool
Returns if the two ports are connected or not.
auto ports_can_be_connected(const Port* src, const Port* dest) -> bool
Returns whether the Port's can be connected (if the connection will be valid and won't break the acyclicity of the graph).
void ports_disconnect(Port** ports, int num_ports, int deleting)
Disconnects all the given ports.
auto ports_remove(Port** ports, int* num_ports) -> int
Removes all the given ports from the project, optionally freeing them.
void port_print_connections_all(void)
Prints all connections.
void port_clear_buffer(Port* port)
Clears the port buffer.
auto port_disconnect_all(Port* port) -> int
Disconnects all srcs and dests from port.
void port_verify_src_and_dests(Port* self)
Verifies that the srcs and dests are correct for project ports.
void port_apply_pan_stereo(Port* l, Port* r, float pan, PanLaw pan_law, PanAlgorithm pan_algo)
Applies the pan to the given L/R ports.
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.
auto port_identifier_is_equal(PortIdentifier* src, PortIdentifier* dest) -> bool
Returns if the 2 PortIdentifier's are equal.
void position_set_to_bar(Position* position, int bar_no)
Sets position to given bar.
void position_set_tick(Position* position, double tick)
Sets the tick of the Position.
void position_sort_array(Position* array, const size_t size)
Sorts an array of Position's.
void position_add_frames(Position* pos, const long frames)
Adds the frames to the position and updates the rest of the fields, and makes sure the frames are still accurate.
auto position_to_frames(const Position* position) -> long
Converts position bars/beats/quarter beats/ticks to frames.
void position_from_seconds(Position* position, double secs)
Converts seconds to position and puts the result in the given Position.
auto position_to_ms(const Position* pos) -> long
Returns the Position in milliseconds.
void position_from_ticks(Position* pos, double ticks)
Sets position to the given total tick count.
void position_snap(const Position* prev_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.
void position_update_ticks_and_frames(Position* position)
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_stringize_allocate(const Position* pos) -> char*
Creates a string in the form of "0.0.0.0" from the given position.
void position_stringize(const Position* pos, char* buf)
Creates a string in the form of "0.0.0.0" from the given position.
void position_print(const Position* pos)
Prints the Position in the "0.0.0.0" form.
auto position_get_total_bars(const Position* pos) -> int
Returns the total number of bars not including the current one.
auto position_get_total_beats(const Position* pos) -> int
Returns the total number of beats not including the current one.
void position_change_sign(Position* pos)
Changes the sign 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.
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.
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.
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* region, const long timeline_frames, const int normalize) -> long
Converts frames on the timeline (global) to local frames (in the clip).
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)
Moves the given ZRegion to the given TrackLane.
void region_move_to_track(ZRegion* region, Track* track)
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 int 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, int 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_remove_midi_note(ZRegion* region, MidiNote* midi_note)
Removes the MIDI note and its components completely.
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_sanity_check(ZRegion* self, bool is_project) -> bool
Sanity checking.
void region_disconnect(ZRegion* self)
Disconnects the region and anything using it.
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.
void region_link_group_update(RegionLinkGroup* self, ZRegion* region)
Updates all other regions in the link group.
void region_link_group_move(RegionLinkGroup* dest, RegionLinkGroup* src)
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, int is_main) -> ScaleObject*
Creates a ScaleObject.
void snap_grid_update_snap_points(SnapGrid* self)
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 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.
void track_set_muted(Track* track, bool mute, bool trigger_undo, bool fire_events)
Sets track muted and optionally adds the action to the undo stack.
auto track_get_full_visible_height(Track* self) -> int
Returns the full visible height (main height + height of all visible automation tracks + height of all visible lanes).
auto track_get_soloed(Track* self) -> bool
Returns if the track is soloed.
auto track_get_implied_soloed(Track* self) -> 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) -> bool
Returns if the track is muted.
void track_set_recording(Track* track, bool recording, bool fire_events)
Sets recording and connects/disconnects the JACK ports.
void track_set_soloed(Track* track, bool solo, bool trigger_undo, bool fire_events)
Sets track soloed and optionally adds the action to the undo stack.
auto track_is_selected(Track* self) -> int
Returns if Track is in TracklistSelections.
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.
void track_write_to_midi_file(Track* self, MIDI_FILE* mf)
Writes the track to the given MIDI file.
void track_select(Track* self, int select, int exclusive, int fire_events)
Appends the Track to the selections.
void track_unselect_all(Track* self)
Unselects all arranger objects in the track.
void track_clear(Track* self)
Removes all objects recursively from the track.
void track_remove_region(Track* self, ZRegion* region, bool fire_events, bool free)
Only removes the region from the track.
auto track_verify_identifiers(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) -> 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_set_pos(Track* track, int pos)
Updates position in the tracklist and also updates the information in the lanes.
auto track_has_piano_roll(const Track* track) -> int
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, int* 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_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).
void track_set_comment(void* track, const char* comment)
Comment setter.
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.
void track_mark_for_bounce(Track* self, bool bounce, bool mark_regions, bool mark_children)
Marks the track for bouncing.
void track_append_all_ports(Track* self, Port*** ports, int* size, bool is_dynamic, int* max_size, bool include_plugins)
Appends all channel ports and optionally plugin ports to the array.
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.
void track_processor_process(TrackProcessor* self, const long g_start_frames, const nframes_t local_offset, const nframes_t nframes)
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.
void tracklist_init_loaded(Tracklist* self)
Initializes the tracklist when loading a project.
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.
void tracklist_print_tracks(Tracklist* self)
Prints the tracks (for debugging).
void tracklist_insert_track(Tracklist* self, Track* track, int pos, int publish_events, int recalc_graph)
Adds given track to given spot in tracklist.
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.
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).
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) -> int
Returns if the tracklist has soloed 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_beat_unit(Transport* self, int beat_unit)
Updates beat unit and anything depending on it.
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 nframes_t 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_playhead(Transport* self, Position* target, bool panic, bool set_cue_point)
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 nframes_t 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) -> 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;.
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

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 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_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_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 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 ChordType

Chord type.

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 AudioEngineBufferSize

Buffer sizes to be used in combo boxes.

enum AudioEngineSamplerate

Samplerates to be used in comboboxes.

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 ExtPortType

External port type.

enum FaderType

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

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 PortFlow

Direction of the signal.

enum PortType

Type of signals the Port handles.

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_TIME_SIG

This is a time signature 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.

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 StretcherBackend

Enumerators
STRETCHER_BACKEND_RUBBERBAND

Lib rubberband.

STRETCHER_BACKEND_PAULSTRETCH

Paulstretch.

STRETCHER_BACKEND_SBSMS

SBSMS - Subband Sinusoidal Modeling Synthesis.

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 TrackProcessorMidiAutomatable

Automatable MIDI signals.

enum TracklistPinOption

Used in track search functions.

enum TransportDisplay

Corrseponts to "transport-display" in the gsettings.

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 split the previous region while writing a new one, until the previous region is completely replaced.

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 AutomationPoint AutomationPoint

An automation point inside an AutomationTrack.

typedef struct Channel Channel

A Channel is part of a Track (excluding Tracks that don't have Channels) and contains information related to routing and the Mixer.

typedef struct ChannelSend ChannelSend

Channel send.

typedef enum ChordType ChordType

Chord type.

typedef enum ChordAccent ChordAccent

Chord accents.

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 ChordObject ChordObject

A ChordObject to be shown in the TimelineArrangerWidget.

typedef struct AudioClip AudioClip

Audio clips for the pool.

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

typedef struct ControlRoom 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.

typedef enum CurveAlgorithm CurveAlgorithm

The algorithm to use for curves.

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

typedef struct CurveOptions CurveOptions

Curve options.

typedef struct AudioEncoder AudioEncoder

Struct for holding info for encoding.

typedef enum AudioEngineBufferSize AudioEngineBufferSize

Buffer sizes to be used in combo boxes.

typedef enum AudioEngineSamplerate AudioEngineSamplerate

Samplerates to be used in comboboxes.

typedef enum BounceMode BounceMode

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

typedef struct AudioEngine AudioEngine

The audio engine.

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 enum ExtPortType ExtPortType

External port type.

typedef struct ExtPort ExtPort

External port.

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 HardwareProcessor HardwareProcessor

Hardware processor.

typedef enum MarkerType MarkerType

Marker type.

typedef struct Marker Marker

Marker for the MarkerTrack.

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 MidiMapping MidiMapping

A mapping from a MIDI value to a destination.

typedef struct MidiMappings MidiMappings

All MIDI mappings in Zrythm.

typedef struct MidiNote MidiNote

A MIDI note inside a ZRegion shown in the piano roll.

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 enum PortInternalType PortInternalType

What the internal data is.

typedef struct Port Port

Must ONLY be created via port_new()

typedef struct StereoPorts StereoPorts

L & R port, for convenience.

Must ONLY be created via stereo_ports_new()

typedef enum PortFlow PortFlow

Direction of the signal.

typedef enum PortType PortType

Type of signals the Port handles.

typedef enum PortUnit PortUnit

Port unit to be displayed in the UI.

typedef enum PortOwnerType PortOwnerType

Type of owner.

typedef enum PortFlags PortFlags

Port flags.

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 Position Position

A Position is made up of bars.beats.sixteenths.ticks.

typedef struct RecordingEvent RecordingEvent

A recording event.

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

typedef enum RegionMusicalMode RegionMusicalMode

Musical mode setting for audio regions.

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 RegionIdentifier RegionIdentifier

Index/identifier for a Region, so we can get Region objects quickly with it without searching by name.

typedef struct RegionLinkGroup RegionLinkGroup

A group of linked regions.

typedef struct RegionLinkGroupManager RegionLinkGroupManager

Manager of region link groups.

typedef struct SamplePlayback SamplePlayback

A sample playback handle to be used by the engine.

typedef struct SampleProcessor SampleProcessor

A processor to be used in the routing graph for playing samples independent of the timeline.

typedef enum MusicalScaleType MusicalScaleType

Scale type (name) eg Aeolian.

typedef struct MusicalScale MusicalScale

To be generated at the beginning, and then copied and reused.

typedef struct ScaleObject ScaleObject

A ScaleObject to be shown in the TimelineArrangerWidget.

typedef struct Stretcher Stretcher

Stretcher interface.

typedef enum TrackType TrackType

The Track's type.

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 TrackProcessor TrackProcessor

A TrackProcessor is a processor that is used as the first entry point when processing a track.

typedef enum TracklistPinOption TracklistPinOption

Used in track search functions.

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 TransportDisplay TransportDisplay

Corrseponts to "transport-display" in the gsettings.

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 Transport Transport

The transport.

typedef struct Velocity Velocity

The MidiNote velocity.

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

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.

void audio_region_init_frame_caches(AudioRegion* self, AudioClip* clip)

Allocates the frame caches from the frames in the clip.

void audio_region_update_channel_caches(ZRegion* self, AudioClip* clip)

Updates the region's channel caches from the region's frames.

AudioClip* audio_region_get_clip(const ZRegion* self)

Returns the audio clip associated with the Region.

void audio_region_free_members(ZRegion* self)

Frees members only but not the audio region itself.

Regions should be free'd using region_free.

AutomationPoint* automation_point_new_float(const float value, const float normalized_val, const Position* pos)

Creates an AutomationPoint in the given AutomationTrack at the given Position.

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

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.

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.

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

void automation_point_set_curviness(AutomationPoint* ap, const curviness_t curviness)

Sets the curviness of the AutomationPoint.

Port* automation_point_get_port(AutomationPoint* self)

Convenience function to return the control port that this AutomationPoint is for.

int automation_point_get_y(AutomationPoint* self, int height)

Returns Y in pixels from the value based on the given height of the parent.

bool automation_point_curves_up(AutomationPoint* self)

Returns if the curve of the AutomationPoint curves upwards as you move right on the x axis.

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.

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, int free)

Removes the AutomationPoint from the ZRegion, optionally freeing it.

Parameters
self
ap
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.

void automation_region_free_members(ZRegion* self)

Frees members only but not the ZRegion itself.

Regions should be free'd using region_free.

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.

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, int* 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

void channel_expose_ports_to_backend(Channel* ch)

Exposes the channel's ports to the backend.

void channel_connect(Channel* ch)

Connects the channel's ports.

This should only be called on new tracks.

void channel_add_balance_control(void* _channel, float pan)

Adds to (or subtracts from) the pan.

void channel_reset_fader(Channel* channel)

Sets fader to 0.0.

void channel_prepare_process(Channel* channel)

Prepares the channel for processing.

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

Channel* channel_new(Track* track)

Creates a channel of the given type with the given label.

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.

int channel_add_plugin(Channel* channel, PluginSlotType slot_type, int pos, Plugin* plugin, bool confirm, 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.
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.

void channel_reconnect_ext_input_ports(Channel* ch)

Called when the input has changed for Midi, Instrument or Audio tracks.

void channel_reattach_midi_editor_manual_press_port(Channel* channel, int connect, const int recalc_graph)

Connects or disconnects the MIDI editor key press port to the channel's first plugin.

AutomationTrack* channel_get_automation_track(Channel* channel, PortFlags type)

Convenience function to get the automation track of the given type for the channel.

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

Removes a plugin at pos from the channel.

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

void channel_update_track_pos(Channel* self, int pos)

Updates the track position in the channel and all related ports and identifiers.

bool channel_get_mono_compat_enabled(Channel* self)

Gets whether mono compatibility is enabled.

void channel_set_mono_compat_enabled(Channel* self, bool enabled, bool fire_events)

Sets whether mono compatibility is enabled.

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

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.

void channel_free(Channel* channel)

Frees the channel.

void channel_send_init(ChannelSend* self, int track_pos, int slot)

Inits a channel send.

Track* channel_send_get_track(ChannelSend* self)

Gets the owner track.

Track* channel_send_get_target_track(ChannelSend* self)

Gets the target track.

float channel_send_get_amount_for_widgets(ChannelSend* self)

Gets the amount to be used in widgets (0.0-1.0).

void channel_send_set_amount_from_widget(ChannelSend* self, float val)

Sets the amount from a widget amount (0.0-1.0).

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

Connects a send to stereo ports.

This function takes either stereo or both l and r.

void channel_send_connect_midi(ChannelSend* self, Port* port)

Connects a send to a midi port.

void channel_send_disconnect(ChannelSend* self)

Removes the connection at the given send.

void channel_send_get_dest_name(ChannelSend* self, char* buf)

Get the name of the destination.

ChannelSend* channel_send_find(ChannelSend* self)

Finds the project send from a given send instance.

ChordDescriptor* chord_descriptor_new(MusicalNote root, int has_bass, MusicalNote bass, ChordType type, ChordAccent accent, int inversion)

Creates a ChordDescriptor.

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.

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.

ChordObject* chord_object_new(RegionIdentifier* region_id, int chord_index, int index)

Creates a ChordObject.

void chord_object_set_region_and_index(ChordObject* self, ZRegion* region, int idx)

Sets the region and index of the chord.

ChordObject* chord_object_find_by_pos(ChordObject* clone)

Finds the ChordObject in the project corresponding to the given one's position.

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.

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

Adds a ChordObject to the Region.

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

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_remove_scale(ChordTrack* self, ScaleObject* scale, bool free)

Removes a scale 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.

void audio_clip_init_loaded(AudioClip* self)

Inits after loading a Project.

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.

void audio_clip_write_to_file(const AudioClip* self, const char* filepath)

Writes the given audio clip data to a file.

void audio_clip_write_to_pool(const AudioClip* self)

Writes the clip to the pool as a wav file.

void audio_clip_free(AudioClip* self)

Frees the audio clip.

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.

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.

void control_room_init_loaded(ControlRoom* self)

Inits the control room from a project.

ControlRoom* control_room_new(void)

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.

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, const int show_progress)

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

Parameters
self
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_setup(AudioEngine* self)

Set up the audio engine, ie, connect to the backend but does not start processing yet.

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 float bpm, const sample_rate_t sample_rate)

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

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

int engine_buffer_size_enum_to_int(AudioEngineBufferSize buffer_size)

Returns the int value correesponding to the given AudioEngineBufferSize.

int engine_samplerate_enum_to_int(AudioEngineSamplerate samplerate)

Returns the int value correesponding to the given AudioEngineSamplerate.

const char* engine_audio_backend_to_string(AudioBackend backend)

Returns the audio backend as a string.

static const char* engine_midi_backend_to_string(MidiBackend backend)

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.

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.

char* exporter_stringize_audio_format(AudioFormat format)

Returns the audio format as string.

Must be g_free()'d by caller.

int exporter_export(ExportSettings* info)

Exports an audio file based on the given settings.

Returns Non-zero if fail.

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.

bool ext_port_matches_backend(ExtPort* self)

Returns if the ext port matches the current backend.

char* ext_port_get_id(ExtPort* ext_port)

Returns a unique identifier (full name prefixed with backend type).

float* ext_port_get_buffer(ExtPort* ext_port, nframes_t nframes)

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.

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.

ExtPort* ext_port_clone(ExtPort* ext_port)

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.

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.

void fader_init_loaded(Fader* self, bool is_project)

Inits fader after a project is loaded.

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

bool fader_get_muted(Fader* self)

Returns if the fader is muted.

bool fader_get_soloed(Fader* self)

Returns if the track is soloed.

bool fader_get_implied_soloed(Fader* self)

Returns whether the fader is not soloed on its own but its direct out (or its direct out's direct out, etc.) is soloed.

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.

float fader_get_amp(void* self)

Gets the fader amplitude (not db) FIXME is void * necessary? do it in the caller.

bool fader_get_mono_compat_enabled(Fader* self)

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.

Used when cloning channels.

void fader_process(Fader* self, nframes_t local_offset, const nframes_t nframes)

Process the Fader.

Parameters
self
local_offset
nframes The number of frames to process.

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.

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.

void graph_node_process(GraphNode* node, const 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.

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.

HardwareProcessor* hardware_processor_new(bool input)

Returns a new empty instance.

bool hardware_processor_rescan_ext_ports(HardwareProcessor* self)

Rescans the hardware ports and appends any missing ones.

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

REALTIME void hardware_processor_process(HardwareProcessor* self, nframes_t nframes)

Processes the data.

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.

Marker* marker_new(const char* name)

Creates a Marker.

int marker_is_equal(Marker* a, Marker* b)

Returns if the two Marker's are equal.

void marker_set_track(Marker* marker, Track* track)

Sets the Track of the Marker.

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_add_marker(MarkerTrack* self, Marker* marker)

Adds a Marker to the Track.

\

@gen_widget Generates a widget for the Marker.

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.

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

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* src, MidiEvent* dest)

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_byte_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_byte_t time, bool queued)

Adds a note off for each note in the chord.

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, uint32_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, uint32_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_panic(MidiEvents* self, int 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 int 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.

int midi_file_get_num_tracks(const char* abs_path)

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_init_loaded(MidiMappings* self)

Initializes the MidiMappings after a Project is loaded.

MidiMappings* midi_mappings_new(void)

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.

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.

void midi_mappings_apply(MidiMappings* self, midi_byte_t* buf)

Applies the given buffer to the matching ports.

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.

MidiNote* midi_note_new(RegionIdentifier* region_id, Position* start_pos, Position* end_pos, uint8_t val, uint8_t vel)

Creates a new MidiNote.

void midi_note_set_region_and_index(MidiNote* self, ZRegion* region, int idx)

Sets the region the MidiNote belongs to.

int midi_note_is_equal(MidiNote* src, MidiNote* dest)

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

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

void midi_note_print(MidiNote* mn)

For debugging.

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)

int midi_note_hit(MidiNote* midi_note, const long gframes)

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.

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.

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.

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.

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

void audio_pool_init_loaded(AudioPool* self)

Inits after loading a project.

AudioPool* audio_pool_new(void)

Creates a new audio pool.

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.

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.

char* audio_pool_gen_name_for_recording_clip(AudioPool* pool, Track* track, int lane)

Generates a name for a recording clip.

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.

Port* port_new_with_type(PortType type, PortFlow flow, const char* label)

Creates port.

StereoPorts* stereo_ports_new_from_existing(Port* l, Port* r)

Creates blank stereo ports.

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.

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

Connects the internal ports using port_connect().

Parameters
src
dest
locked Lock the connection.

void port_get_full_designation(Port* self, char* buf)

Copies a full designation of self in the format "Track/Port" or "Track/Plugin/Port" in buf.

void port_get_all(Port*** ports, int* 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)

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

Parameters
self
track The track that owns this port.

static int port_get_dest_index(Port* self, Port* dest)

Returns the index of the destination in the dest array.

static int port_get_src_index(Port* self, Port* src)

Returns the index of the source in the source array.

static void port_set_multiplier_by_index(Port* port, int idx, float val)

Set the multiplier for a destination by its index in the dest array.

static void port_set_src_multiplier_by_index(Port* port, int idx, float val)

Set the multiplier for a destination by its index in the dest array.

static float port_get_multiplier_by_index(Port* port, int idx)

Get the multiplier for a destination by its index in the dest array.

void port_disconnect_hw_inputs(Port* self)

Disconnects all hardware inputs from the port.

void port_free(Port* port)

Deletes port, doing required cleanup and updating counters.

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.

int port_is_exposed_to_backend(const Port* self)

Returns if the port is exposed to the backend.

void port_rename_backend(Port* self)

Renames the port on the backend side.

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.

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

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.

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

Connets src to dest.

Parameters
src
dest
locked Lock the connection or not.

int port_disconnect(Port* src, Port* dest)

Disconnects src from dest.

static int port_disconnect_dests(Port* src)

Disconnects dests of port.

int port_get_num_unlocked_srcs(Port* port)

Returns the number of unlocked (user-editable) sources.

int port_get_num_unlocked_dests(Port* port)

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.

Parameters
port
track The track that owns this port.
pos

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

void port_sum_signal_from_inputs(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.

void port_set_owner_track(Port* port, Track* track)

Sets the owner track & its ID.

void port_set_owner_track_from_channel(Port* port, Channel* ch)

Sets the owner track & its ID.

void port_set_owner_track_processor(Port* port, TrackProcessor* track_processor)

Sets the owner track & its ID.

void port_set_owner_sample_processor(Port* port, SampleProcessor* sample_processor)

Sets the owner sample processor.

void port_set_owner_fader(Port* port, Fader* fader)

Sets the owner fader & its ID.

void port_set_owner_plugin(Port* port, Plugin* pl)

Sets the owner plugin & its ID.

int port_is_connection_locked(Port* src, Port* dest)

Returns if the connection from src to dest is locked or not.

bool ports_connected(Port* src, Port* dest)

Returns if the two ports are connected or not.

bool ports_can_be_connected(const Port* src, const Port* dest)

Returns whether the Port's can be connected (if the connection will be valid and won't break the acyclicity of the graph).

void ports_disconnect(Port** ports, int num_ports, int deleting)

Disconnects all the given ports.

int ports_remove(Port** ports, int* num_ports)

Removes all the given ports from the project, optionally freeing them.

void port_print_connections_all(void)

Prints all connections.

void port_clear_buffer(Port* port)

Clears the port buffer.

int port_disconnect_all(Port* port)

Disconnects all srcs and dests from port.

void port_verify_src_and_dests(Port* self)

Verifies that the srcs and dests are correct for project ports.

void port_apply_pan_stereo(Port* l, Port* r, float pan, PanLaw pan_law, PanAlgorithm pan_algo)

Applies the pan to the given L/R ports.

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.

bool port_identifier_is_equal(PortIdentifier* src, PortIdentifier* dest)

Returns if the 2 PortIdentifier's are equal.

void position_set_to_bar(Position* position, int bar_no)

Sets position to given bar.

void position_set_tick(Position* position, double tick)

Sets the tick of the Position.

If the tick exceeds the max ticks allowed on the positive or negative axis, it calls position_set_sixteenth until it is within range./

This function can handle both positive and negative Positions. Negative positions start at -1.-1.-1.-1 (one tick before zero) and positive Positions start at zero (1.1.1.0).

void position_sort_array(Position* array, const size_t size)

Sorts an array of Position's.

void position_add_frames(Position* pos, const long frames)

Adds the frames to the position and updates the rest of the fields, and makes sure the frames are still accurate.

long position_to_frames(const Position* position)

Converts position bars/beats/quarter beats/ticks to frames.

void position_from_seconds(Position* position, double secs)

Converts seconds to position and puts the result in the given Position.

long position_to_ms(const Position* pos)

Returns the Position in milliseconds.

void position_from_ticks(Position* pos, double ticks)

Sets position to the given total tick count.

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

Snaps position using given options.

Parameters
prev_pos Previous Position.
pos Position moved to.
track Track at new Position (for Region moving) FIXME needed?.
region ZRegion at new Position (for MidiNote moving) FIXME needed?.
sg SnapGrid options.

NOTE: Does not do negative Positions.

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_update_ticks_and_frames(Position* position)

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.

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.

char* position_stringize_allocate(const Position* pos)

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

Must be free'd by caller.

void position_stringize(const Position* pos, char* buf)

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

void position_print(const Position* pos)

Prints the Position in the "0.0.0.0" form.

int position_get_total_bars(const Position* pos)

Returns the total number of bars not including the current one.

int position_get_total_beats(const Position* pos)

Returns the total number of beats not including the current one.

void position_change_sign(Position* pos)

Changes the sign of the position.

For example, 4.2.1.21 would become -4.2.1.21.

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.

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

ZRegion* region_find(RegionIdentifier* id)

Looks for the ZRegion matching the identifier.

void region_print(const ZRegion* region)

Print region info for debugging.

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* region, const long timeline_frames, const int normalize)

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

Parameters
region
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_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.

Parameters
self
ratio The ratio to stretch by.

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

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)

Moves the given ZRegion to the given TrackLane.

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

Maintains the selection status of the ZRegion.

Assumes that the ZRegion is already in a TrackLane.

void region_move_to_track(ZRegion* region, Track* track)

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

Assumes that the ZRegion is already in a TrackLane.

int region_type_has_lane(const RegionType type)

Returns if the given ZRegion type can exist in TrackLane's.

void region_set_automation_track(ZRegion* region, AutomationTrack* at)

Sets the automation track.

AutomationTrack* region_get_automation_track(ZRegion* region)

Gets the AutomationTrack using the saved index.

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

void region_set_name(ZRegion* region, const char* name, int fire_events)

Sets ZRegion name (without appending anything to it) to all associated regions.

bool region_is_recording(ZRegion* self)

Returns if this region is currently being recorded onto.

bool region_get_musical_mode(ZRegion* self)

Returns whether the region is effectively in musical mode.

void region_remove_midi_note(ZRegion* region, MidiNote* midi_note)

Removes the MIDI note and its components completely.

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.

ArrangerSelections* region_get_arranger_selections(ZRegion* self)

Returns the ArrangerSelections based on the given region type.

bool region_sanity_check(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.

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

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 region_link_group_move(RegionLinkGroup* dest, RegionLinkGroup* src)

Moves the regions from src to dest.

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.

SampleProcessor* sample_processor_new(void)

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.

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

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.

MusicalScale* musical_scale_new(MusicalScaleType type, MusicalNote root)

Creates new scale using type and root note.

MusicalScale* musical_scale_clone(MusicalScale* src)

Clones the scale.

char* musical_scale_to_string(MusicalScale* scale)

Prints the MusicalScale to a string.

MUST be free'd.

void musical_scale_strcpy(MusicalScale* scale, char* buf)

Same as above but uses a buffer instead of allocating.

static int musical_scale_is_equal(MusicalScale* a, MusicalScale* b)

Returns 1 if the scales are equal.

int musical_scale_is_chord_in_scale(MusicalScale* scale, ChordDescriptor* chord)

Returns if all of the chord's notes are in the scale.

int musical_scale_is_accent_in_scale(MusicalScale* scale, MusicalNote chord_root, ChordType type, ChordAccent chord_accent)

Returns if the accent is in the scale.

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.

void musical_scale_free(MusicalScale* scale)

Frees the MusicalScale.

ScaleObject* scale_object_new(MusicalScale* descr, int is_main)

Creates a ScaleObject.

void snap_grid_update_snap_points(SnapGrid* self)

Updates snap points.

int snap_grid_get_snap_ticks(SnapGrid* self)

Gets a snap point's length in ticks.

int snap_grid_get_default_ticks(SnapGrid* self)

Gets a the default length in ticks.

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

bool track_type_has_channel(TrackType type)

Returns if the given TrackType is a type of Track that has a Channel.

void track_set_muted(Track* track, bool mute, bool trigger_undo, bool fire_events)

Sets track muted and optionally adds the action to the undo stack.

int track_get_full_visible_height(Track* self)

Returns the full visible height (main height + height of all visible automation tracks + height of all visible lanes).

bool track_get_soloed(Track* self)

Returns if the track is soloed.

bool track_get_implied_soloed(Track* self)

Returns whether the track is not soloed on its own but its direct out (or its direct out's direct out, etc.) is soloed.

bool track_get_muted(Track* self)

Returns if the track is muted.

void track_set_recording(Track* track, bool recording, bool fire_events)

Sets recording and connects/disconnects the JACK ports.

void track_set_soloed(Track* track, bool solo, bool trigger_undo, bool fire_events)

Sets track soloed and optionally adds the action to the undo stack.

int track_is_selected(Track* self)

Returns if Track is in TracklistSelections.

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

void track_write_to_midi_file(Track* self, MIDI_FILE* mf)

Writes the track to the given MIDI file.

void track_select(Track* self, int select, int exclusive, int fire_events)

Appends the Track to the selections.

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

void track_unselect_all(Track* self)

Unselects all arranger objects in the track.

void track_clear(Track* self)

Removes all objects recursively from the track.

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.

bool track_verify_identifiers(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)

Returns the region at the given position, or NULL.

ZRegion* track_get_last_region(Track* track)

Returns the last ZRegion in the track, or NULL.

void track_set_lanes_visible(Track* track, const int visible)

Set track lanes visible and fire events.

void track_set_automation_visible(Track* track, const bool visible)

Set automation visible and fire events.

int track_type_can_host_region_type(const TrackType tt, const RegionType rt)

Returns if the given TrackType can host the given RegionType.

static int track_type_can_record(const TrackType type)

Returns if the Track can record.

void track_generate_automation_tracks(Track* track)

Generates automatables for the track.

Should be called as soon as the track is created.

void track_setup(Track* track)

Wrapper.

AutomationTracklist* track_get_automation_tracklist(Track* track)

Returns the automation tracklist if the track type has one, or NULL if it doesn't (like chord tracks).

Channel* track_get_channel(Track* track)

Returns the channel of the track, if the track type has a channel, or NULL if it doesn't.

void track_set_pos(Track* track, int pos)

Updates position in the tracklist and also updates the information in the lanes.

int track_has_piano_roll(const Track* track)

Returns if the Track should have a piano roll.

static int track_has_inputs(const Track* track)

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, int* 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).

const char* track_get_name(Track* track)

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.

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.

static int track_type_is_compatible_for_moving(const TrackType type1, const TrackType type2)

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.

FaderType track_get_fader_type(const Track* track)

Returns the FaderType corresponding to the given Track.

FaderType track_type_get_prefader_type(TrackType type)

Returns the prefader type corresponding to the given Track.

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

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

Comment setter.

const char* track_get_comment(void* track)

Comment getter.

void track_set_color(Track* self, const GdkRGBA* color, bool undoable, bool fire_events)

Sets the track color.

void track_set_icon(Track* self, const char* icon_name, bool undoable, bool fire_events)

Sets the track icon.

void track_set_is_project(Track* self, bool is_project)

Recursively marks the track and children as project objects or not.

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

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.

void track_append_all_ports(Track* self, Port*** ports, int* size, bool is_dynamic, int* 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_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.

void track_free(Track* track)

Wrapper for each track type.

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.

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.

TrackLane* track_lane_clone(TrackLane* lane)

Clones the TrackLane.

Mainly used when cloning Track's.

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.

TrackProcessor* track_processor_new(Track* track)

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_disconnect_all(TrackProcessor* self)

Disconnects all ports connected to the TrackProcessor.

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.

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 tracklist_init_loaded(Tracklist* self)

Initializes the tracklist when loading a project.

void tracklist_get_visible_tracks(Tracklist* self, Track** visible_tracks, int* num_visible)

Finds visible tracks and puts them in given array.

Track* tracklist_find_track_by_name(Tracklist* self, const char* name)

Returns the Track matching the given name, if any.

void tracklist_print_tracks(Tracklist* self)

Prints the tracks (for debugging).

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.

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.

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.

int tracklist_get_track_pos(Tracklist* self, Track* track)

Returns the index of the given Track.

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.

Track* tracklist_get_prev_visible_track(Tracklist* self, Track* track)

Returns the previous visible Track in the same Tracklist as the given one (ie, pinned or not).

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_next_visible_track(Tracklist* self, Track* track)

Returns the next visible Track in the same Tracklist as the given one (ie, pinned or not).

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

Returns the Track after delta visible Track's.

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

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_has_soloed(const Tracklist* self)

Returns if the tracklist has soloed tracks.

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.

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.

Transport* transport_new(AudioEngine* engine)

Initialize transport.

Transport* transport_clone(Transport* self)

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.

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_set_beat_unit(Transport* self, int beat_unit)

Updates beat unit and anything depending on it.

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 nframes_t 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_playhead(Transport* self, Position* target, bool panic, bool set_cue_point)

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.

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

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

double transport_get_ppqn(Transport* self)

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.

nframes_t transport_is_loop_point_met(const Transport* self, const long g_start_frames, const nframes_t nframes)

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

Velocity* velocity_new(MidiNote* midi_note, const uint8_t vel)

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.

int velocity_is_equal(Velocity* src, Velocity* dest)

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.

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

Variable documentation

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

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.

Define documentation

#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_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.

Used for fixed-size arrays.

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

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

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

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

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

#define position_is_between(_pos, _start, _end)

Returns if _pos is after or equal to _start and before _end.

#define POSITION_INIT_ON_STACK(name)

Inits the default position on the stack.

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