position+width panning improvements (reverse width now works); relabel pan automation...
[ardour.git] / libs / ardour / ardour / types.h
index 6ec954075c27d5a7bc7cdd388268b8958fce65d0..d452cd6b541e2cc8fcc77a9f3b7d1391fc6e09ad 100644 (file)
 #ifndef __ardour_types_h__
 #define __ardour_types_h__
 
-#ifndef __STDC_FORMAT_MACROS
-#define __STDC_FORMAT_MACROS /* PRI<foo>; C++ requires explicit requesting of these */
-#endif
-
 #include <istream>
 #include <vector>
 #include <boost/shared_ptr.hpp>
+#include <sys/types.h>
+#include <stdint.h>
 
 #include <inttypes.h>
 #include <jack/types.h>
@@ -35,6 +33,7 @@
 #include "pbd/id.h"
 
 #include "ardour/bbt_time.h"
+#include "ardour/chan_count.h"
 
 #include <map>
 
@@ -54,20 +53,40 @@ namespace ARDOUR {
        typedef uint32_t                    layer_t;
        typedef uint64_t                    microseconds_t;
        typedef uint32_t                    nframes_t;
-       typedef int64_t                     nframes64_t;
 
+        /* Any position measured in audio frames.
+           Assumed to be non-negative but not enforced.
+         */
+       typedef int64_t framepos_t;
 
-       /** "Session frames", frames relative to the session timeline.
-        * Everything related to transport position etc. should be of this type.
-        * We might want to make this a compile time option for 32-bitters who
-        * don't want to pay for extremely long session times they don't need...
-        */
-       typedef int64_t sframes_t;
+        /* Any distance from a given framepos_t.
+           Maybe positive or negative.
+        */
+       typedef int64_t frameoffset_t;
+
+       /* Any count of audio frames. 
+           Assumed to be positive but not enforced.
+        */
+       typedef int64_t framecnt_t;
+
+        static const framepos_t max_framepos = INT64_MAX;
+        static const framecnt_t max_framecnt = INT64_MAX;
+
+       struct IOChange {
+
+               enum Type {
+                       NoChange = 0,
+                       ConfigurationChanged = 0x1,
+                       ConnectionsChanged = 0x2
+               } type;
 
-       enum IOChange {
-               NoChange = 0,
-               ConfigurationChanged = 0x1,
-               ConnectionsChanged = 0x2
+               IOChange () : type (NoChange) {}
+               IOChange (Type t) : type (t) {}
+
+               /** channel count of IO before a ConfigurationChanged, if appropriate */
+               ARDOUR::ChanCount before;
+               /** channel count of IO after a ConfigurationChanged, if appropriate */
+               ARDOUR::ChanCount after;
        };
 
        enum OverlapType {
@@ -77,9 +96,22 @@ namespace ARDOUR {
                OverlapEnd,       // overlap begins within and covers end
                OverlapExternal   // overlap extends to (at least) begin+end
        };
+        
+        ARDOUR::OverlapType coverage (framepos_t sa, framepos_t ea,
+                                      framepos_t sb, framepos_t eb);
+
+        /* policies for inserting/pasting material where overlaps
+           might be an issue.
+        */
 
-       OverlapType coverage (nframes_t start_a, nframes_t end_a,
-                             nframes_t start_b, nframes_t end_b);
+        enum InsertMergePolicy {
+                InsertMergeReject,  // no overlaps allowed
+                InsertMergeRelax,   // we just don't care about overlaps
+                InsertMergeReplace, // replace old with new
+                InsertMergeTruncateExisting, // shorten existing to avoid overlap
+                InsertMergeTruncateAddition, // shorten new to avoid overlap
+                InsertMergeExtend   // extend new (or old) to the range of old+new
+        };
 
        /** See parameter.h
         * XXX: I don't think/hope these hex values matter anymore.
@@ -127,7 +159,8 @@ namespace ARDOUR {
        enum MeterPoint {
                MeterInput,
                MeterPreFader,
-               MeterPostFader
+               MeterPostFader,
+               MeterCustom
        };
 
        enum TrackMode {
@@ -260,11 +293,6 @@ namespace ARDOUR {
                SyncPoint
        };
 
-       enum Change {
-               range_guarantee = ~0
-       };
-
-
        enum Placement {
                PreFader,
                PostFader
@@ -312,6 +340,8 @@ namespace ARDOUR {
        };
 
        struct InterThreadInfo {
+               InterThreadInfo () : done (false), cancel (false), progress (0), thread (0) {}
+                       
                volatile bool  done;
                volatile bool  cancel;
                volatile float progress;
@@ -360,10 +390,9 @@ namespace ARDOUR {
                ExportContext
        };
 
-       enum SlaveSource {
-               None = 0,
-               MTC,
+       enum SyncSource {
                JACK,
+               MTC,
                MIDIClock
        };
 
@@ -400,7 +429,7 @@ namespace ARDOUR {
                int   opts; // really RubberBandStretcher::Options
        };
 
-       typedef std::list<nframes64_t> AnalysisFeatureList;
+       typedef std::list<framepos_t> AnalysisFeatureList;
 
        typedef std::list<boost::shared_ptr<Route> >      RouteList;
 
@@ -423,6 +452,57 @@ namespace ARDOUR {
                Groove
        };
 
+       struct CleanupReport {
+               std::vector<std::string> paths;
+               size_t                   space;
+       };
+
+       enum PositionLockStyle {
+               AudioTime,
+               MusicTime
+       };
+
+       /** A struct used to describe changes to processors in a route.
+        *  This is useful because objects that respond to a change in processors
+        *  can optimise what work they do based on details of what has changed.
+       */
+       struct RouteProcessorChange {
+               enum Type {
+                       GeneralChange = 0x0,
+                       MeterPointChange = 0x1
+               };
+
+               RouteProcessorChange () : type (GeneralChange), meter_visibly_changed (true)
+               {}
+
+               RouteProcessorChange (Type t) : type (t), meter_visibly_changed (true)
+               {}
+
+               RouteProcessorChange (Type t, bool m) : type (t), meter_visibly_changed (m)
+               {}
+
+               /** type of change; "GeneralChange" means anything could have changed */
+               Type type;
+               /** true if, when a MeterPointChange has occurred, the change is visible to the user */
+               bool meter_visibly_changed;
+       };
+
+        struct BusProfile {
+            AutoConnectOption input_ac;      /* override the RC config for input auto-connection */
+            AutoConnectOption output_ac;     /* override the RC config for output auto-connection */
+            uint32_t master_out_channels;    /* how many channels for the master bus */
+            uint32_t requested_physical_in;  /* now many of the available physical inputs to consider usable */
+            uint32_t requested_physical_out; /* now many of the available physical inputs to consider usable */
+        };
+
+       enum FadeShape {
+               FadeLinear,
+               FadeFast,
+               FadeSlow,
+               FadeLogA,
+               FadeLogB
+       };
+
 } // namespace ARDOUR
 
 
@@ -438,14 +518,16 @@ std::istream& operator>>(std::istream& o, ARDOUR::MonitorModel& sf);
 std::istream& operator>>(std::istream& o, ARDOUR::RemoteModel& sf);
 std::istream& operator>>(std::istream& o, ARDOUR::ListenPosition& sf);
 std::istream& operator>>(std::istream& o, ARDOUR::LayerModel& sf);
+std::istream& operator>>(std::istream& o, ARDOUR::InsertMergePolicy& sf);
 std::istream& operator>>(std::istream& o, ARDOUR::CrossfadeModel& sf);
-std::istream& operator>>(std::istream& o, ARDOUR::SlaveSource& sf);
+std::istream& operator>>(std::istream& o, ARDOUR::SyncSource& sf);
 std::istream& operator>>(std::istream& o, ARDOUR::ShuttleBehaviour& sf);
 std::istream& operator>>(std::istream& o, ARDOUR::ShuttleUnits& sf);
 std::istream& operator>>(std::istream& o, ARDOUR::TimecodeFormat& sf);
 std::istream& operator>>(std::istream& o, ARDOUR::DenormalModel& sf);
 std::istream& operator>>(std::istream& o, ARDOUR::WaveformScale& sf);
 std::istream& operator>>(std::istream& o, ARDOUR::WaveformShape& sf);
+std::istream& operator>>(std::istream& o, ARDOUR::PositionLockStyle& sf);
 
 std::ostream& operator<<(std::ostream& o, const ARDOUR::SampleFormat& sf);
 std::ostream& operator<<(std::ostream& o, const ARDOUR::HeaderFormat& sf);
@@ -455,31 +537,33 @@ std::ostream& operator<<(std::ostream& o, const ARDOUR::MonitorModel& sf);
 std::ostream& operator<<(std::ostream& o, const ARDOUR::RemoteModel& sf);
 std::ostream& operator<<(std::ostream& o, const ARDOUR::ListenPosition& sf);
 std::ostream& operator<<(std::ostream& o, const ARDOUR::LayerModel& sf);
+std::ostream& operator<<(std::ostream& o, const ARDOUR::InsertMergePolicy& sf);
 std::ostream& operator<<(std::ostream& o, const ARDOUR::CrossfadeModel& sf);
-std::ostream& operator<<(std::ostream& o, const ARDOUR::SlaveSource& sf);
+std::ostream& operator<<(std::ostream& o, const ARDOUR::SyncSource& sf);
 std::ostream& operator<<(std::ostream& o, const ARDOUR::ShuttleBehaviour& sf);
 std::ostream& operator<<(std::ostream& o, const ARDOUR::ShuttleUnits& sf);
 std::ostream& operator<<(std::ostream& o, const ARDOUR::TimecodeFormat& sf);
 std::ostream& operator<<(std::ostream& o, const ARDOUR::DenormalModel& sf);
 std::ostream& operator<<(std::ostream& o, const ARDOUR::WaveformScale& sf);
 std::ostream& operator<<(std::ostream& o, const ARDOUR::WaveformShape& sf);
+std::ostream& operator<<(std::ostream& o, const ARDOUR::PositionLockStyle& sf);
 
-static inline ARDOUR::nframes64_t
-session_frame_to_track_frame (ARDOUR::nframes64_t session_frame, double speed)
+static inline ARDOUR::framepos_t
+session_frame_to_track_frame (ARDOUR::framepos_t session_frame, double speed)
 {
-       return (ARDOUR::nframes64_t)( (double)session_frame * speed );
+       return (ARDOUR::framepos_t)( (double)session_frame * speed );
 }
 
-static inline ARDOUR::nframes64_t
-track_frame_to_session_frame (ARDOUR::nframes64_t track_frame, double speed)
+static inline ARDOUR::framepos_t
+track_frame_to_session_frame (ARDOUR::framepos_t track_frame, double speed)
 {
-       return (ARDOUR::nframes64_t)( (double)track_frame / speed );
+       return (ARDOUR::framepos_t)( (double)track_frame / speed );
 }
 
 /* for now, break the rules and use "using" to make these "global" */
 
 using ARDOUR::nframes_t;
-using ARDOUR::nframes64_t;
+using ARDOUR::framepos_t;
 
 
 #endif /* __ardour_types_h__ */