Ardour  8.7-15-gadf511264b
segment_descriptor.h
Go to the documentation of this file.
1 /*
2  * Copyright (C) 2021 Paul Davis <paul@linuxaudiosystems.com>
3  *
4  * This program is free software; you can redistribute it and/or modify
5  * it under the terms of the GNU General Public License as published by
6  * the Free Software Foundation; either version 2 of the License, or
7  * (at your option) any later version.
8  *
9  * This program is distributed in the hope that it will be useful,
10  * but WITHOUT ANY WARRANTY; without even the implied warranty of
11  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12  * GNU General Public License for more details.
13  *
14  * You should have received a copy of the GNU General Public License along
15  * with this program; if not, write to the Free Software Foundation, Inc.,
16  * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
17  */
18 
19 #ifndef __libardour_segment_descriptor_h__
20 #define __libardour_segment_descriptor_h__
21 
22 #include "temporal/timeline.h"
23 #include "temporal/tempo.h"
24 
25 class XMLNode;
26 
27 namespace ARDOUR {
28 
29 /* An object that describes an extent (duration & position), along with a
30  * potentially expanding set of metadata about that extent (e.g. bpm, meter
31  * etc.)
32  */
33 
35 public:
37  SegmentDescriptor (XMLNode const &, int version);
38 
39  /* This object does not use the tempo map to convert between time
40  * domains, since it describes things that are not (always) on the
41  * timeline.
42  */
43 
45 
47  void set_position (Temporal::Beats const &);
48 
50  void set_duration (Temporal::Beats const &);
51 
53  void set_extent (Temporal::Beats const & pos, Temporal::Beats const & dur);
54 
56  Temporal::timepos_t position() const { return extent().position(); }
57 
58  Temporal::Tempo tempo() const { return _tempo; }
59  void set_tempo (Temporal::Tempo const&);
60 
61  Temporal::Meter meter() const { return _meter; }
62  void set_meter (Temporal::Meter const&);
63 
64  /* Replicate the API of PBD::Stateful without the overhead */
65 
66  XMLNode& get_state () const;
67  int set_state (const XMLNode&, int version);
68 
69 private:
71 
72  /* cannot use a union for these because Temporal::Beats has a
73  "non-trivial" constructor.
74  */
75 
80 
83 };
84 
85 }
86 
87 #endif /* __libardour_segment_descriptor_h__ */
void set_extent(Temporal::Beats const &pos, Temporal::Beats const &dur)
Temporal::TimeDomain _time_domain
Temporal::timecnt_t extent() const
Temporal::TimeDomain time_domain() const
void set_position(Temporal::Beats const &)
void set_extent(Temporal::samplepos_t pos, Temporal::samplecnt_t dur)
void set_meter(Temporal::Meter const &)
Temporal::samplepos_t _position_samples
void set_duration(Temporal::Beats const &)
SegmentDescriptor(XMLNode const &, int version)
Temporal::timepos_t position() const
Temporal::Meter meter() const
Temporal::samplepos_t _duration_samples
void set_tempo(Temporal::Tempo const &)
void set_position(Temporal::samplepos_t)
Temporal::Tempo tempo() const
XMLNode & get_state() const
int set_state(const XMLNode &, int version)
void set_duration(Temporal::samplecnt_t)
timepos_t const & position() const
Definition: timeline.h:342
Definition: xml++.h:114