universal change in the design of the way Route/Track controls are designed and used...
[ardour.git] / libs / ardour / ardour / types.h
1 /*
2     Copyright (C) 2002 Paul Davis
3
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.
8
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.
13
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.
17
18 */
19
20 #ifndef __ardour_types_h__
21 #define __ardour_types_h__
22
23 #include <istream>
24 #include <vector>
25 #include <map>
26 #include <boost/shared_ptr.hpp>
27 #include <sys/types.h>
28 #include <stdint.h>
29 #include <pthread.h>
30
31 #include <inttypes.h>
32
33 #include "timecode/bbt_time.h"
34 #include "timecode/time.h"
35
36 #include "pbd/id.h"
37
38 #include "evoral/Range.hpp"
39
40 #include "ardour/chan_count.h"
41 #include "ardour/plugin_types.h"
42
43 #include <map>
44
45 #if __GNUC__ < 3
46 typedef int intptr_t;
47 #endif
48
49 namespace ARDOUR {
50
51         class Source;
52         class AudioSource;
53         class Route;
54         class Region;
55         class VCA;
56         class AutomationControl;
57
58         typedef float    Sample;
59         typedef float    pan_t;
60         typedef float    gain_t;
61         typedef uint32_t layer_t;
62         typedef uint64_t microseconds_t;
63         typedef uint32_t pframes_t;
64
65         /* Any position measured in audio frames.
66            Assumed to be non-negative but not enforced.
67         */
68         typedef int64_t framepos_t;
69
70         /* Any distance from a given framepos_t.
71            Maybe positive or negative.
72         */
73         typedef int64_t frameoffset_t;
74
75         /* Any count of audio frames.
76            Assumed to be positive but not enforced.
77         */
78         typedef int64_t framecnt_t;
79
80         static const framepos_t max_framepos = INT64_MAX;
81         static const framecnt_t max_framecnt = INT64_MAX;
82         static const layer_t    max_layer    = UINT32_MAX;
83
84         // a set of (time) intervals: first of pair is the offset of the start within the region, second is the offset of the end
85         typedef std::list<std::pair<frameoffset_t, frameoffset_t> > AudioIntervalResult;
86         // associate a set of intervals with regions (e.g. for silence detection)
87         typedef std::map<boost::shared_ptr<ARDOUR::Region>,AudioIntervalResult> AudioIntervalMap;
88
89         typedef std::list<boost::shared_ptr<Region> > RegionList;
90
91         struct IOChange {
92
93                 enum Type {
94                         NoChange = 0,
95                         ConfigurationChanged = 0x1,
96                         ConnectionsChanged = 0x2
97                 } type;
98
99                 IOChange () : type (NoChange) {}
100                 IOChange (Type t) : type (t) {}
101
102                 /** channel count of IO before a ConfigurationChanged, if appropriate */
103                 ARDOUR::ChanCount before;
104                 /** channel count of IO after a ConfigurationChanged, if appropriate */
105                 ARDOUR::ChanCount after;
106         };
107
108         /* policies for inserting/pasting material where overlaps
109            might be an issue.
110         */
111
112         enum InsertMergePolicy {
113                 InsertMergeReject,  // no overlaps allowed
114                 InsertMergeRelax,   // we just don't care about overlaps
115                 InsertMergeReplace, // replace old with new
116                 InsertMergeTruncateExisting, // shorten existing to avoid overlap
117                 InsertMergeTruncateAddition, // shorten new to avoid overlap
118                 InsertMergeExtend   // extend new (or old) to the range of old+new
119         };
120
121         /** See evoral/Parameter.hpp
122          *
123          * When you add things here, you REALLY SHOULD add a case clause to
124          * the constructor of ParameterDescriptor, unless the Controllables
125          * that the enum refers to are completely standard (0-1.0 range, 0.0 as
126          * normal, non-toggled, non-enumerated). Anything else needs to be
127          * added there so that things that try to represent them can do so
128          * with as much information as possible.
129          */
130         enum AutomationType {
131                 NullAutomation,
132                 GainAutomation,
133                 PanAzimuthAutomation,
134                 PanElevationAutomation,
135                 PanWidthAutomation,
136                 PanFrontBackAutomation,
137                 PanLFEAutomation,
138                 PluginAutomation,
139                 PluginPropertyAutomation,
140                 SoloAutomation,
141                 SoloIsolateAutomation,
142                 SoloSafeAutomation,
143                 MuteAutomation,
144                 MidiCCAutomation,
145                 MidiPgmChangeAutomation,
146                 MidiPitchBenderAutomation,
147                 MidiChannelPressureAutomation,
148                 MidiSystemExclusiveAutomation,
149                 FadeInAutomation,
150                 FadeOutAutomation,
151                 EnvelopeAutomation,
152                 RecEnableAutomation,
153                 RecSafeAutomation,
154                 TrimAutomation,
155                 PhaseAutomation,
156                 MonitoringAutomation,
157                 EQGain,
158                 EQFrequency,
159                 EQQ,
160                 EQShape,
161                 EQHPF,
162                 EQEnable,
163                 CompThreshold,
164                 CompSpeed,
165                 CompMode,
166                 CompMakeup,
167                 CompRedux,
168                 CompEnable,
169                 BusSendLevel,
170                 BusSendEnable,
171         };
172
173         enum AutoState {
174                 Off = 0x0,
175                 Write = 0x1,
176                 Touch = 0x2,
177                 Play = 0x4
178         };
179
180         std::string auto_state_to_string (AutoState);
181         AutoState string_to_auto_state (std::string);
182
183         enum AutoStyle {
184                 Absolute = 0x1,
185                 Trim = 0x2
186         };
187
188         std::string auto_style_to_string (AutoStyle);
189         AutoStyle string_to_auto_style (std::string);
190
191         enum AlignStyle {
192                 CaptureTime,
193                 ExistingMaterial
194         };
195
196         enum AlignChoice {
197                 UseCaptureTime,
198                 UseExistingMaterial,
199                 Automatic
200         };
201
202         enum MeterPoint {
203                 MeterInput,
204                 MeterPreFader,
205                 MeterPostFader,
206                 MeterOutput,
207                 MeterCustom
208         };
209
210         enum MeterType {
211                 MeterMaxSignal = 0x0001,
212                 MeterMaxPeak   = 0x0002,
213                 MeterPeak      = 0x0004,
214                 MeterKrms      = 0x0008,
215                 MeterK20       = 0x0010,
216                 MeterK14       = 0x0020,
217                 MeterIEC1DIN   = 0x0040,
218                 MeterIEC1NOR   = 0x0080,
219                 MeterIEC2BBC   = 0x0100,
220                 MeterIEC2EBU   = 0x0200,
221                 MeterVU        = 0x0400,
222                 MeterK12       = 0x0800,
223                 MeterPeak0dB   = 0x1000,
224                 MeterMCP       = 0x2000
225         };
226
227         enum TrackMode {
228                 Normal,
229                 NonLayered,
230                 Destructive
231         };
232
233         enum NoteMode {
234                 Sustained,
235                 Percussive
236         };
237
238         enum ChannelMode {
239                 AllChannels = 0, ///< Pass through all channel information unmodified
240                 FilterChannels,  ///< Ignore events on certain channels
241                 ForceChannel     ///< Force all events to a certain channel
242         };
243
244         enum ColorMode {
245                 MeterColors = 0,
246                 ChannelColors,
247                 TrackColor
248         };
249
250         enum RoundMode {
251                 RoundDownMaybe  = -2,  ///< Round down only if necessary
252                 RoundDownAlways = -1,  ///< Always round down, even if on a division
253                 RoundNearest    = 0,   ///< Round to nearest
254                 RoundUpAlways   = 1,   ///< Always round up, even if on a division
255                 RoundUpMaybe    = 2    ///< Round up only if necessary
256         };
257
258         class AnyTime {
259         public:
260                 enum Type {
261                         Timecode,
262                         BBT,
263                         Frames,
264                         Seconds
265                 };
266
267                 Type type;
268
269                 Timecode::Time     timecode;
270                 Timecode::BBT_Time bbt;
271
272                 union {
273                         framecnt_t     frames;
274                         double         seconds;
275                 };
276
277                 AnyTime() { type = Frames; frames = 0; }
278
279                 bool operator== (AnyTime const & other) const {
280                         if (type != other.type) { return false; }
281
282                         switch (type) {
283                           case Timecode:
284                                 return timecode == other.timecode;
285                           case BBT:
286                                 return bbt == other.bbt;
287                           case Frames:
288                                 return frames == other.frames;
289                           case Seconds:
290                                 return seconds == other.seconds;
291                         }
292                         return false; // get rid of warning
293                 }
294
295                 bool not_zero() const
296                 {
297                         switch (type) {
298                           case Timecode:
299                                 return timecode.hours != 0 || timecode.minutes != 0 ||
300                                        timecode.seconds != 0 || timecode.frames != 0;
301                           case BBT:
302                                 return bbt.bars != 0 || bbt.beats != 0 || bbt.ticks != 0;
303                           case Frames:
304                                 return frames != 0;
305                           case Seconds:
306                                 return seconds != 0;
307                         }
308
309                         abort(); /* NOTREACHED */
310                         return false;
311                 }
312         };
313
314         /* XXX: slightly unfortunate that there is this and Evoral::Range<>,
315            but this has a uint32_t id which Evoral::Range<> does not.
316         */
317         struct AudioRange {
318                 framepos_t start;
319                 framepos_t end;
320                 uint32_t id;
321
322                 AudioRange (framepos_t s, framepos_t e, uint32_t i) : start (s), end (e) , id (i) {}
323
324                 framecnt_t length() const { return end - start + 1; }
325
326                 bool operator== (const AudioRange& other) const {
327                         return start == other.start && end == other.end && id == other.id;
328                 }
329
330                 bool equal (const AudioRange& other) const {
331                         return start == other.start && end == other.end;
332                 }
333
334                 Evoral::OverlapType coverage (framepos_t s, framepos_t e) const {
335                         return Evoral::coverage (start, end, s, e);
336                 }
337         };
338
339         struct MusicRange {
340                 Timecode::BBT_Time start;
341                 Timecode::BBT_Time end;
342                 uint32_t id;
343
344                 MusicRange (Timecode::BBT_Time& s, Timecode::BBT_Time& e, uint32_t i)
345                         : start (s), end (e), id (i) {}
346
347                 bool operator== (const MusicRange& other) const {
348                         return start == other.start && end == other.end && id == other.id;
349                 }
350
351                 bool equal (const MusicRange& other) const {
352                         return start == other.start && end == other.end;
353                 }
354         };
355
356         /*
357             Slowest = 6.6dB/sec falloff at update rate of 40ms
358             Slow    = 6.8dB/sec falloff at update rate of 40ms
359         */
360
361         enum MeterFalloff {
362                 MeterFalloffOff = 0,
363                 MeterFalloffSlowest = 1,
364                 MeterFalloffSlow = 2,
365                 MeterFalloffSlowish = 3,
366                 MeterFalloffModerate = 4,
367                 MeterFalloffMedium = 5,
368                 MeterFalloffFast = 6,
369                 MeterFalloffFaster = 7,
370                 MeterFalloffFastest = 8,
371         };
372
373         enum MeterHold {
374                 MeterHoldOff = 0,
375                 MeterHoldShort = 40,
376                 MeterHoldMedium = 100,
377                 MeterHoldLong = 200
378         };
379
380         enum EditMode {
381                 Slide,
382                 Splice,
383                 Ripple,
384                 Lock
385         };
386
387         enum RegionSelectionAfterSplit {
388                 None = 0,
389                 NewlyCreatedLeft = 1,  // bit 0
390                 NewlyCreatedRight = 2, // bit 1
391                 NewlyCreatedBoth = 3,
392                 Existing = 4,          // bit 2
393                 ExistingNewlyCreatedLeft = 5,
394                 ExistingNewlyCreatedRight = 6,
395                 ExistingNewlyCreatedBoth = 7
396         };
397
398         enum RegionPoint {
399                 Start,
400                 End,
401                 SyncPoint
402         };
403
404         enum Placement {
405                 PreFader,
406                 PostFader
407         };
408
409         enum MonitorModel {
410                 HardwareMonitoring, ///< JACK does monitoring
411                 SoftwareMonitoring, ///< Ardour does monitoring
412                 ExternalMonitoring  ///< we leave monitoring to the audio hardware
413         };
414
415         enum MonitorChoice {
416                 MonitorAuto = 0,
417                 MonitorInput = 0x1,
418                 MonitorDisk = 0x2,
419                 MonitorCue = 0x4,
420         };
421
422         enum MonitorState {
423                 MonitoringSilence = 0x1,
424                 MonitoringInput = 0x2,
425                 MonitoringDisk = 0x4,
426         };
427
428         enum MeterState {
429                 MeteringInput, ///< meter the input IO, regardless of what is going through the route
430                 MeteringRoute  ///< meter what is going through the route
431         };
432
433         enum VUMeterStandard {
434                 MeteringVUfrench,   // 0VU = -2dBu
435                 MeteringVUamerican, // 0VU =  0dBu
436                 MeteringVUstandard, // 0VU = +4dBu
437                 MeteringVUeight     // 0VU = +8dBu
438         };
439
440         enum MeterLineUp {
441                 MeteringLineUp24,
442                 MeteringLineUp20,
443                 MeteringLineUp18,
444                 MeteringLineUp15
445         };
446
447         enum PFLPosition {
448                 /** PFL signals come from before pre-fader processors */
449                 PFLFromBeforeProcessors,
450                 /** PFL signals come pre-fader but after pre-fader processors */
451                 PFLFromAfterProcessors
452         };
453
454         enum AFLPosition {
455                 /** AFL signals come post-fader and before post-fader processors */
456                 AFLFromBeforeProcessors,
457                 /** AFL signals come post-fader but after post-fader processors */
458                 AFLFromAfterProcessors
459         };
460
461         enum DenormalModel {
462                 DenormalNone,
463                 DenormalFTZ,
464                 DenormalDAZ,
465                 DenormalFTZDAZ
466         };
467
468         enum RemoteModel {
469                 UserOrdered,
470                 MixerOrdered
471         };
472
473         enum LayerModel {
474                 LaterHigher,
475                 Manual
476         };
477
478         enum ListenPosition {
479                 AfterFaderListen,
480                 PreFaderListen
481         };
482
483         enum AutoConnectOption {
484                 ManualConnect = 0x0,
485                 AutoConnectPhysical = 0x1,
486                 AutoConnectMaster = 0x2
487         };
488
489     enum TracksAutoNamingRule {
490         UseDefaultNames = 0x1,
491         NameAfterDriver = 0x2
492     };
493
494         enum SampleFormat {
495                 FormatFloat = 0,
496                 FormatInt24,
497                 FormatInt16
498         };
499
500         int format_data_width (ARDOUR::SampleFormat);
501
502         enum CDMarkerFormat {
503                 CDMarkerNone,
504                 CDMarkerCUE,
505                 CDMarkerTOC,
506                 MP4Chaps
507         };
508
509         enum HeaderFormat {
510                 BWF,
511                 WAVE,
512                 WAVE64,
513                 CAF,
514                 AIFF,
515                 iXML,
516                 RF64,
517                 RF64_WAV,
518                 MBWF,
519         };
520
521         struct PeakData {
522                 typedef Sample PeakDatum;
523
524                 PeakDatum min;
525                 PeakDatum max;
526         };
527
528         enum RunContext {
529                 ButlerContext = 0,
530                 TransportContext,
531                 ExportContext
532         };
533
534         enum SyncSource {
535                 /* These are "synonyms". It is important for JACK to be first
536                    both here and in enums.cc, so that the string "JACK" is
537                    correctly recognized in older session and preference files.
538                 */
539                 JACK = 0,
540                 Engine = 0,
541                 MTC,
542                 MIDIClock,
543                 LTC
544         };
545
546         enum ShuttleBehaviour {
547                 Sprung,
548                 Wheel
549         };
550
551         enum ShuttleUnits {
552                 Percentage,
553                 Semitones
554         };
555
556         typedef std::vector<boost::shared_ptr<Source> > SourceList;
557
558         enum SrcQuality {
559                 SrcBest,
560                 SrcGood,
561                 SrcQuick,
562                 SrcFast,
563                 SrcFastest
564         };
565
566         typedef std::list<framepos_t> AnalysisFeatureList;
567
568         typedef std::list<boost::shared_ptr<Route> > RouteList;
569         typedef std::list<boost::weak_ptr  <Route> > WeakRouteList;
570         typedef std::list<boost::shared_ptr<AutomationControl> > ControlList;
571
572         typedef std::list<boost::shared_ptr<VCA> > VCAList;
573
574         class Bundle;
575         typedef std::vector<boost::shared_ptr<Bundle> > BundleList;
576
577         enum WaveformScale {
578                 Linear,
579                 Logarithmic
580         };
581
582         enum WaveformShape {
583                 Traditional,
584                 Rectified
585         };
586
587         struct CleanupReport {
588                 std::vector<std::string> paths;
589                 size_t                   space;
590         };
591
592         enum PositionLockStyle {
593                 AudioTime,
594                 MusicTime
595         };
596
597         /** A struct used to describe changes to processors in a route.
598          *  This is useful because objects that respond to a change in processors
599          *  can optimise what work they do based on details of what has changed.
600         */
601         struct RouteProcessorChange {
602                 enum Type {
603                         GeneralChange = 0x0,
604                         MeterPointChange = 0x1,
605                         RealTimeChange = 0x2
606                 };
607
608                 RouteProcessorChange () : type (GeneralChange), meter_visibly_changed (true)
609                 {}
610
611                 RouteProcessorChange (Type t) : type (t), meter_visibly_changed (true)
612                 {}
613
614                 RouteProcessorChange (Type t, bool m) : type (t), meter_visibly_changed (m)
615                 {}
616
617                 /** type of change; "GeneralChange" means anything could have changed */
618                 Type type;
619                 /** true if, when a MeterPointChange has occurred, the change is visible to the user */
620                 bool meter_visibly_changed;
621         };
622
623         struct BusProfile {
624                 AutoConnectOption input_ac;      /* override the RC config for input auto-connection */
625                 AutoConnectOption output_ac;     /* override the RC config for output auto-connection */
626                 uint32_t master_out_channels;    /* how many channels for the master bus */
627                 uint32_t requested_physical_in;  /* now many of the available physical inputs to consider usable */
628                 uint32_t requested_physical_out; /* now many of the available physical inputs to consider usable */
629         };
630
631         enum FadeShape {
632                 FadeLinear,
633                 FadeFast,
634                 FadeSlow,
635                 FadeConstantPower,
636                 FadeSymmetric,
637         };
638
639         enum TransportState {
640                 /* these values happen to match the constants used by JACK but
641                    this equality cannot be assumed.
642                 */
643                 TransportStopped = 0,
644                 TransportRolling = 1,
645                 TransportLooping = 2,
646                 TransportStarting = 3,
647         };
648
649         enum PortFlags {
650                 /* these values happen to match the constants used by JACK but
651                    this equality cannot be assumed.
652                 */
653                 IsInput = 0x1,
654                 IsOutput = 0x2,
655                 IsPhysical = 0x4,
656                 CanMonitor = 0x8,
657                 IsTerminal = 0x10
658         };
659
660         struct LatencyRange {
661             uint32_t min; //< samples
662             uint32_t max; //< samples
663         };
664
665         enum BufferingPreset {
666                 Small,
667                 Medium,
668                 Large,
669                 Custom,
670         };
671
672         enum AutoReturnTarget {
673                 LastLocate = 0x1,
674                 RangeSelectionStart = 0x2,
675                 Loop = 0x4,
676                 RegionSelectionStart = 0x8,
677         };
678
679         enum PlaylistDisposition {
680                 CopyPlaylist,
681                 NewPlaylist,
682                 SharePlaylist
683         };
684
685 } // namespace ARDOUR
686
687
688 /* these cover types declared above in this header. See enums.cc
689    for the definitions.
690 */
691 std::istream& operator>>(std::istream& o, ARDOUR::SampleFormat& sf);
692 std::istream& operator>>(std::istream& o, ARDOUR::HeaderFormat& sf);
693 std::istream& operator>>(std::istream& o, ARDOUR::AutoConnectOption& sf);
694 std::istream& operator>>(std::istream& o, ARDOUR::TracksAutoNamingRule& sf);
695 std::istream& operator>>(std::istream& o, ARDOUR::EditMode& sf);
696 std::istream& operator>>(std::istream& o, ARDOUR::MonitorModel& sf);
697 std::istream& operator>>(std::istream& o, ARDOUR::PFLPosition& sf);
698 std::istream& operator>>(std::istream& o, ARDOUR::AFLPosition& sf);
699 std::istream& operator>>(std::istream& o, ARDOUR::RemoteModel& sf);
700 std::istream& operator>>(std::istream& o, ARDOUR::ListenPosition& sf);
701 std::istream& operator>>(std::istream& o, ARDOUR::LayerModel& sf);
702 std::istream& operator>>(std::istream& o, ARDOUR::InsertMergePolicy& sf);
703 std::istream& operator>>(std::istream& o, ARDOUR::SyncSource& sf);
704 std::istream& operator>>(std::istream& o, ARDOUR::ShuttleBehaviour& sf);
705 std::istream& operator>>(std::istream& o, ARDOUR::ShuttleUnits& sf);
706 std::istream& operator>>(std::istream& o, Timecode::TimecodeFormat& sf);
707 std::istream& operator>>(std::istream& o, ARDOUR::DenormalModel& sf);
708 std::istream& operator>>(std::istream& o, ARDOUR::PositionLockStyle& sf);
709 std::istream& operator>>(std::istream& o, ARDOUR::FadeShape& sf);
710 std::istream& operator>>(std::istream& o, ARDOUR::RegionSelectionAfterSplit& sf);
711 std::istream& operator>>(std::istream& o, ARDOUR::BufferingPreset& var);
712 std::istream& operator>>(std::istream& o, ARDOUR::AutoReturnTarget& sf);
713 std::istream& operator>>(std::istream& o, ARDOUR::MeterType& sf);
714
715 std::ostream& operator<<(std::ostream& o, const ARDOUR::SampleFormat& sf);
716 std::ostream& operator<<(std::ostream& o, const ARDOUR::HeaderFormat& sf);
717 std::ostream& operator<<(std::ostream& o, const ARDOUR::AutoConnectOption& sf);
718 std::ostream& operator<<(std::ostream& o, const ARDOUR::TracksAutoNamingRule& sf);
719 std::ostream& operator<<(std::ostream& o, const ARDOUR::EditMode& sf);
720 std::ostream& operator<<(std::ostream& o, const ARDOUR::MonitorModel& sf);
721 std::ostream& operator<<(std::ostream& o, const ARDOUR::PFLPosition& sf);
722 std::ostream& operator<<(std::ostream& o, const ARDOUR::AFLPosition& sf);
723 std::ostream& operator<<(std::ostream& o, const ARDOUR::RemoteModel& sf);
724 std::ostream& operator<<(std::ostream& o, const ARDOUR::ListenPosition& sf);
725 std::ostream& operator<<(std::ostream& o, const ARDOUR::LayerModel& sf);
726 std::ostream& operator<<(std::ostream& o, const ARDOUR::InsertMergePolicy& sf);
727 std::ostream& operator<<(std::ostream& o, const ARDOUR::SyncSource& sf);
728 std::ostream& operator<<(std::ostream& o, const ARDOUR::ShuttleBehaviour& sf);
729 std::ostream& operator<<(std::ostream& o, const ARDOUR::ShuttleUnits& sf);
730 std::ostream& operator<<(std::ostream& o, const Timecode::TimecodeFormat& sf);
731 std::ostream& operator<<(std::ostream& o, const ARDOUR::DenormalModel& sf);
732 std::ostream& operator<<(std::ostream& o, const ARDOUR::PositionLockStyle& sf);
733 std::ostream& operator<<(std::ostream& o, const ARDOUR::FadeShape& sf);
734 std::ostream& operator<<(std::ostream& o, const ARDOUR::RegionSelectionAfterSplit& sf);
735 std::ostream& operator<<(std::ostream& o, const ARDOUR::BufferingPreset& var);
736 std::ostream& operator<<(std::ostream& o, const ARDOUR::AutoReturnTarget& sf);
737 std::ostream& operator<<(std::ostream& o, const ARDOUR::MeterType& sf);
738
739 /* because these operators work on types which can be used when making
740    a UI_CONFIG_VARIABLE (in gtk2_ardour) we need them to be exported.
741 */
742 LIBARDOUR_API std::istream& operator>>(std::istream& o, ARDOUR::WaveformScale& sf);
743 LIBARDOUR_API std::istream& operator>>(std::istream& o, ARDOUR::WaveformShape& sf);
744 LIBARDOUR_API std::istream& operator>>(std::istream& o, ARDOUR::VUMeterStandard& sf);
745 LIBARDOUR_API std::istream& operator>>(std::istream& o, ARDOUR::MeterLineUp& sf);
746
747 LIBARDOUR_API std::ostream& operator<<(std::ostream& o, const ARDOUR::WaveformScale& sf);
748 LIBARDOUR_API std::ostream& operator<<(std::ostream& o, const ARDOUR::WaveformShape& sf);
749 LIBARDOUR_API std::ostream& operator<<(std::ostream& o, const ARDOUR::VUMeterStandard& sf);
750 LIBARDOUR_API std::ostream& operator<<(std::ostream& o, const ARDOUR::MeterLineUp& sf);
751
752
753 static inline ARDOUR::framepos_t
754 session_frame_to_track_frame (ARDOUR::framepos_t session_frame, double speed)
755 {
756         long double result = (long double) session_frame * (long double) speed;
757
758         if (result >= (long double) ARDOUR::max_framepos) {
759                 return ARDOUR::max_framepos;
760         } else if (result <= (long double) (ARDOUR::max_framepos) * (ARDOUR::framepos_t)(-1)) {
761                 return (ARDOUR::max_framepos * (ARDOUR::framepos_t)(-1));
762         } else {
763                 return result;
764         }
765 }
766
767 static inline ARDOUR::framepos_t
768 track_frame_to_session_frame (ARDOUR::framepos_t track_frame, double speed)
769 {
770         /* NB - do we need a check for speed == 0 ??? */
771         long double result = (long double) track_frame / (long double) speed;
772
773         if (result >= (long double) ARDOUR::max_framepos) {
774                 return ARDOUR::max_framepos;
775         } else if (result <= (long double) (ARDOUR::max_framepos) * (ARDOUR::framepos_t)(-1)) {
776                 return (ARDOUR::max_framepos * (ARDOUR::framepos_t)(-1));
777         } else {
778                 return result;
779         }
780 }
781
782 /* for now, break the rules and use "using" to make this "global" */
783
784 using ARDOUR::framepos_t;
785
786
787 #endif /* __ardour_types_h__ */