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;
63 /** "Session frames", frames relative to the session timeline.
64 * Everything related to transport position etc. should be of this type.
65 * We might want to make this a compile time option for 32-bitters who
66 * don't want to pay for extremely long session times they don't need...
68 typedef int64_t sframes_t;
72 ConfigurationChanged = 0x1,
73 ConnectionsChanged = 0x2
77 OverlapNone, // no overlap
78 OverlapInternal, // the overlap is 100% with the object
79 OverlapStart, // overlap covers start, but ends within
80 OverlapEnd, // overlap begins within and covers end
81 OverlapExternal // overlap extends to (at least) begin+end
84 OverlapType coverage (nframes_t start_a, nframes_t end_a,
85 nframes_t start_b, nframes_t end_b);
88 * XXX: I don't think/hope these hex values matter anymore.
94 PluginAutomation = 0x4,
96 MuteAutomation = 0x10,
97 MidiCCAutomation = 0x20,
98 MidiPgmChangeAutomation = 0x21,
99 MidiPitchBenderAutomation = 0x22,
100 MidiChannelPressureAutomation = 0x23,
101 MidiSystemExclusiveAutomation = 0x24,
102 FadeInAutomation = 0x40,
103 FadeOutAutomation = 0x80,
104 EnvelopeAutomation = 0x100
114 std::string auto_state_to_string (AutoState);
115 AutoState string_to_auto_state (std::string);
122 std::string auto_style_to_string (AutoStyle);
123 AutoStyle string_to_auto_style (std::string);
148 AllChannels = 0, ///< Pass through all channel information unmodified
149 FilterChannels, ///< Ignore events on certain channels
150 ForceChannel ///< Force all events to a certain channel
170 /* we can't define arithmetic operators for BBT_Time, because
171 the results depend on a TempoMap, but we can define
172 a useful check on the less-than condition.
175 bool operator< (const BBT_Time& other) const {
176 return bars < other.bars ||
177 (bars == other.bars && beats < other.beats) ||
178 (bars == other.bars && beats == other.beats && ticks < other.ticks);
181 bool operator== (const BBT_Time& other) const {
182 return bars == other.bars && beats == other.beats && ticks == other.ticks;
217 AnyTime() { type = Frames; frames = 0; }
225 AudioRange (nframes_t s, nframes_t e, uint32_t i) : start (s), end (e) , id (i) {}
227 nframes_t length() { return end - start + 1; }
229 bool operator== (const AudioRange& other) const {
230 return start == other.start && end == other.end && id == other.id;
233 bool equal (const AudioRange& other) const {
234 return start == other.start && end == other.end;
237 OverlapType coverage (nframes_t s, nframes_t e) const {
238 return ARDOUR::coverage (start, end, s, e);
247 MusicRange (BBT_Time& s, BBT_Time& e, uint32_t i)
248 : start (s), end (e), id (i) {}
250 bool operator== (const MusicRange& other) const {
251 return start == other.start && end == other.end && id == other.id;
254 bool equal (const MusicRange& other) const {
255 return start == other.start && end == other.end;
260 Slowest = 6.6dB/sec falloff at update rate of 40ms
261 Slow = 6.8dB/sec falloff at update rate of 40ms
266 MeterFalloffSlowest = 1,
267 MeterFalloffSlow = 2,
268 MeterFalloffMedium = 3,
269 MeterFalloffFast = 4,
270 MeterFalloffFaster = 5,
271 MeterFalloffFastest = 6
277 MeterHoldMedium = 100,
322 enum CrossfadeModel {
338 enum AutoConnectOption {
340 AutoConnectPhysical = 0x1,
341 AutoConnectMaster = 0x2
344 struct InterThreadInfo {
346 volatile bool cancel;
347 volatile float progress;
357 enum CDMarkerFormat {
374 typedef Sample PeakDatum;
400 enum ShuttleBehaviour {
410 typedef std::vector<boost::shared_ptr<Source> > SourceList;
420 struct TimeFXRequest : public InterThreadInfo {
421 TimeFXRequest() : time_fraction(0), pitch_fraction(0),
422 quick_seek(false), antialias(false), opts(0) {}
424 float pitch_fraction;
429 int opts; // really RubberBandStretcher::Options
432 typedef std::list<nframes64_t> AnalysisFeatureList;
434 typedef std::list<boost::shared_ptr<Route> > RouteList;
437 typedef std::vector<boost::shared_ptr<Bundle> > BundleList;
439 } // namespace ARDOUR
441 std::istream& operator>>(std::istream& o, ARDOUR::SampleFormat& sf);
442 std::istream& operator>>(std::istream& o, ARDOUR::HeaderFormat& sf);
443 std::istream& operator>>(std::istream& o, ARDOUR::AutoConnectOption& sf);
444 std::istream& operator>>(std::istream& o, ARDOUR::EditMode& sf);
445 std::istream& operator>>(std::istream& o, ARDOUR::MonitorModel& sf);
446 std::istream& operator>>(std::istream& o, ARDOUR::RemoteModel& sf);
447 std::istream& operator>>(std::istream& o, ARDOUR::SoloModel& sf);
448 std::istream& operator>>(std::istream& o, ARDOUR::LayerModel& sf);
449 std::istream& operator>>(std::istream& o, ARDOUR::CrossfadeModel& sf);
450 std::istream& operator>>(std::istream& o, ARDOUR::SlaveSource& sf);
451 std::istream& operator>>(std::istream& o, ARDOUR::ShuttleBehaviour& sf);
452 std::istream& operator>>(std::istream& o, ARDOUR::ShuttleUnits& sf);
453 std::istream& operator>>(std::istream& o, ARDOUR::SmpteFormat& sf);
454 std::istream& operator>>(std::istream& o, ARDOUR::DenormalModel& sf);
456 using ARDOUR::nframes_t;
458 static inline nframes_t
459 session_frame_to_track_frame (nframes_t session_frame, double speed)
461 return (nframes_t)( (double)session_frame * speed );
464 static inline nframes_t
465 track_frame_to_session_frame (nframes_t track_frame, double speed)
467 return (nframes_t)( (double)track_frame / speed );
471 #endif /* __ardour_types_h__ */