Ardour  9.7-154-g3d533c4061
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 #pragma once
20 
21 #include "temporal/timeline.h"
22 #include "temporal/tempo.h"
23 
25 
26 class XMLNode;
27 
28 namespace ARDOUR {
29 
30 /* An object that describes an extent (duration & position), along with a
31  * potentially expanding set of metadata about that extent (e.g. bpm, meter
32  * etc.)
33  */
34 
36 public:
38  SegmentDescriptor (XMLNode const &, int version);
39 
40  /* This object does not use the tempo map to convert between time
41  * domains, since it describes things that are not (always) on the
42  * timeline.
43  */
44 
46 
48  void set_position (Temporal::Beats const &);
49 
51  void set_duration (Temporal::Beats const &);
52 
54  void set_extent (Temporal::Beats const & pos, Temporal::Beats const & dur);
55 
57  Temporal::timepos_t position() const { return extent().position(); }
58 
59  Temporal::Tempo tempo() const { return _tempo; }
60  void set_tempo (Temporal::Tempo const&);
61 
62  Temporal::Meter meter() const { return _meter; }
63  void set_meter (Temporal::Meter const&);
64 
65  /* Replicate the API of PBD::Stateful without the overhead */
66 
67  XMLNode& get_state () const;
68  int set_state (const XMLNode&, int version);
69 
70 private:
72 
73  /* cannot use a union for these because Temporal::Beats has a
74  "non-trivial" constructor.
75  */
76 
81 
84 };
85 
86 }
87 
88 namespace std {
89 LIBARDOUR_API std::ostream& operator<<(std::ostream& str, ARDOUR::SegmentDescriptor const &);
90 }
91 
std::ostream & operator<<(std::ostream &o, ARDOUR::Bundle const &)
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:341
Definition: xml++.h:114
#define LIBARDOUR_API