Zrythm
a highly automated and intuitive digital audio workstation
Loading...
Searching...
No Matches
ZRegion Struct Reference

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

#include <dsp/region.h>

Inheritance diagram for ZRegion:
Collaboration diagram for ZRegion:

Public Member Functions

NONNULL void region_print (const ZRegion *region)
 Print region info for debugging.
 
TrackLaneregion_get_lane (const ZRegion *region)
 Get lane.
 
RegionLinkGroupregion_get_link_group (ZRegion *self)
 Returns the region's link group.
 
void region_set_link_group (ZRegion *region, int group_idx, bool update_identifier)
 Sets the link group to the region.
 
MidiNoteregion_find_midi_note (ZRegion *r, MidiNote *_mn)
 Returns the MidiNote matching the properties of the given MidiNote.
 
NONNULL HOT signed_frame_t region_timeline_frames_to_local (const ZRegion *const self, const signed_frame_t timeline_frames, const bool normalize)
 Converts frames on the timeline (global) to local frames (in the clip).
 
NONNULL void region_get_frames_till_next_loop_or_end (const ZRegion *const self, const signed_frame_t timeline_frames, signed_frame_t *ret_frames, bool *is_loop)
 Returns the number of frames until the next loop end point or the end of the region.
 
NONNULL void region_set_lane (ZRegion *self, TrackLane *lane)
 Sets the track lane.
 
void region_gen_name (ZRegion *region, const char *base_name, AutomationTrack *at, Track *track)
 Generates a name for the ZRegion, either using the given AutomationTrack or Track, or appending to the given base name.
 
NONNULL WARN_UNUSED_RESULT bool region_stretch (ZRegion *self, double ratio, GError **error)
 Stretch the region's contents.
 
NONNULL void region_update_identifier (ZRegion *self)
 To be called every time the identifier changes to update the region's children.
 
NONNULL void region_update_link_group (ZRegion *self)
 Updates all other regions in the region link group, if any.
 
void region_move_to_track (ZRegion *region, Track *track, int lane_or_at_index, int index)
 Moves the ZRegion to the given Track, maintaining the selection status of the ZRegion.
 
void region_set_automation_track (ZRegion *region, AutomationTrack *at)
 Sets the automation track.
 
AutomationTrackregion_get_automation_track (const ZRegion *const region)
 Gets the AutomationTrack using the saved index.
 
NONNULL int region_is_hit (const ZRegion *region, const signed_frame_t gframes, const bool inclusive)
 Returns if the position is inside the region or not.
 
int region_is_hit_by_range (const ZRegion *region, const signed_frame_t gframes_start, const signed_frame_t gframes_end, const bool end_inclusive)
 Returns if any part of the ZRegion is inside the given range, inclusive.
 
char * region_generate_filename (ZRegion *region)
 Generates the filename for this region.
 
bool region_is_recording (ZRegion *self)
 Returns if this region is currently being recorded onto.
 
bool region_get_musical_mode (ZRegion *self)
 Returns whether the region is effectively in musical mode.
 
void region_add_arranger_object (ZRegion *self, ArrangerObject *obj, bool fire_events)
 Wrapper for adding an arranger object.
 
void region_unlink (ZRegion *region)
 Removes the link group from the region, if any.
 
void region_remove_all_children (ZRegion *region)
 Removes all children objects from the region.
 
ArrangerSelectionsregion_get_arranger_selections (ZRegion *self)
 Returns the ArrangerSelections based on the given region type.
 
ArrangerWidgetregion_get_arranger_for_children (ZRegion *self)
 Returns the arranger for editing the region's children.
 
bool region_validate (ZRegion *self, bool is_project, double frames_per_tick)
 Sanity checking.
 
void region_disconnect (ZRegion *self)
 Disconnects the region and anything using it.
 
- Public Member Functions inherited from ArrangerObject
void arranger_object_move (ArrangerObject *self, const double ticks)
 Moves the object by the given amount of ticks.
 
bool arranger_object_validate (const ArrangerObject *const self)
 Validates the arranger object.
 
void arranger_object_set_name (ArrangerObject *self, const char *name, int fire_events)
 Sets the name of the object, if the object can have a name.
 

Data Fields

ArrangerObject base
 Base struct.
 
RegionIdentifier id
 Unique ID.
 
char * name
 Name to be shown on the widget.
 
char * escaped_name
 Escaped name for drawing.
 
GdkRGBA color
 Region color independent of track.
 
bool use_color
 Whether to use the custom color.
 
MidiNote ** midi_notes
 MIDI notes.
 
int num_midi_notes
 
size_t midi_notes_size
 
