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 ARDOUR::OverlapType coverage (framepos_t sa, framepos_t ea,
87 framepos_t sb, framepos_t eb);
89 /* policies for inserting/pasting material where overlaps
93 enum InsertMergePolicy {
94 InsertMergeReject, // no overlaps allowed
95 InsertMergeRelax, // we just don't care about overlaps
96 InsertMergeReplace, // replace old with new
97 InsertMergeTruncateExisting, // shorten existing to avoid overlap
98 InsertMergeTruncateAddition, // shorten new to avoid overlap
99 InsertMergeExtend // extend new (or old) to the range of old+new
103 * XXX: I don't think/hope these hex values matter anymore.
105 enum AutomationType {
106 NullAutomation = 0x0,
107 GainAutomation = 0x1,
109 PluginAutomation = 0x4,
110 SoloAutomation = 0x8,
111 MuteAutomation = 0x10,
112 MidiCCAutomation = 0x20,
113 MidiPgmChangeAutomation = 0x21,
114 MidiPitchBenderAutomation = 0x22,
115 MidiChannelPressureAutomation = 0x23,
116 MidiSystemExclusiveAutomation = 0x24,
117 FadeInAutomation = 0x40,
118 FadeOutAutomation = 0x80,
119 EnvelopeAutomation = 0x100
129 std::string auto_state_to_string (AutoState);
130 AutoState string_to_auto_state (std::string);
137 std::string auto_style_to_string (AutoStyle);
138 AutoStyle string_to_auto_style (std::string);
164 AllChannels = 0, ///< Pass through all channel information unmodified
165 FilterChannels, ///< Ignore events on certain channels
166 ForceChannel ///< Force all events to a certain channel
175 enum TimecodeFormat {
198 Timecode::Time timecode;
206 AnyTime() { type = Frames; frames = 0; }
214 AudioRange (nframes_t s, nframes_t e, uint32_t i) : start (s), end (e) , id (i) {}
216 nframes_t length() { return end - start + 1; }
218 bool operator== (const AudioRange& other) const {
219 return start == other.start && end == other.end && id == other.id;
222 bool equal (const AudioRange& other) const {
223 return start == other.start && end == other.end;
226 OverlapType coverage (nframes_t s, nframes_t e) const {
227 return ARDOUR::coverage (start, end, s, e);
236 MusicRange (BBT_Time& s, BBT_Time& e, uint32_t i)
237 : start (s), end (e), id (i) {}
239 bool operator== (const MusicRange& other) const {
240 return start == other.start && end == other.end && id == other.id;
243 bool equal (const MusicRange& other) const {
244 return start == other.start && end == other.end;
249 Slowest = 6.6dB/sec falloff at update rate of 40ms
250 Slow = 6.8dB/sec falloff at update rate of 40ms
255 MeterFalloffSlowest = 1,
256 MeterFalloffSlow = 2,
257 MeterFalloffMedium = 3,
258 MeterFalloffFast = 4,
259 MeterFalloffFaster = 5,
260 MeterFalloffFastest = 6
266 MeterHoldMedium = 100,
306 enum CrossfadeModel {
317 enum ListenPosition {
322 enum AutoConnectOption {
324 AutoConnectPhysical = 0x1,
325 AutoConnectMaster = 0x2
328 struct InterThreadInfo {
329 InterThreadInfo () : done (false), cancel (false), progress (0), thread (0) {}
332 volatile bool cancel;
333 volatile float progress;
343 enum CDMarkerFormat {
360 typedef Sample PeakDatum;
385 enum ShuttleBehaviour {
395 typedef std::vector<boost::shared_ptr<Source> > SourceList;
405 struct TimeFXRequest : public InterThreadInfo {
407 : time_fraction(0), pitch_fraction(0),
408 quick_seek(false), antialias(false), opts(0) {}
410 float pitch_fraction;
415 int opts; // really RubberBandStretcher::Options
418 typedef std::list<nframes64_t> AnalysisFeatureList;
420 typedef std::list<boost::shared_ptr<Route> > RouteList;
423 typedef std::vector<boost::shared_ptr<Bundle> > BundleList;
441 struct CleanupReport {
442 std::vector<std::string> paths;
446 enum PositionLockStyle {
451 /** A struct used to describe changes to processors in a route.
452 * This is useful because objects that respond to a change in processors
453 * can optimise what work they do based on details of what has changed.
455 struct RouteProcessorChange {
458 MeterPointChange = 0x1
461 RouteProcessorChange () : type (GeneralChange), meter_visibly_changed (true)
464 RouteProcessorChange (Type t) : type (t), meter_visibly_changed (true)
467 RouteProcessorChange (Type t, bool m) : type (t), meter_visibly_changed (m)
470 /** type of change; "GeneralChange" means anything could have changed */
472 /** true if, when a MeterPointChange has occurred, the change is visible to the user */
473 bool meter_visibly_changed;
477 AutoConnectOption input_ac; /* override the RC config for input auto-connection */
478 AutoConnectOption output_ac; /* override the RC config for output auto-connection */
479 uint32_t master_out_channels; /* how many channels for the master bus */
480 uint32_t requested_physical_in; /* now many of the available physical inputs to consider usable */
481 uint32_t requested_physical_out; /* now many of the available physical inputs to consider usable */
484 } // namespace ARDOUR
487 /* these cover types declared above in this header. See enums.cc
491 std::istream& operator>>(std::istream& o, ARDOUR::SampleFormat& sf);
492 std::istream& operator>>(std::istream& o, ARDOUR::HeaderFormat& sf);
493 std::istream& operator>>(std::istream& o, ARDOUR::AutoConnectOption& sf);
494 std::istream& operator>>(std::istream& o, ARDOUR::EditMode& sf);
495 std::istream& operator>>(std::istream& o, ARDOUR::MonitorModel& sf);
496 std::istream& operator>>(std::istream& o, ARDOUR::RemoteModel& sf);
497 std::istream& operator>>(std::istream& o, ARDOUR::ListenPosition& sf);
498 std::istream& operator>>(std::istream& o, ARDOUR::LayerModel& sf);
499 std::istream& operator>>(std::istream& o, ARDOUR::InsertMergePolicy& sf);
500 std::istream& operator>>(std::istream& o, ARDOUR::CrossfadeModel& sf);
501 std::istream& operator>>(std::istream& o, ARDOUR::SyncSource& sf);
502 std::istream& operator>>(std::istream& o, ARDOUR::ShuttleBehaviour& sf);
503 std::istream& operator>>(std::istream& o, ARDOUR::ShuttleUnits& sf);
504 std::istream& operator>>(std::istream& o, ARDOUR::TimecodeFormat& sf);
505 std::istream& operator>>(std::istream& o, ARDOUR::DenormalModel& sf);
506 std::istream& operator>>(std::istream& o, ARDOUR::WaveformScale& sf);
507 std::istream& operator>>(std::istream& o, ARDOUR::WaveformShape& sf);
508 std::istream& operator>>(std::istream& o, ARDOUR::PositionLockStyle& sf);
510 std::ostream& operator<<(std::ostream& o, const ARDOUR::SampleFormat& sf);
511 std::ostream& operator<<(std::ostream& o, const ARDOUR::HeaderFormat& sf);
512 std::ostream& operator<<(std::ostream& o, const ARDOUR::AutoConnectOption& sf);
513 std::ostream& operator<<(std::ostream& o, const ARDOUR::EditMode& sf);
514 std::ostream& operator<<(std::ostream& o, const ARDOUR::MonitorModel& sf);
515 std::ostream& operator<<(std::ostream& o, const ARDOUR::RemoteModel& sf);
516 std::ostream& operator<<(std::ostream& o, const ARDOUR::ListenPosition& sf);
517 std::ostream& operator<<(std::ostream& o, const ARDOUR::LayerModel& sf);
518 std::ostream& operator<<(std::ostream& o, const ARDOUR::InsertMergePolicy& sf);
519 std::ostream& operator<<(std::ostream& o, const ARDOUR::CrossfadeModel& sf);
520 std::ostream& operator<<(std::ostream& o, const ARDOUR::SyncSource& sf);
521 std::ostream& operator<<(std::ostream& o, const ARDOUR::ShuttleBehaviour& sf);
522 std::ostream& operator<<(std::ostream& o, const ARDOUR::ShuttleUnits& sf);
523 std::ostream& operator<<(std::ostream& o, const ARDOUR::TimecodeFormat& sf);
524 std::ostream& operator<<(std::ostream& o, const ARDOUR::DenormalModel& sf);
525 std::ostream& operator<<(std::ostream& o, const ARDOUR::WaveformScale& sf);
526 std::ostream& operator<<(std::ostream& o, const ARDOUR::WaveformShape& sf);
527 std::ostream& operator<<(std::ostream& o, const ARDOUR::PositionLockStyle& sf);
529 static inline ARDOUR::nframes64_t
530 session_frame_to_track_frame (ARDOUR::nframes64_t session_frame, double speed)
532 return (ARDOUR::nframes64_t)( (double)session_frame * speed );
535 static inline ARDOUR::nframes64_t
536 track_frame_to_session_frame (ARDOUR::nframes64_t track_frame, double speed)
538 return (ARDOUR::nframes64_t)( (double)track_frame / speed );
541 /* for now, break the rules and use "using" to make these "global" */
543 using ARDOUR::nframes_t;
544 using ARDOUR::nframes64_t;
547 #endif /* __ardour_types_h__ */