Zrythm v2.0.0-DEV
a highly automated and intuitive digital audio workstation
Loading...
Searching...
No Matches
zrythm::structure::tracks::PianoRollTrack Class Reference

Interface for a piano roll track. More...

#include <src/structure/tracks/piano_roll_track.h>

Inheritance diagram for zrythm::structure::tracks::PianoRollTrack:
Collaboration diagram for zrythm::structure::tracks::PianoRollTrack:

Public Member Functions

void write_to_midi_file (MIDI_FILE *mf, dsp::MidiEventVector *events, const dsp::Position *start, const dsp::Position *end, int track_index, bool lanes_as_tracks, bool use_track_pos)
 Writes the track to the given MIDI file.
uint8_t get_midi_ch (const arrangement::MidiRegion &midi_region) const
 Returns the MIDI channel that this region should be played on, starting from 1.
void clear_objects () override
 Removes all objects recursively from the track.
void get_regions_in_range (std::vector< arrangement::ArrangerObjectUuidReference > &regions, std::optional< signed_frame_t > p1, std::optional< signed_frame_t > p2) override
 Returns all the regions inside the given range, or all the regions if both p1 and p2 are NULL.
bool allow_only_specific_midi_channels () const
auto & midi_channels_to_allow () const
Public Member Functions inherited from zrythm::structure::tracks::RecordableTrack
bool get_recording () const
void set_recording (this auto &&self, bool recording)
 Sets recording and connects/disconnects the JACK ports.
std::optional< ArrangerObjectPtrVariant > get_recording_region () const
template<typename DerivedT>
void init_recordable_track (this DerivedT &self, GenericBoolGetter autoarm_enabled_checker)
 Initializes a recordable track.
Public Member Functions inherited from zrythm::structure::tracks::ProcessableTrack
 ProcessableTrack (const dsp::ITransport &transport, PortType signal_type, Dependencies dependencies)
AutomationTracklistautomationTracklist () const
Public Member Functions inherited from zrythm::structure::tracks::Track
bool has_piano_roll () const
bool is_folder () const
bool is_audio_group () const
bool is_midi_group () const
bool is_audio_bus () const
bool is_midi_bus () const
bool is_modulator () const
bool is_chord () const
bool is_marker () const
bool is_audio () const
bool is_instrument () const
bool is_midi () const
bool is_master () const
bool is_deletable () const
bool is_copyable () const
template<typename DerivedT>
requires std::derived_from<base_type<DerivedT>, Track> && FinalClass<base_type<DerivedT>>
double get_full_visible_height (this DerivedT &&self)
 Returns the full visible height (main height + height of all visible automation tracks + height of all visible lanes).
template<typename DerivedT>
requires std::derived_from<base_type<DerivedT>, Track> && FinalClass<base_type<DerivedT>>
bool multiply_heights (this DerivedT &&self, double multiplier, bool visible_only, bool check_only)
bool can_be_group_target () const
bool is_frozen () const
template<arrangement::RegionObject RegionT, FinalClass SelfT>
void insert_region (this SelfT &self, arrangement::ArrangerObjectUuidReference region_ref, AutomationTrack *at, std::optional< int > lane_pos, std::optional< int > idx, bool gen_name)
 Inserts a Region to the given lane or AutomationTrack of the track, at the given index.
template<arrangement::RegionObject RegionT>
void add_region (this auto &self, auto region_ref, AutomationTrack *at, std::optional< int > lane_pos, bool gen_name)
 Appends a Region to the given lane or AutomationTrack of the track.
void append_objects (std::vector< ArrangerObjectPtrVariant > &objects) const
 Appends all the objects in the track to objects.
void unselect_all ()
 Unselects all arranger objects in the track.
template<typename DerivedT>
requires std::derived_from<base_type<DerivedT>, Track> && FinalClass<base_type<DerivedT>>
bool contains_uninstantiated_plugin (this DerivedT &&self)
virtual void temporary_virtual_method_hack () const =0
utils::Utf8String get_name () const
 Getter for the track name.
bool set_name_with_action_full (const utils::Utf8String &name)
 Internally called by set_name_with_action().
void set_name_with_action (const utils::Utf8String &name)
 Setter to be used by the UI to create an undoable action.
void set_name (const Tracklist &tracklist, const utils::Utf8String &name, bool pub_events)
 Setter for the track name.
utils::Utf8String get_unique_name (const Tracklist &tracklist, const utils::Utf8String &name)
 Returns a unique name for a new track based on the given name.
auto get_input_signal_type () const
auto get_output_signal_type () const
template<typename DerivedT>
requires std::derived_from<base_type<DerivedT>, Track> && FinalClass<base_type<DerivedT>>
void get_plugins (this DerivedT &&self, std::vector< zrythm::plugins::Plugin * > &arr)
 Fills in the given array with all plugins in the track.
void track_freeze (bool freeze)
 Freezes or unfreezes the track.
bool is_enabled () const
bool enabled () const
bool disabled () const
int get_total_bars (const engine::session::Transport &transport, int total_bars) const
void set_caches (CacheType types)
 Set various caches (snapshots, track name hash, plugin input/output ports, etc).
