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.
20 #ifndef __ardour_types_h__
21 #define __ardour_types_h__
23 #ifndef __STDC_FORMAT_MACROS
24 #define __STDC_FORMAT_MACROS /* PRI<foo>; C++ requires explicit requesting of these */
29 #include <boost/shared_ptr.hpp>
32 #include <jack/types.h>
33 #include <jack/midiport.h>
34 #include <control_protocol/smpte.h>
44 /* eventually, we'd like everything (including JACK) to
45 move to this. for now, its a dedicated type.
48 typedef int64_t nframes64_t;
55 typedef jack_default_audio_sample_t Sample;
58 typedef uint32_t layer_t;
59 typedef uint64_t microseconds_t;
60 typedef uint32_t nframes_t;
62 typedef jack_midi_event_t MidiEvent;
63 typedef unsigned char Byte;
67 ConfigurationChanged = 0x1,
68 ConnectionsChanged = 0x2
72 OverlapNone, // no overlap
73 OverlapInternal, // the overlap is 100% with the object
74 OverlapStart, // overlap covers start, but ends within
75 OverlapEnd, // overlap begins within and covers end
76 OverlapExternal // overlap extends to (at least) begin+end
79 OverlapType coverage (nframes_t start_a, nframes_t end_a,
80 nframes_t start_b, nframes_t end_b);
85 PluginAutomation = 0x4,
97 std::string auto_state_to_string (AutoState);
98 AutoState string_to_auto_state (std::string);
105 std::string auto_style_to_string (AutoStyle);
106 AutoStyle string_to_auto_style (std::string);
135 /* we can't define arithmetic operators for BBT_Time, because
136 the results depend on a TempoMap, but we can define
137 a useful check on the less-than condition.
140 bool operator< (const BBT_Time& other) const {
141 return bars < other.bars ||
142 (bars == other.bars && beats < other.beats) ||
143 (bars == other.bars && beats == other.beats && ticks < other.ticks);
146 bool operator== (const BBT_Time& other) const {
147 return bars == other.bars && beats == other.beats && ticks == other.ticks;
182 AnyTime() { type = Frames; frames = 0; }
190 AudioRange (nframes_t s, nframes_t e, uint32_t i) : start (s), end (e) , id (i) {}
192 nframes_t length() { return end - start + 1; }
194 bool operator== (const AudioRange& other) const {
195 return start == other.start && end == other.end && id == other.id;
198 bool equal (const AudioRange& other) const {
199 return start == other.start && end == other.end;
202 OverlapType coverage (nframes_t s, nframes_t e) const {
203 return ARDOUR::coverage (start, end, s, e);
212 MusicRange (BBT_Time& s, BBT_Time& e, uint32_t i)
213 : start (s), end (e), id (i) {}
215 bool operator== (const MusicRange& other) const {
216 return start == other.start && end == other.end && id == other.id;
219 bool equal (const MusicRange& other) const {
220 return start == other.start && end == other.end;
225 Slowest = 6.6dB/sec falloff at update rate of 40ms
226 Slow = 6.8dB/sec falloff at update rate of 40ms
231 MeterFalloffSlowest = 1,
232 MeterFalloffSlow = 2,
233 MeterFalloffMedium = 3,
234 MeterFalloffFast = 4,
235 MeterFalloffFaster = 5,
236 MeterFalloffFastest = 6
242 MeterHoldMedium = 100,
286 enum CrossfadeModel {
302 enum AutoConnectOption {
303 AutoConnectPhysical = 0x1,
304 AutoConnectMaster = 0x2
307 struct InterThreadInfo {
309 volatile bool cancel;
310 volatile float progress;
331 typedef Sample PeakDatum;
349 enum ShuttleBehaviour {
359 typedef std::vector<boost::shared_ptr<Source> > SourceList;
360 } // namespace ARDOUR
362 std::istream& operator>>(std::istream& o, ARDOUR::SampleFormat& sf);
363 std::istream& operator>>(std::istream& o, ARDOUR::HeaderFormat& sf);
364 std::istream& operator>>(std::istream& o, ARDOUR::AutoConnectOption& sf);
365 std::istream& operator>>(std::istream& o, ARDOUR::EditMode& sf);
366 std::istream& operator>>(std::istream& o, ARDOUR::MonitorModel& sf);
367 std::istream& operator>>(std::istream& o, ARDOUR::RemoteModel& sf);
368 std::istream& operator>>(std::istream& o, ARDOUR::SoloModel& sf);
369 std::istream& operator>>(std::istream& o, ARDOUR::LayerModel& sf);
370 std::istream& operator>>(std::istream& o, ARDOUR::CrossfadeModel& sf);
371 std::istream& operator>>(std::istream& o, ARDOUR::SlaveSource& sf);
372 std::istream& operator>>(std::istream& o, ARDOUR::ShuttleBehaviour& sf);
373 std::istream& operator>>(std::istream& o, ARDOUR::ShuttleUnits& sf);
374 std::istream& operator>>(std::istream& o, ARDOUR::SmpteFormat& sf);
375 std::istream& operator>>(std::istream& o, ARDOUR::DenormalModel& sf);
377 using ARDOUR::nframes_t;
379 static inline nframes_t
380 session_frame_to_track_frame (nframes_t session_frame, double speed)
382 return (nframes_t)( (double)session_frame * speed );
385 static inline nframes_t
386 track_frame_to_session_frame (nframes_t track_frame, double speed)
388 return (nframes_t)( (double)track_frame / speed );
392 #endif /* __ardour_types_h__ */