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>)
45template <RegionObject ObjectT>
46[[gnu::nonnull]] std::pair<int64_t, bool>
47get_frames_till_next_loop_or_end (
49 int64_t timeline_frames)
51 const auto * loop_range = obj.loopRange ();
52 const auto loop_size = loop_range->get_loop_length_in_frames ();
53 assert (loop_size > 0);
54 const auto object_position_frames = obj.position ()->samples ();
55 const int64_t loop_end_frames =
56 loop_range->loopEndPosition ()->samples ();
57 const int64_t clip_start_frames =
58 loop_range->clipStartPosition ()->samples ();
60 int64_t local_frames = timeline_frames - object_position_frames;
61 local_frames += clip_start_frames;
62 while (local_frames >= loop_end_frames)
64 local_frames -= loop_size;
67 const int64_t frames_till_next_loop = loop_end_frames - local_frames;
68 const int64_t frames_till_end =
69 obj.bounds ()->get_end_position_samples (
true) - timeline_frames;
71 return std::make_pair (
72 std::min (frames_till_end, frames_till_next_loop),
73 frames_till_next_loop < frames_till_end);
80 return std::make_pair (
81 obj->position ()->ticks (),
82 obj->position ()->ticks ()
83 + (obj->bounds () !=
nullptr ? obj->bounds ()->length ()->ticks () : 0));
Base class for all objects in the arranger.