#include <boost/shared_ptr.hpp>
+#include "ardour/interthread_info.h"
#include "ardour/route.h"
#include "ardour/public_diskstream.h"
class Session;
class Playlist;
class RouteGroup;
+class Source;
class Region;
class Diskstream;
+class IO;
-class Track : public Route, public PublicDiskstream
+class LIBARDOUR_API 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 ();
+ 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 int no_roll (nframes_t nframes, framepos_t start_frame, framepos_t end_frame,
- bool state_changing, bool can_record, bool rec_monitors_input);
+ 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;
- int silent_roll (nframes_t nframes, framepos_t start_frame, framepos_t end_frame,
- bool can_record, bool rec_monitors_input, bool& need_butler);
+ virtual int no_roll (pframes_t nframes, framepos_t start_frame, framepos_t end_frame,
+ bool state_changing);
- virtual int roll (nframes_t nframes, framepos_t start_frame, framepos_t end_frame,
- int declick, bool can_record, bool rec_monitors_input, bool& need_butler) = 0;
+ int silent_roll (pframes_t nframes, framepos_t start_frame, framepos_t end_frame,
+ bool& need_butler);
- bool needs_butler() const { return _needs_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 needs_butler() const { return _needs_butler; }
+
+ virtual DataType data_type () const = 0;
bool can_record();
- virtual void use_new_diskstream () = 0;
- virtual void set_diskstream (boost::shared_ptr<Diskstream>);
+ void use_new_diskstream ();
+ virtual boost::shared_ptr<Diskstream> create_diskstream() = 0;
+ virtual void set_diskstream (boost::shared_ptr<Diskstream>);
- nframes_t update_total_latency();
- void set_latency_delay (nframes_t);
+ void set_latency_compensation (framecnt_t);
enum FreezeState {
NoFreeze,
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<Processor> endpoint, bool include_endpoint) const = 0;
virtual boost::shared_ptr<Region> bounce (InterThreadInfo&) = 0;
- virtual boost::shared_ptr<Region> bounce_range (nframes_t start, nframes_t end, InterThreadInfo&, bool enable_processing = true) = 0;
+ virtual boost::shared_ptr<Region> bounce_range (framepos_t start, framepos_t end, InterThreadInfo&,
+ 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, bool for_freeze) = 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<PBD::Controllable> rec_enable_control() { return _rec_enable_control; }
+ boost::shared_ptr<AutomationControl> rec_enable_control() { return _rec_enable_control; }
bool record_enabled() const;
- void set_record_enable (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);
- /* XXX: unfortunate that this is exposed */
- PBD::ID const & diskstream_id () const;
+ bool using_diskstream_id (PBD::ID) const;
- void set_block_size (nframes_t);
+ void set_block_size (pframes_t);
/* PublicDiskstream interface */
boost::shared_ptr<Playlist> playlist ();
- void monitor_input (bool);
+ void request_input_monitoring (bool);
+ void ensure_input_monitoring (bool);
bool destructive () const;
- std::list<boost::shared_ptr<Region> > & last_capture_regions ();
+ std::list<boost::shared_ptr<Source> > & last_capture_sources ();
void set_capture_offset ();
+ std::string steal_write_source_name ();
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);
- uint32_t read_data_count() const;
- uint32_t write_data_count() const;
void set_pending_overwrite (bool);
- int seek (nframes_t, bool complete_refill = false);
+ int seek (framepos_t, bool complete_refill = false);
bool hidden () const;
- int can_internal_playback_seek (nframes_t);
- int internal_playback_seek (nframes_t);
+ int can_internal_playback_seek (framecnt_t);
+ int internal_playback_seek (framecnt_t);
void non_realtime_input_change ();
- void non_realtime_locate (nframes_t);
+ void non_realtime_locate (framepos_t);
void non_realtime_set_speed ();
int overwrite_existing_buffers ();
- nframes_t get_captured_frames (uint32_t n = 0);
+ framecnt_t get_captured_frames (uint32_t n = 0) const;
int set_loop (Location *);
- void transport_looped (nframes_t);
+ 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 prepare_to_stop (framepos_t, framepos_t);
void set_slaved (bool);
ChanCount n_channels ();
- nframes_t get_capture_start_frame (uint32_t n = 0);
+ framepos_t get_capture_start_frame (uint32_t n = 0) const;
AlignStyle alignment_style () const;
- void set_record_enabled (bool);
- nframes_t current_capture_start () const;
- nframes_t current_capture_end () 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<Playlist>);
- void set_align_style (AlignStyle);
+ 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 ();
+ void adjust_playback_buffering ();
+ void adjust_capture_buffering ();
PBD::Signal0<void> DiskstreamChanged;
PBD::Signal0<void> FreezeChange;
+ /* 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;
protected:
- virtual XMLNode& state (bool full) = 0;
+ XMLNode& state (bool full);
boost::shared_ptr<Diskstream> _diskstream;
- MeterPoint _saved_meter_point;
- TrackMode _mode;
- bool _needs_butler;
-
- ChanCount input_streams () const;
+ MeterPoint _saved_meter_point;
+ TrackMode _mode;
+ bool _needs_butler;
+ MonitorChoice _monitoring;
+ boost::shared_ptr<MonitoringControllable> _monitoring_control;
//private: (FIXME)
struct FreezeRecordProcessorInfo {
FreezeState state;
};
- struct RecEnableControllable : public PBD::Controllable {
- RecEnableControllable (Track&);
+ class RecEnableControl : public AutomationControl {
+ public:
+ RecEnableControl (boost::shared_ptr<Track> t);
- void set_value (float);
- float get_value (void) const;
+ void set_value (double, PBD::Controllable::GroupControlDisposition);
+ void set_value_unchecked (double);
+ double get_value (void) const;
- Track& track;
+ boost::weak_ptr<Track> track;
+
+ private:
+ void _set_value (double, PBD::Controllable::GroupControlDisposition);
};
virtual void set_state_part_two () = 0;
XMLNode* pending_state;
bool _destructive;
- boost::shared_ptr<RecEnableControllable> _rec_enable_control;
+ 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*/