Set encoder quality for existing ExportFormatSpecs
[ardour.git] / libs / ardour / disk_io.cc
index c43e42c315d3478d241ce7c7cc2189396001fcf1..427f3644041db6ceec5e5858835c89a2beb74b9c 100644 (file)
@@ -50,7 +50,6 @@ DiskIOProcessor::DiskIOProcessor (Session& s, string const & str, Flag f)
        : Processor (s, str)
        , _flags (f)
        , i_am_the_modifier (false)
-       , _seek_required (false)
        , _slaved (false)
        , in_set_state (false)
        , playback_sample (0)
@@ -63,6 +62,23 @@ DiskIOProcessor::DiskIOProcessor (Session& s, string const & str, Flag f)
        set_display_to_user (false);
 }
 
+DiskIOProcessor::~DiskIOProcessor ()
+{
+       {
+               RCUWriter<ChannelList> writer (channels);
+               boost::shared_ptr<ChannelList> c = writer.get_copy();
+
+               for (ChannelList::iterator chan = c->begin(); chan != c->end(); ++chan) {
+                       delete *chan;
+               }
+
+               c->clear();
+       }
+
+       channels.flush ();
+}
+
+
 void
 DiskIOProcessor::init ()
 {
@@ -189,21 +205,6 @@ DiskIOProcessor::non_realtime_locate (samplepos_t location)
        seek (location, true);
 }
 
-void
-DiskIOProcessor::non_realtime_speed_change ()
-{
-       if (_seek_required) {
-               seek (_session.transport_sample(), true);
-               _seek_required = false;
-       }
-}
-
-bool
-DiskIOProcessor::realtime_speed_change ()
-{
-       return true;
-}
-
 int
 DiskIOProcessor::set_state (const XMLNode& node, int version)
 {
@@ -218,21 +219,6 @@ DiskIOProcessor::set_state (const XMLNode& node, int version)
        return 0;
 }
 
-int
-DiskIOProcessor::add_channel_to (boost::shared_ptr<ChannelList> c, uint32_t how_many)
-{
-       while (how_many--) {
-               c->push_back (new ChannelInfo (_session.butler()->audio_diskstream_playback_buffer_size()));
-               interpolation.add_channel ();
-               DEBUG_TRACE (DEBUG::DiskIO, string_compose ("%1: new channel, write space = %2 read = %3\n",
-                                                           name(),
-                                                           c->back()->buf->write_space(),
-                                                           c->back()->buf->read_space()));
-       }
-
-       return 0;
-}
-
 int
 DiskIOProcessor::add_channel (uint32_t how_many)
 {
@@ -248,7 +234,6 @@ DiskIOProcessor::remove_channel_from (boost::shared_ptr<ChannelList> c, uint32_t
        while (how_many-- && !c->empty()) {
                delete c->back();
                c->pop_back();
-               interpolation.remove_channel ();
        }
 
        return 0;
@@ -331,32 +316,20 @@ DiskIOProcessor::use_playlist (DataType dt, boost::shared_ptr<Playlist> playlist
 }
 
 DiskIOProcessor::ChannelInfo::ChannelInfo (samplecnt_t bufsize)
-       : buf (new RingBufferNPT<Sample> (bufsize))
-{
-       /* touch the ringbuffer buffer, which will cause
-          them to be mapped into locked physical RAM if
-          we're running with mlockall(). this doesn't do
-          much if we're not.
-       */
-
-       memset (buf->buffer(), 0, sizeof (Sample) * buf->bufsize());
-       capture_transition_buf = new RingBufferNPT<CaptureTransition> (256);
-}
-
-void
-DiskIOProcessor::ChannelInfo::resize (samplecnt_t bufsize)
+       : rbuf (0)
+       , wbuf (0)
+       , capture_transition_buf (0)
+       , curr_capture_cnt (0)
 {
-       delete buf;
-       buf = new RingBufferNPT<Sample> (bufsize);
-       memset (buf->buffer(), 0, sizeof (Sample) * buf->bufsize());
 }
 
 DiskIOProcessor::ChannelInfo::~ChannelInfo ()
 {
-       delete buf;
-       buf = 0;
-
+       delete rbuf;
+       delete wbuf;
        delete capture_transition_buf;
+       rbuf = 0;
+       wbuf = 0;
        capture_transition_buf = 0;
 }