2 * Copyright (C) 2008-2011 Sakari Bergen <sakari.bergen@beatwaves.net>
3 * Copyright (C) 2008-2017 Paul Davis <paul@linuxaudiosystems.com>
4 * Copyright (C) 2009-2010 Carl Hetherington <carl@carlh.net>
5 * Copyright (C) 2009-2012 David Robillard <d@drobilla.net>
6 * Copyright (C) 2016-2019 Robin Gareus <robin@gareus.org>
8 * This program is free software; you can redistribute it and/or modify
9 * it under the terms of the GNU General Public License as published by
10 * the Free Software Foundation; either version 2 of the License, or
11 * (at your option) any later version.
13 * This program is distributed in the hope that it will be useful,
14 * but WITHOUT ANY WARRANTY; without even the implied warranty of
15 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16 * GNU General Public License for more details.
18 * You should have received a copy of the GNU General Public License along
19 * with this program; if not, write to the Free Software Foundation, Inc.,
20 * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
23 #ifndef __ardour_export_timespan_h__
24 #define __ardour_export_timespan_h__
28 #include <boost/shared_ptr.hpp>
30 #include "ardour/libardour_visibility.h"
31 #include "ardour/types.h"
40 class LIBARDOUR_API ExportTimespan
43 typedef boost::shared_ptr<ExportStatus> ExportStatusPtr;
46 friend class ExportElementFactory;
47 ExportTimespan (ExportStatusPtr status, samplecnt_t sample_rate);
52 std::string name () const { return _name; }
53 void set_name (std::string name) { _name = name; }
55 std::string range_id () const { return _range_id; }
56 void set_range_id (std::string range_id) { _range_id = range_id; }
58 bool realtime () const { return _realtime; }
59 void set_realtime (bool rt) { _realtime = rt; }
61 void set_range (samplepos_t start, samplepos_t end);
62 samplecnt_t get_length () const { return end_sample - start_sample; }
63 samplepos_t get_start () const { return start_sample; }
64 samplepos_t get_end () const { return end_sample; }
66 /// Primarily compare start time, then end time
67 bool operator< (ExportTimespan const & other) {
68 if (start_sample < other.start_sample) { return true; }
69 if (start_sample > other.start_sample) { return false; }
70 return end_sample < other.end_sample;
75 ExportStatusPtr status;
77 samplepos_t start_sample;
78 samplepos_t end_sample;
80 samplecnt_t sample_rate;
83 std::string _range_id;
90 #endif /* __ardour_export_timespan_h__ */