X-Git-Url: https://main.carlh.net/gitweb/?a=blobdiff_plain;f=libs%2Fardour%2Fardour%2Ftrack.h;h=b7f5c1f5f4638c5acad041f644e0cdf0d601d4c6;hb=1f53c861b85ef07e60fb589a1c28efbc159e1a5c;hp=dd8a17f8cee935be56ecd719941827702b89aeea;hpb=75e6adcf03078c24d13ddc7c9c714582a6cf7891;p=ardour.git diff --git a/libs/ardour/ardour/track.h b/libs/ardour/ardour/track.h index dd8a17f8ce..b7f5c1f5f4 100644 --- a/libs/ardour/ardour/track.h +++ b/libs/ardour/ardour/track.h @@ -21,8 +21,11 @@ #include +#include "pbd/enum_convert.h" + +#include "ardour/interthread_info.h" +#include "ardour/recordable.h" #include "ardour/route.h" -#include "ardour/public_diskstream.h" namespace ARDOUR { @@ -31,27 +34,40 @@ class Playlist; class RouteGroup; class Source; class Region; -class Diskstream; - -class Track : public Route, public PublicDiskstream +class DiskReader; +class DiskWriter; +class IO; +class Location; +class MonitorControl; +class RecordEnableControl; +class RecordSafeControl; + +/** A track is an route (bus) with a recordable diskstream and + * related objects relevant to recording, playback and editing. + * + * Specifically a track has a playlist object that describes material + * to be played from disk, and modifies that object during recording and + * editing. + */ +class LIBARDOUR_API Track : public Route, public Recordable { public: - Track (Session&, std::string name, Route::Flag f = Route::Flag (0), TrackMode m = Normal, DataType default_type = DataType::AUDIO); + Track (Session&, std::string name, PresentationInfo::Flag f = PresentationInfo::Flag (0), TrackMode m = Normal, DataType default_type = DataType::AUDIO); virtual ~Track (); 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 TrackModeChanged; - virtual void set_monitoring (MonitorChoice); - MonitorChoice monitoring_choice() const { return _monitoring; } - MonitorState monitoring_state(); - PBD::Signal0 MonitoringChanged; + boost::shared_ptr monitoring_control() const { return _monitoring_control; } + + MonitorState monitoring_state () const; + MeterState metering_state () const; + + bool set_processor_state (XMLNode const & node, XMLProperty const* prop, ProcessorList& new_order, bool& must_configure); virtual int no_roll (pframes_t nframes, framepos_t start_frame, framepos_t end_frame, bool state_changing); @@ -63,17 +79,11 @@ class Track : public Route, public PublicDiskstream int declick, bool& need_butler) = 0; bool needs_butler() const { return _needs_butler; } - void toggle_monitor_input (); - - virtual DataType data_type () const = 0; bool can_record(); - virtual void use_new_diskstream () = 0; - virtual void set_diskstream (boost::shared_ptr); - void set_latency_compensation (framecnt_t); - + void update_latency_information (); enum FreezeState { NoFreeze, Frozen, @@ -85,36 +95,58 @@ class Track : public Route, public PublicDiskstream virtual void freeze_me (InterThreadInfo&) = 0; virtual void unfreeze () = 0; - virtual boost::shared_ptr bounce (InterThreadInfo&) = 0; - virtual boost::shared_ptr bounce_range (framepos_t start, framepos_t end, InterThreadInfo&, bool enable_processing = true) = 0; + /** 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 endpoint, bool include_endpoint) const = 0; + + /** bounce track from session start to session end to new region + * + * @param itt asynchronous progress report and cancel + * @return a new audio region (or nil in case of error) + */ + virtual boost::shared_ptr bounce (InterThreadInfo& itt) = 0; + + /** 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 bounce_range (framepos_t start, framepos_t end, InterThreadInfo& itt, + 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, bool for_freeze) = 0; XMLNode& get_state(); XMLNode& get_template(); - int set_state (const XMLNode&, int version); + 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; } + boost::shared_ptr rec_enable_control() const { return _record_enable_control; } + boost::shared_ptr rec_safe_control() const { return _record_safe_control; } - bool record_enabled() const; - void set_record_enabled (bool yn, void *src); + int prep_record_enabled (bool); + bool can_be_record_enabled (); + bool can_be_record_safe (); - /* XXX: unfortunate that this is exposed */ - PBD::ID const & diskstream_id () const; + void use_captured_sources (SourceList&, CaptureInfos const &); void set_block_size (pframes_t); - /** @return true if the track can be bounced, or false if it cannot because - * it has more outputs than diskstream channels. - */ - virtual bool bounceable () const = 0; - - /* PublicDiskstream interface */ boost::shared_ptr playlist (); - void monitor_input (bool); + void request_input_monitoring (bool); + void ensure_input_monitoring (bool); bool destructive () const; std::list > & last_capture_sources (); - void set_capture_offset (); - std::list > 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; @@ -122,21 +154,19 @@ class Track : public Route, public PublicDiskstream 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 (); + int can_internal_playback_seek (framecnt_t); + int internal_playback_seek (framecnt_t); void non_realtime_locate (framepos_t); - void non_realtime_set_speed (); + void realtime_handle_transport_stopped (); + void non_realtime_speed_change (); int overwrite_existing_buffers (); framecnt_t get_captured_frames (uint32_t n = 0) const; - int set_loop (Location *); + int set_loop (ARDOUR::Location *); void transport_looped (framepos_t); - bool realtime_set_speed (double, bool); + bool realtime_speed_change (); 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; @@ -144,31 +174,36 @@ class Track : public Route, public PublicDiskstream 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); + void playlist_modified (); + int use_playlist (DataType, boost::shared_ptr); + int find_and_use_playlist (DataType, PBD::ID const &); int use_copy_playlist (); int use_new_playlist (); void adjust_playback_buffering (); void adjust_capture_buffering (); - PBD::Signal0 DiskstreamChanged; + void set_disk_io_position (DiskIOPoint); + DiskIOPoint disk_io_point() const { return _disk_io_point; } + PBD::Signal0 FreezeChange; PBD::Signal0 PlaylistChanged; - PBD::Signal0 RecordEnableChanged; PBD::Signal0 SpeedChanged; PBD::Signal0 AlignmentStyleChanged; protected: XMLNode& state (bool full); - int _set_state (const XMLNode&, int version, bool); - boost::shared_ptr _diskstream; + boost::shared_ptr _disk_reader; + boost::shared_ptr _disk_writer; + boost::shared_ptr _playlists[DataType::num_types]; + MeterPoint _saved_meter_point; + DiskIOPoint _disk_io_point; TrackMode _mode; bool _needs_butler; - MonitorChoice _monitoring; + boost::shared_ptr _monitoring_control; //private: (FIXME) struct FreezeRecordProcessorInfo { @@ -193,36 +228,42 @@ class Track : public Route, public PublicDiskstream FreezeState state; }; - struct RecEnableControllable : public PBD::Controllable { - RecEnableControllable (Track&); + virtual void set_state_part_two () = 0; - void set_value (double); - double get_value (void) const; + FreezeRecord _freeze_record; + XMLNode* pending_state; + bool _destructive; - Track& track; - }; + void maybe_declick (BufferSet&, framecnt_t, int); - virtual void set_state_part_two () = 0; + boost::shared_ptr _record_enable_control; + boost::shared_ptr _record_safe_control; - FreezeRecord _freeze_record; - XMLNode* pending_state; - bool _destructive; + virtual void record_enable_changed (bool, PBD::Controllable::GroupControlDisposition); + virtual void record_safe_changed (bool, PBD::Controllable::GroupControlDisposition); - void maybe_declick (BufferSet&, framecnt_t, int); + framecnt_t check_initial_delay (framecnt_t nframes, framepos_t&); + virtual void monitoring_changed (bool, PBD::Controllable::GroupControlDisposition); - virtual bool send_silence () const; + AlignChoice _alignment_choice; + void set_align_choice_from_io (); + void input_changed (); - boost::shared_ptr _rec_enable_control; - - framecnt_t check_initial_delay (framecnt_t nframes, framecnt_t&); + void use_captured_audio_sources (SourceList&, CaptureInfos const &); + void use_captured_midi_sources (SourceList&, CaptureInfos const &); private: - void diskstream_playlist_changed (); - void diskstream_record_enable_changed (); - void diskstream_speed_changed (); - void diskstream_alignment_style_changed (); + void parameter_changed (std::string const & p); + void setup_invisible_processors_oh_children_of_mine (ProcessorList&); + void add_processors_oh_children_of_mine (); + + std::string _diskstream_name; }; }; /* namespace ARDOUR*/ +namespace PBD { + DEFINE_ENUM_CONVERT(ARDOUR::Track::FreezeState); +} + #endif /* __ardour_track_h__ */