Zrythm v2.0.0-alpha.1
a highly automated and intuitive digital audio workstation
Loading...
Searching...
No Matches
zrythm::dsp::Transport Class Reference

The Transport class represents the transport controls and state for an audio engine. More...

#include <src/dsp/transport.h>

Inheritance diagram for zrythm::dsp::Transport:
Collaboration diagram for zrythm::dsp::Transport:

Data Structures

struct  ConfigProvider
class  TransportSnapshot

Public Types

enum class  Display { BBT , Time }
 Corrseponts to "transport-display" in the gsettings. More...
enum class  RecordingMode { OverwriteEvents , MergeEvents , Takes , TakesMuted }
 Recording mode for MIDI and audio. More...
using PlayState = dsp::ITransport::PlayState

Public Member Functions

 Transport (const dsp::TempoMapWrapper &tempo_map_wrapper, ConfigProvider config_provider, QObject *parent=nullptr)
bool loopEnabled () const
void setLoopEnabled (bool enabled)
Q_SIGNAL void loopEnabledChanged (bool enabled)
bool recordEnabled () const
void setRecordEnabled (bool enabled)
Q_SIGNAL void recordEnabledChanged (bool enabled)
bool punchEnabled () const
void setPunchEnabled (bool enabled)
Q_SIGNAL void punchEnabledChanged (bool enabled)
PlayState getPlayState () const
void setPlayState (PlayState state)
Q_SIGNAL void playStateChanged (PlayState state)
dsp::PlayheadQmlWrapperplayhead () const
dsp::TimelinePositioncuePosition () const
dsp::TimelinePositionloopStartPosition () const
dsp::TimelinePositionloopEndPosition () const
dsp::TimelinePositionpunchInPosition () const
dsp::TimelinePositionpunchOutPosition () const
Q_INVOKABLE void requestPause ()
 Request pause.
Q_INVOKABLE void requestRoll ()
 Request playback.
Q_INVOKABLE void movePlayhead (double ticks, bool setCuePoint)
 Moves the playhead to the given tick position.
units::sample_t get_playhead_position_in_audio_thread () const noexcept
Q_INVOKABLE bool isRolling () const
Q_INVOKABLE bool isPaused () const
void add_to_playhead_in_audio_thread (const dsp::Transport::TransportSnapshot &transport_snapshot, units::sample_t nframes) noexcept
 Moves the playhead by the time corresponding to given samples, taking into account the loop end point.
void set_play_state_rt_safe (PlayState state)
void move_playhead (units::precise_tick_t target_ticks, bool set_cue_point)
 Moves playhead to given pos.
void goto_prev_or_next_marker (bool prev, utils::RangeOf< units::precise_tick_t > auto &&extra_markers)
 Moves the playhead to the previous or next marker.
bool position_is_inside_punch_range (units::sample_t pos) const
auto playhead_ticks_before_pause () const
void consume_metronome_countin_samples (units::sample_t samples)
 For engine use only.
void consume_recording_preroll_samples (units::sample_t samples)
 For engine use only.
auto get_snapshot () const noexcept

Properties

QML_ELEMENT bool loopEnabled
bool recordEnabled
bool punchEnabled
zrythm::dsp::ITransport::PlayState playState
zrythm::dsp::PlayheadQmlWrapperplayhead
zrythm::dsp::TimelinePositioncuePosition
zrythm::dsp::TimelinePositionloopStartPosition
zrythm::dsp::TimelinePositionloopEndPosition
zrythm::dsp::TimelinePositionpunchInPosition
zrythm::dsp::TimelinePositionpunchOutPosition

Friends

void init_from (Transport &obj, const Transport &other, utils::ObjectCloneType clone_type)
void to_json (nlohmann::json &j, const Transport &transport)
void from_json (const nlohmann::json &j, Transport &transport)

Detailed Description

The Transport class represents the transport controls and state for an audio engine.

It manages playback, recording, and other transport-related functionality.

Definition at line 47 of file transport.h.

Member Typedef Documentation

◆ PlayState

using zrythm::dsp::Transport::PlayState = dsp::ITransport::PlayState

Definition at line 70 of file transport.h.

Member Enumeration Documentation

◆ Display

Corrseponts to "transport-display" in the gsettings.

Definition at line 77 of file transport.h.

◆ RecordingMode

Recording mode for MIDI and audio.

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

Enumerator
OverwriteEvents 

Overwrite events in first recorded clip.

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

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

MergeEvents 

Merge events in existing clip.

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

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

Takes 

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

TakesMuted 

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

Definition at line 90 of file transport.h.

Member Function Documentation

◆ consume_metronome_countin_samples()

void zrythm::dsp::Transport::consume_metronome_countin_samples ( units::sample_t samples)
inline

For engine use only.

Parameters
samplesSamples to consume.

Definition at line 418 of file transport.h.

◆ consume_recording_preroll_samples()

void zrythm::dsp::Transport::consume_recording_preroll_samples ( units::sample_t samples)
inline

For engine use only.

Parameters
samplesSamples to consume.

Definition at line 429 of file transport.h.

◆ cuePosition()

