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