9#ifndef __AUDIO_REGION_H__
10#define __AUDIO_REGION_H__
20#include <glib/gi18n.h>
36#define REGION_MAGIC 93075327
37#define IS_REGION(x) (((Region *) x)->magic == REGION_MAGIC)
38#define IS_REGION_AND_NONNULL(x) (x && IS_REGION (x))
40#define REGION_PRINTF_FILENAME "%s_%s.mid"
42#define region_is_selected(r) arranger_object_is_selected ((ArrangerObject *) r)
106 size_t midi_notes_size;
123 int num_unended_notes;
182 int num_split_points;
183 size_t split_points_size;
210 int num_chord_objects;
211 size_t chord_objects_size;
249 GdkRectangle last_main_full_rect;
255 GdkRectangle last_lane_full_rect;
281#define region_type_can_fade(rtype) (rtype == RegionType::REGION_TYPE_AUDIO)
291 unsigned int track_name_hash,
293 int idx_inside_lane);
303region_set_track_name_hash (
305 unsigned int name_hash)
307 self->
id.track_name_hash = name_hash;
312region_print_to_str (
const Region * self,
char * buf,
const size_t buf_size);
350region_has_link_group (
Region * region);
382 const Region *
const self,
384 const bool normalize);
399 const Region *
const self,
422 const char * base_name,
438NONNULL WARN_UNUSED_RESULT
bool
480 int lane_or_at_index,
491 return type == RegionType::REGION_TYPE_MIDI
492 || type == RegionType::REGION_TYPE_AUDIO;
536 const bool inclusive);
551 const bool end_inclusive);
576region_generate_filename (
Region * region);
579region_get_type_as_string (
RegionType type,
char * buf);
610region_create_link_group_if_none (
Region * region);
626region_remove_all_children (
Region * region);
636region_is_looped (const
Region * const self);
645region_get_arranger_selections (
Region * self);
653region_get_arranger_for_children (
Region * self);
664region_validate (
Region * self,
bool is_project,
double frames_per_tick);
Macros for arranger object backends.
Chord object in the TimelineArranger.
API for MIDI notes in the PianoRoll.
NONNULL_ARGS(1) int undo_manager_undo(UndoManager *self
Undo last action.
TrackLane * region_get_lane(const Region *region)
Get lane.
Region * region_at_position(const Track *track, const AutomationTrack *at, const Position *pos)
Returns the region at the given position in the given Track.
void region_copy(Region *src, Region *dest)
Copies the data from src to dest.
NONNULL void region_set_lane(Region *self, TrackLane *lane)
Sets the track lane.
int region_is_hit_by_range(const Region *region, const signed_frame_t gframes_start, const signed_frame_t gframes_end, const bool end_inclusive)
Returns if any part of the Region is inside the given range, inclusive.
NONNULL int region_is_hit(const Region *region, const signed_frame_t gframes, const bool inclusive)
Returns if the position is inside the region or not.
HOT NONNULL Region * region_find(const RegionIdentifier *const id)
Looks for the Region matching the identifier.
void region_set_automation_track(Region *region, AutomationTrack *at)
Sets the automation track.
void region_init(Region *region, const Position *start_pos, const Position *end_pos, unsigned int track_name_hash, int lane_pos, int idx_inside_lane)
Only to be used by implementing structs.
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...
void region_move_to_track(Region *region, Track *track, int lane_or_at_index, int index)
Moves the Region to the given Track, maintaining the selection status of the Region.
NONNULL WARN_UNUSED_RESULT bool region_stretch(Region *self, double ratio, GError **error)
Stretch the region's contents.
MidiNote * region_find_midi_note(Region *r, MidiNote *_mn)
Returns the MidiNote matching the properties of the given MidiNote.
NONNULL HOT signed_frame_t region_timeline_frames_to_local(const Region *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 Region *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.
RegionMusicalMode
Musical mode setting for audio regions.
RegionType
Type of Region.
void region_copy_children(Region *dest, Region *src)
Clones and copies all children from src to dest.
NONNULL void region_update_identifier(Region *self)
To be called every time the identifier changes to update the region's children.
AutomationTrack * region_get_automation_track(const Region *const region)
Gets the AutomationTrack using the saved index.
RegionLinkGroup * region_get_link_group(Region *self)
Returns the region's link group.
NONNULL void region_print(const Region *region)
Print region info for debugging.
NONNULL void region_update_link_group(Region *self)
Updates all other regions in the region link group, if any.
void region_set_link_group(Region *region, int group_idx, bool update_identifier)
Sets the link group to the region.
@ REGION_MUSICAL_MODE_ON
Musical mode on - auto-stretch when BPM changes.
@ REGION_MUSICAL_MODE_OFF
Musical mode off - don't auto-stretch when BPM changes.
@ REGION_MUSICAL_MODE_INHERIT
Inherit from global musical mode setting.
int_fast64_t signed_frame_t
Signed type for frame index.
float sample_t
The sample type.
Base struct for arranger objects.
Audio clips for the pool.
An automation point inside an AutomationTrack.
A Channel is part of a Track (excluding Tracks that don't have Channels) and contains information rel...
A ChordObject to be shown in the TimelineArrangerWidget.
A MIDI note inside a Region shown in the piano roll.
A Position is made up of bars.beats.sixteenths.ticks.
Index/identifier for a Region, so we can get Region objects quickly with it without searching by name...
A group of linked regions.
A region (clip) is an object on the timeline that contains either MidiNote's or AudioClip's.
ArrangerObject base
Base struct.
bool read_from_pool
Whether to read the clip from the pool (used in most cases).
PangoLayout * layout
Cache layout for drawing the name.
GdkRGBA color
Region color independent of track.
AudioClip * clip
Clip to read frames from, if not from the pool.
gint64 last_cache_time
Last timestamp the region was cached.
float gain
Gain to apply to the audio (amplitude 0.0-2.0).
ChordObject ** chord_objects
ChordObject's in this Region.
bool stretching
Whether currently running the stretching algorithm.
PangoLayout * chords_layout
Cache layout for drawing the chord names inside the region.
gint64 last_clip_change
Last timestamp the audio clip or its contents changed.
Position * split_points
Array of split points.
GdkRectangle last_lane_draw_rect
Last lane draw rect.
MidiNote * unended_notes[12000]
Unended notes started in recording with MIDI NOTE ON signal but haven't received a NOTE OFF yet.
double before_length
The length before stretching, in ticks.
AutomationPoint * last_recorded_ap
Last recorded automation point.
int pool_id
Audio pool ID of the associated audio file, mostly used during serialization.
char * name
Name to be shown on the widget.
int bounce
Set to ON during bouncing if this region should be included.
char * escaped_name
Escaped name for drawing.
GdkRectangle last_main_draw_rect
Last main draw rect.
MidiNote ** midi_notes
MIDI notes.
bool use_color
Whether to use the custom color.
ArrangerObject last_positions_obj
Last known marker positions (only positions are used).
RegionMusicalMode musical_mode
Musical mode setting.
RegionIdentifier id
Unique ID.
AutomationPoint ** aps
The automation points this region contains.
double stretch_ratio
Used during arranger UI overlay actions.
A TrackLane belongs to a Track (can have many TrackLanes in a Track) and contains Regions.
Track to be inserted into the Project's Tracklist.