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

Transport API. More...

#include <stdint.h>
#include "dsp/port.h"
#include "dsp/region.h"
#include "utils/types.h"
#include "zix/sem.h"
Include dependency graph for transport.h:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Data Structures

struct  Transport
 The transport. More...
 

Macros

#define TIME_SIGNATURE_SCHEMA_VERSION   1
 
#define TRANSPORT_SCHEMA_VERSION   1
 
#define TRANSPORT   (AUDIO_ENGINE->transport)
 
#define TRANSPORT_DEFAULT_TOTAL_BARS   128
 
#define PLAYHEAD   (&TRANSPORT->playhead_pos)
 
#define TRANSPORT_IS_ROLLING   (TRANSPORT->play_state == PLAYSTATE_ROLLING)
 
#define TRANSPORT_IS_PAUSED   (TRANSPORT->play_state == PLAYSTATE_PAUSED)
 
#define TRANSPORT_IS_LOOPING   (TRANSPORT->loop)
 
#define TRANSPORT_IS_RECORDING   (TRANSPORT->recording)
 

Enumerations

enum  PrerollCountBars { PREROLL_COUNT_BARS_NONE , PREROLL_COUNT_BARS_ONE , PREROLL_COUNT_BARS_TWO , PREROLL_COUNT_BARS_FOUR }
 
enum  PlayState { PLAYSTATE_ROLL_REQUESTED , PLAYSTATE_ROLLING , PLAYSTATE_PAUSE_REQUESTED , PLAYSTATE_PAUSED }
 
enum  TransportDisplay { TRANSPORT_DISPLAY_BBT , TRANSPORT_DISPLAY_TIME }
 Corrseponts to "transport-display" in the gsettings. More...
 
enum  TransportRecordingMode { RECORDING_MODE_OVERWRITE_EVENTS , RECORDING_MODE_MERGE_EVENTS , RECORDING_MODE_TAKES , RECORDING_MODE_TAKES_MUTED }
 Recording mode for MIDI and audio. More...
 

Functions

NONNULL Transporttransport_new (AudioEngine *engine)
 Initialize transport.
 
void transport_init_loaded (Transport *self, AudioEngine *engine, Track *tempo_track)
 Initialize loaded transport.
 
Transporttransport_clone (const Transport *src)
 Clones the transport values.
 
void transport_prepare_audio_regions_for_stretch (Transport *self, TimelineSelections *sel)
 Prepares audio regions for stretching (sets the ZRegion::before_length).
 
bool transport_stretch_regions (Transport *self, TimelineSelections *sel, bool with_fixed_ratio, double time_ratio, bool force, GError **error)
 Stretches regions.
 
void transport_set_punch_mode_enabled (Transport *self, bool enabled)
 
void transport_set_start_playback_on_midi_input (Transport *self, bool enabled)
 
void transport_set_recording_mode (Transport *self, TransportRecordingMode mode)
 
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 signed_frame_t nframes)
 Moves the playhead by the time corresponding to given samples, taking into account the loop end point.
 
void transport_request_pause (Transport *self, bool with_wait)
 Request pause.
 
void transport_request_roll (Transport *self, bool with_wait)
 Request playback.
 
void transport_set_playhead_pos (Transport *self, Position *pos)
 Setter for playhead Position.
 
void transport_set_playhead_to_bar (Transport *self, int bar)
 
void transport_get_playhead_pos (Transport *self, Position *pos)
 Getter for playhead Position.
 
void transport_move_backward (Transport *self, bool with_wait)
 Move to the previous snap point on the timeline.
 
void transport_move_forward (Transport *self, bool with_wait)
 Move to the next snap point on the timeline.
 
bool transport_can_user_move_playhead (const Transport *self)
 Returns whether the user can currently move the playhead (eg, via the UI or via scripts).
 
void transport_move_playhead (Transport *self, const Position *target, bool panic, bool set_cue_point, bool fire_events)
 Moves playhead to given pos.
 
void transport_set_loop (Transport *self, bool enabled, bool with_wait)
 Enables or disables loop.
 
void transport_goto_start_marker (Transport *self)
 Moves the playhead to the start Marker.
 
void transport_goto_end_marker (Transport *self)
 Moves the playhead to the end Marker.
 
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_positions (Transport *self, bool update_from_ticks)
 Updates the frames in all transport positions.
 
void transport_position_add_frames (const Transport *self, Position *pos, const signed_frame_t frames)
 Adds frames to the given position similar to position_add_frames, except that it adjusts the new Position if the loop end point was crossed.
 
double transport_get_ppqn (Transport *self)
 Returns the PPQN (Parts/Ticks Per Quarter Note).
 
void transport_get_range_pos (Transport *self, bool first, Position *pos)
 Stores the position of the range in pos.
 
void transport_get_loop_range_pos (Transport *self, bool first, Position *pos)
 Stores the position of the range in pos.
 
void transport_set_has_range (Transport *self, bool has_range)
 Sets if the project has range and updates UI.
 
void transport_set_range (Transport *self, bool range1, const Position *start_pos, const Position *pos, bool snap)
 Set the range1 or range2 position.
 
void transport_set_loop_range (Transport *self, bool start, const Position *start_pos, const Position *pos, bool snap)
 Set the loop range.
 
bool transport_position_is_inside_punch_range (Transport *self, Position *pos)
 
void transport_recalculate_total_bars (Transport *self, ArrangerSelections *sel)
 Recalculates the total bars based on the last object's position.
 
void transport_update_total_bars (Transport *self, int total_bars, bool fire_events)
 Updates the total bars.
 
void transport_update_caches (Transport *self, int beats_per_bar, int beat_unit)
 
void transport_set_recording (Transport *self, bool record, bool with_wait, bool fire_events)
 Sets recording on/off.
 
void transport_free (Transport *self)
 

Detailed Description

Transport API.

Definition in file transport.h.