Audio module

The audio module contains DSP and audio related code.

DSP and audio related code.

Modules

module Sub Group

Classes

struct Automatable
An automatable control.
struct AutomationCurve
The curve between two AutomationPoint's.
struct AutomationPoint
An automation point living 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 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 AudioEncoder
Struct for holding info for encoding.
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 Marker
Marker for the MarkerTrack.
struct Metronome
Metronome settings.
struct MidiEvent
Backend-agnostic MIDI event descriptor.
struct MidiEvents
Container for passing midi events through ports.
struct MidiNote
A MIDI note living inside a Region and shown on the piano roll.
struct PassthroughProcessor
A simple processor that copies the buffers of its inputs to its outputs.
struct AudioPool
An audio pool is a pool of audio files and their corresponding float arrays in memory that are referenced by regions.
struct PortIdentifier
Struct used to identify Ports in the project.
struct Port
Must ONLY be created via port_new()
struct StereoPorts
L & R port, for convenience.
struct Position
A Position is made up of bars.beats.sixteenths.ticks.
struct Region
A region (clip) is an object on the timeline that contains either MidiNote's or AudioClip's.
struct Graph
Graph.
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 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 AutomationCurveType { AUTOMATION_CURVE_TYPE_BOOL, AUTOMATION_CURVE_TYPE_STEP, AUTOMATION_CURVE_TYPE_FLOAT }
Type of AutomationCurve.
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 AudioFormat { AUDIO_FORMAT_FLAC, AUDIO_FORMAT_OGG, AUDIO_FORMAT_WAV, AUDIO_FORMAT_MP3, AUDIO_FORMAT_MIDI, NUM_AUDIO_FORMATS }
Audio format.
enum BitDepth { BIT_DEPTH_16, BIT_DEPTH_24, BIT_DEPTH_32 }
Bit depth.
enum ExtPortType { EXT_PORT_TYPE_JACK, EXT_PORT_TYPE_ALSA }
External port type.
enum FaderType { FADER_TYPE_NONE, FADER_TYPE_AUDIO_CHANNEL, FADER_TYPE_MIDI_CHANNEL, FADER_TYPE_GENERIC }
enum MarkerType { MARKER_TYPE_START, MARKER_TYPE_END, MARKER_TYPE_CUSTOM }
Marker type.
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_ON, MIDI_EVENT_TYPE_NOTE_OFF, MIDI_EVENT_TYPE_ALL_NOTES_OFF }
Type of MIDI event.
enum MidiNoteCloneFlag { MIDI_NOTE_CLONE_COPY_MAIN, MIDI_NOTE_CLONE_COPY, MIDI_NOTE_CLONE_LINK }
enum PassthroughProcessorType { PP_TYPE_NONE, PP_TYPE_AUDIO_CHANNEL, PP_TYPE_MIDI_CHANNEL }
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 PortOwnerType { PORT_OWNER_TYPE_BACKEND, PORT_OWNER_TYPE_PLUGIN, PORT_OWNER_TYPE_TRACK, PORT_OWNER_TYPE_PREFADER, PORT_OWNER_TYPE_FADER, PORT_OWNER_TYPE_MONITOR_FADER, PORT_OWNER_TYPE_TRACK_PROCESSOR, PORT_OWNER_TYPE_SAMPLE_PROCESSOR }
Type of owner.
enum PortFlags { PORT_FLAG_STEREO_L = 0x01, PORT_FLAG_STEREO_R = 0x02, PORT_FLAG_PIANO_ROLL = 0x04, PORT_FLAG_SIDECHAIN = 0x08, PORT_FLAG_MAIN_PORT = 0x10, PORT_FLAG_MANUAL_PRESS = 0x20, OPT_F = 0x40 }
Port flags.
enum PortInternalType { INTERNAL_NONE, INTERNAL_LV2_PORT, INTERNAL_JACK_PORT, INTERNAL_PA_PORT, INTERNAL_ALSA_SEQ_PORT }
What the internal data is.
enum RegionType { REGION_TYPE_MIDI = 0x01, REGION_TYPE_AUDIO = 0x02, REGION_TYPE_AUTOMATION = 0x04, REGION_TYPE_CHORD = 0x08 }
Type of Region.
enum RegionCloneFlag { REGION_CLONE_COPY_MAIN, REGION_CLONE_COPY, REGION_CLONE_LINK }
Flag do indicate how to clone the Region.
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 }
Graph nodes can be either ports or processors.
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 TrackType { TRACK_TYPE_INSTRUMENT, TRACK_TYPE_AUDIO, TRACK_TYPE_MASTER, TRACK_TYPE_CHORD, TRACK_TYPE_MARKER, TRACK_TYPE_AUDIO_BUS, TRACK_TYPE_AUDIO_GROUP, TRACK_TYPE_MIDI, TRACK_TYPE_MIDI_BUS, TRACK_TYPE_MIDI_GROUP }
enum VelocityCloneFlag { VELOCITY_CLONE_COPY_MAIN, VELOCITY_CLONE_COPY }

Typedefs

