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,
94 std::string auto_state_to_string (AutoState);
95 AutoState string_to_auto_state (std::string);
102 std::string auto_style_to_string (AutoStyle);
103 AutoStyle string_to_auto_style (std::string);
132 /* we can't define arithmetic operators for BBT_Time, because
133 the results depend on a TempoMap, but we can define
134 a useful check on the less-than condition.
137 bool operator< (const BBT_Time& other) const {
138 return bars < other.bars ||
139 (bars == other.bars && beats < other.beats) ||
140 (bars == other.bars && beats == other.beats && ticks < other.ticks);
143 bool operator== (const BBT_Time& other) const {
144 return bars == other.bars && beats == other.beats && ticks == other.ticks;
167 AnyTime() { type = Frames; frames = 0; }
175 AudioRange (nframes_t s, nframes_t e, uint32_t i) : start (s), end (e) , id (i) {}
177 nframes_t length() { return end - start + 1; }
179 bool operator== (const AudioRange& other) const {
180 return start == other.start && end == other.end && id == other.id;
183 bool equal (const AudioRange& other) const {
184 return start == other.start && end == other.end;
187 OverlapType coverage (nframes_t s, nframes_t e) const {
188 return ARDOUR::coverage (start, end, s, e);
197 MusicRange (BBT_Time& s, BBT_Time& e, uint32_t i)
198 : start (s), end (e), id (i) {}
200 bool operator== (const MusicRange& other) const {
201 return start == other.start && end == other.end && id == other.id;
204 bool equal (const MusicRange& other) const {
205 return start == other.start && end == other.end;
210 Slowest = 6.6dB/sec falloff at update rate of 40ms
211 Slow = 6.8dB/sec falloff at update rate of 40ms
216 MeterFalloffSlowest = 1,
217 MeterFalloffSlow = 2,
218 MeterFalloffMedium = 3,
219 MeterFalloffFast = 4,
220 MeterFalloffFaster = 5,
221 MeterFalloffFastest = 6
227 MeterHoldMedium = 100,
258 enum CrossfadeModel {
274 enum AutoConnectOption {
275 AutoConnectPhysical = 0x1,
276 AutoConnectMaster = 0x2
279 struct InterThreadInfo {
281 volatile bool cancel;
282 volatile float progress;
303 typedef Sample PeakDatum;
321 enum ShuttleBehaviour {
331 typedef std::vector<boost::shared_ptr<AudioSource> > SourceList;
333 } // namespace ARDOUR
335 std::istream& operator>>(std::istream& o, ARDOUR::SampleFormat& sf);
336 std::istream& operator>>(std::istream& o, ARDOUR::HeaderFormat& sf);
337 std::istream& operator>>(std::istream& o, ARDOUR::AutoConnectOption& sf);
338 std::istream& operator>>(std::istream& o, ARDOUR::EditMode& sf);
339 std::istream& operator>>(std::istream& o, ARDOUR::MonitorModel& sf);
340 std::istream& operator>>(std::istream& o, ARDOUR::SoloModel& sf);
341 std::istream& operator>>(std::istream& o, ARDOUR::LayerModel& sf);
342 std::istream& operator>>(std::istream& o, ARDOUR::CrossfadeModel& sf);
343 std::istream& operator>>(std::istream& o, ARDOUR::SlaveSource& sf);
344 std::istream& operator>>(std::istream& o, ARDOUR::ShuttleBehaviour& sf);
345 std::istream& operator>>(std::istream& o, ARDOUR::ShuttleUnits& sf);
347 static inline nframes_t
348 session_frame_to_track_frame (nframes_t session_frame, double speed)
350 return (nframes_t)( (double)session_frame * speed );
353 static inline nframes_t
354 track_frame_to_session_frame (nframes_t track_frame, double speed)
356 return (nframes_t)( (double)track_frame / speed );
360 #endif /* __ardour_types_h__ */