Optimize plugin-processing for non-automated params
[ardour.git] / libs / ardour / ardour / disk_reader.h
index 04e4ccb3a149006aff4220fa6de0cf2c8b77ed58..47139efd5b69d696c5bcff5243500d1bf6649566 100644 (file)
@@ -35,7 +35,7 @@ template<typename T> class MidiRingBuffer;
 
 class LIBARDOUR_API DiskReader : public DiskIOProcessor
 {
-  public:
+public:
        DiskReader (Session&, std::string const & name, DiskIOProcessor::Flag f = DiskIOProcessor::Flag (0));
        ~DiskReader ();
 
@@ -52,7 +52,6 @@ class LIBARDOUR_API DiskReader : public DiskIOProcessor
        int overwrite_existing_buffers ();
        void set_pending_overwrite (bool yn);
 
-       virtual XMLNode& state (bool full);
        int set_state (const XMLNode&, int version);
 
        PBD::Signal0<void>            AlignmentStyleChanged;
@@ -94,23 +93,39 @@ class LIBARDOUR_API DiskReader : public DiskIOProcessor
        void playlist_modified ();
        void reset_tracker ();
 
+       bool declick_in_progress () const {
+               return _declick_gain != 0; // declick-out
+       }
+
        static void set_midi_readahead_samples (samplecnt_t samples_ahead) { midi_readahead = samples_ahead; }
 
        static void set_no_disk_output (bool yn);
        static bool no_disk_output() { return _no_disk_output; }
 
-  protected:
+protected:
        friend class Track;
        friend class MidiTrack;
 
+       struct ReaderChannelInfo : public DiskIOProcessor::ChannelInfo {
+               ReaderChannelInfo (samplecnt_t buffer_size)
+                       : DiskIOProcessor::ChannelInfo (buffer_size)
+               {
+                       resize (buffer_size);
+               }
+               void resize (samplecnt_t);
+       };
+
+       XMLNode& state ();
+
        void resolve_tracker (Evoral::EventSink<samplepos_t>& buffer, samplepos_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<samplepos_t> > const &, bool);
 
-  private:
+       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.
        */
@@ -121,20 +136,14 @@ class LIBARDOUR_API DiskReader : public DiskIOProcessor
        IOChange      input_change_pending;
        samplepos_t   file_sample[DataType::num_types];
 
+       gain_t        _declick_gain;
+
        int _do_refill_with_alloc (bool partial_fill);
 
        static samplecnt_t _chunk_samples;
        static samplecnt_t midi_readahead;
        static bool       _no_disk_output;
 
-       /* The MIDI stuff */
-
-       /** 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;
-
        int audio_read (Sample* buf, Sample* mixdown_buffer, float* gain_buffer,
                        samplepos_t& start, samplecnt_t cnt,
                        int channel, bool reversed);