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_control_event.h"
13#include "structure/arrangement/midi_note.h"
14#include "structure/arrangement/midi_region.h"
15#include "structure/arrangement/scale_object.h"
16#include "structure/arrangement/tempo_object.h"
17#include "structure/arrangement/time_signature_object.h"
19namespace zrythm::structure::arrangement
22template <FinalArrangerObjectSub
class ObjT>
24is_arranger_object_deletable (
const ObjT &obj)
26 if constexpr (std::is_same_v<ObjT, Marker>)
46template <RegionObject ObjectT>
47[[gnu::nonnull]] std::pair<int64_t, bool>
48get_frames_till_next_loop_or_end (
50 int64_t timeline_frames)
52 const auto * loop_range = obj.loopRange ();
53 const auto loop_size = loop_range->get_loop_length_in_frames ();
54 assert (loop_size > 0);
55 const auto object_position_frames = obj.position ()->samples ();
56 const int64_t loop_end_frames =
57 loop_range->loopEndPosition ()->samples ();
58 const int64_t clip_start_frames =
59 loop_range->clipStartPosition ()->samples ();
61 int64_t local_frames = timeline_frames - object_position_frames;
62 local_frames += clip_start_frames;
63 while (local_frames >= loop_end_frames)
65 local_frames -= loop_size;
68 const int64_t frames_till_next_loop = loop_end_frames - local_frames;
69 const int64_t frames_till_end =
70 obj.bounds ()->get_end_position_samples (
true) - timeline_frames;
72 return std::make_pair (
73 std::min (frames_till_end, frames_till_next_loop),
74 frames_till_next_loop < frames_till_end);
81 return std::make_pair (
82 obj->position ()->ticks (),
83 obj->position ()->ticks ()
84 + (obj->bounds () !=
nullptr ? obj->bounds ()->length ()->ticks () : 0));
Base class for all objects in the arranger.