some strategic documentation
[ardour.git] / libs / ardour / ardour / track.h
index 2a6d3f7ad4f391c7c07cacb11a532eecb341f25d..c49cbd00e24c4a2bd92d4a3e43259bbe6cd15aab 100644 (file)
@@ -35,6 +35,11 @@ class Region;
 class Diskstream;
 class IO;
 
+/** A track is an route (bus) with a recordable diskstream and
+ * related objects relevant to tracking, playback and editing.
+ *
+ * Specifically a track has regions and playlist objects.
+ */
 class LIBARDOUR_API Track : public Route, public PublicDiskstream
 {
   public:
@@ -44,19 +49,32 @@ class LIBARDOUR_API Track : public Route, public PublicDiskstream
        int init ();
 
        bool set_name (const std::string& str);
+       void resync_track_name ();
 
        TrackMode mode () const { return _mode; }
        virtual int set_mode (TrackMode /*m*/) { return false; }
        virtual bool can_use_mode (TrackMode /*m*/, bool& /*bounce_required*/) { return false; }
        PBD::Signal0<void> TrackModeChanged;
 
-       virtual void set_monitoring (MonitorChoice);
+       class LIBARDOUR_API MonitoringControllable : public RouteAutomationControl {
+       public:
+               MonitoringControllable (std::string name, boost::shared_ptr<Track>);
+               void set_value (double, PBD::Controllable::GroupControlDisposition group_override);
+               /* currently no automation, so no need for set_value_unchecked() */
+               double get_value () const;
+       private:
+               void _set_value (double, PBD::Controllable::GroupControlDisposition group_override);
+       };
+
+       void set_monitoring (MonitorChoice, PBD::Controllable::GroupControlDisposition group_override);
        MonitorChoice monitoring_choice() const { return _monitoring; }
         MonitorState monitoring_state () const;
        PBD::Signal0<void> MonitoringChanged;
 
+       boost::shared_ptr<AutomationControl> monitoring_control() const { return _monitoring_control; }
+
        MeterState metering_state () const;
-       
+
        virtual int no_roll (pframes_t nframes, framepos_t start_frame, framepos_t end_frame,
                             bool state_changing);
 
@@ -89,14 +107,29 @@ class LIBARDOUR_API Track : public Route, public PublicDiskstream
        virtual void freeze_me (InterThreadInfo&) = 0;
        virtual void unfreeze () = 0;
 
-       /** @return true if the track can be bounced, or false otherwise.
+       /** Test if the track can be bounced with the given settings.
+        * If sends/inserts/returns are present in the signal path or the given track
+        * has no audio outputs bouncing is not possible.
+        *
+        * @param endpoint the processor to tap the signal off (or nil for the top)
+        * @param include_endpoint include the given processor in the bounced audio.
+        * @return true if the track can be bounced, or false otherwise.
         */
        virtual bool bounceable (boost::shared_ptr<Processor> endpoint, bool include_endpoint) const = 0;
        virtual boost::shared_ptr<Region> bounce (InterThreadInfo&) = 0;
-       virtual boost::shared_ptr<Region> bounce_range (framepos_t start, framepos_t end, InterThreadInfo&, 
+
+       /** Bounce the given range to a new audio region.
+        * @param start start time (in samples)
+        * @param end end time (in samples)
+        * @param itt asynchronous progress report and cancel
+        * @param endpoint the processor to tap the signal off (or nil for the top)
+        * @param include_endpoint include the given processor in the bounced audio.
+        * @return a new audio region (or nil in case of error)
+        */
+       virtual boost::shared_ptr<Region> bounce_range (framepos_t start, framepos_t end, InterThreadInfo& itt,
                                                        boost::shared_ptr<Processor> endpoint, bool include_endpoint) = 0;
        virtual int export_stuff (BufferSet& bufs, framepos_t start_frame, framecnt_t nframes,
-                                 boost::shared_ptr<Processor> endpoint, bool include_endpoint, bool for_export) = 0;
+                                 boost::shared_ptr<Processor> endpoint, bool include_endpoint, bool for_export, bool for_freeze) = 0;
 
        XMLNode&    get_state();
        XMLNode&    get_template();
@@ -106,8 +139,10 @@ class LIBARDOUR_API Track : public Route, public PublicDiskstream
        boost::shared_ptr<AutomationControl> rec_enable_control() { return _rec_enable_control; }
 
        bool record_enabled() const;
-       void set_record_enabled (bool yn, void *src);
-       void prep_record_enabled (bool yn, void *src);
+       bool record_safe () const;
+       void set_record_enabled (bool yn, PBD::Controllable::GroupControlDisposition);
+       void set_record_safe (bool yn, PBD::Controllable::GroupControlDisposition);
+       void prep_record_enabled (bool yn, PBD::Controllable::GroupControlDisposition);
 
        bool using_diskstream_id (PBD::ID) const;
 
@@ -120,7 +155,7 @@ class LIBARDOUR_API Track : public Route, public PublicDiskstream
        bool destructive () const;
        std::list<boost::shared_ptr<Source> > & last_capture_sources ();
        void set_capture_offset ();
-       std::list<boost::shared_ptr<Source> > steal_write_sources();
+       std::string steal_write_source_name ();
        void reset_write_sources (bool, bool force = false);
        float playback_buffer_load () const;
        float capture_buffer_load () const;
@@ -142,7 +177,7 @@ class LIBARDOUR_API Track : public Route, public PublicDiskstream
        void transport_stopped_wallclock (struct tm &, time_t, bool);
        bool pending_overwrite () const;
        double speed () const;
-       void prepare_to_stop (framepos_t);
+       void prepare_to_stop (framepos_t, framepos_t);
        void set_slaved (bool);
        ChanCount n_channels ();
        framepos_t get_capture_start_frame (uint32_t n = 0) const;
@@ -164,6 +199,7 @@ class LIBARDOUR_API Track : public Route, public PublicDiskstream
        /* Emitted when our diskstream is set to use a different playlist */
        PBD::Signal0<void> PlaylistChanged;
        PBD::Signal0<void> RecordEnableChanged;
+       PBD::Signal0<void> RecordSafeChanged;
        PBD::Signal0<void> SpeedChanged;
        PBD::Signal0<void> AlignmentStyleChanged;
 
@@ -175,6 +211,7 @@ class LIBARDOUR_API Track : public Route, public PublicDiskstream
        TrackMode     _mode;
        bool          _needs_butler;
        MonitorChoice _monitoring;
+       boost::shared_ptr<MonitoringControllable> _monitoring_control;
 
        //private: (FIXME)
        struct FreezeRecordProcessorInfo {
@@ -199,13 +236,18 @@ class LIBARDOUR_API Track : public Route, public PublicDiskstream
                FreezeState                        state;
        };
 
-       struct RecEnableControl : public AutomationControl {
+       class RecEnableControl : public AutomationControl {
+       public:
                RecEnableControl (boost::shared_ptr<Track> t);
 
-               void set_value (double);
+               void set_value (double, PBD::Controllable::GroupControlDisposition);
+               void set_value_unchecked (double);
                double get_value (void) const;
 
                boost::weak_ptr<Track> track;
+
+       private:
+               void _set_value (double, PBD::Controllable::GroupControlDisposition);
        };
 
        virtual void set_state_part_two () = 0;
@@ -217,17 +259,21 @@ class LIBARDOUR_API Track : public Route, public PublicDiskstream
        void maybe_declick (BufferSet&, framecnt_t, int);
 
        boost::shared_ptr<RecEnableControl> _rec_enable_control;
-       
+
        framecnt_t check_initial_delay (framecnt_t nframes, framepos_t&);
 
 private:
 
        virtual boost::shared_ptr<Diskstream> diskstream_factory (XMLNode const &) = 0;
-       
+
        void diskstream_playlist_changed ();
        void diskstream_record_enable_changed ();
+       void diskstream_record_safe_changed ();
        void diskstream_speed_changed ();
        void diskstream_alignment_style_changed ();
+       void parameter_changed (std::string const & p);
+
+       std::string _diskstream_name;
 };
 
 }; /* namespace ARDOUR*/