using Automatable = struct Automatable
An automatable control.
using AutomationCurveType = enum AutomationCurveType
Type of AutomationCurve.
using AutomationCurve = struct AutomationCurve
The curve between two AutomationPoint's.
using AutomationPoint = struct AutomationPoint
An automation point living inside an AutomationTrack.
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 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 AudioEncoder = struct AudioEncoder
Struct for holding info for encoding.
using AudioFormat = enum AudioFormat
Audio format.
using BitDepth = enum BitDepth
Bit depth.
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 MarkerType = enum MarkerType
Marker type.
using Marker = struct Marker
Marker for the MarkerTrack.
using MarkerTrack = struct Track
MarkerTrack is just a Track.
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 MidiNote = struct MidiNote
A MIDI note living inside a Region and shown on the piano roll.
using PassthroughProcessor = struct PassthroughProcessor
A simple processor that copies the buffers of its inputs to its outputs.
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 PortFlow = enum PortFlow
Direction of the signal.
using PortType = enum PortType
Type of signals the Port handles.
using PortOwnerType = enum PortOwnerType
Type of owner.
using PortFlags = enum PortFlags
Port flags.
using PortInternalType = enum PortInternalType
What the internal data is.
using PortIdentifier = struct PortIdentifier
Struct used to identify Ports in the project.
using Port = struct Port
Must ONLY be created via port_new()
using StereoPorts = struct StereoPorts
L & R port, for convenience.
using Position = struct Position
A Position is made up of bars.beats.sixteenths.ticks.
using RegionType = enum RegionType
Type of Region.
using RegionCloneFlag = enum RegionCloneFlag
Flag do indicate how to clone the Region.
using Region = struct Region
A region (clip) is an object on the timeline that contains either MidiNote's or AudioClip's.
using GraphNodeType = enum GraphNodeType
Graph nodes can be either ports or processors.
using Graph = struct Graph
Graph.
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 Track = struct Track
Track to be inserted into the Project's Tracklist.
using TrackLane = struct TrackLane
A TrackLane belongs to a Track (can have many TrackLanes in a Track) and contains Regions.
using TrackProcessor = struct TrackProcessor
A TrackProcessor is a processor that is used as the first entry point when processing a track.
using Tracklist = struct Tracklist
The Tracklist contains all the tracks in the Project.
using Transport = struct Transport
The transport.
using Velocity = struct Velocity
The MidiNote velocity.
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 channels_t channels, const Position* start_pos, const int is_main) -> AudioRegion*
Creates a Region for audio data.
auto audio_region_get_clip(const Region* self) -> AudioClip*
Returns the audio clip associated with the Region.
void audio_region_free_members(AudioRegion* self)
Frees members only but not the audio region itself.
void automatable_init_loaded(Automatable* self)
Inits a loaded automatable.
auto automatable_find(Automatable* clone) -> Automatable*
Finds the Automatable in the project from the given clone.
auto automatable_create_lv2_control(Plugin* plugin, Lv2Control* control) -> Automatable*
Creates an automatable for an LV2 control.
auto automatable_stringize_value_type(Automatable* a) -> char*
Returns the type of its value (float, bool, etc.) as a string.
auto automatable_real_val_to_normalized(Automatable* self, float real_val) -> float
Converts real value (eg.
auto automatable_normalized_val_to_real(Automatable* self, float normalized_val) -> float
Converts normalized value (0.0 to 1.0) to real value (eg.
auto automatable_get_val(Automatable* self) -> float
Gets the current value of the parameter the automatable is for.
void automatable_set_val_from_normalized(Automatable* self, float val, int automating)
Updates the actual value.
auto automatable_get_automation_track(Automatable* automatable) -> AutomationTrack*
Gets automation track for given automatable, if any.
auto automation_curve_new(const AutomatableType a_type, const Position* pos) -> AutomationCurve*
Creates an AutomationCurve.
auto automation_curve_get_normalized_value(AutomationCurve* ac, double x) -> double
The function to return a point on the curve.
void automation_curve_update_frames(AutomationCurve* self)
Updates the frames of each position in each child of the AutomationCurve recursively.
void automation_curve_set_curviness(AutomationCurve* ac, const curviness_t curviness)
Sets the curviness of the AutomationCurve.
void automation_curve_free(AutomationCurve* ap)
Frees the automation point.
auto automation_point_find(AutomationPoint* src) -> AutomationPoint*
Finds the automation point in the project matching the params of the given one.
auto automation_point_new_float(const float value, const Position* pos, int is_main) -> AutomationPoint*
Creates an AutomationPoint in the given AutomationTrack at the given Position.
void automation_point_update_fvalue(AutomationPoint* ap, float fval, ArrangerObjectUpdateFlag update_flag)
Updates the value and notifies interested parties.
void automation_point_set_region_and_index(AutomationPoint* _ap, Region* region, int index)
Sets the Region and the index in the region that the AutomationPoint belongs to, in all its counterparts.
auto automation_point_get_normalized_value(AutomationPoint* ap) -> float
Returns the normalized value (0.0 to 1.0).
void automation_point_update_frames(AutomationPoint* self)
Updates the frames of each position in each child of the AutomationPoint recursively.
auto automation_point_clone(AutomationPoint* src, AutomationPointCloneFlag flag) -> AutomationPoint*
Clones the atuomation point.
auto automation_point_get_track(AutomationPoint* ap) -> Track*
Returns the Track this AutomationPoint is in.
void automation_point_free(AutomationPoint* ap)
Frees the automation point.
auto automation_region_new(const Position* start_pos, const Position* end_pos, const int is_main) -> Region*
Creates a new Region for automation.
void automation_region_print_automation(Region* self)
Prints the automation in this Region.
void automation_region_force_sort(Region* self)
Forces sort of the automation points.
void automation_region_add_ap(Region* self, AutomationPoint* ap, int gen_curves)
Adds automation point and optionally generates curve points accordingly.
void automation_region_add_ac(Region* self, AutomationCurve* ac)
Adds the given AutomationCurve.
auto automation_region_get_prev_ap(Region* self, AutomationPoint* ap) -> AutomationPoint*
Returns the AutomationPoint before the position.
auto automation_region_get_next_ap(Region* self, AutomationPoint* ap) -> AutomationPoint*
Returns the AutomationPoint after the position.
static auto automation_region_get_ap_before_curve(Region* self, AutomationCurve* ac) -> AutomationPoint*
Returns the AutomationPoint before the given AutomationCurve.
static auto automation_region_get_ap_after_curve(Region* self, AutomationCurve* ac) -> AutomationPoint*
Returns the ap after the curve point.
auto automation_region_get_next_curve_ac(Region* self, AutomationPoint* ap) -> AutomationCurve*
Returns the curve point right after the given ap.
void automation_region_remove_ap(Region* self, AutomationPoint* ap, int free)
Removes the given AutomationPoint from the Region.
void automation_region_remove_ac(Region* self, AutomationCurve* ac, int free)
Removes the given AutomationCurve from the Region.
void automation_region_free_members(Region* self)
Frees members only but not the Region itself.
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, int 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_pan(void* _channel, float pan)
Adds to (or subtracts from) the pan.
void channel_prepare_for_serialization(Channel* ch)
Prepares the Channel for serialization.
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_remove_ats_from_automation_tracklist(Channel* ch)
Removes the AutomationTrack's associated with this channel from the AutomationTracklist in the corresponding Track.
void channel_process(Channel* channel)
The process function prototype.
auto channel_add_plugin(Channel* channel, int pos, Plugin* plugin, int confirm, int gen_automatables, int recalc_graph) -> int
Adds given plugin to given position in the strip.
void channel_update_output(Channel* ch, Track* output)
Updates the output of the Channel (where the Channel routes to.
void channel_reconnect_ext_input_ports(Channel* ch)
Called when the input has changed for Midi, Instrument or Audio tracks.
auto channel_get_last_active_slot_index(Channel* channel) -> int
Returns the index of the last active slot.
auto channel_get_last_plugin(Channel* self) -> Plugin*
Returns the last Plugin in the strip.
auto channel_get_index(Channel* channel) -> int
Returns the index on the mixer.
auto channel_get_plugin_index(Channel* channel, Plugin* plugin) -> int
Returns the plugin's strip index on the channel.
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_first_plugin(Channel* channel) -> Plugin*
Convenience method to get the first active plugin in the channel.
auto channel_get_automatable(Channel* channel, AutomatableType type) -> Automatable*
Convenience function to get the fader automatable of the channel.
void channel_generate_automation_tracks(Channel* channel)
Generates automatables for the channel.
void channel_remove_plugin(Channel* channel, int pos, int deleting_plugin, int deleting_channel, int recalc_graph)
Removes a plugin at pos from the channel.
auto channel_clone(Channel* ch, Track* track) -> Channel*
Clones the channel recursively.
void channel_disconnect(Channel* channel, int remove_pl, int recalc_graph)
Disconnects the channel from the processing chain.
void channel_free(Channel* channel)
Frees the channel.
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_string(ChordDescriptor* chord) -> char*
Returns the chord in human readable string.
void chord_descriptor_free(ChordDescriptor* self)
Frees the ChordDescriptor.
void chord_object_init_loaded(ChordObject* self)
Init the ChordObject after the Project is loaded.
auto chord_object_new(Region* region, int index, int is_main) -> ChordObject*
Creates a ChordObject.
void chord_object_set_region(ChordObject* self, Region* region)
Sets the Track of the chord.
auto chord_object_get_chord_descriptor(ChordObject* self) -> ChordDescriptor*
Returns the ChordDescriptor associated with this ChordObject.
void chord_object_update_frames(ChordObject* self)
Updates the frames of each position in each child of the ChordObject recursively.
auto chord_object_find(ChordObject* clone) -> ChordObject*
Finds the ChordObject in the project corresponding to the given one.
auto chord_object_find_by_pos(ChordObject* clone) -> ChordObject*
Finds the ChordObject in the project corresponding to the given one's position.
auto chord_object_clone(ChordObject* src, ChordObjectCloneFlag flag) -> ChordObject*
Clones the given chord.
void chord_object_free(ChordObject* self)
Frees the ChordObject.
auto chord_region_new(const Position* start_pos, const Position* end_pos, const int is_main) -> Region*
Creates a new Region for chords.
void chord_region_add_chord_object(Region* self, ChordObject* chord)
Adds a ChordObject to the Region.
void chord_region_remove_chord_object(Region* self, ChordObject* chord, int free)
Removes a ChordObject from the Region.
void chord_region_free_members(Region* self)
Frees members only but not the Region itself.
auto chord_track_new(void) -> ChordTrack*
Creates a new chord Track.
void chord_track_init(Track* track)
Inits a chord track (e.g.
void chord_track_add_scale(ChordTrack* track, ScaleObject* chord)
Adds a ChordObject to the Track.
void chord_track_remove_scale(ChordTrack* self, ScaleObject* scale, int 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_free(ChordTrack* self)
Frees 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.
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.
void engine_realloc_port_buffers(AudioEngine* self, nframes_t buf_size)
void engine_init(AudioEngine* self, int loading)
Init audio engine.
void engine_activate(AudioEngine* self)
Activates the audio engine to start 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.
static 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_tear_down(AudioEngine* self)
Closes any connections and free's data.
auto exporter_stringize_audio_format(AudioFormat format) -> char*
Returns the audio format as string.
void exporter_export(ExportSettings* info)
Exports an audio file based on the given settings.
void ext_port_init_loaded(ExtPort* ext_port)
Inits the ExtPort after loading a project.
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_ports_get(PortType type, PortFlow flow, int 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.
void fader_init_loaded(Fader* self)
Inits fader after a project is loaded.
void fader_init(Fader* self, FaderType type, Channel* ch)
Inits fader to default values.
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).
auto fader_get_amp(void* self) -> float
Gets the fader amplitude (not db) FIXME is void * necessary? do it in the caller.
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(Fader* src, Fader* dest)
Copy the struct members from source to dest.
void fader_process(Fader* self, nframes_t local_offset, const nframes_t nframes)
Process the Fader.
void instrument_track_init(Track* track)
Initializes an instrument track.
void instrument_track_free(InstrumentTrack* track)
Frees the track.
auto marker_new(const char* name, int is_main) -> 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.
void marker_set_name(Marker* marker, const char* name)
Sets the name to all the Marker's counterparts.
void marker_update_frames(Marker* self)
Updates the frames of each position in each child of the Marker recursively.
auto marker_find(Marker* clone) -> Marker*
Finds the marker in the project corresponding to the given one.
void marker_free(Marker* self)
Frees the Marker.
auto marker_track_default(void) -> 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_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 marker_track_free(MarkerTrack* self)
Frees the MarkerTrack.
void master_track_free(Track* track)
Frees the track.
void metronome_init(Metronome* self)
Initializes the Metronome by loading the samples into memory.
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, int 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.
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)
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, midi_byte_t 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_free(MidiEvents* self)
Frees the MIDI events.
void midi_panic_all(int queued)
Queues MIDI note off to event queues.
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(MidiRegion* region, Position* start_pos, Position* end_pos, uint8_t val, uint8_t vel, int is_main) -> MidiNote*
void midi_note_set_region(MidiNote* midi_note, Region* region)
Sets the Region the MidiNote belongs to.
auto midi_note_find(MidiNote* clone) -> MidiNote*
Finds the actual MidiNote in the project from the given clone.
auto midi_note_get_track(MidiNote* self) -> Track*
Gets the Track this MidiNote is in.
auto midi_note_clone(MidiNote* src, MidiNoteCloneFlag flag) -> MidiNote*
Deep clones the midi note.
void midi_note_update_frames(MidiNote* self)
Updates the frames of each position in each child of the MidiNote recursively.
auto midi_note_is_equal(MidiNote* src, MidiNote* dest) -> int
Returns 1 if the MidiNotes match, 0 if not.
void midi_note_print(MidiNote* mn)
For debugging.
void midi_note_shift_pitch(MidiNote* self, const int delta, ArrangerObjectUpdateFlag update_flag)
Shifts MidiNote's position and/or value.
auto midi_note_hit(const 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.
auto midi_note_get_length_in_ticks(const MidiNote* self) -> long
Returns the MidiNote length in ticks.
void midi_note_set_val(MidiNote* midi_note, const uint8_t val, ArrangerObjectUpdateFlag update_flag)
Sets the pitch of the MidiNote.
void midi_note_free(MidiNote* self)
Frees a single MidiNote and its components.
auto midi_region_new(const Position* start_pos, const Position* end_pos, int is_main) -> MidiRegion*
Creates a new Region for MIDI notes.
void midi_region_add_midi_note(MidiRegion* region, MidiNote* midi_note)
Adds midi note to region.
auto midi_region_pop_unended_note(MidiRegion* self, int pitch) -> MidiNote*
Returns the midi note with the given pitch from the unended notes.
void midi_region_print_midi_notes(Region* self)
Prints the MidiNotes in the Region.
auto midi_region_get_first_midi_note(MidiRegion* region) -> MidiNote*
Gets first midi note.
auto midi_region_get_last_midi_note(MidiRegion* region) -> MidiNote*
Gets last midi note.
auto midi_region_get_highest_midi_note(MidiRegion* region) -> MidiNote*
Gets highest midi note.
auto midi_region_get_lowest_midi_note(MidiRegion* region) -> MidiNote*
Gets lowest midi note.
void midi_region_remove_midi_note(Region* region, MidiNote* midi_note, int free, int pub_event)
Removes the MIDI note from the Region.
void midi_region_remove_all_midi_notes(MidiRegion* region)
Removes all MIDI ntoes and their components completely.
void midi_region_write_to_midi_file(const Region* self, MIDI_FILE* mf, const int add_region_start, const int export_full)
Returns the midi note at given position with the given pitch.
void midi_region_export_to_midi_file(const Region* self, const char* full_path, int midi_version, const int export_full)
Exports the Region to a specified MIDI file.
auto midi_region_get_midi_ch(const Region* self) -> uint8_t
Returns the MIDI channel that this region should be played on, starting from 1.
auto midi_region_get_as_events(const Region* 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(MidiRegion* 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 passthrough_processor_init_loaded(PassthroughProcessor* self)
Inits a PassthroughProcessor after loading a project.
void passthrough_processor_init(PassthroughProcessor* self, PassthroughProcessorType type, Channel* ch)
Inits passthrough_processor to default values.
void passthrough_processor_clear_buffers(PassthroughProcessor* self)
Clears all buffers.
void passthrough_processor_set_widget_val(PassthroughProcessor* self, float val)
Sets the passthrough_processor levels from a normalized value 0.0-1.0 (such as in widgets).
void passthrough_processor_disconnect_all(PassthroughProcessor* self)
Disconnects all ports connected to the processor.
void passthrough_processor_copy(PassthroughProcessor* src, PassthroughProcessor* dest)
Copy the struct members from source to dest.
void passthrough_processor_process(PassthroughProcessor* self, const nframes_t g_frames, const nframes_t nframes)
Process the PassthroughProcessor.
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 port_init_loaded(Port* port)
This function finds the Ports corresponding to the PortIdentifiers for srcs and dests.
auto port_find_from_identifier(PortIdentifier* id) -> Port*
Finds the Port corresponding to the identifier.
auto port_identifier_is_equal(PortIdentifier* src, PortIdentifier* dest) -> int
Returns if the 2 PortIdentifier's are equal.
auto port_new(const char* label) -> Port*
Creates port.
auto port_new_with_type(PortType type, PortFlow flow, const char* label) -> Port*
Creates port.
auto port_new_with_data(PortInternalType internal_type, PortType type, PortFlow flow, const char* label, void* data) -> Port*
Creates port and adds given data to it.
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_receive_midi_events_from_jack(Port* port, const nframes_t start_frames, const nframes_t nframes)
Receives MIDI data from the port's exposed JACK port (if any) into the port.
void port_receive_audio_data_from_jack(Port* port, const nframes_t start_frames, const nframes_t nframes)
Receives audio data from the port's exposed JACK port (if any) into the port.
void port_send_midi_events_to_jack(Port* port, const nframes_t start_frames, const nframes_t nframes)
Sends MIDI data from the port to its exposed JACK port (if any).
void port_send_audio_data_to_jack(Port* port, const nframes_t start_frames, const nframes_t nframes)
Sends audio data from the port to its exposed JACK port (if any).
void port_sum_data_from_jack(Port* port, const nframes_t start_frames, const nframes_t nframes)
Sums the inputs coming in from JACK, before the port is processed.
void port_send_data_to_jack(Port* self, const nframes_t start_frames, const nframes_t nframes)
Sends the port data to JACK, after the port is processed.
auto port_get_full_designation(const Port* self) -> char*
Returns a full designation of the port in the format "Track/Port" or "Track/Plugin/Port".
void port_get_all(Port** ports, int* size)
Gathers all ports in the project and puts them in the given array and size.
static auto port_get_dest_index(Port* port, Port* dest) -> int
Returns the index of the destination in the dest 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 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_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(const Port* self)
Renames the port on the backend side.
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.
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 nframes_t start_frame, const nframes_t nframes, const int 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_processor(Port* port, Track* track)
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_prefader(Port* port, PassthroughProcessor* fader)
Sets the owner fader & its ID.
void port_set_owner_plugin(Port* port, Plugin* pl)
Sets the owner plugin & its ID.
auto ports_connected(Port* src, Port* dest) -> int
Returns if the two ports are connected or not.
auto ports_can_be_connected(const Port* src, const Port* dest) -> int
Returns whether the Port's can be connected (if the connection will be valid and won't break the acyclicity of the graph).
static 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_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.
void position_set_to_bar(Position* position, int bar_no)
Sets position to given bar.
void position_set_tick(Position* position, long 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, long ticks)
Sets position to the given total tick count.
void position_snap(const Position* prev_pos, Position* pos, Track* track, Region* 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_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) -> long
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 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) -> int
Quantizes the given Position using the given QuantizeOptions.
void quantize_options_free(QuantizeOptions* self)
Free's the QuantizeOptions.
void region_init(Region* region, const Position* start_pos, const Position* end_pos, const int is_main)
Only to be used by implementing structs.
void region_init_loaded(Region* region)
Inits freshly loaded region.
auto region_find(Region* r) -> Region*
Finds the region corresponding to the given one.
auto region_find_by_name(const char* name) -> Region*
Looks for the Region under the given name.
void region_split(Region* region, const Position* pos, const int pos_is_local, Region** r1, Region** r2)
Splits the given Region at the given Position, deletes the original Region and adds 2 new Regions in the same parent (Track or AutomationTrack).
void region_unsplit(Region* r1, Region* r2, Region** region)
Undoes what region_split() did.
void region_print(const Region* region)
Print region info for debugging.
auto region_find_midi_note(Region* r, MidiNote* _mn) -> MidiNote*
Returns the MidiNote matching the properties of the given MidiNote.
auto region_get_full_length_in_ticks(Region* region) -> long
Returns the full length as it appears on the timeline in ticks.
auto region_get_full_length_in_frames(const Region* region) -> long
Returns the full length as it appears on the timeline in frames.
auto region_get_true_length_in_ticks(Region* region) -> long
Returns the true length as it appears on the piano roll (not taking into account any looping) in ticks.
auto region_get_loop_length_in_frames(const Region* region) -> long
Returns the length of the loop in frames.
auto region_get_loop_length_in_ticks(const Region* region) -> long
Returns the length of the loop in ticks.
auto region_timeline_frames_to_local(const Region* region, const long timeline_frames, const int normalize) -> long
Converts frames on the timeline (global) to local frames (in the clip).
auto region_get_track(const Region* region) -> Track*
Returns the Track this Region is in.
void region_set_track_pos(Region* region, const int pos)
Sets the Track position to the Region and all its members recursively.
auto region_get_num_loops(Region* region, int count_incomplete_loops) -> int
Returns the number of loops in the region, optionally including incomplete ones.
void region_set_lane(Region* region, TrackLane* lane)
Sets the track lane.
void region_gen_name(Region* region, const char* base_name, AutomationTrack* at, Track* track)
Generates a name for the Region, either using the given AutomationTrack or Track, or appending to the given base name.
void region_move_to_lane(Region* region, TrackLane* lane, const int tmp)
Moves the given Region to the given TrackLane.
void region_move_to_track(Region* region, Track* track, const int tmp)
Moves the Region to the given Track, maintaining the selection status of the Region and the TrackLane position.
auto region_type_has_lane(const RegionType type) -> int
Returns if the given Region type can exist in TrackLane's.
void region_set_automation_track(Region* region, AutomationTrack* at)
Sets the automation track.
void region_copy(Region* src, Region* dest)
Copies the data from src to dest.
void region_set_true_end_pos(Region* region, const Position* pos, ArrangerObjectUpdateFlag update_flag)
Checks if position is valid then sets it.
void region_set_loop_end_pos(Region* region, const Position* pos, ArrangerObjectUpdateFlag update_flag)
Checks if position is valid then sets it.
void region_set_loop_start_pos(Region* region, const Position* pos, ArrangerObjectUpdateFlag update_flag)
Checks if position is valid then sets it.
void region_set_clip_start_pos(Region* region, const Position* pos, ArrangerObjectUpdateFlag update_flag)
Checks if position is valid then sets it.
void region_add_ticks_to_children(Region* self, const long ticks)
Moves the children of the region by the given amount of ticks.
void region_resize(Region* region, const int left, const long ticks, const int loop, ArrangerObjectUpdateFlag update_flag)
Resizes the object on the left side or right side by given amount of ticks.
void region_update_frames(Region* self)
Updates the frames of each position in each child of the region recursively.
auto region_is_hit(const Region* 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 Region* region, const long gframes_start, const long gframes_end, const int end_inclusive) -> int
Returns if any part of the Region is inside the given range, inclusive.
auto region_at_position(Track* track, Position* pos) -> Region*
Returns the region at the given position in the given Track.
auto region_generate_filename(Region* region) -> char*
Generates the filename for this region.
auto region_get_start_region(Region** regions, int num_regions) -> Region*
Returns the region with the earliest start point.
void region_set_name(Region* region, char* name)
Sets Region name (without appending anything to it) to all associated regions.
void region_remove_midi_note(Region* region, MidiNote* midi_note)
Removes the MIDI note and its components completely.
auto region_clone(Region* region, RegionCloneFlag flag) -> Region*
Clone region.
void region_disconnect(Region* self)
Disconnects the region and anything using it.
void region_free_all(Region* region)
Frees each Region stored in obj_info.
void region_free(Region* region)
Frees a single Region and its components.
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_playback_latency(Router* router) -> nframes_t
Returns the max playback latency of the trigger nodes.
auto graph_validate(Router* router, const Port* src, const Port* dest) -> int
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_free(Graph* self)
Frees the graph and its members.
void sample_playback_init(SamplePlayback* self, sample_t** buf, long buf_size, channels_t channels, float vol, nframes_t start_offset)
Initializes a SamplePlayback with a sample to play back.
void sample_processor_init(SampleProcessor* self)
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.
void scale_object_init_loaded(ScaleObject* self)
Init the ScaleObject after the Project is loaded.
auto scale_object_new(MusicalScale* descr, int is_main) -> ScaleObject*
Creates a ScaleObject.
auto scale_object_get_track(ScaleObject* self) -> Track*
Returns the Track this ScaleObject is in.
void scale_object_set_track(ScaleObject* self, Track* track)
Sets the Track of the scale.
void scale_object_update_frames(ScaleObject* self)
Updates the frames of each position in each child of the ScaleObject recursively.
auto scale_object_find(ScaleObject* clone) -> ScaleObject*
Finds the ScaleObject in the project corresponding to the given one.
auto scale_object_clone(ScaleObject* src, ScaleObjectCloneFlag flag) -> ScaleObject*
Clones the given scale.
void scale_object_free(ScaleObject* self)
Frees the ScaleObject.
void track_init(Track* self, const int add_lane)
Inits the Track, optionally adding a single lane.
auto track_new(TrackType type, char* label, const int with_lane) -> Track*
Creates a track with the given label and returns it.
auto track_clone(Track* track) -> Track*
Clones the track and returns the clone.
static auto track_type_has_channel(TrackType type) -> int
Returns if the given TrackType is a type of Track that has a Channel.
void track_set_muted(Track* track, int mute, int trigger_undo)
Sets track muted and optionally adds the action to the undo stack.
void track_set_recording(Track* track, int recording)
Sets recording and connects/disconnects the JACK ports.
void track_set_soloed(Track* track, int solo, int trigger_undo)
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, Region* region, AutomationTrack* at, int lane_pos, int gen_name, int fire_events)
Adds a Region to the given lane or AutomationTrack of the track.
void track_write_to_midi_file(const 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_remove_region(Track* track, Region* region, int fire_events, int free)
Removes the region from the track.
auto track_get_region_at_pos(const Track* track, const Position* pos) -> Region*
Returns the region at the given position, or NULL.
auto track_get_last_region(Track* track) -> Region*
Returns the last Region in the track, or NULL.
static auto track_type_can_record(const TrackType type) -> int
Returns if the Track can record.
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.
auto track_get_fader_automatable(Track* track) -> Automatable*
Wrapper for track types that have fader automatables.
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(Track* track, const char* name)
Setter for the track name.
void track_add_modulator(Track* track, Modulator* modulator)
Adds and connects a Modulator to the Track.
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_get_passthrough_processor_type(const Track* track) -> PassthroughProcessorType
Returns the PassthroughProcessorType 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_free(Track* track)
Wrapper for each track type.
void track_lane_init_loaded(TrackLane* lane)
Inits the TrackLane after a project was loaded.
auto track_lane_new(Track* track, int pos) -> TrackLane*
Creates a new TrackLane at the given pos in the given Track.
void track_lane_add_region(TrackLane* self, Region* region)
Adds a Region to the given TrackLane.
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, const int set_pointers)
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(const 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)
Inits a TrackProcessor after a project is loaded.
void track_processor_init(TrackProcessor* self, Track* track)
Inits the TrackProcessor to default values.
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_members(TrackProcessor* self)
Frees the members of 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.
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, int rm_pl, int free, int publish_events, int 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.
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).
static auto tracklist_track_name_is_unique(Tracklist* self, const char* name) -> 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.
void transport_init(Transport* self, int loading)
Initialize transport.
void transport_set_bpm(Transport* self, float bpm)
Sets BPM and does any necessary processing (like notifying interested parties).
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(Position* target, int panic)
Moves playhead to given pos.
void transport_set_loop(Transport* self, int 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.
auto transport_frames_add_frames(const Transport* self, const long gframes, const nframes_t frames) -> long
Adds frames to the given global frames, while adjusting the new frames to loop back if the loop point was crossed.
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_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;.
void velocity_init_loaded(Velocity* self)
Init after loading a Project.
auto velocity_new(MidiNote* midi_note, const uint8_t vel, const int is_main) -> 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.
void velocity_set_cache_vel(Velocity* velocity, const uint8_t vel)
Sets the cached value for use in live actions.
auto velocity_find(Velocity* clone) -> Velocity*
Finds the actual Velocity in the project from the given clone.
auto velocity_clone(Velocity* src, VelocityCloneFlag flag) -> Velocity*
Clones the Velocity.
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, ArrangerObjectUpdateFlag update_flag)
Sets the velocity to the given value.
void velocity_free(Velocity* self)
Destroys the velocity instance.

Variables

int index
Index in its parent.
Port* port
Pointer to the Port, if plugin port.
PortIdentifier* port_id
Port identifier, used when saving/loading so we can fetch the port.
Lv2Control* control
Pointer to the control, if LV2 plugin.
Track* track
Associated track.
int track_id
Used when saving/loading projects.
int slot
Slot, if plugin automation.
Plugin* plugin
Plugin, for convenience, if plugin automation.
char* label
Human friendly label.
AutomatableType type
Volume/pan/plugin control/etc.
static const Position POSITION_START_POS
Default start position to be used for setting structs equal (i.e., new_pos = POSITION_START_POS), and calculations.

Defines

#define automation_point_get_main_automation_point(r)
Gets the main counterpart of the AutomationPoint.
#define automation_point_get_main_trans_automation_point(r)
Gets the transient counterpart of the AutomationPoint.
#define chord_object_get_main_chord_object(r)
Gets the main counterpart of the ChordObject.
#define chord_object_get_main_trans_chord_object(r)
Gets the transient counterpart of the ChordObject.
#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 engine_is_port_own(self, port)
Returns 1 if the port is an engine port or control room port, otherwise 0.
#define marker_get_main_marker(r)
Gets the main counterpart of the Marker.
#define marker_get_main_trans_marker(r)
Gets the transient counterpart of the Marker.
#define midi_note_get_main_trans_midi_note(r)
Gets the transient counterpart of the MidiNote.
#define midi_note_get_main_midi_note(r)
Gets the main counterpart of the MidiNote.
#define midi_note_should_be_visible(mn)
Returns if MidiNote is (should be) visible.
#define PORT_NOT_OWNED
Special ID for owner_pl, owner_ch, etc.
#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_is_between(_pos, _start, _end)
Returns if _pos is after or equal to _start and before _end.
#define DEFINE_START_POS
Start Position to be used in calculations.
#define POSITION_INIT_ON_STACK(name)
Inits the default position on the stack.
#define position_init(__pos)
Initializes given position.
#define POSITION_MOVE_BY_TICKS(_tmp_pos, _use_cached, _obj, _pos_name, _ticks, _update_flag)
Moves the Position of an object only has a start position defined by the argument pos_name and a cache position named cache_##pos_name by the given amount of ticks.
#define POSITION_MOVE_BY_TICKS_W_LENGTH(_tmp_pos, _use_cached, _obj, _ticks, _update_flag)
Moves the Position of an object that has a start and end position named start_pos and end_pos and cached positions named cache_start_pos and cache_end_pos by given amount of ticks.
#define position_set_to_pos(_pos, _target)
Sets position to target position.
#define region_get_lane_region(r)
Gets the TrackLane counterpart of the Region.
#define region_get_main_region(r)
Gets the non-TrackLane counterpart of the Region.
#define region_get_lane_trans_region(r)
Gets the TrackLane counterpart of the Region (transient).
#define region_get_main_trans_region(r)
Gets the non-TrackLane counterpart of the Region (transient).
#define region_should_be_visible(mn)
Returns if Region is (should be) visible.
#define scale_object_get_main_scale_object(r)
Gets the main counterpart of the ScaleObject.
#define scale_object_get_main_trans_scale_object(r)
Gets the transient counterpart of the ScaleObject.
#define VELOCITY_DEFAULT
Default velocity.
#define velocity_get_main_trans_velocity(r)
Gets the transient counterpart of the Velocity.
#define velocity_get_main_velocity(r)
Gets the main counterpart of the Velocity.
#define velocity_is_selected(vel)
Wrapper that calls midi_note_is_selected().
#define velocity_should_be_visible(vel)
Returns if Velocity is (should be) visible.

Enum documentation

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

Enumerators
MIDI_NOTE_CLONE_COPY_MAIN

Create a new MidiNote to be added to a Region as a main MidiNote.

MIDI_NOTE_CLONE_COPY

Create a new MidiNote that will not be used as a main MidiNote.

MIDI_NOTE_CLONE_LINK

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

Flag do indicate how to clone the Region.

Enumerators
REGION_CLONE_COPY_MAIN

Create a new Region to be added to a Track as a main Region.

REGION_CLONE_COPY

Create a new Region that will not be used as a main Region.

REGION_CLONE_LINK

TODO.

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.

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 TrackType

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

Enumerators
VELOCITY_CLONE_COPY_MAIN

Create a new Velocity to be added to a MidiNote as a main Velocity.

VELOCITY_CLONE_COPY

Create a new Velocity that will not be used as a main Velocity.

Typedef documentation

typedef struct Automatable Automatable

An automatable control.

These are not meant to be serialized and are generated at run time.

typedef struct ChordDescriptor ChordDescriptor

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

Chord objects should include a ChordDescriptor.

typedef struct AudioClip AudioClip

Audio clips for the pool.

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

typedef 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 MidiEvents MidiEvents

Container for passing midi events through ports.

This should be passed in the data field of MIDI Ports

typedef struct PassthroughProcessor PassthroughProcessor

A simple processor that copies the buffers of its inputs to its outputs.

Used for the pre fader processor.

typedef struct AudioPool AudioPool

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

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

typedef struct 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 StereoPorts StereoPorts

L & R port, for convenience.

Must ONLY be created via stereo_ports_new()

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

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

It is uniquely identified using its name (and ArrangerObjectInfo type), so name must be unique throughout the Project.

Each main Region must have its obj_info member filled in with clones.

typedef enum GraphNodeType GraphNodeType

Graph nodes can be either ports or processors.

Processors can be plugins, faders, etc.

typedef struct Track Track

Track to be inserted into the Project's Tracklist.

Each Track contains a Channel with Plugins.

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

typedef struct TrackLane TrackLane

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

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

typedef struct Tracklist Tracklist

The Tracklist contains all the tracks in the Project.

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

typedef struct MidiEvents MidiEvents

Container for passing midi events through ports.

This should be passed in the data field of MIDI Ports

Function documentation

AudioRegion* audio_region_new(const int pool_id, const char* filename, const float* frames, const long nframes, const channels_t channels, const Position* start_pos, const int is_main)

Creates a Region for audio data.

Parameters
pool_id The pool ID. This is used if not -1.
filename Filename, if loading from file, otherwise NULL.
frames Float array, if loading from float array, otherwise NULL.
nframes Number of frames per channel.
channels
start_pos
is_main

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

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

void audio_region_free_members(AudioRegion* self)

Frees members only but not the audio region itself.

Regions should be free'd using region_free.

char* automatable_stringize_value_type(Automatable* a)

Returns the type of its value (float, bool, etc.) as a string.

Must be free'd.

float automatable_real_val_to_normalized(Automatable* self, float real_val)

Converts real value (eg.

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

float automatable_normalized_val_to_real(Automatable* self, float normalized_val)

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

-10.0 to 100.0).

float automatable_get_val(Automatable* self)

Gets the current value of the parameter the automatable is for.

This does not consider the automation track, it only looks in the actual parameter for its current value.

void automatable_set_val_from_normalized(Automatable* self, float val, int automating)

Updates the actual value.

Parameters
self
val
automating 1 if this is from an automation event. This will set Lv2Port's automating field to 1 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.

AutomationCurve* automation_curve_new(const AutomatableType a_type, const Position* pos)

Creates an AutomationCurve.

Parameters
a_type The AutomationType, used to figure out the AutomationCurve type.
pos

double automation_curve_get_normalized_value(AutomationCurve* ac, double x)

The function to return a point on the curve.

Parameters
ac 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_curve_free(AutomationCurve* ap)

Frees the automation point.

Frees the automation point.

AutomationPoint* automation_point_new_float(const float value, const Position* pos, int is_main)

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

Parameters
value
pos
is_main Whether this AutomationPoint will be the main counterpart (see ArrangerObjectInfo).

void automation_point_update_fvalue(AutomationPoint* ap, float fval, ArrangerObjectUpdateFlag update_flag)

Updates the value and notifies interested parties.

Returns Whether moved or not. FIXME always call this after move !!!!!!!!! Updates the value from given real value and notifies interested parties.

Updates the value and notifies interested parties.

void automation_point_free(AutomationPoint* ap)

Frees the automation point.

Frees the automation point.

Region* automation_region_new(const Position* start_pos, const Position* end_pos, const int is_main)

Creates a new Region for automation.

Parameters
start_pos
end_pos
is_main If this is 1 it will create the additional Region ( main_transient).

void automation_region_add_ac(Region* self, AutomationCurve* ac)

Adds the given AutomationCurve.

double array size if full

AutomationPoint* automation_region_get_prev_ap(Region* self, AutomationPoint* ap)

Returns the AutomationPoint before the position.

Returns the AutomationPoint before the position.

AutomationPoint* automation_region_get_next_ap(Region* self, AutomationPoint* ap)

Returns the AutomationPoint after the position.

Returns the AutomationPoint after the position.

void automation_region_remove_ap(Region* self, AutomationPoint* ap, int free)

Removes the given AutomationPoint from the Region.

Parameters
self
ap
free Optionally free the AutomationPoint.

Removes the given AutomationPoint from the Region.

void automation_region_remove_ac(Region* self, AutomationCurve* ac, int free)

Removes the given AutomationCurve from the Region.

Parameters
self
ac
free Optionally free the AutomationCurve.

Removes the given AutomationCurve from the Region.

void automation_region_free_members(Region* self)

Frees members only but not the Region itself.

Regions should be free'd using region_free.

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

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

The array must be large enough.

void channel_connect(Channel* ch)

Connects the channel's ports.

Connect MIDI in and piano roll to MIDI out.

void channel_prepare_process(Channel* channel)

Prepares the channel for processing.

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

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, int pos, Plugin* plugin, int confirm, int gen_automatables, int recalc_graph)

Adds given plugin to given position in the strip.

Parameters
channel The Channel.
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.
Returns 1 if plugin added, 0 if not.

The plugin must be already instantiated at this point.

int channel_get_index(Channel* channel)

Returns the index on the mixer.

where is this used?

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.

Parameters
channel
connect Connect or not.
recalc_graph

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

Automatable* channel_get_automatable(Channel* channel, AutomatableType type)

Convenience function to get the fader automatable of the channel.

Convenience function to get the fader automatable of the channel.

void channel_generate_automation_tracks(Channel* channel)

Generates automatables for the channel.

Should be called as soon as the track is created.

Generates automatables for the channel.

Should be called as soon as the track is created.

void channel_remove_plugin(Channel* channel, int pos, int deleting_plugin, int deleting_channel, int recalc_graph)

Removes a plugin at pos from the channel.

Parameters
channel
pos
deleting_plugin
deleting_channel
recalc_graph Recalculate mixer graph.

If deleting_channel is 1, the automation tracks associated with he plugin are not deleted at this time.

This function will always recalculate the graph in order to avoid situations where the plugin might be used during processing.

If deleting_channel is 1, the automation tracks associated with the plugin are not deleted at this time.

This function will always recalculate the graph in order to avoid situations where the plugin might be used during processing.

Channel* channel_clone(Channel* ch, Track* track)

Clones the channel recursively.

Parameters
ch
track The track to use for getting the name.

Note the given track is not cloned.

void channel_disconnect(Channel* channel, int remove_pl, int recalc_graph)

Disconnects the channel from the processing chain.

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

Channels should never be free'd by themselves in normal circumstances. Use track_free to free them.

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_string(ChordDescriptor* chord)

Returns the chord in human readable string.

MUST be free'd by caller.

ChordObject* chord_object_find_by_pos(ChordObject* clone)

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

Used in actions.

Region* chord_region_new(const Position* start_pos, const Position* end_pos, const int is_main)

Creates a new Region for chords.

Parameters
start_pos
end_pos
is_main If this is 1 it will create the additional Region ( main_transient).

void chord_region_remove_chord_object(Region* self, ChordObject* chord, int free)

Removes a ChordObject from the Region.

Parameters
self
chord
free Optionally free the ChordObject.

void chord_region_free_members(Region* self)

Frees members only but not the Region itself.

Regions should be free'd using region_free.

ChordTrack* chord_track_new(void)

Creates a new chord Track.

Creates a new chord Track.

void chord_track_init(Track* track)

Inits a chord track (e.g.

when cloning).

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

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 engine_realloc_port_buffers(AudioEngine* self, nframes_t buf_size)

reallocate port buffers to new size

void engine_init(AudioEngine* self, int loading)

Init audio engine.

loading is 1 if loading a project.

init audio pool

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_fill_out_bufs(AudioEngine* self, const nframes_t nframes)

Called to fill in the external buffers at the end of the processing cycle.

Called to fill in the external buffers at the end of the processing cycle.

char* exporter_stringize_audio_format(AudioFormat format)

Returns the audio format as string.

Must be g_free()'d by caller.

void exporter_export(ExportSettings* info)

Exports an audio file based on the given settings.

TODO move some things into functions.

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_ports_get(PortType type, PortFlow flow, int hw, ExtPort** ports, int* size)

Collects external ports of the given type.

Parameters
type
flow
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.

void fader_init(Fader* self, FaderType type, Channel* ch)

Inits fader to default values.

Parameters
self The Fader to init.
type The FaderType.
ch Channel, if this is a channel Fader.

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_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 instrument_track_free(InstrumentTrack* track)

Frees the track.

TODO

Marker* marker_find(Marker* clone)

Finds the marker in the project corresponding to the given one.

Finds the marker in the project corresponding to the given one.

void marker_track_add_marker(MarkerTrack* self, Marker* marker)

Adds a Marker to the Track.

\

Generates a widget for the Marker.

void master_track_free(Track* track)

Frees the track.

TODO

MidiEvents* midi_events_new(Port* port)

Allocates and inits a MidiEvents struct.

Parameters
port Owner Port.

void midi_events_append(MidiEvents* src, MidiEvents* dest, const nframes_t start_frame, const nframes_t nframes, int 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_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.

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_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, midi_byte_t pitchbend, midi_time_t time, int queued)

Adds a control event to the given MidiEvents.

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

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_panic_all(int queued)

Queues MIDI note off to event queues.

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

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(MidiRegion* region, Position* start_pos, Position* end_pos, uint8_t val, uint8_t vel, int is_main)

Parameters
region
start_pos
end_pos
val
vel
is_main Is main MidiNote. If this is 1 then arranger_object_info_init_main() is called to create a transient midi note in obj_info.

int midi_note_is_equal(MidiNote* src, MidiNote* dest)

Returns 1 if the MidiNotes match, 0 if not.

Returns 1 if the MidiNotes match, 0 if not.

void midi_note_shift_pitch(MidiNote* self, const int delta, ArrangerObjectUpdateFlag update_flag)

Shifts MidiNote's position and/or value.

Parameters
self
delta Y (0-127)
update_flag

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.

MidiRegion* midi_region_new(const Position* start_pos, const Position* end_pos, int is_main)

Creates a new Region for MIDI notes.

Parameters
start_pos
end_pos
is_main Is main Region. If this is 1 it will create the 3 additional Regions (lane, lane_transient & main_transient).

void midi_region_add_midi_note(MidiRegion* region, MidiNote* midi_note)

Adds midi note to region.

Adds midi note to region.

MidiNote* midi_region_pop_unended_note(MidiRegion* 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(Region* self)

Prints the MidiNotes in the Region.

Used for debugging.

void midi_region_remove_midi_note(Region* 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_write_to_midi_file(const Region* self, MIDI_FILE* mf, const int add_region_start, const int export_full)

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.

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

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

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

Exports the Region 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.

MidiEvents* midi_region_get_as_events(const Region* 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(MidiRegion* self)

Frees members only but not the midi region itself.

Regions should be free'd using region_free.

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
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 passthrough_processor_init(PassthroughProcessor* self, PassthroughProcessorType type, Channel* ch)

Inits passthrough_processor to default values.

Parameters
self The PassthroughProcessor to init.
type
ch Channel.

This assumes that the channel has no plugins.

void passthrough_processor_process(PassthroughProcessor* self, const nframes_t g_frames, const nframes_t nframes)

Process the PassthroughProcessor.

Parameters
self
g_frames The global start frames.
nframes The number of frames to process.

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.

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

void port_init_loaded(Port* port)

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_find_from_identifier(PortIdentifier* id)

Finds the Port corresponding to the identifier.

Parameters
id The PortIdentifier to use for searching.

Port* port_new(const char* label)

Creates port.

Sets id and updates appropriate counters.

Port* port_new_with_data(PortInternalType internal_type, PortType type, PortFlow flow, const char* label, void* data)

Creates port and adds given data to it.

Parameters
internal_type The internal data format.
type
flow
label
data The data.

TODO semaphore

TODO end semaphore

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

Creates blank stereo ports.

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.

char* port_get_full_designation(const Port* self)

Returns a full designation of the port in the format "Track/Port" or "Track/Plugin/Port".

Must be free'd.

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_connect(Port* src, Port* dest, const int locked)

Connets src to dest.

Parameters
src
dest
locked Lock the connection or not.

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 nframes_t start_frame, const nframes_t nframes, const int noroll)

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

Parameters
port
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_plugin(Port* port, Plugin* pl)

Sets the owner plugin & its ID.

Sets the owner plugin & its ID.

void port_print_connections_all(void)

Prints all connections.

src->owner_tr &&

src->owner_backend)

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.

void position_set_tick(Position* position, long 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).

long position_to_frames(const Position* position)

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

Note: transport must be setup by this point.

void position_from_seconds(Position* position, double secs)

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

TODO

void position_snap(const Position* prev_pos, Position* pos, Track* track, Region* 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 Region 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 Position to set.
snap The SnapGrid.

FIXME rename to something more meaningful.

FIXME rename to something more meaningful.

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

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

Parameters
start_pos
end_pos
pos Position to set to.

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

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

char* quantize_options_stringize(NoteLength note_length, NoteType note_type)

Returns the grid intensity as a human-readable string.

Must be free'd.

Returns the grid intensity as a human-readable string.

Must be free'd.

int 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 region_init(Region* region, const Position* start_pos, const Position* end_pos, const int is_main)

Only to be used by implementing structs.

Parameters
region
start_pos
end_pos
is_main Is main Region. If this is 1 then arranger_object_info_init_main() is called to create 3 additional regions in obj_info.

Region* region_find(Region* r)

Finds the region corresponding to the given one.

This should be called when we have a copy or a clone, to get the actual region in the project.

Region* region_find_by_name(const char* name)

Looks for the Region under the given name.

Warning: very expensive function.

void region_split(Region* region, const Position* pos, const int pos_is_local, Region** r1, Region** r2)

Splits the given Region at the given Position, deletes the original Region and adds 2 new Regions in the same parent (Track or AutomationTrack).

Parameters
region The Region to split. This Region will be deleted.
pos The Position to split at.
pos_is_local If the position is local (1) or global (0).
r1 Address to hold the pointer to the newly created region 1.
r2 Address to hold the pointer to the newly created region 2.

The given region must be the main region, as this will create 2 new main regions.

void region_unsplit(Region* r1, Region* r2, Region** region)

Undoes what region_split() did.

Parameters
r1 The first region.
r2 The second Region.
region An address to store the newly created Region.

MidiNote* region_find_midi_note(Region* 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(const Region* 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_move_to_lane(Region* region, TrackLane* lane, const int tmp)

Moves the given Region to the given TrackLane.

Parameters
region
lane
tmp If the Region should be moved temporarily (the tmp_lane member will be used instead of actually moving).

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

Maintains the selection status of the Region.

Assumes that the Region is already in a TrackLane.

void region_move_to_track(Region* region, Track* track, const int tmp)

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

Parameters
region
track
tmp If the Region should be moved temporarily (the tmp_lane member will be used instead of actually moving).

Assumes that the Region is already in a TrackLane.

void region_copy(Region* src, Region* dest)

Copies the data from src to dest.

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

void region_resize(Region* region, const int left, const long ticks, const int loop, ArrangerObjectUpdateFlag update_flag)

Resizes the object on the left side or right side by given amount of ticks.

Parameters
region
left 1 to resize left side, 0 to resize right side.
ticks Number of ticks to resize.
loop Whether this is a loop-resize (1) or a normal resize (0).
update_flag ArrangerObjectUpdateFlag.

int region_is_hit(const Region* 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.

Region* region_at_position(Track* track, Position* pos)

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

Parameters
track The track to look in.
pos The position.

FIXME with lanes there can be multiple positions.

char* region_generate_filename(Region* region)

Generates the filename for this region.

MUST be free'd.

MUST be free'd.

FIXME logic needs changing

Region* region_clone(Region* region, RegionCloneFlag flag)

Clone region.

Creates a new region and either links to the original or copies every field.

void region_disconnect(Region* self)

Disconnects the region and anything using it.

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

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

int graph_validate(Router* router, const Port* src, const Port* dest)

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

Returns 1 for ok, 0 for invalid.

int graph_start(Graph* graph)

Starts as many threads as there are cores.

Returns 1 if graph started, 0 otherwise.

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

Process the samples for the given number of frames.

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

char* musical_scale_to_string(MusicalScale* scale)

Prints the MusicalScale to a string.

MUST be free'd.

int musical_scale_is_key_in_scale(MusicalScale* scale, MusicalNote key)

Returns if the given key is in the given MusicalScale.

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

char* musical_scale_as_string(MusicalScale* scale)

Returns the scale in human readable string.

MUST be free'd by caller.

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, char* label, const int with_lane)

Creates a track with the given label and returns it.

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

void track_set_soloed(Track* track, int solo, int trigger_undo)

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

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

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

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

Parameters
track
region
at The AutomationTrack of this Region, 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 Region must be the main region (see ArrangerObjectInfo).

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

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

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_remove_region(Track* track, Region* region, int fire_events, int free)

Removes the region from the track.

free Also free the Region.

Removes the region from the track.

free Also free the Region.

Region* track_get_last_region(Track* track)

Returns the last Region in the track, or NULL.

Returns the last Region in the track, or NULL.

Automatable* track_get_fader_automatable(Track* track)

Wrapper for track types that have fader automatables.

Otherwise returns NULL.

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.

Getter for the track name.

void track_set_name(Track* track, const char* name)

Setter for the track name.

If the track name is duplicate, it discards the new name.

If the track name is duplicate, it discards the new name.

Must only be called from the GTK thread.

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

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

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

void track_lane_set_track_pos(TrackLane* self, const int pos, const int set_pointers)

Sets the track position to the lane and all its members recursively.

Parameters
self
pos
set_pointers Sets the Track pointers as well.

TrackLane* track_lane_clone(TrackLane* lane)

Clones the TrackLane.

Mainly used when cloning Track's.

void track_processor_init_loaded(TrackProcessor* self)

Inits a TrackProcessor after a project is loaded.

Inits a TrackProcessor after a project is loaded.

void track_processor_init(TrackProcessor* self, Track* track)

Inits the TrackProcessor to default values.

Parameters
self The TrackProcessor to init.
track The owner Track.

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.

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

Removes a track from the Tracklist and the TracklistSelections.

Parameters
self
track
rm_pl Remove plugins or not.
free Free the track or not (free later).
publish_events Push a track deleted event to the UI.
recalc_graph Recalculate the mixer graph.

Also disconnects the channel.

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

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

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

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

Returns the Track after delta visible Track's.

Negative delta searches backwards.

void transport_set_beat_unit(Transport* self, int beat_unit)

Updates beat unit and anything depending on it.

Regarding calculation: 3840 = TICKS_PER_QUARTER_NOTE * 4 to get the ticks per full note. Divide by beat unit (e.g. if beat unit is 2, it means it is a 1/2th note, so multiply 1/2 with the ticks per note

void transport_move_playhead(Position* target, int panic)

Moves playhead to given pos.

Parameters
target Position to set to.
panic Send MIDI panic or not.

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

long transport_frames_add_frames(const Transport* self, const long gframes, const nframes_t frames)

Adds frames to the given global frames, while adjusting the new frames to loop back if the loop point was crossed.

Returns The new frames adjusted.

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.

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.

void velocity_set_val(Velocity* self, const int val, ArrangerObjectUpdateFlag update_flag)

Sets the velocity to the given value.

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

Variable documentation

PortIdentifier* port_id

Port identifier, used when saving/loading so we can fetch the port.

It is a pointer so it can be NULL.

Lv2Control* control

Pointer to the control, if LV2 plugin.

When loading, this can be fetched using the port.

FIXME use a getter, having this everywhere is confusing.

Define documentation

#define PORT_NOT_OWNED

Special ID for owner_pl, owner_ch, etc.

to indicate that the port is not owned.

#define position_compare(p1, p2)

Compares 2 positions based on their frames.

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

#define position_init(__pos)

Initializes given position.

Assumes the given argument is a Pointer *.

#define POSITION_MOVE_BY_TICKS(_tmp_pos, _use_cached, _obj, _pos_name, _ticks, _update_flag)

Moves the Position of an object only has a start position defined by the argument pos_name and a cache position named cache_##pos_name by the given amount of ticks.

Parameters
_tmp_pos A Position variable to use for calculations so we don't create one in the macro.
_use_cached An int variable set to 1 for using the cached positions or 0 for moving the normal positions.
_obj The object.
_pos_name The name of the position.
_ticks The number of ticks to move by.
_update_flag

This also assumes that there is a SET_POS defined. See audio/chord_object.c for an example.

This doesn't allow the start position to be less than 1.1.1.0.

#define POSITION_MOVE_BY_TICKS_W_LENGTH(_tmp_pos, _use_cached, _obj, _ticks, _update_flag)

Moves the Position of an object that has a start and end position named start_pos and end_pos and cached positions named cache_start_pos and cache_end_pos by given amount of ticks.

Parameters
_tmp_pos A Position variable to use for calculations so we don't create one in the macro.
_use_cached An int variable set to 1 for using the cached positions or 0 for moving the normal positions.
_obj The object.
_ticks The number of ticks to move by.
_update_flag ArrangerObjectUpdateFlag.

This also assumes that there is a SET_POS defined. See audio/region.c for an example.

This doesn't allow the start position to be less than 1.1.1.0.

#define position_set_to_pos(_pos, _target)

Sets position to target position.

Assumes each position is Position *.

#define region_get_lane_region(r)

Gets the TrackLane counterpart of the Region.

Only applies to Regions that have lanes.

#define region_get_lane_trans_region(r)

Gets the TrackLane counterpart of the Region (transient).

Only applies to Regions that have lanes.