utils::Utf8String generate_window_name_for_plugin (const plugins::Plugin &plugin) const
utils::Utf8String get_full_designation_for_port (const dsp::Port &port) const
virtual bool currently_muted () const
virtual bool currently_listened () const
virtual bool get_implied_soloed () const
 Returns whether the track is not soloed on its own but its direct out (or its direct out's direct out, etc.) is soloed.
virtual bool currently_soloed () const
void set_selection_status_getter (TrackSelectionStatusGetter getter)
void unset_selection_status_getter ()
auto & get_plugin_registry () const
auto & get_plugin_registry ()
auto & get_port_registry () const
auto & get_port_registry ()
auto & get_param_registry () const
auto & get_param_registry ()
auto & get_object_registry () const
auto & get_object_registry ()
auto get_type () const
auto get_icon_name () const
Public Member Functions inherited from zrythm::utils::UuidIdentifiableObject< Track >
UuidIdentifiableObjectoperator= (const UuidIdentifiableObject &other)=default
auto get_uuid () const
Public Member Functions inherited from zrythm::structure::tracks::LanedTrackImpl< MidiLane >
bool create_missing_lanes (int pos)
 Creates missing TrackLane's until pos.
void remove_empty_last_lanes ()
 Removes the empty last lanes of the Track (except the last one).
bool has_soloed_lanes () const
 Returns whether the track has any soloed lanes.
double get_visible_lane_heights () const
 Gets the total height of all visible lanes (if any).
void generate_lanes ()
 Generates lanes for the track.
int get_lane_index (const MidiLane &lane) const
MidiLaneget_lane_at (const size_t index)
Public Member Functions inherited from zrythm::structure::tracks::LanedTrack
void set_lanes_visible (bool visible)
 Set lanes visible and fire events.

Protected Member Functions

void set_playback_caches () override
 Set the playback caches for a track.
Protected Member Functions inherited from zrythm::structure::tracks::RecordableTrack
 RecordableTrack (const dsp::ITransport &transport, ProcessableTrack::Dependencies dependencies)
dsp::ProcessorParameterget_recording_param () const
Protected Member Functions inherited from zrythm::structure::tracks::Track
 Track (Type type, PortType in_signal_type, PortType out_signal_type, BaseTrackDependencies dependencies)
 Constructor to be used by subclasses.
void add_region_if_in_range (std::optional< signed_frame_t > p1, std::optional< signed_frame_t > p2, std::vector< arrangement::ArrangerObjectUuidReference > &regions, arrangement::ArrangerObjectUuidReference region)

Friends

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

Additional Inherited Members

Public Types inherited from zrythm::structure::tracks::ProcessableTrack
using Dependencies = AutomationTrackHolder::Dependencies
Public Types inherited from zrythm::structure::tracks::Track
using Plugin = plugins::Plugin
using PluginUuid = Plugin::Uuid
using PortType = dsp::PortType
using PluginRegistry = plugins::PluginRegistry
using PluginPtrVariant = PluginRegistry::VariantType
using PluginSlot = plugins::PluginSlot
using ArrangerObject = structure::arrangement::ArrangerObject
using ArrangerObjectPtrVariant
using ArrangerObjectRegistry = structure::arrangement::ArrangerObjectRegistry
using Type = ::TrackTypeWrapper::TrackType
using TrackSelectionStatusGetter = std::function<bool (const Track::Uuid &)>
using Color = utils::Color
Public Types inherited from zrythm::structure::tracks::LanedTrackImpl< MidiLane >
using RegionT
using TrackLaneType
Static Public Member Functions inherited from zrythm::structure::tracks::Track
static constexpr bool type_can_have_direct_out (Type type)
static bool type_can_have_region_type (Type type, ArrangerObject::Type region_type)
static constexpr bool type_is_copyable (Type type)
static constexpr bool type_is_deletable (Type type)
 Returns whether a track of the given type should be deletable by the user.
static Type type_get_from_plugin_descriptor (const zrythm::plugins::PluginDescriptor &descr)
static consteval bool type_has_mono_compat_switch (const Type tt)
static constexpr bool type_is_compatible_for_moving (const Type type1, const Type type2)
 Returns if regions in tracks from type1 can be moved to type2.
static constexpr bool type_has_piano_roll (const Type type)
 Returns if the Track should have a piano roll.
static constexpr bool type_has_inputs (const Type type)
 Returns if the Track should have an inputs selector.
static bool type_can_be_group_target (const Type type)
 Returns if the Track can be a direct route target.
template<typename T>
static consteval Type get_type_for_class ()
static Trackfrom_variant (const TrackPtrVariant &variant)
static bool is_plugin_descriptor_valid_for_slot_type (const plugins::PluginDescriptor &descr, zrythm::plugins::PluginSlotType slot_type, Track::Type track_type)
 Returns if descr can be dropped at slot_type in a track of type track_type.
Data Fields inherited from zrythm::structure::tracks::RecordableTrack
dsp::ProcessorParameterUuidReference recording_id_
 Recording or not.
bool record_set_automatically_ = false
 Whether record was set automatically when the channel was selected.
std::optional< arrangement::ArrangerObject::Uuidrecording_region_
 Region currently recording on.
bool recording_start_sent_ = false
 This is a flag to let the recording manager know that a START signal was already sent for recording.
bool recording_stop_sent_ = false
 This is a flag to let the recording manager know that a STOP signal was already sent for recording.i.
bool recording_paused_ = false
 This must only be set by the RecordingManager when temporarily pausing recording, eg when looping or leaving the punch range.
Data Fields inherited from zrythm::structure::tracks::ProcessableTrack
utils::QObjectUniquePtr< TrackProcessorprocessor_
 The TrackProcessor, used for processing.
Data Fields inherited from zrythm::structure::tracks::LanedTrackImpl< MidiLane >
TrackLaneList lanes_
 Lanes in this track containing Regions.
std::vector< std::unique_ptr< MidiLane > > lane_snapshots_
 Snapshots used during playback.
Data Fields inherited from zrythm::structure::tracks::LanedTrack
bool lanes_visible_ = false
 Flag to set lanes visible or not.
int last_lane_idx_ = 0
 Lane index of region before recording paused.
int last_lane_created_ = 0
 Last lane created during this drag.
bool block_auto_creation_and_deletion_ = false
 Block auto-creating or deleting lanes.
Static Public Attributes inherited from zrythm::structure::tracks::Track
static constexpr int MIN_HEIGHT = 26
static constexpr int DEF_HEIGHT = 52
Protected Attributes inherited from zrythm::structure::tracks::Track
BaseTrackDependencies base_dependencies_
Type type_ {}
 The type of track this is.
utils::Utf8String name_
 Track name, used in channel too.
utils::Utf8String icon_name_
 Icon name of the track.
bool visible_ = true
 Whole Track is visible or not.
bool filtered_ = false
 Track will be hidden if true (temporary and not serializable).
double main_height_ { DEF_HEIGHT }
 Height of the main part (without lanes).
bool enabled_ = true
 Active (enabled) or not.
Color color_
 Track color.
PortType in_signal_type_ = {}
 The input signal type (eg audio bus tracks have audio input signals).
PortType out_signal_type_ = {}
 The output signal type (eg midi tracks have MIDI output signals).
utils::Utf8String comment_
 User comments.
std::optional< dsp::FileAudioSourceUuidReferencefrozen_clip_id_
 Pool ID of the clip if track is frozen (unset if not frozen).
std::optional< TrackSelectionStatusGetter > track_selection_status_getter_
 Track selection status getter.

Detailed Description

Interface for a piano roll track.

Definition at line 25 of file piano_roll_track.h.

Member Function Documentation

◆ allow_only_specific_midi_channels()

bool zrythm::structure::tracks::PianoRollTrack::allow_only_specific_midi_channels ( ) const
inline

Definition at line 73 of file piano_roll_track.h.

◆ clear_objects()

void zrythm::structure::tracks::PianoRollTrack::clear_objects ( )
overridevirtual

Removes all objects recursively from the track.

Reimplemented from zrythm::structure::tracks::Track.

◆ get_regions_in_range()

void zrythm::structure::tracks::PianoRollTrack::get_regions_in_range ( std::vector< arrangement::ArrangerObjectUuidReference > & regions,
std::optional< signed_frame_t > p1,
std::optional< signed_frame_t > p2 )
overridevirtual

Returns all the regions inside the given range, or all the regions if both p1 and p2 are NULL.

Returns
The number of regions returned.

Reimplemented from zrythm::structure::tracks::Track.

◆ midi_channels_to_allow()

auto & zrythm::structure::tracks::PianoRollTrack::midi_channels_to_allow ( ) const
inline

Definition at line 77 of file piano_roll_track.h.

◆ set_playback_caches()

void zrythm::structure::tracks::PianoRollTrack::set_playback_caches ( )
overrideprotectedvirtual

Set the playback caches for a track.

This is called by set_caches().

Reimplemented from zrythm::structure::tracks::Track.

◆ write_to_midi_file()

void zrythm::structure::tracks::PianoRollTrack::write_to_midi_file ( MIDI_FILE * mf,
dsp::MidiEventVector * events,
const dsp::Position * start,
const dsp::Position * end,
int track_index,
bool lanes_as_tracks,
bool use_track_pos )

Writes the track to the given MIDI file.

Parameters
use_track_posWhether to use the track position in the MIDI data. The track will be set to 1 if false.
eventsTrack events, if not using lanes as tracks or using track position.
lanes_as_tracksExport lanes as separate tracks (only possible with MIDI type 1). This will calculate a unique MIDI track number for the region's lane.
use_track_or_lane_posWhether to use the track/lane position in the MIDI data. The MIDI track will be set to 1 if false.
startEvents before this position will be skipped.
endEvents after this position will be skipped.

◆ from_json

void from_json ( const nlohmann::json & j,
PianoRollTrack & track )
friend

Definition at line 99 of file piano_roll_track.h.

◆ to_json

void to_json ( nlohmann::json & j,
const PianoRollTrack & track )
friend

Definition at line 92 of file piano_roll_track.h.


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