rename a method to be more clear; remove an unused method from DiskReader
[ardour.git] / libs / ardour / ardour / disk_reader.h
index aa50894ebe92f78573eb5c91ad7e74a4d09edb8b..faeeaf1f529e4a75c0aa64f1a8b8ecdf3a3e3791 100644 (file)
 #ifndef __ardour_disk_reader_h__
 #define __ardour_disk_reader_h__
 
-#include "pbd/ringbufferNPT.h"
-#include "pbd/rcu.h"
+#include "pbd/i18n.h"
 
 #include "ardour/disk_io.h"
-#include "ardour/interpolation.h"
 #include "ardour/midi_buffer.h"
 
 namespace ARDOUR
@@ -42,18 +40,15 @@ class LIBARDOUR_API DiskReader : public DiskIOProcessor
        ~DiskReader ();
 
        bool set_name (std::string const & str);
+       std::string display_name() const { return std::string (_("reader")); }
 
        static framecnt_t chunk_frames() { return _chunk_frames; }
        static framecnt_t default_chunk_frames ();
        static void set_chunk_frames (framecnt_t n) { _chunk_frames = n; }
 
        void run (BufferSet& /*bufs*/, framepos_t /*start_frame*/, framepos_t /*end_frame*/, double speed, pframes_t /*nframes*/, bool /*result_required*/);
-       int set_block_size (pframes_t);
-       bool configure_io (ChanCount in, ChanCount out);
-       bool can_support_io_configuration (const ChanCount& in, ChanCount& out) = 0;
        void realtime_handle_transport_stopped ();
        void realtime_locate ();
-       void non_realtime_locate (framepos_t);
        int overwrite_existing_buffers ();
        void set_pending_overwrite (bool yn);
 
@@ -63,20 +58,8 @@ class LIBARDOUR_API DiskReader : public DiskIOProcessor
        virtual XMLNode& state (bool full);
        int set_state (const XMLNode&, int version);
 
-       boost::shared_ptr<Playlist>      get_playlist (DataType dt) const { return _playlists[dt]; }
-       boost::shared_ptr<MidiPlaylist>  midi_playlist() const;
-       boost::shared_ptr<AudioPlaylist> audio_playlist() const;
-
-       virtual void playlist_modified ();
-       virtual int use_playlist (DataType, boost::shared_ptr<Playlist>);
-       virtual int use_new_playlist (DataType);
-       virtual int use_copy_playlist (DataType);
-
-       PBD::Signal1<void,DataType>   PlaylistChanged;
        PBD::Signal0<void>            AlignmentStyleChanged;
 
-       int set_loop (Location *loc);
-
        float buffer_load() const;
 
        void move_processor_automation (boost::weak_ptr<Processor>, std::list<Evoral::RangeMove<framepos_t> > const &);
@@ -99,8 +82,6 @@ class LIBARDOUR_API DiskReader : public DiskIOProcessor
 
        bool pending_overwrite () const { return _pending_overwrite; }
 
-       virtual int find_and_use_playlist (DataType, std::string const &);
-
        // Working buffers for do_refill (butler thread)
        static void allocate_working_buffers();
        static void free_working_buffers();
@@ -108,45 +89,38 @@ class LIBARDOUR_API DiskReader : public DiskIOProcessor
        void adjust_buffering ();
 
        int can_internal_playback_seek (framecnt_t distance);
+       int internal_playback_seek (framecnt_t distance);
        int seek (framepos_t frame, bool complete_refill = false);
 
-       int add_channel (uint32_t how_many);
-       int remove_channel (uint32_t how_many);
+       static PBD::Signal0<void> Underrun;
 
-       bool need_butler() const { return _need_butler; }
+       void playlist_modified ();
+       void reset_tracker ();
 
-       PBD::Signal0<void> Underrun;
+       static void set_midi_readahead_frames (framecnt_t frames_ahead) { midi_readahead = frames_ahead; }
 
   protected:
-       boost::shared_ptr<Playlist> _playlists[DataType::num_types];
+       friend class Track;
+       friend class MidiTrack;
 
