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/timecode.h"
37 #include "ardour/bbt_time.h"
51 typedef jack_default_audio_sample_t Sample;
54 typedef uint32_t layer_t;
55 typedef uint64_t microseconds_t;
56 typedef uint32_t nframes_t;
57 typedef int64_t nframes64_t;
60 /** "Session frames", frames relative to the session timeline.
61 * Everything related to transport position etc. should be of this type.
62 * We might want to make this a compile time option for 32-bitters who
63 * don't want to pay for extremely long session times they don't need...
65 typedef int64_t sframes_t;
66 typedef int64_t framepos_t;
67 /* any offset from a framepos_t, measured in audio frames */
68 typedef int64_t frameoffset_t;
69 /* any count of audio frames */
70 typedef int64_t framecnt_t;
74 ConfigurationChanged = 0x1,
75 ConnectionsChanged = 0x2
79 OverlapNone, // no overlap
80 OverlapInternal, // the overlap is 100% with the object
81 OverlapStart, // overlap covers start, but ends within
82 OverlapEnd, // overlap begins within and covers end
83 OverlapExternal // overlap extends to (at least) begin+end
86 OverlapType coverage (nframes_t start_a, nframes_t end_a,
87 nframes_t start_b, nframes_t end_b);
90 * XXX: I don't think/hope these hex values matter anymore.
96 PluginAutomation = 0x4,
98 MuteAutomation = 0x10,
99 MidiCCAutomation = 0x20,
100 MidiPgmChangeAutomation = 0x21,
101 MidiPitchBenderAutomation = 0x22,
102 MidiChannelPressureAutomation = 0x23,
103 MidiSystemExclusiveAutomation = 0x24,
104 FadeInAutomation = 0x40,
105 FadeOutAutomation = 0x80,
106 EnvelopeAutomation = 0x100
116 std::string auto_state_to_string (AutoState);
117 AutoState string_to_auto_state (std::string);
124 std::string auto_style_to_string (AutoStyle);
125 AutoStyle string_to_auto_style (std::string);
151 AllChannels = 0, ///< Pass through all channel information unmodified
152 FilterChannels, ///< Ignore events on certain channels
153 ForceChannel ///< Force all events to a certain channel
162 enum TimecodeFormat {
185 Timecode::Time timecode;
193 AnyTime() { type = Frames; frames = 0; }
201 AudioRange (nframes_t s, nframes_t e, uint32_t i) : start (s), end (e) , id (i) {}
203 nframes_t length() { return end - start + 1; }
205 bool operator== (const AudioRange& other) const {
206 return start == other.start && end == other.end && id == other.id;
209 bool equal (const AudioRange& other) const {
210 return start == other.start && end == other.end;
213 OverlapType coverage (nframes_t s, nframes_t e) const {
214 return ARDOUR::coverage (start, end, s, e);
223 MusicRange (BBT_Time& s, BBT_Time& e, uint32_t i)
224 : start (s), end (e), id (i) {}
226 bool operator== (const MusicRange& other) const {
227 return start == other.start && end == other.end && id == other.id;
230 bool equal (const MusicRange& other) const {
231 return start == other.start && end == other.end;
236 Slowest = 6.6dB/sec falloff at update rate of 40ms
237 Slow = 6.8dB/sec falloff at update rate of 40ms
242 MeterFalloffSlowest = 1,
243 MeterFalloffSlow = 2,
244 MeterFalloffMedium = 3,
245 MeterFalloffFast = 4,
246 MeterFalloffFaster = 5,
247 MeterFalloffFastest = 6
253 MeterHoldMedium = 100,
293 enum CrossfadeModel {
304 enum ListenPosition {
309 enum AutoConnectOption {
311 AutoConnectPhysical = 0x1,
312 AutoConnectMaster = 0x2
315 struct InterThreadInfo {
317 volatile bool cancel;
318 volatile float progress;
328 enum CDMarkerFormat {
345 typedef Sample PeakDatum;
370 enum ShuttleBehaviour {
380 typedef std::vector<boost::shared_ptr<Source> > SourceList;
390 struct TimeFXRequest : public InterThreadInfo {
392 : time_fraction(0), pitch_fraction(0),
393 quick_seek(false), antialias(false), opts(0) {}
395 float pitch_fraction;
400 int opts; // really RubberBandStretcher::Options
403 typedef std::list<nframes64_t> AnalysisFeatureList;
405 typedef std::list<boost::shared_ptr<Route> > RouteList;
408 typedef std::vector<boost::shared_ptr<Bundle> > BundleList;
426 struct CleanupReport {
427 std::vector<std::string> paths;
431 /** A struct used to describe changes to processors in a route.
432 * This is useful because objects that respond to a change in processors
433 * can optimise what work they do based on details of what has changed.
435 struct RouteProcessorChange {
438 MeterPointChange = 0x1
441 RouteProcessorChange () : type (GeneralChange), meter_visibly_changed (true)
444 RouteProcessorChange (Type t) : type (t), meter_visibly_changed (true)
447 RouteProcessorChange (Type t, bool m) : type (t), meter_visibly_changed (m)
450 /** type of change; "GeneralChange" means anything could have changed */
452 /** true if, when a MeterPointChange has occurred, the change is visible to the user */
453 bool meter_visibly_changed;
456 } // namespace ARDOUR
459 /* these cover types declared above in this header. See enums.cc
463 std::istream& operator>>(std::istream& o, ARDOUR::SampleFormat& sf);
464 std::istream& operator>>(std::istream& o, ARDOUR::HeaderFormat& sf);
465 std::istream& operator>>(std::istream& o, ARDOUR::AutoConnectOption& sf);
466 std::istream& operator>>(std::istream& o, ARDOUR::EditMode& sf);
467 std::istream& operator>>(std::istream& o, ARDOUR::MonitorModel& sf);
468 std::istream& operator>>(std::istream& o, ARDOUR::RemoteModel& sf);
469 std::istream& operator>>(std::istream& o, ARDOUR::ListenPosition& sf);
470 std::istream& operator>>(std::istream& o, ARDOUR::LayerModel& sf);
471 std::istream& operator>>(std::istream& o, ARDOUR::CrossfadeModel& sf);
472 std::istream& operator>>(std::istream& o, ARDOUR::SyncSource& sf);
473 std::istream& operator>>(std::istream& o, ARDOUR::ShuttleBehaviour& sf);
474 std::istream& operator>>(std::istream& o, ARDOUR::ShuttleUnits& sf);
475 std::istream& operator>>(std::istream& o, ARDOUR::TimecodeFormat& sf);
476 std::istream& operator>>(std::istream& o, ARDOUR::DenormalModel& sf);
477 std::istream& operator>>(std::istream& o, ARDOUR::WaveformScale& sf);
478 std::istream& operator>>(std::istream& o, ARDOUR::WaveformShape& sf);
480 std::ostream& operator<<(std::ostream& o, const ARDOUR::SampleFormat& sf);
481 std::ostream& operator<<(std::ostream& o, const ARDOUR::HeaderFormat& sf);
482 std::ostream& operator<<(std::ostream& o, const ARDOUR::AutoConnectOption& sf);
483 std::ostream& operator<<(std::ostream& o, const ARDOUR::EditMode& sf);
484 std::ostream& operator<<(std::ostream& o, const ARDOUR::MonitorModel& sf);
485 std::ostream& operator<<(std::ostream& o, const ARDOUR::RemoteModel& sf);
486 std::ostream& operator<<(std::ostream& o, const ARDOUR::ListenPosition& sf);
487 std::ostream& operator<<(std::ostream& o, const ARDOUR::LayerModel& sf);
488 std::ostream& operator<<(std::ostream& o, const ARDOUR::CrossfadeModel& sf);
489 std::ostream& operator<<(std::ostream& o, const ARDOUR::SyncSource& sf);
490 std::ostream& operator<<(std::ostream& o, const ARDOUR::ShuttleBehaviour& sf);
491 std::ostream& operator<<(std::ostream& o, const ARDOUR::ShuttleUnits& sf);
492 std::ostream& operator<<(std::ostream& o, const ARDOUR::TimecodeFormat& sf);
493 std::ostream& operator<<(std::ostream& o, const ARDOUR::DenormalModel& sf);
494 std::ostream& operator<<(std::ostream& o, const ARDOUR::WaveformScale& sf);
495 std::ostream& operator<<(std::ostream& o, const ARDOUR::WaveformShape& sf);
497 static inline ARDOUR::nframes64_t
498 session_frame_to_track_frame (ARDOUR::nframes64_t session_frame, double speed)
500 return (ARDOUR::nframes64_t)( (double)session_frame * speed );
503 static inline ARDOUR::nframes64_t
504 track_frame_to_session_frame (ARDOUR::nframes64_t track_frame, double speed)
506 return (ARDOUR::nframes64_t)( (double)track_frame / speed );
509 /* for now, break the rules and use "using" to make these "global" */
511 using ARDOUR::nframes_t;
512 using ARDOUR::nframes64_t;
515 #endif /* __ardour_types_h__ */