MidiNoteunended_notes [12000]
 Unended notes started in recording with MIDI NOTE ON signal but haven't received a NOTE OFF yet.
 
int num_unended_notes
 
int pool_id
 Audio pool ID of the associated audio file, mostly used during serialization.
 
bool stretching
 Whether currently running the stretching algorithm.
 
double before_length
 The length before stretching, in ticks.
 
double stretch_ratio
 Used during arranger UI overlay actions.
 
bool read_from_pool
 Whether to read the clip from the pool (used in most cases).
 
float gain
 Gain to apply to the audio (amplitude 0.0-2.0).
 
AudioClipclip
 Clip to read frames from, if not from the pool.
 
RegionMusicalMode musical_mode
 Musical mode setting.
 
Positionsplit_points
 Array of split points.
 
int num_split_points
 
size_t split_points_size
 
AutomationPoint ** aps
 The automation points this region contains.
 
int num_aps
 
size_t aps_size
 
AutomationPointlast_recorded_ap
 Last recorded automation point.
 
ChordObject ** chord_objects
 ChordObject's in this Region.
 
int num_chord_objects
 
size_t chord_objects_size
 
int bounce
 Set to ON during bouncing if this region should be included.
 
PangoLayout * layout
 Cache layout for drawing the name.
 
PangoLayout * chords_layout
 Cache layout for drawing the chord names inside the region.
 
GdkRectangle last_main_full_rect
 
GdkRectangle last_main_draw_rect
 Last main draw rect.
 
GdkRectangle last_lane_full_rect
 
GdkRectangle last_lane_draw_rect
 Last lane draw rect.
 
gint64 last_clip_change
 Last timestamp the audio clip or its contents changed.
 
gint64 last_cache_time
 Last timestamp the region was cached.
 
ArrangerObject last_positions_obj
 Last known marker positions (only positions are used).
 
TrackLaneowner_lane = nullptr
 
int magic
 
- Data Fields inherited from ArrangerObject
ArrangerObjectType type
 
ArrangerObjectFlags flags
 Flags.
 
Position pos
 Position (or start Position if the object has length).
 
Position end_pos
 End Position, if the object has one.
 
Position clip_start_pos
 Start position of the clip loop, relative to the object's start.
 
Position loop_start_pos
 Loop start Position, if the object has one, relative to the object's start.
 
Position loop_end_pos
 End position of the clip loop, relative to the object's start.
 
Position fade_in_pos
 Fade in position, relative to the object's start.
 
Position fade_out_pos
 Fade out position, relative to the object's start.
 
CurveOptions fade_in_opts
 Fade in curve options.
 
CurveOptions fade_out_opts
 Fade out curve options.
 
GdkRectangle full_rect
 The full rectangle this object covers including off-screen parts, in absolute coordinates.
 
int textw
 Cache text H extents and W extents for the text, if the object has any.
 
int texth
 
ArrangerObjecttransient
 A copy ArrangerObject corresponding to this, such as when ctrl+dragging.
 
ArrangerObjectmain
 The opposite of the above.
 
bool muted
 Whether muted or not (if applicable).
 
int magic
 
RegionIdentifier region_id
 Parent region identifier for objects that are part of a region.
 
int index_in_prev_lane
 Object's index in the previous lane (before being moved to a new lane/track).
 
bool deleted_temporarily
 Whether deleted with delete tool.
 
cairo_t * cached_cr [2]
 Cached cairo_t.
 
cairo_surface_t * cached_surface [2]
 Cached surface containing drawing.
 
GdkRectangle last_name_rect
 Last drawn name rectangle, if object has a name.
 
bool is_auditioner
 Whether part of an auditioner track.
 

Detailed Description

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

It is uniquely identified using its name, so it must be unique throughout the Project.

Definition at line 71 of file region.h.

Field Documentation

◆ aps

AutomationPoint** ZRegion::aps

The automation points this region contains.

Could also be used in audio regions for volume automation.

Must always stay sorted by position.

Definition at line 197 of file region.h.

◆ aps_size

size_t ZRegion::aps_size

Definition at line 199 of file region.h.

◆ base

ArrangerObject ZRegion::base

Base struct.

Definition at line 76 of file region.h.

◆ before_length

double ZRegion::before_length

The length before stretching, in ticks.

Definition at line 143 of file region.h.

◆ bounce

int ZRegion::bounce

Set to ON during bouncing if this region should be included.

Only relevant for audio and midi regions.

Definition at line 221 of file region.h.

◆ chord_objects

ChordObject** ZRegion::chord_objects

ChordObject's in this Region.

Definition at line 209 of file region.h.

◆ chord_objects_size

