From 87b2c94759ab95c31bf0ba43e299eb78dcfd6385 Mon Sep 17 00:00:00 2001 From: Robin Gareus Date: Tue, 22 May 2018 21:35:27 +0200 Subject: Separate ChannelInfo for disk reader and writer This allows to use different types for write and read buffers, in preparation for a dedicated reader-buffer. --- libs/ardour/ardour/disk_io.h | 20 +++++++++++++------- libs/ardour/ardour/disk_reader.h | 11 +++++++++++ libs/ardour/ardour/disk_writer.h | 11 +++++++++++ 3 files changed, 35 insertions(+), 7 deletions(-) (limited to 'libs/ardour/ardour') diff --git a/libs/ardour/ardour/disk_io.h b/libs/ardour/ardour/disk_io.h index 8cba4e24f6..f39ee1d253 100644 --- a/libs/ardour/ardour/disk_io.h +++ b/libs/ardour/ardour/disk_io.h @@ -56,6 +56,7 @@ public: static const std::string state_node_name; DiskIOProcessor (Session&, const std::string& name, Flag f); + virtual ~DiskIOProcessor (); void set_route (boost::shared_ptr); void drop_route (); @@ -150,28 +151,33 @@ protected: struct ChannelInfo : public boost::noncopyable { ChannelInfo (samplecnt_t buffer_size); - ~ChannelInfo (); + virtual ~ChannelInfo (); - /** A ringbuffer for data to be played back, written to in the - butler thread, read from in the process thread. - */ + /** Ringbuffer for data to be played back. + * written to in the butler thread, read from in the process thread. + */ PBD::RingBufferNPT* buf; + + /** A ringbuffer for data to be recorded back, written to in the + * process thread, read from in the butler thread. + */ + PBD::RingBufferNPT* wbuf; PBD::RingBufferNPT::rw_vector rw_vector; /* used only by capture */ boost::shared_ptr write_source; - PBD::RingBufferNPT * capture_transition_buf; + PBD::RingBufferNPT* capture_transition_buf; /* used in the butler thread only */ samplecnt_t curr_capture_cnt; - void resize (samplecnt_t); + virtual void resize (samplecnt_t) = 0; }; typedef std::vector ChannelList; SerializedRCUManager channels; - int add_channel_to (boost::shared_ptr, uint32_t how_many); + virtual int add_channel_to (boost::shared_ptr, uint32_t how_many) = 0; int remove_channel_from (boost::shared_ptr, uint32_t how_many); boost::shared_ptr _playlists[DataType::num_types]; diff --git a/libs/ardour/ardour/disk_reader.h b/libs/ardour/ardour/disk_reader.h index cb37bc6cb1..9027bf3282 100644 --- a/libs/ardour/ardour/disk_reader.h +++ b/libs/ardour/ardour/disk_reader.h @@ -102,6 +102,15 @@ protected: friend class Track; friend class MidiTrack; + struct ReaderChannelInfo : public DiskIOProcessor::ChannelInfo { + ReaderChannelInfo (samplecnt_t buffer_size) + : DiskIOProcessor::ChannelInfo::ChannelInfo (buffer_size) + { + resize (buffer_size); + } + void resize (samplecnt_t); + }; + XMLNode& state (); void resolve_tracker (Evoral::EventSink& buffer, samplepos_t time); @@ -110,6 +119,8 @@ protected: int use_playlist (DataType, boost::shared_ptr); void playlist_ranges_moved (std::list< Evoral::RangeMove > const &, bool); + int add_channel_to (boost::shared_ptr, uint32_t how_many); + private: /** The number of samples by which this diskstream's output should be delayed with respect to the transport sample. This is used for latency compensation. diff --git a/libs/ardour/ardour/disk_writer.h b/libs/ardour/ardour/disk_writer.h index 11d795c11a..115da0a2e5 100644 --- a/libs/ardour/ardour/disk_writer.h +++ b/libs/ardour/ardour/disk_writer.h @@ -133,6 +133,15 @@ public: protected: friend class Track; + struct WriterChannelInfo : public DiskIOProcessor::ChannelInfo { + WriterChannelInfo (samplecnt_t buffer_size) + : DiskIOProcessor::ChannelInfo::ChannelInfo (buffer_size) + { + resize (buffer_size); + } + void resize (samplecnt_t); + }; + virtual XMLNode& state (); int do_flush (RunContext context, bool force = false); @@ -143,6 +152,8 @@ protected: void setup_destructive_playlist (); void use_destructive_playlist (); + int add_channel_to (boost::shared_ptr, uint32_t how_many); + void engage_record_enable (); void disengage_record_enable (); void engage_record_safe (); -- cgit v1.2.3