diff options
author | Robin Gareus <robin@gareus.org> | 2018-05-22 21:35:27 +0200 |
---|---|---|
committer | Robin Gareus <robin@gareus.org> | 2018-07-09 17:30:38 +0200 |
commit | 87b2c94759ab95c31bf0ba43e299eb78dcfd6385 (patch) | |
tree | d8e2b40750f2c4729b6adb09256027cf6ffd3a50 /libs/ardour/ardour | |
parent | cf11764763c302242f4d803cae2c326a66c8f5d8 (diff) |
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.
Diffstat (limited to 'libs/ardour/ardour')
-rw-r--r-- | libs/ardour/ardour/disk_io.h | 20 | ||||
-rw-r--r-- | libs/ardour/ardour/disk_reader.h | 11 | ||||
-rw-r--r-- | libs/ardour/ardour/disk_writer.h | 11 |
3 files changed, 35 insertions, 7 deletions
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<Route>); 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<Sample>* buf; + + /** A ringbuffer for data to be recorded back, written to in the + * process thread, read from in the butler thread. + */ + PBD::RingBufferNPT<Sample>* wbuf; PBD::RingBufferNPT<Sample>::rw_vector rw_vector; /* used only by capture */ boost::shared_ptr<AudioFileSource> write_source; - PBD::RingBufferNPT<CaptureTransition> * capture_transition_buf; + PBD::RingBufferNPT<CaptureTransition>* 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<ChannelInfo*> ChannelList; SerializedRCUManager<ChannelList> channels; - int add_channel_to (boost::shared_ptr<ChannelList>, uint32_t how_many); + virtual int add_channel_to (boost::shared_ptr<ChannelList>, uint32_t how_many) = 0; int remove_channel_from (boost::shared_ptr<ChannelList>, uint32_t how_many); boost::shared_ptr<Playlist> _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<samplepos_t>& buffer, samplepos_t time); @@ -110,6 +119,8 @@ protected: int use_playlist (DataType, boost::shared_ptr<Playlist>); void playlist_ranges_moved (std::list< Evoral::RangeMove<samplepos_t> > const &, bool); + int add_channel_to (boost::shared_ptr<ChannelList>, 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<ChannelList>, uint32_t how_many); + void engage_record_enable (); void disengage_record_enable (); void engage_record_safe (); |