Ardour  9.0-pre0-582-g084a23a80d
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 
24 class XMLNode;
25 
26 namespace ARDOUR {
27 
28 /* An object that describes an extent (duration & position), along with a
29  * potentially expanding set of metadata about that extent (e.g. bpm, meter
30  * etc.)
31  */
32 
34 public:
36  SegmentDescriptor (XMLNode const &, int version);
37 
38  /* This object does not use the tempo map to convert between time
39  * domains, since it describes things that are not (always) on the
40  * timeline.
41  */
42 
44 
46  void set_position (Temporal::Beats const &);
47 
49  void set_duration (Temporal::Beats const &);
50 
52  void set_extent (Temporal::Beats const & pos, Temporal::Beats const & dur);
53 
55  Temporal::timepos_t position() const { return extent().position(); }
56 
57  Temporal::Tempo tempo() const { return _tempo; }
58  void set_tempo (Temporal::Tempo const&);
59 
60  Temporal::Meter meter() const { return _meter; }
61  void set_meter (Temporal::Meter const&);
62 
63  /* Replicate the API of PBD::Stateful without the overhead */
64 
65  XMLNode& get_state () const;
66  int set_state (const XMLNode&, int version);
67 
68 private:
70 
71  /* cannot use a union for these because Temporal::Beats has a
72  "non-trivial" constructor.
73  */
74 
79 
82 };
83 
84 }
85 
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