1 /*
2  * Copyright (C) 2002-2018 Paul Davis <paul@linuxaudiosystems.com>
3  * Copyright (C) 2005 Karsten Wiese <fzuuzf@googlemail.com>
4  * Copyright (C) 2006-2014 David Robillard <d@drobilla.net>
5  * Copyright (C) 2008-2009 Hans Baier <hansfbaier@googlemail.com>
6  * Copyright (C) 2009-2012 Carl Hetherington <carl@carlh.net>
7  * Copyright (C) 2010-2011 Sakari Bergen <sakari.bergen@beatwaves.net>
8  * Copyright (C) 2012-2019 Robin Gareus <robin@gareus.org>
9  * Copyright (C) 2013-2015 Tim Mayberry <mojofunk@gmail.com>
10  * Copyright (C) 2013-2017 Nick Mainsbridge <mainsbridge@gmail.com>
11  * Copyright (C) 2013-2018 Colin Fletcher <colin.m.fletcher@googlemail.com>
12  * Copyright (C) 2014-2015 John Emmas <john@creativepost.co.uk>
13  * Copyright (C) 2015 Len Ovens <len@ovenwerks.net>
14  * Copyright (C) 2017-2019 Ben Loftis <ben@harrisonconsoles.com>
15  *
16  * This program is free software; you can redistribute it and/or modify
17  * it under the terms of the GNU General Public License as published by
18  * the Free Software Foundation; either version 2 of the License, or
19  * (at your option) any later version.
20  *
21  * This program is distributed in the hope that it will be useful,
22  * but WITHOUT ANY WARRANTY; without even the implied warranty of
23  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
24  * GNU General Public License for more details.
25  *
26  * You should have received a copy of the GNU General Public License along
27  * with this program; if not, write to the Free Software Foundation, Inc.,
28  * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
29  */
30 
31 #ifndef __ardour_types_h__
32 #define __ardour_types_h__
33 
34 #include <istream>
35 #include <vector>
36 #include <map>
37 #include <set>
38 #include <boost/shared_ptr.hpp>
39 #include <sys/types.h>
40 #include <stdint.h>
41 #include <pthread.h>
42 
43 #include <inttypes.h>
44 
45 #include "temporal/bbt_time.h"
46 #include "temporal/time.h"
47 #include "temporal/types.h"
48 
49 #include "pbd/id.h"
50 #include "pbd/microseconds.h"
51 
52 #include "evoral/Range.h"
53 
54 #include "ardour/chan_count.h"
55 #include "ardour/plugin_types.h"
56 
57 #include <map>
58 
59 using Temporal::max_samplepos;
60 using Temporal::max_samplecnt;
61 
62 #if defined (__GNUC__) && (__GNUC__ < 3)
63 typedef int intptr_t;
64 #endif
65 
66 namespace ARDOUR {
67 
68 class Source;
69 class AudioSource;
70 class Route;
71 class Region;
72 class Stripable;
73 class VCA;
74 class AutomationControl;
75 class SlavableAutomationControl;
76 
77 typedef float    Sample;
78 typedef float    pan_t;
79 typedef float    gain_t;
80 typedef uint32_t layer_t;
81 typedef uint32_t pframes_t;
82 
83 /* rebind Temporal position types into ARDOUR namespace */
84 typedef Temporal::samplecnt_t samplecnt_t;
85 typedef Temporal::samplepos_t samplepos_t;
86 typedef Temporal::sampleoffset_t sampleoffset_t;
87 
88 static const layer_t    max_layer    = UINT32_MAX;
89 
90 // a set of (time) intervals: first of pair is the offset of the start within the region, second is the offset of the end
91 typedef std::list<std::pair<sampleoffset_t, sampleoffset_t> > AudioIntervalResult;
92 // associate a set of intervals with regions (e.g. for silence detection)
93 typedef std::map<boost::shared_ptr<ARDOUR::Region>,AudioIntervalResult> AudioIntervalMap;
94 
95 typedef std::list<boost::shared_ptr<Region> > RegionList;
96 
97 struct IOChange {
98 
99 	enum Type {
100 		NoChange = 0,
101 		ConfigurationChanged = 0x1,
102 		ConnectionsChanged = 0x2
103 	} type;
104 
IOChangeIOChange105 	IOChange () : type (NoChange) {}
IOChangeIOChange106 	IOChange (Type t) : type (t) {}
107 
108 	/** channel count of IO before a ConfigurationChanged, if appropriate */
109 	ARDOUR::ChanCount before;
110 	/** channel count of IO after a ConfigurationChanged, if appropriate */
111 	ARDOUR::ChanCount after;
112 };
113 
114 /* policies for inserting/pasting material where overlaps
115    might be an issue.
116 */
117 
118 enum InsertMergePolicy {
119 	InsertMergeReject,  ///< no overlaps allowed
120 	InsertMergeRelax,   ///< we just don't care about overlaps
121 	InsertMergeReplace, ///< replace old with new
122 	InsertMergeTruncateExisting, ///< shorten existing to avoid overlap
123 	InsertMergeTruncateAddition, ///< shorten new to avoid overlap
124 	InsertMergeExtend   ///< extend new (or old) to the range of old+new
125 };
126 
127 /** See evoral/Parameter.h
128  *
129  * When you add things here, you REALLY SHOULD add a case clause to
130  * the constructor of ParameterDescriptor, unless the Controllables
131  * that the enum refers to are completely standard (0-1.0 range, 0.0 as
132  * normal, non-toggled, non-enumerated). Anything else needs to be
133  * added there so that things that try to represent them can do so
134  * with as much information as possible.
135  */
136 enum AutomationType {
137 	NullAutomation,
138 	GainAutomation,
139 	PanAzimuthAutomation,
140 	PanElevationAutomation,
141 	PanWidthAutomation,
142 	PanFrontBackAutomation,
143 	PanLFEAutomation,
144 	PluginAutomation,
145 	PluginPropertyAutomation,
146 	SoloAutomation,
147 	SoloIsolateAutomation,
148 	SoloSafeAutomation,
149 	MuteAutomation,
150 	MidiCCAutomation,
151 	MidiPgmChangeAutomation,
152 	MidiPitchBenderAutomation,
153 	MidiChannelPressureAutomation,
154 	MidiNotePressureAutomation,
155 	MidiSystemExclusiveAutomation,
156 	FadeInAutomation,
157 	FadeOutAutomation,
158 	EnvelopeAutomation,
159 	RecEnableAutomation,
160 	RecSafeAutomation,
161 	TrimAutomation,
162 	PhaseAutomation,
163 	MonitoringAutomation,
164 	BusSendLevel,
165 	BusSendEnable,
166 	MainOutVolume,
167 
168 	/* used only by Controllable Descriptor to access send parameters */
169 
170 	SendLevelAutomation,
171 	SendEnableAutomation,
172 	SendAzimuthAutomation,
173 };
174 
175 enum AutoState {
176 	Off   = 0x00,
177 	Write = 0x01,
178 	Touch = 0x02,
179 	Play  = 0x04,
180 	Latch = 0x08
181 };
182 
183 std::string auto_state_to_string (AutoState);
184 AutoState string_to_auto_state (std::string);
185 
186 enum AlignStyle {
187 	CaptureTime,
188 	ExistingMaterial
189 };
190 
191 enum AlignChoice {
192 	UseCaptureTime,
193 	UseExistingMaterial,
194 	Automatic
195 };
196 
197 enum MeterPoint {
198 	MeterInput,
199 	MeterPreFader,
200 	MeterPostFader,
201 	MeterOutput,
202 	MeterCustom
203 };
204 
205 enum DiskIOPoint {
206 	DiskIOPreFader,  /* after the trim control, but before other processors */
207 	DiskIOPostFader, /* before the main outs, after other processors */
208 	DiskIOCustom,   /* up to the user. Caveat Emptor! */
209 };
210 
211 enum MeterType {
212 	MeterMaxSignal = 0x0001,
213 	MeterMaxPeak   = 0x0002,
214 	MeterPeak      = 0x0004,
215 	MeterKrms      = 0x0008,
216 	MeterK20       = 0x0010,
217 	MeterK14       = 0x0020,
218 	MeterIEC1DIN   = 0x0040,
219 	MeterIEC1NOR   = 0x0080,
220 	MeterIEC2BBC   = 0x0100,
221 	MeterIEC2EBU   = 0x0200,
222 	MeterVU        = 0x0400,
223 	MeterK12       = 0x0800,
224 	MeterPeak0dB   = 0x1000,
225 	MeterMCP       = 0x2000
226 };
227 
228 enum TrackMode {
229 	Normal,
230 	NonLayered,
231 	/* No longer in use but kept to allow loading of older sessions */
232 	Destructive,
233 };
234 
235 enum NoteMode {
236 	Sustained,
237 	Percussive
238 };
239 
240 enum ChannelMode {
241 	AllChannels = 0, ///< Pass through all channel information unmodified
242 	FilterChannels,  ///< Ignore events on certain channels
243 	ForceChannel     ///< Force all events to a certain channel
244 };
245 
246 enum ColorMode {
247 	MeterColors = 0,
248 	ChannelColors,
249 	TrackColor
250 };
251 
252 enum RoundMode {
253 	RoundDownMaybe  = -2,  ///< Round down only if necessary
254 	RoundDownAlways = -1,  ///< Always round down, even if on a division
255 	RoundNearest    = 0,   ///< Round to nearest
256 	RoundUpAlways   = 1,   ///< Always round up, even if on a division
257 	RoundUpMaybe    = 2    ///< Round up only if necessary
258 };
259 
260 enum SnapPref {
261 	SnapToAny_Visual    = 0, /**< Snap to the editor's visual snap
262 	                          * (incoprorating snap prefs and the current zoom scaling)
263 	                          * this defines the behavior for visual mouse drags, for example */
264 
265 	SnapToGrid_Scaled   = 1, /**< Snap to the selected grid quantization with visual scaling.
266 	                          * Ignores other snap preferences (markers, regions, etc)
267 	                          * this defines the behavior for nudging the playhead to next/prev grid, for example */
268 
269 	SnapToGrid_Unscaled = 2, /**< Snap to the selected grid quantization.
270 	                          * If one is selected, and ignore any visual scaling
271 	                          * this is the behavior for automated processes like "snap regions to grid"
272 	                          * but note that midi quantization uses its own mechanism, not the grid */
273 };
274 
275 class AnyTime {
276                                         public:
277 	enum Type {
278 		Timecode,
279 		BBT,
280 		Samples,
281 		Seconds
282 	};
283 
284 	Type type;
285 
286 	Timecode::Time     timecode;
287 	Timecode::BBT_Time bbt;
288 
289 	union {
290 		samplecnt_t     samples;
291 		double         seconds;
292 	};
293 
AnyTime()294 	AnyTime() { type = Samples; samples = 0; }
295 
296 	bool operator== (AnyTime const & other) const {
297 		if (type != other.type) { return false; }
298 
299 		switch (type) {
300 		case Timecode:
301 			return timecode == other.timecode;
302 		case BBT:
303 			return bbt == other.bbt;
304 		case Samples:
305 			return samples == other.samples;
306 		case Seconds:
307 			return seconds == other.seconds;
308 		}
309 		return false; // get rid of warning
310 	}
311 
not_zero()312 	bool not_zero() const
313 	{
314 		switch (type) {
315 		case Timecode:
316 			return timecode.hours != 0 || timecode.minutes != 0 ||
317 				timecode.seconds != 0 || timecode.frames != 0;
318 		case BBT:
319 			return bbt.bars != 0 || bbt.beats != 0 || bbt.ticks != 0;
320 		case Samples:
321 			return samples != 0;
322 		case Seconds:
323 			return seconds != 0;
324 		}
325 
326 		abort(); /* NOTREACHED */
327 		return false;
328 	}
329 };
330 
331 /* used for translating audio samples to an exact musical position using a note divisor.
332    an exact musical position almost never falls exactly on an audio sample, but for sub-sample
333    musical accuracy we need to derive exact musical locations from a sample position
334    the division follows TempoMap::exact_beat_at_sample().
335    division
336    -1       musical location is the bar closest to sample
337    0       musical location is the musical position of the sample
338    1       musical location is the BBT beat closest to sample
339    n       musical location is the quarter-note division n closest to sample
340 */
341 struct MusicSample {
342 	samplepos_t sample;
343 	int32_t    division;
344 
MusicSampleMusicSample345 	MusicSample (samplepos_t f, int32_t d) : sample (f), division (d) {}
346 
setMusicSample347 	void set (samplepos_t f, int32_t d) {sample = f; division = d; }
348 
349 	MusicSample operator- (MusicSample other) { return MusicSample (sample - other.sample, 0); }
350 };
351 
352 /* XXX: slightly unfortunate that there is this and Evoral::Range<>,
353    but this has a uint32_t id which Evoral::Range<> does not.
354 */
355 struct AudioRange {
356 	samplepos_t start;
357 	samplepos_t end;
358 	uint32_t id;
359 
AudioRangeAudioRange360 	AudioRange (samplepos_t s, samplepos_t e, uint32_t i) : start (s), end (e) , id (i) {}
361 
lengthAudioRange362 	samplecnt_t length() const { return end - start + 1; }
363 
364 	bool operator== (const AudioRange& other) const {
365 		return start == other.start && end == other.end && id == other.id;
366 	}
367 
equalAudioRange368 	bool equal (const AudioRange& other) const {
369 		return start == other.start && end == other.end;
370 	}
371 
coverageAudioRange372 	Evoral::OverlapType coverage (samplepos_t s, samplepos_t e) const {
373 		return Evoral::coverage (start, end, s, e);
374 	}
375 };
376 
377 struct MusicRange {
378 	Timecode::BBT_Time start;
379 	Timecode::BBT_Time end;
380 	uint32_t id;
381 
MusicRangeMusicRange382 	MusicRange (Timecode::BBT_Time& s, Timecode::BBT_Time& e, uint32_t i)
383 		: start (s), end (e), id (i) {}
384 
385 	bool operator== (const MusicRange& other) const {
386 		return start == other.start && end == other.end && id == other.id;
387 	}
388 
equalMusicRange389 	bool equal (const MusicRange& other) const {
390 		return start == other.start && end == other.end;
391 	}
392 };
393 
394 class CueMarker {
395   public:
CueMarker(std::string const & text,samplepos_t position)396 	CueMarker (std::string const& text, samplepos_t position) : _text (text), _position (position) {}
397 
text()398 	std::string text() const { return _text; }
set_text(std::string const & str)399 	void set_text (std::string const & str) { _text = str; }
400 
position()401 	samplepos_t position() const { return _position; }
set_position(samplepos_t pos)402 	void set_position (samplepos_t pos) { _position = pos; }
403 
404 	bool operator== (CueMarker const & other) const { return _position == other.position() && _text == other.text(); }
405 	bool operator< (CueMarker const & other) const { return _position < other.position(); }
406 
407   private:
408 	std::string _text;
409 	samplepos_t _position;
410 };
411 
412 typedef std::set<CueMarker> CueMarkers;
413 
414 /*
415   Slowest = 6.6dB/sec falloff at update rate of 40ms
416   Slow    = 6.8dB/sec falloff at update rate of 40ms
417 */
418 
419 enum MeterFalloff {
420 	MeterFalloffOff = 0,
421 	MeterFalloffSlowest = 1,
422 	MeterFalloffSlow = 2,
423 	MeterFalloffSlowish = 3,
424 	MeterFalloffModerate = 4,
425 	MeterFalloffMedium = 5,
426 	MeterFalloffFast = 6,
427 	MeterFalloffFaster = 7,
428 	MeterFalloffFastest = 8,
429 };
430 
431 enum MeterHold {
432 	MeterHoldOff = 0,
433 	MeterHoldShort = 40,
434 	MeterHoldMedium = 100,
435 	MeterHoldLong = 200
436 };
437 
438 enum EditMode {
439 	Slide,
440 	Splice,
441 	Ripple,
442 	Lock
443 };
444 
445 enum RegionSelectionAfterSplit {
446 	None = 0,
447 	NewlyCreatedLeft = 1,  // bit 0
448 	NewlyCreatedRight = 2, // bit 1
449 	NewlyCreatedBoth = 3,
450 	Existing = 4,          // bit 2
451 	ExistingNewlyCreatedLeft = 5,
452 	ExistingNewlyCreatedRight = 6,
453 	ExistingNewlyCreatedBoth = 7
454 };
455 
456 enum RangeSelectionAfterSplit {
457 	ClearSel = 0,
458 	PreserveSel = 1,  // bit 0
459 	ForceSel = 2      // bit 1
460 };
461 
462 enum RegionPoint {
463 	Start,
464 	End,
465 	SyncPoint
466 };
467 
468 enum Placement {
469 	PreFader,
470 	PostFader
471 };
472 
473 enum MonitorModel {
474 	HardwareMonitoring, ///< JACK does monitoring
475 	SoftwareMonitoring, ///< Ardour does monitoring
476 	ExternalMonitoring  ///< we leave monitoring to the audio hardware
477 };
478 
479 enum MonitorChoice {
480 	MonitorAuto = 0,
481 	MonitorInput = 0x1,
482 	MonitorDisk = 0x2,
483 	MonitorCue = 0x3,
484 };
485 
486 enum MonitorState {
487 	MonitoringSilence = 0x0,
488 	MonitoringInput = 0x2,
489 	MonitoringDisk = 0x4,
490 	MonitoringCue = 0x6,
491 };
492 
493 enum VUMeterStandard {
494 	MeteringVUfrench,   ///< 0VU = -2dBu
495 	MeteringVUamerican, ///< 0VU =  0dBu
496 	MeteringVUstandard, ///< 0VU = +4dBu
497 	MeteringVUeight     ///< 0VU = +8dBu
498 };
499 
500 enum MeterLineUp {
501 	MeteringLineUp24,
502 	MeteringLineUp20,
503 	MeteringLineUp18,
504 	MeteringLineUp15
505 };
506 
507 enum InputMeterLayout {
508 	LayoutVertical,
509 	LayoutHorizontal,
510 	LayoutAutomatic,
511 };
512 
513 enum PFLPosition {
514 	/** PFL signals come from before pre-fader processors */
515 	PFLFromBeforeProcessors,
516 	/** PFL signals come pre-fader but after pre-fader processors */
517 	PFLFromAfterProcessors
518 };
519 
520 enum AFLPosition {
521 	/** AFL signals come post-fader and before post-fader processors */
522 	AFLFromBeforeProcessors,
523 	/** AFL signals come post-fader but after post-fader processors */
524 	AFLFromAfterProcessors
525 };
526 
527 enum ClockDeltaMode {
528 	NoDelta,
529 	DeltaEditPoint,
530 	DeltaOriginMarker
531 };
532 
533 enum DenormalModel {
534 	DenormalNone,
535 	DenormalFTZ,
536 	DenormalDAZ,
537 	DenormalFTZDAZ
538 };
539 
540 enum LayerModel {
541 	LaterHigher,
542 	Manual
543 };
544 
545 enum ListenPosition {
546 	AfterFaderListen,
547 	PreFaderListen
548 };
549 
550 enum AutoConnectOption {
551 	ManualConnect = 0x0,
552 	AutoConnectPhysical = 0x1,
553 	AutoConnectMaster = 0x2
554 };
555 
556 enum TracksAutoNamingRule {
557 	UseDefaultNames = 0x1,
558 	NameAfterDriver = 0x2
559 };
560 
561 enum SampleFormat {
562 	FormatFloat = 0,
563 	FormatInt24,
564 	FormatInt16
565 };
566 
567 int format_data_width (ARDOUR::SampleFormat);
568 
569 enum CDMarkerFormat {
570 	CDMarkerNone,
571 	CDMarkerCUE,
572 	CDMarkerTOC,
573 	MP4Chaps
574 };
575 
576 enum HeaderFormat {
577 	BWF,
578 	WAVE,
579 	WAVE64,
580 	CAF,
581 	AIFF,
582 	iXML,
583 	RF64,
584 	RF64_WAV,
585 	MBWF,
586 	FLAC,
587 };
588 
589 struct PeakData {
590 	typedef Sample PeakDatum;
591 
592 	PeakDatum min;
593 	PeakDatum max;
594 };
595 
596 enum RunContext {
597 	ButlerContext = 0,
598 	TransportContext,
599 	ExportContext
600 };
601 
602 enum SyncSource {
603 	/* The first two are "synonyms". It is important for JACK to be first
604 	   both here and in enums.cc, so that the string "JACK" is
605 	   correctly recognized in older session and preference files.
606 	*/
607 	JACK = 0,
608 	Engine = 0,
609 	MTC,
610 	MIDIClock,
611 	LTC,
612 };
613 
614 enum TransportRequestSource {
615 	TRS_Engine,
616 	TRS_MTC,
617 	TRS_MIDIClock,
618 	TRS_LTC,
619 	TRS_MMC,
620 	TRS_UI,
621 };
622 
623 enum TransportRequestType {
624 	TR_StartStop = 0x1,
625 	TR_Speed     = 0x2,
626 	TR_Locate    = 0x4
627 };
628 
629 enum ShuttleBehaviour {
630 	Sprung,
631 	Wheel
632 };
633 
634 enum ShuttleUnits {
635 	Percentage,
636 	Semitones
637 };
638 
639 typedef std::vector<boost::shared_ptr<Source> > SourceList;
640 
641 enum SrcQuality {
642 	SrcBest,
643 	SrcGood,
644 	SrcQuick,
645 	SrcFast,
646 	SrcFastest
647 };
648 
649 typedef std::list<samplepos_t> AnalysisFeatureList;
650 typedef std::vector<samplepos_t> XrunPositions;
651 
652 typedef std::list<boost::shared_ptr<Route> > RouteList;
653 typedef std::list<boost::shared_ptr<Stripable> > StripableList;
654 typedef std::list<boost::weak_ptr  <Route> > WeakRouteList;
655 typedef std::list<boost::weak_ptr  <Stripable> > WeakStripableList;
656 typedef std::list<boost::shared_ptr<AutomationControl> > ControlList;
657 typedef std::list<boost::shared_ptr<SlavableAutomationControl> > SlavableControlList;
658 typedef std::set <boost::shared_ptr<AutomationControl> > AutomationControlSet;
659 
660 typedef std::list<boost::shared_ptr<VCA> > VCAList;
661 
662 class Bundle;
663 typedef std::vector<boost::shared_ptr<Bundle> > BundleList;
664 
665 enum RegionEquivalence {
666 	Exact,
667 	Enclosed,
668 	Overlap,
669 	LayerTime
670 };
671 
672 enum WaveformScale {
673 	Linear,
674 	Logarithmic
675 };
676 
677 enum WaveformShape {
678 	Traditional,
679 	Rectified
680 };
681 
682 enum ScreenSaverMode {
683 	InhibitNever,
684 	InhibitWhileRecording,
685 	InhibitAlways
686 };
687 
688 struct CleanupReport {
CleanupReportCleanupReport689 	CleanupReport () : space (0) {}
690 	std::vector<std::string> paths;
691 	size_t                   space;
692 };
693 
694 enum PositionLockStyle {
695 	AudioTime,
696 	MusicTime
697 };
698 
699 /** A struct used to describe changes to processors in a route.
700  *  This is useful because objects that respond to a change in processors
701  *  can optimise what work they do based on details of what has changed.
702  */
703 struct RouteProcessorChange {
704 	enum Type {
705 		GeneralChange = 0x0,
706 		MeterPointChange = 0x1,
707 		RealTimeChange = 0x2
708 	};
709 
RouteProcessorChangeRouteProcessorChange710 	RouteProcessorChange () : type (GeneralChange), meter_visibly_changed (true)
711 	{}
712 
RouteProcessorChangeRouteProcessorChange713 	RouteProcessorChange (Type t) : type (t), meter_visibly_changed (true)
714 	{}
715 
RouteProcessorChangeRouteProcessorChange716 	RouteProcessorChange (Type t, bool m) : type (t), meter_visibly_changed (m)
717 	{}
718 
719 	/** type of change; "GeneralChange" means anything could have changed */
720 	Type type;
721 	/** true if, when a MeterPointChange has occurred, the change is visible to the user */
722 	bool meter_visibly_changed;
723 };
724 
725 struct BusProfile {
BusProfileBusProfile726 	BusProfile() : master_out_channels (0) {}
727 	uint32_t master_out_channels; /* how many channels for the master bus, 0: no master bus */
728 };
729 
730 enum FadeShape {
731 	FadeLinear,
732 	FadeFast,
733 	FadeSlow,
734 	FadeConstantPower,
735 	FadeSymmetric,
736 };
737 
738 enum TransportState {
739 	/* these values happen to match the constants used by JACK but
740 	   this equality cannot be assumed.
741 	*/
742 	TransportStopped = 0,
743 	TransportRolling = 1,
744 	TransportLooping = 2,
745 	TransportStarting = 3,
746 };
747 
748 enum PortFlags {
749 	/* these values happen to match the constants used by JACK but
750 	   this equality cannot be assumed.
751 	*/
752 	IsInput = 0x1,
753 	IsOutput = 0x2,
754 	IsPhysical = 0x4,
755 	CanMonitor = 0x8,
756 	IsTerminal = 0x10,
757 
758 	/* non-JACK related flags */
759 	Hidden = 0x20,
760 	Shadow = 0x40,
761 
762 	TransportMasterPort = 0x80,  // incoming data, used by slaves
763 	TransportGenerator  = 0x100, // outgoing, timecode/clock generators
764 	TransportSyncPort   = 0x180  // = TransportMasterPort | TransportGenerator
765 };
766 
767 enum MidiPortFlags {
768 	MidiPortMusic = 0x1,
769 	MidiPortControl = 0x2,
770 	MidiPortSelection = 0x4,
771 	MidiPortVirtual = 0x8
772 };
773 
774 struct LatencyRange {
LatencyRangeLatencyRange775 	LatencyRange () : min (0), max (0) {}
LatencyRangeLatencyRange776 	LatencyRange (const LatencyRange& other) : min (other.min), max (other.max) {}
777 
778 	uint32_t min; //< samples
779 	uint32_t max; //< samples
780 
781 	bool operator==(const LatencyRange& other) const {
782 		return (min == other.min && max == other.max);
783 	}
784 
785 	LatencyRange& operator=(const LatencyRange& other) {
786 		min = other.min;
787 		max = other.max;
788 		return *this;
789 	}
790 };
791 
792 enum BufferingPreset {
793 	Small,
794 	Medium,
795 	Large,
796 	Custom,
797 };
798 
799 enum AutoReturnTarget {
800 	LastLocate = 0x1,
801 	RangeSelectionStart = 0x2,
802 	Loop = 0x4,
803 	RegionSelectionStart = 0x8,
804 };
805 
806 enum PlaylistDisposition {
807 	CopyPlaylist,
808 	NewPlaylist,
809 	SharePlaylist
810 };
811 
812 enum MidiTrackNameSource {
813 	SMFTrackNumber,
814 	SMFTrackName,
815 	SMFInstrumentName
816 };
817 
818 enum MidiTempoMapDisposition {
819 	SMFTempoIgnore,
820 	SMFTempoUse,
821 };
822 
823 struct CaptureInfo {
824 	samplepos_t   start;
825 	samplecnt_t   samples;
826 	samplecnt_t   loop_offset;
827 	XrunPositions xruns;
828 };
829 
830 enum LoopFadeChoice {
831 	NoLoopFade,
832 	EndLoopFade,
833 	BothLoopFade,
834 	XFadeLoop,
835 };
836 
837 enum OverwriteReason {
838 	PlaylistChanged = 0x1,   // actual playlist was swapped/reset
839 	PlaylistModified = 0x2,  // contents of playlist changed
840 	LoopDisabled = 0x4,
841 	LoopChanged = 0x8,
842 };
843 
844 enum LocateTransportDisposition {
845 	MustRoll,
846 	MustStop,
847 	RollIfAppropriate
848 };
849 
850 typedef std::vector<CaptureInfo*> CaptureInfos;
851 
852 } // namespace ARDOUR
853 
854 /* for now, break the rules and use "using" to make this "global" */
855 
856 using ARDOUR::samplepos_t;
857 
858 #endif /* __ardour_types_h__ */
859