diff options
Diffstat (limited to 'libs/ardour/ardour')
-rw-r--r-- | libs/ardour/ardour/audio_diskstream.h | 2 | ||||
-rw-r--r-- | libs/ardour/ardour/audio_track.h | 3 | ||||
-rw-r--r-- | libs/ardour/ardour/diskstream.h | 26 | ||||
-rw-r--r-- | libs/ardour/ardour/midi_diskstream.h | 2 | ||||
-rw-r--r-- | libs/ardour/ardour/midi_track.h | 3 | ||||
-rw-r--r-- | libs/ardour/ardour/playlist.h | 1 | ||||
-rwxr-xr-x | libs/ardour/ardour/public_diskstream.h | 80 | ||||
-rw-r--r-- | libs/ardour/ardour/route.h | 2 | ||||
-rw-r--r-- | libs/ardour/ardour/session.h | 51 | ||||
-rw-r--r-- | libs/ardour/ardour/session_event.h | 2 | ||||
-rw-r--r-- | libs/ardour/ardour/track.h | 67 |
11 files changed, 188 insertions, 51 deletions
diff --git a/libs/ardour/ardour/audio_diskstream.h b/libs/ardour/ardour/audio_diskstream.h index 0a8a7a0a8e..6cf064a61d 100644 --- a/libs/ardour/ardour/audio_diskstream.h +++ b/libs/ardour/ardour/audio_diskstream.h @@ -228,7 +228,7 @@ class AudioDiskstream : public Diskstream ChannelInfo* channel_info, int channel, bool reversed); void finish_capture (bool rec_monitors_input, boost::shared_ptr<ChannelList>); - void transport_stopped (struct tm&, time_t, bool abort); + void transport_stopped_wallclock (struct tm&, time_t, bool abort); void transport_looped (nframes_t transport_frame); void init (); diff --git a/libs/ardour/ardour/audio_track.h b/libs/ardour/ardour/audio_track.h index 0c4f29ee86..d74f5e53b9 100644 --- a/libs/ardour/ardour/audio_track.h +++ b/libs/ardour/ardour/audio_track.h @@ -28,6 +28,7 @@ class Session; class AudioDiskstream; class AudioPlaylist; class RouteGroup; +class AudioFileSource; class AudioTrack : public Track { @@ -56,6 +57,8 @@ class AudioTrack : public Track int set_state(const XMLNode&, int version); + boost::shared_ptr<AudioFileSource> write_source (uint32_t n = 0); + protected: XMLNode& state (bool full); diff --git a/libs/ardour/ardour/diskstream.h b/libs/ardour/ardour/diskstream.h index da6297e0fb..97a512cf3f 100644 --- a/libs/ardour/ardour/diskstream.h +++ b/libs/ardour/ardour/diskstream.h @@ -37,6 +37,7 @@ #include "ardour/session_object.h" #include "ardour/types.h" #include "ardour/utils.h" +#include "ardour/public_diskstream.h" struct tm; @@ -46,10 +47,10 @@ class IO; class Playlist; class Processor; class Region; -class Route; class Session; +class Track; -class Diskstream : public SessionObject +class Diskstream : public SessionObject, public PublicDiskstream { public: enum Flag { @@ -66,7 +67,7 @@ class Diskstream : public SessionObject bool set_name (const std::string& str); boost::shared_ptr<ARDOUR::IO> io() const { return _io; } - void set_route (ARDOUR::Route&); + void set_track (ARDOUR::Track *); virtual float playback_buffer_load() const = 0; virtual float capture_buffer_load() const = 0; @@ -99,7 +100,6 @@ class Diskstream : public SessionObject virtual void punch_in() {} virtual void punch_out() {} - void set_speed (double); void non_realtime_set_speed (); virtual void non_realtime_locate (nframes_t /*location*/) {}; virtual void playlist_modified (); @@ -143,6 +143,14 @@ class Diskstream : public SessionObject void move_processor_automation (boost::weak_ptr<Processor>, std::list<Evoral::RangeMove<framepos_t> > const &); + /** For non-butler contexts (allocates temporary working buffers) */ + virtual int do_refill_with_alloc() = 0; + virtual void set_block_size (nframes_t) = 0; + + bool pending_overwrite () const { + return _pending_overwrite; + } + PBD::Signal0<void> RecordEnableChanged; PBD::Signal0<void> SpeedChanged; PBD::Signal0<void> ReverseChanged; @@ -163,7 +171,6 @@ class Diskstream : public SessionObject virtual void set_pending_overwrite (bool) = 0; virtual int overwrite_existing_buffers () = 0; - virtual void set_block_size (nframes_t) = 0; virtual int internal_playback_seek (nframes_t distance) = 0; virtual int can_internal_playback_seek (nframes_t distance) = 0; virtual int rename_write_sources () = 0; @@ -199,16 +206,13 @@ class Diskstream : public SessionObject virtual int do_flush (RunContext context, bool force = false) = 0; virtual int do_refill () = 0; - /** For non-butler contexts (allocates temporary working buffers) */ - virtual int do_refill_with_alloc() = 0; - /* XXX fix this redundancy ... */ virtual void playlist_changed (const PBD::PropertyChange&); virtual void playlist_deleted (boost::weak_ptr<Playlist>); virtual void playlist_ranges_moved (std::list< Evoral::RangeMove<framepos_t> > const &); - virtual void transport_stopped (struct tm&, time_t, bool abort) = 0; + virtual void transport_stopped_wallclock (struct tm&, time_t, bool abort) = 0; virtual void transport_looped (nframes_t transport_frame) = 0; struct CaptureInfo { @@ -245,7 +249,7 @@ class Diskstream : public SessionObject uint32_t i_am_the_modifier; boost::shared_ptr<ARDOUR::IO> _io; - Route* _route; + Track* _track; ChanCount _n_channels; boost::shared_ptr<Playlist> _playlist; @@ -273,7 +277,7 @@ class Diskstream : public SessionObject Location* loop_location; nframes_t overwrite_frame; off_t overwrite_offset; - bool pending_overwrite; + bool _pending_overwrite; bool overwrite_queued; IOChange input_change_pending; nframes_t wrap_buffer_size; diff --git a/libs/ardour/ardour/midi_diskstream.h b/libs/ardour/ardour/midi_diskstream.h index 81f2979f3f..abbfc28feb 100644 --- a/libs/ardour/ardour/midi_diskstream.h +++ b/libs/ardour/ardour/midi_diskstream.h @@ -151,7 +151,7 @@ class MidiDiskstream : public Diskstream int read (nframes_t& start, nframes_t cnt, bool reversed); void finish_capture (bool rec_monitors_input); - void transport_stopped (struct tm&, time_t, bool abort); + void transport_stopped_wallclock (struct tm&, time_t, bool abort); void transport_looped (nframes_t transport_frame); void init (); diff --git a/libs/ardour/ardour/midi_track.h b/libs/ardour/ardour/midi_track.h index f4f29398b2..0399492a02 100644 --- a/libs/ardour/ardour/midi_track.h +++ b/libs/ardour/ardour/midi_track.h @@ -31,6 +31,7 @@ class Session; class MidiDiskstream; class MidiPlaylist; class RouteGroup; +class SMFSource; class MidiTrack : public Track { @@ -90,6 +91,8 @@ public: bool midi_thru() const { return _midi_thru; } void set_midi_thru (bool yn); + boost::shared_ptr<SMFSource> write_source (uint32_t n = 0); + protected: XMLNode& state (bool full); diff --git a/libs/ardour/ardour/playlist.h b/libs/ardour/ardour/playlist.h index d9a14c01fd..c5b79644c6 100644 --- a/libs/ardour/ardour/playlist.h +++ b/libs/ardour/ardour/playlist.h @@ -195,6 +195,7 @@ class Playlist : public SessionObject uint32_t read_data_count() const { return _read_data_count; } + /* XXX: use of diskstream here is a little unfortunate */ const PBD::ID& get_orig_diskstream_id () const { return _orig_diskstream_id; } void set_orig_diskstream_id (const PBD::ID& did) { _orig_diskstream_id = did; } diff --git a/libs/ardour/ardour/public_diskstream.h b/libs/ardour/ardour/public_diskstream.h new file mode 100755 index 0000000000..90ca030af1 --- /dev/null +++ b/libs/ardour/ardour/public_diskstream.h @@ -0,0 +1,80 @@ +/* + Copyright (C) 2010 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 + the Free Software Foundation; either version 2 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program; if not, write to the Free Software + Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. + +*/ + +#ifndef __ardour_public_diskstream_h__ +#define __ardour_public_diskstream_h__ + +namespace ARDOUR { + +class Playlist; +class Region; +class Location; + +/** Public interface to a Diskstream */ +class PublicDiskstream +{ +public: + + virtual boost::shared_ptr<Playlist> playlist () = 0; + virtual void monitor_input (bool) = 0; + virtual bool destructive () const = 0; + virtual std::list<boost::shared_ptr<Region> > & last_capture_regions () = 0; + virtual void set_capture_offset () = 0; + virtual void reset_write_sources (bool, bool force = false) = 0; + virtual float playback_buffer_load () const = 0; + virtual float capture_buffer_load () const = 0; + virtual int do_refill () = 0; + virtual int do_flush (RunContext, bool force = false) = 0; + virtual uint32_t read_data_count() const = 0; + virtual uint32_t write_data_count() const = 0; + virtual void set_pending_overwrite (bool) = 0; + virtual int seek (nframes_t, bool complete_refill = false) = 0; + virtual bool hidden () const = 0; + virtual int can_internal_playback_seek (nframes_t) = 0; + virtual int internal_playback_seek (nframes_t) = 0; + virtual void non_realtime_input_change () = 0; + virtual void non_realtime_locate (nframes_t) = 0; + virtual void non_realtime_set_speed () = 0; + virtual int overwrite_existing_buffers () = 0; + virtual nframes_t get_captured_frames (uint32_t n = 0) = 0; + virtual int set_loop (Location *) = 0; + virtual void transport_looped (nframes_t) = 0; + virtual bool realtime_set_speed (double, bool) = 0; + virtual void transport_stopped_wallclock (struct tm &, time_t, bool) = 0; + virtual bool pending_overwrite () const = 0; + virtual double speed () const = 0; + virtual void prepare_to_stop (framepos_t) = 0; + virtual void set_slaved (bool) = 0; + virtual ChanCount n_channels () = 0; + virtual nframes_t get_capture_start_frame (uint32_t n = 0) = 0; + virtual AlignStyle alignment_style () const = 0; + virtual void set_record_enabled (bool) = 0; + virtual nframes_t current_capture_start () const = 0; + virtual nframes_t current_capture_end () const = 0; + virtual void playlist_modified () = 0; + virtual int use_playlist (boost::shared_ptr<Playlist>) = 0; + virtual void set_align_style (AlignStyle) = 0; + virtual int use_copy_playlist () = 0; + virtual int use_new_playlist () = 0; + +}; + +} + +#endif diff --git a/libs/ardour/ardour/route.h b/libs/ardour/ardour/route.h index ae514e2f18..f9ba1a8e8a 100644 --- a/libs/ardour/ardour/route.h +++ b/libs/ardour/ardour/route.h @@ -338,10 +338,10 @@ class Route : public SessionObject, public AutomatableControls, public RouteGrou void catch_up_on_solo_mute_override (); void mod_solo_by_others (int32_t); - void set_block_size (nframes_t nframes); bool has_external_redirects() const; void curve_reallocate (); void just_meter_input (sframes_t start_frame, sframes_t end_frame, nframes_t nframes); + virtual void set_block_size (nframes_t nframes); protected: nframes_t check_initial_delay (nframes_t, nframes_t&); diff --git a/libs/ardour/ardour/session.h b/libs/ardour/ardour/session.h index ed1dc68f43..e2f3ff1625 100644 --- a/libs/ardour/ardour/session.h +++ b/libs/ardour/ardour/session.h @@ -77,7 +77,6 @@ namespace Evoral { namespace ARDOUR { -class AudioDiskstream; class AudioEngine; class AudioFileSource; class AudioRegion; @@ -96,7 +95,6 @@ class ExportStatus; class IO; class IOProcessor; class ImportStatus; -class MidiDiskstream; class MidiRegion; class MidiSource; class MidiTrack; @@ -121,6 +119,7 @@ class Slave; class Source; class TempoMap; class VSTPlugin; +class Track; extern void setup_enum_writer (); @@ -193,26 +192,18 @@ class Session : public PBD::StatefulDestructible, public PBD::ScopedConnectionLi BufferSet& get_scratch_buffers (ChanCount count = ChanCount::ZERO); BufferSet& get_mix_buffers (ChanCount count = ChanCount::ZERO); - void add_diskstream (boost::shared_ptr<Diskstream>); - boost::shared_ptr<Diskstream> diskstream_by_id (const PBD::ID& id); - boost::shared_ptr<Diskstream> diskstream_by_name (std::string name); - bool have_rec_enabled_diskstream () const; + bool have_rec_enabled_track () const; bool have_captured() const { return _have_captured; } - void refill_all_diskstream_buffers (); + void refill_all_track_buffers (); Butler* butler() { return _butler; } void butler_transport_work (); - uint32_t get_next_diskstream_id() const { return n_diskstreams(); } - uint32_t n_diskstreams() const; - void refresh_disk_space (); - typedef std::list<boost::shared_ptr<Diskstream> > DiskstreamList; - - SerializedRCUManager<DiskstreamList>& diskstream_list() { return diskstreams; } - + int load_diskstreams_2X (XMLNode const &, int); + int load_routes (const XMLNode&, int); boost::shared_ptr<RouteList> get_routes() const { return routes.reader (); @@ -307,8 +298,8 @@ class Session : public PBD::StatefulDestructible, public PBD::ScopedConnectionLi void use_rf_shuttle_speed (); void allow_auto_play (bool yn); void request_transport_speed (double speed); - void request_overwrite_buffer (Diskstream*); - void request_diskstream_speed (Diskstream&, double speed); + void request_overwrite_buffer (Track *); + void request_track_speed (Track *, double speed); void request_input_change_handling (); bool locate_pending() const { return static_cast<bool>(post_transport_work()&PostTransportLocate); } @@ -542,9 +533,9 @@ class Session : public PBD::StatefulDestructible, public PBD::ScopedConnectionLi */ static PBD::Signal0<int> AskAboutPendingState; - boost::shared_ptr<AudioFileSource> create_audio_source_for_session (ARDOUR::AudioDiskstream&, uint32_t which_channel, bool destructive); + boost::shared_ptr<AudioFileSource> create_audio_source_for_session (size_t, std::string const &, uint32_t, bool); - boost::shared_ptr<MidiSource> create_midi_source_for_session (ARDOUR::MidiDiskstream&); + boost::shared_ptr<MidiSource> create_midi_source_for_session (std::string const &); boost::shared_ptr<Source> source_by_id (const PBD::ID&); boost::shared_ptr<Source> source_by_path_and_channel (const Glib::ustring&, uint16_t); @@ -932,7 +923,7 @@ class Session : public PBD::StatefulDestructible, public PBD::ScopedConnectionLi PBD::ScopedConnection export_freewheel_connection; - void get_diskstream_statistics (); + void get_track_statistics (); int process_routes (nframes_t, bool& need_butler); int silent_process_routes (nframes_t, bool& need_butler); @@ -1174,13 +1165,13 @@ class Session : public PBD::StatefulDestructible, public PBD::ScopedConnectionLi void set_play_loop (bool yn); void unset_play_loop (); - void overwrite_some_buffers (Diskstream*); + void overwrite_some_buffers (Track *); void flush_all_inserts (); int micro_locate (nframes_t distance); void locate (nframes64_t, bool with_roll, bool with_flush, bool with_loop=false, bool force=false); void start_locate (nframes64_t, bool with_roll, bool with_flush, bool with_loop=false, bool force=false); void force_locate (nframes64_t frame, bool with_roll = false); - void set_diskstream_speed (Diskstream*, double speed); + void set_track_speed (Track *, double speed); void set_transport_speed (double speed, bool abort = false, bool clear_state = false); void stop_transport (bool abort = false, bool clear_state = false); void start_transport (); @@ -1203,12 +1194,6 @@ class Session : public PBD::StatefulDestructible, public PBD::ScopedConnectionLi std::list<RouteGroup *> _route_groups; - /* disk-streams */ - - SerializedRCUManager<DiskstreamList> diskstreams; - - int load_diskstreams (const XMLNode&); - /* routes stuff */ SerializedRCUManager<RouteList> routes; @@ -1217,6 +1202,7 @@ class Session : public PBD::StatefulDestructible, public PBD::ScopedConnectionLi uint32_t destructive_index; boost::shared_ptr<Route> XMLRouteFactory (const XMLNode&, int); + boost::shared_ptr<Route> XMLRouteFactory_2X (const XMLNode&, int); void route_processors_changed (RouteProcessorChange); @@ -1265,7 +1251,7 @@ class Session : public PBD::StatefulDestructible, public PBD::ScopedConnectionLi void remove_playlist (boost::weak_ptr<Playlist>); void playlist_length_changed (); - void diskstream_playlist_changed (boost::weak_ptr<Diskstream>); + void track_playlist_changed (boost::weak_ptr<Track>); /* NAMED SELECTIONS */ @@ -1342,7 +1328,7 @@ class Session : public PBD::StatefulDestructible, public PBD::ScopedConnectionLi XMLNode* _bundle_xml_node; int load_bundles (XMLNode const &); - void reverse_diskstream_buffers (); + void reverse_track_buffers (); UndoHistory _history; std::stack<UndoTransaction*> _current_trans; @@ -1436,8 +1422,8 @@ class Session : public PBD::StatefulDestructible, public PBD::ScopedConnectionLi mutable bool have_looped; ///< Used in ::audible_frame(*) - void update_have_rec_enabled_diskstream (); - gint _have_rec_enabled_diskstream; + void update_have_rec_enabled_track (); + gint _have_rec_enabled_track; static int ask_about_playlist_deletion (boost::shared_ptr<Playlist>); @@ -1450,6 +1436,9 @@ class Session : public PBD::StatefulDestructible, public PBD::ScopedConnectionLi void rt_set_mute (boost::shared_ptr<RouteList>, bool yn, bool group_override); void rt_set_listen (boost::shared_ptr<RouteList>, bool yn, bool group_override); void rt_set_record_enable (boost::shared_ptr<RouteList>, bool yn, bool group_override); + + /** temporary list of Diskstreams used only during load of 2.X sessions */ + std::list<boost::shared_ptr<Diskstream> > _diskstreams_2X; }; } // namespace ARDOUR diff --git a/libs/ardour/ardour/session_event.h b/libs/ardour/ardour/session_event.h index 2306bb7c1a..726c5be47b 100644 --- a/libs/ardour/ardour/session_event.h +++ b/libs/ardour/ardour/session_event.h @@ -19,7 +19,7 @@ class Region; struct SessionEvent { enum Type { SetTransportSpeed, - SetDiskstreamSpeed, + SetTrackSpeed, Locate, LocateRoll, LocateRollLocate, diff --git a/libs/ardour/ardour/track.h b/libs/ardour/ardour/track.h index c05d222cc2..a40b82916b 100644 --- a/libs/ardour/ardour/track.h +++ b/libs/ardour/ardour/track.h @@ -22,16 +22,17 @@ #include <boost/shared_ptr.hpp> #include "ardour/route.h" +#include "ardour/public_diskstream.h" namespace ARDOUR { class Session; -class Diskstream; class Playlist; class RouteGroup; 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); @@ -60,10 +61,8 @@ class Track : public Route bool can_record(); - boost::shared_ptr<Diskstream> diskstream() const { return _diskstream; } - virtual void use_new_diskstream () = 0; - virtual void set_diskstream (boost::shared_ptr<Diskstream>) = 0; + virtual void set_diskstream (boost::shared_ptr<Diskstream>); nframes_t update_total_latency(); void set_latency_delay (nframes_t); @@ -92,8 +91,60 @@ class Track : public Route bool record_enabled() const; void set_record_enable (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> playlist (); + void monitor_input (bool); + bool destructive () const; + std::list<boost::shared_ptr<Region> > & last_capture_regions (); + void set_capture_offset (); + 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); + bool hidden () const; + int can_internal_playback_seek (nframes_t); + int internal_playback_seek (nframes_t); + void non_realtime_input_change (); + void non_realtime_locate (nframes_t); + void non_realtime_set_speed (); + int overwrite_existing_buffers (); + nframes_t get_captured_frames (uint32_t n = 0); + int set_loop (Location *); + void transport_looped (nframes_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 (); + nframes_t get_capture_start_frame (uint32_t n = 0); + AlignStyle alignment_style () const; + void set_record_enabled (bool); + nframes_t current_capture_start () const; + nframes_t current_capture_end () const; + void playlist_modified (); + int use_playlist (boost::shared_ptr<Playlist>); + void set_align_style (AlignStyle); + int use_copy_playlist (); + int use_new_playlist (); + PBD::Signal0<void> DiskstreamChanged; PBD::Signal0<void> FreezeChange; + PBD::Signal0<void> PlaylistChanged; + PBD::Signal0<void> RecordEnableChanged; + PBD::Signal0<void> SpeedChanged; + PBD::Signal0<void> AlignmentStyleChanged; protected: virtual XMLNode& state (bool full) = 0; @@ -144,6 +195,12 @@ class Track : public Route bool _destructive; boost::shared_ptr<RecEnableControllable> _rec_enable_control; + +private: + void diskstream_playlist_changed (); + void diskstream_record_enable_changed (); + void diskstream_speed_changed (); + void diskstream_alignment_style_changed (); }; }; /* namespace ARDOUR*/ |