size_t ZRegion::chord_objects_size

Definition at line 211 of file region.h.

◆ chords_layout

PangoLayout* ZRegion::chords_layout

Cache layout for drawing the chord names inside the region.

Definition at line 246 of file region.h.

◆ clip

AudioClip* ZRegion::clip

Clip to read frames from, if not from the pool.

Definition at line 159 of file region.h.

◆ color

GdkRGBA ZRegion::color

Region color independent of track.

Definition at line 90 of file region.h.

◆ escaped_name

char* ZRegion::escaped_name

Escaped name for drawing.

Definition at line 85 of file region.h.

◆ gain

float ZRegion::gain

Gain to apply to the audio (amplitude 0.0-2.0).

Definition at line 154 of file region.h.

◆ id

RegionIdentifier ZRegion::id

Unique ID.

Definition at line 79 of file region.h.

◆ last_cache_time

gint64 ZRegion::last_cache_time

Last timestamp the region was cached.

Definition at line 265 of file region.h.

◆ last_clip_change

gint64 ZRegion::last_clip_change

Last timestamp the audio clip or its contents changed.

Definition at line 262 of file region.h.

◆ last_lane_draw_rect

GdkRectangle ZRegion::last_lane_draw_rect

Last lane draw rect.

Definition at line 258 of file region.h.

◆ last_lane_full_rect

GdkRectangle ZRegion::last_lane_full_rect

Definition at line 255 of file region.h.

◆ last_main_draw_rect

GdkRectangle ZRegion::last_main_draw_rect

Last main draw rect.

Definition at line 252 of file region.h.

◆ last_main_full_rect

GdkRectangle ZRegion::last_main_full_rect

Definition at line 249 of file region.h.

◆ last_positions_obj

ArrangerObject ZRegion::last_positions_obj

Last known marker positions (only positions are used).

Definition at line 269 of file region.h.

◆ last_recorded_ap

AutomationPoint* ZRegion::last_recorded_ap

Last recorded automation point.

Definition at line 202 of file region.h.

◆ layout

PangoLayout* ZRegion::layout

Cache layout for drawing the name.

Definition at line 242 of file region.h.

◆ magic

int ZRegion::magic

Definition at line 275 of file region.h.

◆ midi_notes

MidiNote** ZRegion::midi_notes

MIDI notes.

Definition at line 104 of file region.h.

◆ midi_notes_size

size_t ZRegion::midi_notes_size

Definition at line 106 of file region.h.

◆ musical_mode

RegionMusicalMode ZRegion::musical_mode

Musical mode setting.

Definition at line 178 of file region.h.

◆ name

char* ZRegion::name

Name to be shown on the widget.

Definition at line 82 of file region.h.

◆ num_aps

int ZRegion::num_aps

Definition at line 198 of file region.h.

◆ num_chord_objects

int ZRegion::num_chord_objects

Definition at line 210 of file region.h.

◆ num_midi_notes

int ZRegion::num_midi_notes

Definition at line 105 of file region.h.

◆ num_split_points

int ZRegion::num_split_points

Definition at line 182 of file region.h.

◆ num_unended_notes

int ZRegion::num_unended_notes

Definition at line 123 of file region.h.

◆ owner_lane

TrackLane* ZRegion::owner_lane = nullptr

Definition at line 273 of file region.h.

◆ pool_id

int ZRegion::pool_id

Audio pool ID of the associated audio file, mostly used during serialization.

Definition at line 131 of file region.h.

◆ read_from_pool

bool ZRegion::read_from_pool

Whether to read the clip from the pool (used in most cases).

Definition at line 151 of file region.h.

◆ split_points

Position* ZRegion::split_points

Array of split points.

Definition at line 181 of file region.h.

◆ split_points_size

size_t ZRegion::split_points_size

Definition at line 183 of file region.h.

◆ stretch_ratio

double ZRegion::stretch_ratio

Used during arranger UI overlay actions.

Definition at line 146 of file region.h.

◆ stretching

bool ZRegion::stretching

Whether currently running the stretching algorithm.

If this is true, region drawing will be deferred.

Definition at line 138 of file region.h.

◆ unended_notes

MidiNote* ZRegion::unended_notes[12000]

Unended notes started in recording with MIDI NOTE ON signal but haven't received a NOTE OFF yet.

This is also used temporarily when reading from MIDI files.

FIXME allocate.

Note
These are present in ZRegion::midi_notes and must not be free'd separately.

Definition at line 122 of file region.h.

◆ use_color

bool ZRegion::use_color

Whether to use the custom color.

If false, the track color will be used.

Definition at line 97 of file region.h.


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