dsp::TimelinePosition * zrythm::dsp::Transport::cuePosition ( ) const
inline

Definition at line 263 of file transport.h.

◆ get_playhead_position_in_audio_thread()

units::sample_t zrythm::dsp::Transport::get_playhead_position_in_audio_thread ( ) const
inlinenoexcept

Definition at line 309 of file transport.h.

◆ get_snapshot()

auto zrythm::dsp::Transport::get_snapshot ( ) const
inlinenoexcept

Definition at line 435 of file transport.h.

◆ getPlayState()

PlayState zrythm::dsp::Transport::getPlayState ( ) const
inline

Definition at line 255 of file transport.h.

◆ goto_prev_or_next_marker()

void zrythm::dsp::Transport::goto_prev_or_next_marker ( bool prev,
utils::RangeOf< units::precise_tick_t > auto && extra_markers )
inline

Moves the playhead to the previous or next marker.

Parameters
prevTrue for previous, false for next.

Definition at line 355 of file transport.h.

◆ isPaused()

Q_INVOKABLE bool zrythm::dsp::Transport::isPaused ( ) const
inline

Definition at line 321 of file transport.h.

◆ isRolling()

Q_INVOKABLE bool zrythm::dsp::Transport::isRolling ( ) const
inline

Definition at line 316 of file transport.h.

◆ loopEnabled()

bool zrythm::dsp::Transport::loopEnabled ( ) const
inline

Definition at line 243 of file transport.h.

◆ loopEndPosition()

dsp::TimelinePosition * zrythm::dsp::Transport::loopEndPosition ( ) const
inline

Definition at line 268 of file transport.h.

◆ loopStartPosition()

dsp::TimelinePosition * zrythm::dsp::Transport::loopStartPosition ( ) const
inline

Definition at line 264 of file transport.h.

◆ move_playhead()

void zrythm::dsp::Transport::move_playhead ( units::precise_tick_t target_ticks,
bool set_cue_point )

Moves playhead to given pos.

This is only for moves other than while playing and for looping while playing. For example it should be used for moves when the user clicks on a position in the ruler.

Should not be used during exporting.

Parameters
target_ticksPosition to set to.
set_cue_pointAlso set the cue point at this position.

◆ movePlayhead()

Q_INVOKABLE void zrythm::dsp::Transport::movePlayhead ( double ticks,
bool setCuePoint )

Moves the playhead to the given tick position.

This is intended for user-initiated playhead moves (e.g., clicking on the ruler).

Parameters
ticksThe target position in ticks.
setCuePointIf true, also sets the cue position to this position.

◆ playhead()

dsp::PlayheadQmlWrapper * zrythm::dsp::Transport::playhead ( ) const
inline

Definition at line 259 of file transport.h.

◆ playhead_ticks_before_pause()

auto zrythm::dsp::Transport::playhead_ticks_before_pause ( ) const
inline

Definition at line 408 of file transport.h.

◆ punchEnabled()

bool zrythm::dsp::Transport::punchEnabled ( ) const
inline

Definition at line 251 of file transport.h.

◆ punchInPosition()

dsp::TimelinePosition * zrythm::dsp::Transport::punchInPosition ( ) const
inline

Definition at line 272 of file transport.h.

◆ punchOutPosition()

dsp::TimelinePosition * zrythm::dsp::Transport::punchOutPosition ( ) const
inline

Definition at line 276 of file transport.h.

◆ recordEnabled()

bool zrythm::dsp::Transport::recordEnabled ( ) const
inline

Definition at line 247 of file transport.h.

Property Documentation

◆ cuePosition

zrythm::dsp::TimelinePosition * zrythm::dsp::Transport::cuePosition
read

Definition at line 56 of file transport.h.

◆ loopEnabled

QML_ELEMENT bool zrythm::dsp::Transport::loopEnabled
readwrite

Definition at line 51 of file transport.h.

◆ loopEndPosition

zrythm::dsp::TimelinePosition * zrythm::dsp::Transport::loopEndPosition
read

Definition at line 59 of file transport.h.

◆ loopStartPosition

zrythm::dsp::TimelinePosition * zrythm::dsp::Transport::loopStartPosition
read

Definition at line 57 of file transport.h.

◆ playhead

zrythm::dsp::PlayheadQmlWrapper * zrythm::dsp::Transport::playhead
read

Definition at line 55 of file transport.h.

◆ playState

zrythm::dsp::ITransport::PlayState zrythm::dsp::Transport::playState
readwrite

Definition at line 54 of file transport.h.

◆ punchEnabled

bool zrythm::dsp::Transport::punchEnabled
readwrite

Definition at line 53 of file transport.h.

◆ punchInPosition

zrythm::dsp::TimelinePosition * zrythm::dsp::Transport::punchInPosition
read

Definition at line 60 of file transport.h.

◆ punchOutPosition

zrythm::dsp::TimelinePosition * zrythm::dsp::Transport::punchOutPosition
read

Definition at line 61 of file transport.h.

◆ recordEnabled

bool zrythm::dsp::Transport::recordEnabled
readwrite

Definition at line 52 of file transport.h.


The documentation for this class was generated from the following file: