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__
27 #include <boost/shared_ptr.hpp>
28 #include <sys/types.h>
34 #include "temporal/bbt_time.h"
35 #include "temporal/time.h"
36 #include "temporal/types.h"
40 #include "evoral/Range.hpp"
42 #include "ardour/chan_count.h"
43 #include "ardour/plugin_types.h"
47 using Temporal::max_samplepos;
48 using Temporal::max_samplecnt;
62 class AutomationControl;
63 class SlavableAutomationControl;
68 typedef uint32_t layer_t;
69 typedef uint64_t microseconds_t;
70 typedef uint32_t pframes_t;
72 /* rebind Temporal position types into ARDOUR namespace */
73 typedef Temporal::samplecnt_t samplecnt_t;
74 typedef Temporal::samplepos_t samplepos_t;
75 typedef Temporal::sampleoffset_t sampleoffset_t;
77 static const layer_t max_layer = UINT32_MAX;
79 // a set of (time) intervals: first of pair is the offset of the start within the region, second is the offset of the end
80 typedef std::list<std::pair<sampleoffset_t, sampleoffset_t> > AudioIntervalResult;
81 // associate a set of intervals with regions (e.g. for silence detection)
82 typedef std::map<boost::shared_ptr<ARDOUR::Region>,AudioIntervalResult> AudioIntervalMap;
84 typedef std::list<boost::shared_ptr<Region> > RegionList;
90 ConfigurationChanged = 0x1,
91 ConnectionsChanged = 0x2
94 IOChange () : type (NoChange) {}
95 IOChange (Type t) : type (t) {}
97 /** channel count of IO before a ConfigurationChanged, if appropriate */
98 ARDOUR::ChanCount before;
99 /** channel count of IO after a ConfigurationChanged, if appropriate */
100 ARDOUR::ChanCount after;
103 /* policies for inserting/pasting material where overlaps
107 enum InsertMergePolicy {
108 InsertMergeReject, ///< no overlaps allowed
109 InsertMergeRelax, ///< we just don't care about overlaps
110 InsertMergeReplace, ///< replace old with new
111 InsertMergeTruncateExisting, ///< shorten existing to avoid overlap
112 InsertMergeTruncateAddition, ///< shorten new to avoid overlap
113 InsertMergeExtend ///< extend new (or old) to the range of old+new
116 /** See evoral/Parameter.hpp
118 * When you add things here, you REALLY SHOULD add a case clause to
119 * the constructor of ParameterDescriptor, unless the Controllables
120 * that the enum refers to are completely standard (0-1.0 range, 0.0 as
121 * normal, non-toggled, non-enumerated). Anything else needs to be
122 * added there so that things that try to represent them can do so
123 * with as much information as possible.
125 enum AutomationType {
128 PanAzimuthAutomation,
129 PanElevationAutomation,
131 PanFrontBackAutomation,
134 PluginPropertyAutomation,
136 SoloIsolateAutomation,
140 MidiPgmChangeAutomation,
141 MidiPitchBenderAutomation,
142 MidiChannelPressureAutomation,
143 MidiNotePressureAutomation,
144 MidiSystemExclusiveAutomation,
152 MonitoringAutomation,
165 std::string auto_state_to_string (AutoState);
166 AutoState string_to_auto_state (std::string);
188 DiskIOPreFader, /* after the trim control, but before other processors */
189 DiskIOPostFader, /* before the main outs, after other processors */
190 DiskIOCustom, /* up to the user. Caveat Emptor! */
194 MeterMaxSignal = 0x0001,
195 MeterMaxPeak = 0x0002,
200 MeterIEC1DIN = 0x0040,
201 MeterIEC1NOR = 0x0080,
202 MeterIEC2BBC = 0x0100,
203 MeterIEC2EBU = 0x0200,
206 MeterPeak0dB = 0x1000,
222 AllChannels = 0, ///< Pass through all channel information unmodified
223 FilterChannels, ///< Ignore events on certain channels
224 ForceChannel ///< Force all events to a certain channel
234 RoundDownMaybe = -2, ///< Round down only if necessary
235 RoundDownAlways = -1, ///< Always round down, even if on a division
236 RoundNearest = 0, ///< Round to nearest
237 RoundUpAlways = 1, ///< Always round up, even if on a division
238 RoundUpMaybe = 2 ///< Round up only if necessary
242 SnapToAny = 0, ///< Snaps to the closest of ( snap prefs, grid quantization )
243 SnapToGrid = 1, ///< Prefer snapping to the closest grid quantization, if a Grid selection is enabled
257 Timecode::Time timecode;
258 Timecode::BBT_Time bbt;
265 AnyTime() { type = Samples; samples = 0; }
267 bool operator== (AnyTime const & other) const {
268 if (type != other.type) { return false; }
272 return timecode == other.timecode;
274 return bbt == other.bbt;
276 return samples == other.samples;
278 return seconds == other.seconds;
280 return false; // get rid of warning
283 bool not_zero() const
287 return timecode.hours != 0 || timecode.minutes != 0 ||
288 timecode.seconds != 0 || timecode.frames != 0;
290 return bbt.bars != 0 || bbt.beats != 0 || bbt.ticks != 0;
297 abort(); /* NOTREACHED */
302 /* used for translating audio samples to an exact musical position using a note divisor.
303 an exact musical position almost never falls exactly on an audio sample, but for sub-sample
304 musical accuracy we need to derive exact musical locations from a sample position
305 the division follows TempoMap::exact_beat_at_sample().
307 -1 musical location is the bar closest to sample
308 0 musical location is the musical position of the sample
309 1 musical location is the BBT beat closest to sample
310 n musical location is the quarter-note division n closest to sample
316 MusicSample (samplepos_t f, int32_t d) : sample (f), division (d) {}
318 void set (samplepos_t f, int32_t d) {sample = f; division = d; }
320 MusicSample operator- (MusicSample other) { return MusicSample (sample - other.sample, 0); }
323 /* XXX: slightly unfortunate that there is this and Evoral::Range<>,
324 but this has a uint32_t id which Evoral::Range<> does not.
331 AudioRange (samplepos_t s, samplepos_t e, uint32_t i) : start (s), end (e) , id (i) {}
333 samplecnt_t length() const { return end - start + 1; }
335 bool operator== (const AudioRange& other) const {
336 return start == other.start && end == other.end && id == other.id;
339 bool equal (const AudioRange& other) const {
340 return start == other.start && end == other.end;
343 Evoral::OverlapType coverage (samplepos_t s, samplepos_t e) const {
344 return Evoral::coverage (start, end, s, e);
349 Timecode::BBT_Time start;
350 Timecode::BBT_Time end;
353 MusicRange (Timecode::BBT_Time& s, Timecode::BBT_Time& e, uint32_t i)
354 : start (s), end (e), id (i) {}
356 bool operator== (const MusicRange& other) const {
357 return start == other.start && end == other.end && id == other.id;
360 bool equal (const MusicRange& other) const {
361 return start == other.start && end == other.end;
366 Slowest = 6.6dB/sec falloff at update rate of 40ms
367 Slow = 6.8dB/sec falloff at update rate of 40ms
372 MeterFalloffSlowest = 1,
373 MeterFalloffSlow = 2,
374 MeterFalloffSlowish = 3,
375 MeterFalloffModerate = 4,
376 MeterFalloffMedium = 5,
377 MeterFalloffFast = 6,
378 MeterFalloffFaster = 7,
379 MeterFalloffFastest = 8,
385 MeterHoldMedium = 100,
396 enum RegionSelectionAfterSplit {
398 NewlyCreatedLeft = 1, // bit 0
399 NewlyCreatedRight = 2, // bit 1
400 NewlyCreatedBoth = 3,
401 Existing = 4, // bit 2
402 ExistingNewlyCreatedLeft = 5,
403 ExistingNewlyCreatedRight = 6,
404 ExistingNewlyCreatedBoth = 7
419 HardwareMonitoring, ///< JACK does monitoring
420 SoftwareMonitoring, ///< Ardour does monitoring
421 ExternalMonitoring ///< we leave monitoring to the audio hardware
432 MonitoringSilence = 0x1,
433 MonitoringInput = 0x2,
434 MonitoringDisk = 0x4,
438 MeteringInput, ///< meter the input IO, regardless of what is going through the route
439 MeteringRoute ///< meter what is going through the route
442 enum VUMeterStandard {
443 MeteringVUfrench, // 0VU = -2dBu
444 MeteringVUamerican, // 0VU = 0dBu
445 MeteringVUstandard, // 0VU = +4dBu
446 MeteringVUeight // 0VU = +8dBu
457 /** PFL signals come from before pre-fader processors */
458 PFLFromBeforeProcessors,
459 /** PFL signals come pre-fader but after pre-fader processors */
460 PFLFromAfterProcessors
464 /** AFL signals come post-fader and before post-fader processors */
465 AFLFromBeforeProcessors,
466 /** AFL signals come post-fader but after post-fader processors */
467 AFLFromAfterProcessors
470 enum ClockDeltaMode {
488 enum ListenPosition {
493 enum AutoConnectOption {
495 AutoConnectPhysical = 0x1,
496 AutoConnectMaster = 0x2
499 enum TracksAutoNamingRule {
500 UseDefaultNames = 0x1,
501 NameAfterDriver = 0x2
510 int format_data_width (ARDOUR::SampleFormat);
512 enum CDMarkerFormat {
532 typedef Sample PeakDatum;
545 /* These are "synonyms". It is important for JACK to be first
546 both here and in enums.cc, so that the string "JACK" is
547 correctly recognized in older session and preference files.
556 enum ShuttleBehaviour {
566 typedef std::vector<boost::shared_ptr<Source> > SourceList;
576 typedef std::list<samplepos_t> AnalysisFeatureList;
578 typedef std::list<boost::shared_ptr<Route> > RouteList;
579 typedef std::list<boost::shared_ptr<Stripable> > StripableList;
580 typedef std::list<boost::weak_ptr <Route> > WeakRouteList;
581 typedef std::list<boost::weak_ptr <Stripable> > WeakStripableList;
582 typedef std::list<boost::shared_ptr<AutomationControl> > ControlList;
583 typedef std::list<boost::shared_ptr<SlavableAutomationControl> > SlavableControlList;
584 typedef std::set <boost::shared_ptr<AutomationControl> > AutomationControlSet;
586 typedef std::list<boost::shared_ptr<VCA> > VCAList;
589 typedef std::vector<boost::shared_ptr<Bundle> > BundleList;
601 struct CleanupReport {
602 std::vector<std::string> paths;
606 enum PositionLockStyle {
611 /** A struct used to describe changes to processors in a route.
612 * This is useful because objects that respond to a change in processors
613 * can optimise what work they do based on details of what has changed.
615 struct RouteProcessorChange {
618 MeterPointChange = 0x1,
622 RouteProcessorChange () : type (GeneralChange), meter_visibly_changed (true)
625 RouteProcessorChange (Type t) : type (t), meter_visibly_changed (true)
628 RouteProcessorChange (Type t, bool m) : type (t), meter_visibly_changed (m)
631 /** type of change; "GeneralChange" means anything could have changed */
633 /** true if, when a MeterPointChange has occurred, the change is visible to the user */
634 bool meter_visibly_changed;
638 uint32_t master_out_channels; /* how many channels for the master bus, 0: no master bus */
649 enum TransportState {
650 /* these values happen to match the constants used by JACK but
651 this equality cannot be assumed.
653 TransportStopped = 0,
654 TransportRolling = 1,
655 TransportLooping = 2,
656 TransportStarting = 3,
660 /* these values happen to match the constants used by JACK but
661 this equality cannot be assumed.
669 /* non-JACK related flags */
676 MidiPortControl = 0x2,
677 MidiPortSelection = 0x4,
678 MidiPortVirtual = 0x8
681 struct LatencyRange {
682 uint32_t min; //< samples
683 uint32_t max; //< samples
686 enum BufferingPreset {
693 enum AutoReturnTarget {
695 RangeSelectionStart = 0x2,
697 RegionSelectionStart = 0x8,
700 enum PlaylistDisposition {
706 enum MidiTrackNameSource {
712 enum MidiTempoMapDisposition {
722 typedef std::vector<CaptureInfo*> CaptureInfos;
724 } // namespace ARDOUR
726 /* for now, break the rules and use "using" to make this "global" */
728 using ARDOUR::samplepos_t;
730 #endif /* __ardour_types_h__ */