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;
56 typedef jack_default_audio_sample_t Sample;
59 typedef uint32_t layer_t;
60 typedef uint64_t microseconds_t;
61 typedef uint32_t nframes_t;
65 ConfigurationChanged = 0x1,
66 ConnectionsChanged = 0x2
70 OverlapNone, // no overlap
71 OverlapInternal, // the overlap is 100% with the object
72 OverlapStart, // overlap covers start, but ends within
73 OverlapEnd, // overlap begins within and covers end
74 OverlapExternal // overlap extends to (at least) begin+end
77 OverlapType coverage (nframes_t start_a, nframes_t end_a,
78 nframes_t start_b, nframes_t end_b);
81 * XXX: I don't think/hope these hex values matter anymore.
87 PluginAutomation = 0x4,
89 MuteAutomation = 0x10,
90 MidiCCAutomation = 0x20,
91 MidiPgmChangeAutomation = 0x21,
92 MidiPitchBenderAutomation = 0x22,
93 MidiChannelPressureAutomation = 0x23,
94 MidiSystemExclusiveAutomation = 0x24,
95 FadeInAutomation = 0x40,
96 FadeOutAutomation = 0x80,
97 EnvelopeAutomation = 0x100
107 std::string auto_state_to_string (AutoState);
108 AutoState string_to_auto_state (std::string);
115 std::string auto_style_to_string (AutoStyle);
116 AutoStyle string_to_auto_style (std::string);
140 AllChannels = 0, ///< Pass through all channel information unmodified
141 FilterChannels, ///< Ignore events on certain channels
142 ForceChannel ///< Force all events to a certain channel
162 /* we can't define arithmetic operators for BBT_Time, because
163 the results depend on a TempoMap, but we can define
164 a useful check on the less-than condition.
167 bool operator< (const BBT_Time& other) const {
168 return bars < other.bars ||
169 (bars == other.bars && beats < other.beats) ||
170 (bars == other.bars && beats == other.beats && ticks < other.ticks);
173 bool operator== (const BBT_Time& other) const {
174 return bars == other.bars && beats == other.beats && ticks == other.ticks;
209 AnyTime() { type = Frames; frames = 0; }
217 AudioRange (nframes_t s, nframes_t e, uint32_t i) : start (s), end (e) , id (i) {}
219 nframes_t length() { return end - start + 1; }
221 bool operator== (const AudioRange& other) const {
222 return start == other.start && end == other.end && id == other.id;
225 bool equal (const AudioRange& other) const {
226 return start == other.start && end == other.end;
229 OverlapType coverage (nframes_t s, nframes_t e) const {
230 return ARDOUR::coverage (start, end, s, e);
239 MusicRange (BBT_Time& s, BBT_Time& e, uint32_t i)
240 : start (s), end (e), id (i) {}
242 bool operator== (const MusicRange& other) const {
243 return start == other.start && end == other.end && id == other.id;
246 bool equal (const MusicRange& other) const {
247 return start == other.start && end == other.end;
252 Slowest = 6.6dB/sec falloff at update rate of 40ms
253 Slow = 6.8dB/sec falloff at update rate of 40ms
258 MeterFalloffSlowest = 1,
259 MeterFalloffSlow = 2,
260 MeterFalloffMedium = 3,
261 MeterFalloffFast = 4,
262 MeterFalloffFaster = 5,
263 MeterFalloffFastest = 6
269 MeterHoldMedium = 100,
314 enum CrossfadeModel {
330 enum AutoConnectOption {
331 AutoConnectPhysical = 0x1,
332 AutoConnectMaster = 0x2
335 struct InterThreadInfo {
337 volatile bool cancel;
338 volatile float progress;
348 enum CDMarkerFormat {
365 typedef Sample PeakDatum;
391 enum ShuttleBehaviour {
401 typedef std::vector<boost::shared_ptr<Source> > SourceList;
411 struct TimeFXRequest : public InterThreadInfo {
412 TimeFXRequest() : time_fraction(0), pitch_fraction(0),
413 quick_seek(false), antialias(false), opts(0) {}
415 float pitch_fraction;
420 int opts; // really RubberBandStretcher::Options
423 typedef std::list<nframes64_t> AnalysisFeatureList;
425 typedef std::list<boost::shared_ptr<Route> > RouteList;
428 typedef std::vector<boost::shared_ptr<Bundle> > BundleList;
430 } // namespace ARDOUR
432 std::istream& operator>>(std::istream& o, ARDOUR::SampleFormat& sf);
433 std::istream& operator>>(std::istream& o, ARDOUR::HeaderFormat& sf);
434 std::istream& operator>>(std::istream& o, ARDOUR::AutoConnectOption& sf);
435 std::istream& operator>>(std::istream& o, ARDOUR::EditMode& sf);
436 std::istream& operator>>(std::istream& o, ARDOUR::MonitorModel& sf);
437 std::istream& operator>>(std::istream& o, ARDOUR::RemoteModel& sf);
438 std::istream& operator>>(std::istream& o, ARDOUR::SoloModel& sf);
439 std::istream& operator>>(std::istream& o, ARDOUR::LayerModel& sf);
440 std::istream& operator>>(std::istream& o, ARDOUR::CrossfadeModel& sf);
441 std::istream& operator>>(std::istream& o, ARDOUR::SlaveSource& sf);
442 std::istream& operator>>(std::istream& o, ARDOUR::ShuttleBehaviour& sf);
443 std::istream& operator>>(std::istream& o, ARDOUR::ShuttleUnits& sf);
444 std::istream& operator>>(std::istream& o, ARDOUR::SmpteFormat& sf);
445 std::istream& operator>>(std::istream& o, ARDOUR::DenormalModel& sf);
447 using ARDOUR::nframes_t;
449 static inline nframes_t
450 session_frame_to_track_frame (nframes_t session_frame, double speed)
452 return (nframes_t)( (double)session_frame * speed );
455 static inline nframes_t
456 track_frame_to_session_frame (nframes_t track_frame, double speed)
458 return (nframes_t)( (double)track_frame / speed );
462 #endif /* __ardour_types_h__ */