2 Copyright (C) 2002 Paul Davis
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.
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.
14 You should have received a copy of the GNU General Public License
15 along with this program; if not, write to the Free Software
16 Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
21 #ifndef __ardour_types_h__
22 #define __ardour_types_h__
24 #ifndef __STDC_FORMAT_MACROS
25 #define __STDC_FORMAT_MACROS /* PRI<foo>; C++ requires explicit requesting of these */
30 #include <boost/shared_ptr.hpp>
33 #include <jack/types.h>
34 #include <control_protocol/smpte.h>
44 /* at some point move this into the ARDOUR namespace,
45 but for now its outside because it replaces the
46 old global "jack_nframes_t"
49 typedef uint32_t nframes_t;
56 typedef jack_default_audio_sample_t Sample;
59 typedef uint32_t layer_t;
60 typedef uint64_t microseconds_t;
64 ConfigurationChanged = 0x1,
65 ConnectionsChanged = 0x2
69 OverlapNone, // no overlap
70 OverlapInternal, // the overlap is 100% with the object
71 OverlapStart, // overlap covers start, but ends within
72 OverlapEnd, // overlap begins within and covers end
73 OverlapExternal // overlap extends to (at least) begin+end
76 OverlapType coverage (nframes_t start_a, nframes_t end_a,
77 nframes_t start_b, nframes_t end_b);
82 PluginAutomation = 0x4,
126 /* we can't define arithmetic operators for BBT_Time, because
127 the results depend on a TempoMap, but we can define
128 a useful check on the less-than condition.
131 bool operator< (const BBT_Time& other) const {
132 return bars < other.bars ||
133 (bars == other.bars && beats < other.beats) ||
134 (bars == other.bars && beats == other.beats && ticks < other.ticks);
137 bool operator== (const BBT_Time& other) const {
138 return bars == other.bars && beats == other.beats && ticks == other.ticks;
161 AnyTime() { type = Frames; frames = 0; }
169 AudioRange (nframes_t s, nframes_t e, uint32_t i) : start (s), end (e) , id (i) {}
171 nframes_t length() { return end - start + 1; }
173 bool operator== (const AudioRange& other) const {
174 return start == other.start && end == other.end && id == other.id;
177 bool equal (const AudioRange& other) const {
178 return start == other.start && end == other.end;
181 OverlapType coverage (nframes_t s, nframes_t e) const {
182 return ARDOUR::coverage (start, end, s, e);
191 MusicRange (BBT_Time& s, BBT_Time& e, uint32_t i)
192 : start (s), end (e), id (i) {}
194 bool operator== (const MusicRange& other) const {
195 return start == other.start && end == other.end && id == other.id;
198 bool equal (const MusicRange& other) const {
199 return start == other.start && end == other.end;
224 enum CrossfadeModel {
240 enum AutoConnectOption {
241 AutoConnectPhysical = 0x1,
242 AutoConnectMaster = 0x2
245 struct InterThreadInfo {
247 volatile bool cancel;
248 volatile float progress;
269 typedef Sample PeakDatum;
287 enum ShuttleBehaviour {
297 typedef std::vector<boost::shared_ptr<AudioSource> > SourceList;
299 } // namespace ARDOUR
301 std::istream& operator>>(std::istream& o, ARDOUR::SampleFormat& sf);
302 std::istream& operator>>(std::istream& o, ARDOUR::HeaderFormat& sf);
303 std::istream& operator>>(std::istream& o, ARDOUR::AutoConnectOption& sf);
304 std::istream& operator>>(std::istream& o, ARDOUR::EditMode& sf);
305 std::istream& operator>>(std::istream& o, ARDOUR::SoloModel& sf);
306 std::istream& operator>>(std::istream& o, ARDOUR::LayerModel& sf);
307 std::istream& operator>>(std::istream& o, ARDOUR::CrossfadeModel& sf);
308 std::istream& operator>>(std::istream& o, ARDOUR::SlaveSource& sf);
309 std::istream& operator>>(std::istream& o, ARDOUR::ShuttleBehaviour& sf);
310 std::istream& operator>>(std::istream& o, ARDOUR::ShuttleUnits& sf);
312 static inline nframes_t
313 session_frame_to_track_frame (nframes_t session_frame, double speed)
315 return (nframes_t)( (double)session_frame * speed );
318 static inline nframes_t
319 track_frame_to_session_frame (nframes_t track_frame, double speed)
321 return (nframes_t)( (double)track_frame / speed );
325 #endif /* __ardour_types_h__ */