X-Git-Url: https://main.carlh.net/gitweb/?a=blobdiff_plain;f=libs%2Fardour%2Fardour%2Ftrack.h;h=ff1b57950a4bfbd2662cad59364949b7c0a1932f;hb=cdfbec0eb1289c17159f3263c1e6256afdee67dc;hp=243d0db46d14f5108449bc9781a8fc0adaf32974;hpb=fedf3d34f32264ac57c6a222b678dc90f2bb1a88;p=ardour.git diff --git a/libs/ardour/ardour/track.h b/libs/ardour/ardour/track.h index 243d0db46d..ff1b57950a 100644 --- a/libs/ardour/ardour/track.h +++ b/libs/ardour/ardour/track.h @@ -1,5 +1,5 @@ /* - Copyright (C) 2006 Paul Davis + Copyright (C) 2006 Paul Davis This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -21,44 +21,51 @@ #include -#include +#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&, string name, Route::Flag f = Route::Flag (0), TrackMode m = Normal, DataType default_type = DataType::AUDIO); - + Track (Session&, std::string name, Route::Flag f = Route::Flag (0), TrackMode m = Normal, DataType default_type = DataType::AUDIO); virtual ~Track (); - - int set_name (string str, void *src); - - virtual int roll (nframes_t nframes, nframes_t start_frame, nframes_t end_frame, - nframes_t offset, int declick, bool can_record, bool rec_monitors_input) = 0; - - virtual int no_roll (nframes_t nframes, nframes_t start_frame, nframes_t end_frame, - nframes_t offset, bool state_changing, bool can_record, bool rec_monitors_input) = 0; - - virtual int silent_roll (nframes_t nframes, nframes_t start_frame, nframes_t end_frame, - nframes_t offset, bool can_record, bool rec_monitors_input) = 0; - void toggle_monitor_input (); + int init (); - bool can_record(); + 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; } + PBD::Signal0 TrackModeChanged; - boost::shared_ptr diskstream() const { return _diskstream; } + 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); - virtual int use_diskstream (string name) = 0; - virtual int use_diskstream (const PBD::ID& id) = 0; + int silent_roll (nframes_t nframes, framepos_t start_frame, framepos_t end_frame, + bool can_record, bool rec_monitors_input, bool& need_butler); - TrackMode mode() const { return _mode; } - void set_mode (TrackMode m); + 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; + + 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); nframes_t update_total_latency(); void set_latency_delay (nframes_t); @@ -70,84 +77,135 @@ class Track : public Route }; FreezeState freeze_state() const; - - virtual void freeze (InterThreadInfo&) = 0; + + virtual void freeze_me (InterThreadInfo&) = 0; virtual void unfreeze () = 0; - virtual void bounce (InterThreadInfo&) = 0; - virtual void bounce_range (nframes_t start, nframes_t end, InterThreadInfo&) = 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; XMLNode& get_state(); XMLNode& get_template(); - virtual int set_state(const XMLNode& node) = 0; + virtual int set_state (const XMLNode&, int version) = 0; + static void zero_diskstream_id_in_xml (XMLNode&); - PBD::Controllable& rec_enable_control() { return _rec_enable_control; } + 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 ModeChanged; - sigc::signal DiskstreamChanged; - sigc::signal FreezeChange; + void set_record_enabled (bool yn, void *src); + + /* XXX: unfortunate that this is exposed */ + PBD::ID const & diskstream_id () const; + + void set_block_size (nframes_t); + + /* PublicDiskstream interface */ + boost::shared_ptr playlist (); + void monitor_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); + uint32_t read_data_count() const; + uint32_t write_data_count() const; + 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; + 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); + int use_copy_playlist (); + int use_new_playlist (); + void adjust_playback_buffering (); + void adjust_capture_buffering (); + + PBD::Signal0 DiskstreamChanged; + PBD::Signal0 FreezeChange; + 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; boost::shared_ptr _diskstream; MeterPoint _saved_meter_point; TrackMode _mode; + bool _needs_butler; + + ChanCount input_streams () const; //private: (FIXME) - struct FreezeRecordInsertInfo { - FreezeRecordInsertInfo(XMLNode& st, boost::shared_ptr ins) - : state (st), insert (ins) {} - - XMLNode state; - boost::shared_ptr insert; - PBD::ID id; - UndoAction memento; + struct FreezeRecordProcessorInfo { + FreezeRecordProcessorInfo(XMLNode& st, boost::shared_ptr proc) + : state (st), processor (proc) {} + + XMLNode state; + boost::shared_ptr processor; + PBD::ID id; }; struct FreezeRecord { - FreezeRecord() - : playlist(0) - , have_mementos(false) - {} + FreezeRecord() + : have_mementos(false) + {} - ~FreezeRecord(); + ~FreezeRecord(); - Playlist* playlist; - vector insert_info; - bool have_mementos; - FreezeState state; + boost::shared_ptr playlist; + std::vector processor_info; + bool have_mementos; + FreezeState state; }; struct RecEnableControllable : public PBD::Controllable { - RecEnableControllable (Track&); - - void set_value (float); - float get_value (void) const; + RecEnableControllable (Track&); - Track& track; - }; - - //virtual void diskstream_record_enable_changed (void *src) = 0; - //virtual void diskstream_input_channel_changed (void *src) = 0; + void set_value (double); + double get_value (void) const; - //virtual void input_change_handler (void *src) = 0; + Track& track; + }; virtual void set_state_part_two () = 0; FreezeRecord _freeze_record; XMLNode* pending_state; - sigc::connection recenable_connection; - sigc::connection ic_connection; - RecEnableControllable _rec_enable_control; bool _destructive; + + boost::shared_ptr _rec_enable_control; + +private: + void diskstream_playlist_changed (); + void diskstream_record_enable_changed (); + void diskstream_speed_changed (); + void diskstream_alignment_style_changed (); }; }; /* namespace ARDOUR*/