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 <jack/midiport.h>
35 #include <control_protocol/smpte.h>
50 typedef jack_default_audio_sample_t Sample;
53 typedef uint32_t layer_t;
54 typedef uint64_t microseconds_t;
55 typedef uint32_t nframes_t;
57 typedef jack_midi_event_t MidiEvent;
58 typedef unsigned char RawMidi;
62 ConfigurationChanged = 0x1,
63 ConnectionsChanged = 0x2
67 OverlapNone, // no overlap
68 OverlapInternal, // the overlap is 100% with the object
69 OverlapStart, // overlap covers start, but ends within
70 OverlapEnd, // overlap begins within and covers end
71 OverlapExternal // overlap extends to (at least) begin+end
74 OverlapType coverage (nframes_t start_a, nframes_t end_a,
75 nframes_t start_b, nframes_t end_b);
80 PluginAutomation = 0x4,
92 std::string auto_state_to_string (AutoState);
93 AutoState string_to_auto_state (std::string);
100 std::string auto_style_to_string (AutoStyle);
101 AutoStyle string_to_auto_style (std::string);
130 /* we can't define arithmetic operators for BBT_Time, because
131 the results depend on a TempoMap, but we can define
132 a useful check on the less-than condition.
135 bool operator< (const BBT_Time& other) const {
136 return bars < other.bars ||
137 (bars == other.bars && beats < other.beats) ||
138 (bars == other.bars && beats == other.beats && ticks < other.ticks);
141 bool operator== (const BBT_Time& other) const {
142 return bars == other.bars && beats == other.beats && ticks == other.ticks;
177 AnyTime() { type = Frames; frames = 0; }
185 AudioRange (nframes_t s, nframes_t e, uint32_t i) : start (s), end (e) , id (i) {}
187 nframes_t length() { return end - start + 1; }
189 bool operator== (const AudioRange& other) const {
190 return start == other.start && end == other.end && id == other.id;
193 bool equal (const AudioRange& other) const {
194 return start == other.start && end == other.end;
197 OverlapType coverage (nframes_t s, nframes_t e) const {
198 return ARDOUR::coverage (start, end, s, e);
207 MusicRange (BBT_Time& s, BBT_Time& e, uint32_t i)
208 : start (s), end (e), id (i) {}
210 bool operator== (const MusicRange& other) const {
211 return start == other.start && end == other.end && id == other.id;
214 bool equal (const MusicRange& other) const {
215 return start == other.start && end == other.end;
220 Slowest = 6.6dB/sec falloff at update rate of 40ms
221 Slow = 6.8dB/sec falloff at update rate of 40ms
226 MeterFalloffSlowest = 1,
227 MeterFalloffSlow = 2,
228 MeterFalloffMedium = 3,
229 MeterFalloffFast = 4,
230 MeterFalloffFaster = 5,
231 MeterFalloffFastest = 6
237 MeterHoldMedium = 100,
268 enum CrossfadeModel {
284 enum AutoConnectOption {
285 AutoConnectPhysical = 0x1,
286 AutoConnectMaster = 0x2
289 struct InterThreadInfo {
291 volatile bool cancel;
292 volatile float progress;
313 typedef Sample PeakDatum;
331 enum ShuttleBehaviour {
341 typedef std::vector<boost::shared_ptr<Source> > SourceList;
342 } // namespace ARDOUR
344 std::istream& operator>>(std::istream& o, ARDOUR::SampleFormat& sf);
345 std::istream& operator>>(std::istream& o, ARDOUR::HeaderFormat& sf);
346 std::istream& operator>>(std::istream& o, ARDOUR::AutoConnectOption& sf);
347 std::istream& operator>>(std::istream& o, ARDOUR::EditMode& sf);
348 std::istream& operator>>(std::istream& o, ARDOUR::MonitorModel& sf);
349 std::istream& operator>>(std::istream& o, ARDOUR::SoloModel& sf);
350 std::istream& operator>>(std::istream& o, ARDOUR::LayerModel& sf);
351 std::istream& operator>>(std::istream& o, ARDOUR::CrossfadeModel& sf);
352 std::istream& operator>>(std::istream& o, ARDOUR::SlaveSource& sf);
353 std::istream& operator>>(std::istream& o, ARDOUR::ShuttleBehaviour& sf);
354 std::istream& operator>>(std::istream& o, ARDOUR::ShuttleUnits& sf);
355 std::istream& operator>>(std::istream& o, ARDOUR::SmpteFormat& sf);
357 using ARDOUR::nframes_t;
359 static inline nframes_t
360 session_frame_to_track_frame (nframes_t session_frame, double speed)
362 return (nframes_t)( (double)session_frame * speed );
365 static inline nframes_t
366 track_frame_to_session_frame (nframes_t track_frame, double speed)
368 return (nframes_t)( (double)track_frame / speed );
372 #endif /* __ardour_types_h__ */