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;
179 AnyTime() { type = Frames; frames = 0; }
187 AudioRange (nframes_t s, nframes_t e, uint32_t i) : start (s), end (e) , id (i) {}
189 nframes_t length() { return end - start + 1; }
191 bool operator== (const AudioRange& other) const {
192 return start == other.start && end == other.end && id == other.id;
195 bool equal (const AudioRange& other) const {
196 return start == other.start && end == other.end;
199 OverlapType coverage (nframes_t s, nframes_t e) const {
200 return ARDOUR::coverage (start, end, s, e);
209 MusicRange (BBT_Time& s, BBT_Time& e, uint32_t i)
210 : start (s), end (e), id (i) {}
212 bool operator== (const MusicRange& other) const {
213 return start == other.start && end == other.end && id == other.id;
216 bool equal (const MusicRange& other) const {
217 return start == other.start && end == other.end;
222 Slowest = 6.6dB/sec falloff at update rate of 40ms
223 Slow = 6.8dB/sec falloff at update rate of 40ms
228 MeterFalloffSlowest = 1,
229 MeterFalloffSlow = 2,
230 MeterFalloffMedium = 3,
231 MeterFalloffFast = 4,
232 MeterFalloffFaster = 5,
233 MeterFalloffFastest = 6
239 MeterHoldMedium = 100,
270 enum CrossfadeModel {
286 enum AutoConnectOption {
287 AutoConnectPhysical = 0x1,
288 AutoConnectMaster = 0x2
291 struct InterThreadInfo {
293 volatile bool cancel;
294 volatile float progress;
315 typedef Sample PeakDatum;
333 enum ShuttleBehaviour {
343 typedef std::vector<boost::shared_ptr<AudioSource> > SourceList;
345 } // namespace ARDOUR
347 std::istream& operator>>(std::istream& o, ARDOUR::SampleFormat& sf);
348 std::istream& operator>>(std::istream& o, ARDOUR::HeaderFormat& sf);
349 std::istream& operator>>(std::istream& o, ARDOUR::AutoConnectOption& sf);
350 std::istream& operator>>(std::istream& o, ARDOUR::EditMode& sf);
351 std::istream& operator>>(std::istream& o, ARDOUR::MonitorModel& sf);
352 std::istream& operator>>(std::istream& o, ARDOUR::SoloModel& sf);
353 std::istream& operator>>(std::istream& o, ARDOUR::LayerModel& sf);
354 std::istream& operator>>(std::istream& o, ARDOUR::CrossfadeModel& sf);
355 std::istream& operator>>(std::istream& o, ARDOUR::SlaveSource& sf);
356 std::istream& operator>>(std::istream& o, ARDOUR::ShuttleBehaviour& sf);
357 std::istream& operator>>(std::istream& o, ARDOUR::ShuttleUnits& sf);
358 std::istream& operator>>(std::istream& o, ARDOUR::SmpteFormat& sf);
360 static inline nframes_t
361 session_frame_to_track_frame (nframes_t session_frame, double speed)
363 return (nframes_t)( (double)session_frame * speed );
366 static inline nframes_t
367 track_frame_to_session_frame (nframes_t track_frame, double speed)
369 return (nframes_t)( (double)track_frame / speed );
373 #endif /* __ardour_types_h__ */