6#include "structure/arrangement/audio_region.h"
7#include "structure/arrangement/audio_source_object.h"
8#include "structure/arrangement/automation_region.h"
9#include "structure/arrangement/chord_object.h"
10#include "structure/arrangement/chord_region.h"
11#include "structure/arrangement/marker.h"
12#include "structure/arrangement/midi_note.h"
13#include "structure/arrangement/midi_region.h"
14#include "structure/arrangement/scale_object.h"
15#include "structure/arrangement/tempo_object.h"
16#include "structure/arrangement/time_signature_object.h"
18namespace zrythm::structure::arrangement
21template <FinalArrangerObjectSub
class ObjT>
23is_arranger_object_deletable (
const ObjT &obj)
25 if constexpr (std::is_same_v<ObjT, Marker>)
43template <RegionObject ObjectT>
44[[gnu::nonnull]] std::pair<signed_frame_t, bool>
45get_frames_till_next_loop_or_end (
49 const auto * loop_range = obj.loopRange ();
50 const auto loop_size = loop_range->get_loop_length_in_frames ();
51 assert (loop_size > 0);
52 const auto object_position_frames = obj.position ()->samples ();
54 loop_range->loopEndPosition ()->samples ();
56 loop_range->clipStartPosition ()->samples ();
58 signed_frame_t local_frames = timeline_frames - object_position_frames;
59 local_frames += clip_start_frames;
60 while (local_frames >= loop_end_frames)
62 local_frames -= loop_size;
65 const signed_frame_t frames_till_next_loop = loop_end_frames - local_frames;
67 obj.bounds ()->get_end_position_samples (
true) - timeline_frames;
69 return std::make_pair (
70 std::min (frames_till_end, frames_till_next_loop),
71 frames_till_next_loop < frames_till_end);
77 return std::make_pair (
78 obj->position ()->ticks (),
79 obj->position ()->ticks ()
80 + (obj->bounds () !=
nullptr ? obj->bounds ()->length ()->ticks () : 0));
Base class for all objects in the arranger.
int_fast64_t signed_frame_t
Signed type for frame index.