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 unsigned char Byte;
64 /** Identical to jack_midi_event_t, but with double timestamp
66 * time is either a frame time (from/to Jack) or a beat time (internal
67 * tempo time, used in MidiModel) depending on context.
70 MidiEvent(double t=0, size_t s=0, Byte* b=NULL)
71 : time(t), size(s), buffer(b)
74 double time; /**< Sample index (or beat time) at which event is valid */
75 size_t size; /**< Number of bytes of data in \a buffer */
76 Byte* buffer; /**< Raw MIDI data */
81 ConfigurationChanged = 0x1,
82 ConnectionsChanged = 0x2
86 OverlapNone, // no overlap
87 OverlapInternal, // the overlap is 100% with the object
88 OverlapStart, // overlap covers start, but ends within
89 OverlapEnd, // overlap begins within and covers end
90 OverlapExternal // overlap extends to (at least) begin+end
93 OverlapType coverage (nframes_t start_a, nframes_t end_a,
94 nframes_t start_b, nframes_t end_b);
97 * XXX: I don't think/hope these hex values matter anymore.
100 NullAutomation = 0x0,
101 GainAutomation = 0x1,
103 PluginAutomation = 0x4,
104 SoloAutomation = 0x8,
105 MuteAutomation = 0x10,
106 MidiCCAutomation = 0x20,
107 FadeInAutomation = 0x40,
108 FadeOutAutomation = 0x80,
109 EnvelopeAutomation = 0x100
119 std::string auto_state_to_string (AutoState);
120 AutoState string_to_auto_state (std::string);
127 std::string auto_style_to_string (AutoStyle);
128 AutoStyle string_to_auto_style (std::string);
157 /* we can't define arithmetic operators for BBT_Time, because
158 the results depend on a TempoMap, but we can define
159 a useful check on the less-than condition.
162 bool operator< (const BBT_Time& other) const {
163 return bars < other.bars ||
164 (bars == other.bars && beats < other.beats) ||
165 (bars == other.bars && beats == other.beats && ticks < other.ticks);
168 bool operator== (const BBT_Time& other) const {
169 return bars == other.bars && beats == other.beats && ticks == other.ticks;
204 AnyTime() { type = Frames; frames = 0; }
212 AudioRange (nframes_t s, nframes_t e, uint32_t i) : start (s), end (e) , id (i) {}
214 nframes_t length() { return end - start + 1; }
216 bool operator== (const AudioRange& other) const {
217 return start == other.start && end == other.end && id == other.id;
220 bool equal (const AudioRange& other) const {
221 return start == other.start && end == other.end;
224 OverlapType coverage (nframes_t s, nframes_t e) const {
225 return ARDOUR::coverage (start, end, s, e);
234 MusicRange (BBT_Time& s, BBT_Time& e, uint32_t i)
235 : start (s), end (e), id (i) {}
237 bool operator== (const MusicRange& other) const {
238 return start == other.start && end == other.end && id == other.id;
241 bool equal (const MusicRange& other) const {
242 return start == other.start && end == other.end;
247 Slowest = 6.6dB/sec falloff at update rate of 40ms
248 Slow = 6.8dB/sec falloff at update rate of 40ms
253 MeterFalloffSlowest = 1,
254 MeterFalloffSlow = 2,
255 MeterFalloffMedium = 3,
256 MeterFalloffFast = 4,
257 MeterFalloffFaster = 5,
258 MeterFalloffFastest = 6
264 MeterHoldMedium = 100,
308 enum CrossfadeModel {
324 enum AutoConnectOption {
325 AutoConnectPhysical = 0x1,
326 AutoConnectMaster = 0x2
329 struct InterThreadInfo {
331 volatile bool cancel;
332 volatile float progress;
353 typedef Sample PeakDatum;
371 enum ShuttleBehaviour {
381 typedef std::vector<boost::shared_ptr<Source> > SourceList;
382 } // namespace ARDOUR
384 std::istream& operator>>(std::istream& o, ARDOUR::SampleFormat& sf);
385 std::istream& operator>>(std::istream& o, ARDOUR::HeaderFormat& sf);
386 std::istream& operator>>(std::istream& o, ARDOUR::AutoConnectOption& sf);
387 std::istream& operator>>(std::istream& o, ARDOUR::EditMode& sf);
388 std::istream& operator>>(std::istream& o, ARDOUR::MonitorModel& sf);
389 std::istream& operator>>(std::istream& o, ARDOUR::RemoteModel& sf);
390 std::istream& operator>>(std::istream& o, ARDOUR::SoloModel& sf);
391 std::istream& operator>>(std::istream& o, ARDOUR::LayerModel& sf);
392 std::istream& operator>>(std::istream& o, ARDOUR::CrossfadeModel& sf);
393 std::istream& operator>>(std::istream& o, ARDOUR::SlaveSource& sf);
394 std::istream& operator>>(std::istream& o, ARDOUR::ShuttleBehaviour& sf);
395 std::istream& operator>>(std::istream& o, ARDOUR::ShuttleUnits& sf);
396 std::istream& operator>>(std::istream& o, ARDOUR::SmpteFormat& sf);
397 std::istream& operator>>(std::istream& o, ARDOUR::DenormalModel& sf);
399 using ARDOUR::nframes_t;
401 static inline nframes_t
402 session_frame_to_track_frame (nframes_t session_frame, double speed)
404 return (nframes_t)( (double)session_frame * speed );
407 static inline nframes_t
408 track_frame_to_session_frame (nframes_t track_frame, double speed)
410 return (nframes_t)( (double)track_frame / speed );
414 #endif /* __ardour_types_h__ */