X-Git-Url: https://main.carlh.net/gitweb/?a=blobdiff_plain;f=libs%2Fardour%2Fardour%2Ftrack.h;h=587a8dcd1b430a4564b20517241903f2398fa1d9;hb=722defe41a6119cfe6e9f5a66fdcb2408c12a455;hp=02cab70a84f49c0943157a695bdc987b9f517cc5;hpb=8713667ec1a6cc9ba56c07f763e5a422cc47fbef;p=ardour.git diff --git a/libs/ardour/ardour/track.h b/libs/ardour/ardour/track.h index 02cab70a84..587a8dcd1b 100644 --- a/libs/ardour/ardour/track.h +++ b/libs/ardour/ardour/track.h @@ -21,50 +21,61 @@ #include +#include "ardour/interthread_info.h" #include "ardour/route.h" +#include "ardour/public_diskstream.h" namespace ARDOUR { class Session; -class Diskstream; class Playlist; class RouteGroup; +class Source; class Region; +class Diskstream; -class Track : public Route +class Track : public Route, public PublicDiskstream { public: Track (Session&, std::string name, Route::Flag f = Route::Flag (0), TrackMode m = Normal, DataType default_type = DataType::AUDIO); - virtual ~Track (); + int init (); + bool set_name (const std::string& str); 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; } - sigc::signal TrackModeChanged; + PBD::Signal0 TrackModeChanged; - virtual int no_roll (nframes_t nframes, sframes_t start_frame, sframes_t end_frame, - bool state_changing, bool can_record, bool rec_monitors_input); + virtual void set_monitoring (MonitorChoice); + MonitorChoice monitoring_choice() const { return _monitoring; } + MonitorState monitoring_state () const; + PBD::Signal0 MonitoringChanged; - int silent_roll (nframes_t nframes, sframes_t start_frame, sframes_t end_frame, - bool can_record, bool rec_monitors_input); + MeterState metering_state () const; + + virtual int no_roll (pframes_t nframes, framepos_t start_frame, framepos_t end_frame, + bool state_changing); - virtual int roll (nframes_t nframes, sframes_t start_frame, sframes_t end_frame, - int declick, bool can_record, bool rec_monitors_input) = 0; + int silent_roll (pframes_t nframes, framepos_t start_frame, framepos_t end_frame, + bool& need_butler); - void toggle_monitor_input (); + virtual int roll (pframes_t nframes, framepos_t start_frame, framepos_t end_frame, + int declick, bool& need_butler) = 0; - bool can_record(); + bool needs_butler() const { return _needs_butler; } + + virtual DataType data_type () const = 0; - boost::shared_ptr diskstream() const { return _diskstream; } + bool can_record(); - virtual int use_diskstream (std::string name) = 0; - virtual int use_diskstream (const PBD::ID& id) = 0; + void use_new_diskstream (); + virtual boost::shared_ptr create_diskstream() = 0; + virtual void set_diskstream (boost::shared_ptr); - nframes_t update_total_latency(); - void set_latency_delay (nframes_t); + void set_latency_compensation (framecnt_t); enum FreezeState { NoFreeze, @@ -74,35 +85,98 @@ class Track : public Route FreezeState freeze_state() const; - virtual void freeze (InterThreadInfo&) = 0; + virtual void freeze_me (InterThreadInfo&) = 0; virtual void unfreeze () = 0; + /** @return true if the track can be bounced, or false otherwise. + */ + virtual bool bounceable (boost::shared_ptr endpoint, bool include_endpoint) const = 0; virtual boost::shared_ptr bounce (InterThreadInfo&) = 0; - virtual boost::shared_ptr bounce_range (nframes_t start, nframes_t end, InterThreadInfo&, bool enable_processing = true) = 0; + virtual boost::shared_ptr bounce_range (framepos_t start, framepos_t end, InterThreadInfo&, + boost::shared_ptr endpoint, bool include_endpoint) = 0; + virtual int export_stuff (BufferSet& bufs, framepos_t start_frame, framecnt_t nframes, + boost::shared_ptr endpoint, bool include_endpoint, bool for_export) = 0; XMLNode& get_state(); XMLNode& get_template(); - virtual int set_state (const XMLNode&, int version) = 0; + virtual int set_state (const XMLNode&, int version); static void zero_diskstream_id_in_xml (XMLNode&); boost::shared_ptr rec_enable_control() { return _rec_enable_control; } bool record_enabled() const; - void set_record_enable (bool yn, void *src); - - void set_meter_point (MeterPoint, void* src); - - sigc::signal DiskstreamChanged; - sigc::signal FreezeChange; + void set_record_enabled (bool yn, void *src); + + bool using_diskstream_id (PBD::ID) const; + + void set_block_size (pframes_t); + + /* PublicDiskstream interface */ + boost::shared_ptr playlist (); + void request_jack_monitors_input (bool); + void ensure_jack_monitors_input (bool); + bool destructive () const; + std::list > & last_capture_sources (); + void set_capture_offset (); + std::list > steal_write_sources(); + void reset_write_sources (bool, bool force = false); + float playback_buffer_load () const; + float capture_buffer_load () const; + int do_refill (); + int do_flush (RunContext, bool force = false); + void set_pending_overwrite (bool); + int seek (framepos_t, bool complete_refill = false); + bool hidden () const; + int can_internal_playback_seek (framepos_t); + int internal_playback_seek (framepos_t); + void non_realtime_input_change (); + void non_realtime_locate (framepos_t); + void non_realtime_set_speed (); + int overwrite_existing_buffers (); + framecnt_t get_captured_frames (uint32_t n = 0) const; + int set_loop (Location *); + void transport_looped (framepos_t); + bool realtime_set_speed (double, bool); + void transport_stopped_wallclock (struct tm &, time_t, bool); + bool pending_overwrite () const; + double speed () const; + void prepare_to_stop (framepos_t); + void set_slaved (bool); + ChanCount n_channels (); + framepos_t get_capture_start_frame (uint32_t n = 0) const; + AlignStyle alignment_style () const; + AlignChoice alignment_choice () const; + framepos_t current_capture_start () const; + framepos_t current_capture_end () const; + void playlist_modified (); + int use_playlist (boost::shared_ptr); + void set_align_style (AlignStyle, bool force=false); + void set_align_choice (AlignChoice, bool force=false); + int use_copy_playlist (); + int use_new_playlist (); + void adjust_playback_buffering (); + void adjust_capture_buffering (); + + PBD::Signal0 DiskstreamChanged; + PBD::Signal0 FreezeChange; + /* Emitted when our diskstream is set to use a different playlist */ + PBD::Signal0 PlaylistChanged; + PBD::Signal0 RecordEnableChanged; + PBD::Signal0 SpeedChanged; + PBD::Signal0 AlignmentStyleChanged; protected: - Track (Session& sess, const XMLNode& node, DataType default_type = DataType::AUDIO); - - virtual XMLNode& state (bool full) = 0; + XMLNode& state (bool full); boost::shared_ptr _diskstream; - MeterPoint _saved_meter_point; - TrackMode _mode; + MeterPoint _saved_meter_point; + /** used to keep track of processors that we are deactivating during record, + if `do-not-record-plugins' is enabled. + */ + std::list > _deactivated_processors; + TrackMode _mode; + bool _needs_butler; + MonitorChoice _monitoring; //private: (FIXME) struct FreezeRecordProcessorInfo { @@ -125,16 +199,13 @@ class Track : public Route std::vector processor_info; bool have_mementos; FreezeState state; - gain_t gain; - AutoState gain_automation_state; - AutoState pan_automation_state; }; struct RecEnableControllable : public PBD::Controllable { RecEnableControllable (Track&); - void set_value (float); - float get_value (void) const; + void set_value (double); + double get_value (void) const; Track& track; }; @@ -143,11 +214,26 @@ class Track : public Route FreezeRecord _freeze_record; XMLNode* pending_state; - sigc::connection recenable_connection; - sigc::connection ic_connection; bool _destructive; + void maybe_declick (BufferSet&, framecnt_t, int); + boost::shared_ptr _rec_enable_control; + + framecnt_t check_initial_delay (framecnt_t nframes, framecnt_t&); + +private: + + virtual boost::shared_ptr diskstream_factory (XMLNode const &) = 0; + + void diskstream_playlist_changed (); + void diskstream_record_enable_changed (); + void diskstream_speed_changed (); + void diskstream_alignment_style_changed (); + + void parameter_changed (std::string); + void deactivate_visible_processors (); + void activate_deactivated_processors (); }; }; /* namespace ARDOUR*/