-       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 &, bool);
-
-       void reset_tracker ();
        void resolve_tracker (Evoral::EventSink<framepos_t>& buffer, framepos_t time);
        boost::shared_ptr<MidiBuffer> get_gui_feed_buffer () const;
 
+       void playlist_changed (const PBD::PropertyChange&);
+       int use_playlist (DataType, boost::shared_ptr<Playlist>);
+       void playlist_ranges_moved (std::list< Evoral::RangeMove<framepos_t> > const &, bool);
+
   private:
        /** The number of frames by which this diskstream's output should be delayed
            with respect to the transport frame.  This is used for latency compensation.
        */
        framecnt_t   _roll_delay;
-       Location*     loop_location;
        framepos_t    overwrite_frame;
        off_t         overwrite_offset;
        bool          _pending_overwrite;
        bool          overwrite_queued;
        IOChange      input_change_pending;
        framecnt_t    wrap_buffer_size;
-       framecnt_t    speed_buffer_size;
-       framepos_t     file_frame;
-       framepos_t     playback_sample;
-       MonitorChoice   _monitoring_choice;
-       bool            _need_butler;
-
-       PBD::ScopedConnectionList playlist_connections;
 
        int _do_refill_with_alloc (bool partial_fill);
 
@@ -155,47 +129,11 @@ class LIBARDOUR_API DiskReader : public DiskIOProcessor
 
        /* The MIDI stuff */
 
-       MidiRingBuffer<framepos_t>*  _midi_buf;
-
        /** A buffer that we use to put newly-arrived MIDI data in for
            the GUI to read (so that it can update itself).
        */
        MidiBuffer                   _gui_feed_buffer;
        mutable Glib::Threads::Mutex _gui_feed_buffer_mutex;
-       CubicMidiInterpolation midi_interpolation;
-       gint                         _frames_written_to_ringbuffer;
-       gint                         _frames_read_from_ringbuffer;
-
-       /** Information about one of our channels */
-       struct ChannelInfo : public boost::noncopyable {
-
-               ChannelInfo (framecnt_t buffer_size,
-                            framecnt_t speed_buffer_size,
-                            framecnt_t wrap_buffer_size);
-               ~ChannelInfo ();
-
-               Sample     *wrap_buffer;
-               Sample     *speed_buffer;
-               Sample     *current_buffer;
-
-               /** A ringbuffer for data to be played back, written to in the
-                   butler thread, read from in the process thread.
-               */
-               PBD::RingBufferNPT<Sample>* buf;
-
-               Sample* scrub_buffer;
-               Sample* scrub_forward_buffer;
-               Sample* scrub_reverse_buffer;
-
-               PBD::RingBufferNPT<Sample>::rw_vector read_vector;
-
-               void resize (framecnt_t);
-       };
-
-       typedef std::vector<ChannelInfo*> ChannelList;
-       SerializedRCUManager<ChannelList> channels;
-
-       CubicInterpolation interpolation;
 
        int audio_read (Sample* buf, Sample* mixdown_buffer, float* gain_buffer,
                        framepos_t& start, framecnt_t cnt,
@@ -209,15 +147,9 @@ class LIBARDOUR_API DiskReader : public DiskIOProcessor
        int refill_audio (Sample *mixdown_buffer, float *gain_buffer, framecnt_t fill_level);
        int refill_midi ();
 
-       int add_channel_to (boost::shared_ptr<ChannelList>, uint32_t how_many);
-       int remove_channel_from (boost::shared_ptr<ChannelList>, uint32_t how_many);
-
-       int internal_playback_seek (framecnt_t distance);
        frameoffset_t calculate_playback_distance (pframes_t);
 
-       void allocate_temporary_buffers();
-       void get_playback (MidiBuffer& dst, framecnt_t nframes);
-       void flush_playback (framepos_t start, framepos_t end);
+       void get_midi_playback (MidiBuffer& dst, framecnt_t nframes, MonitorState, BufferSet&, double speed, framecnt_t distance);
 };
 
 } // namespace