Improve import status messages slightly.
[ardour.git] / libs / ardour / audio_track.cc
index 1db11472059f168f10a03d68fa3e7e8769cbb1ba..8e68eb014077c22e9045144c5a27962dfbc228fa 100644 (file)
@@ -173,10 +173,10 @@ AudioTrack::deprecated_use_diskstream_connections ()
 }
 
 int
-AudioTrack::set_diskstream (boost::shared_ptr<AudioDiskstream> ds, void *src)
+AudioTrack::set_diskstream (boost::shared_ptr<AudioDiskstream> ds, void * /*src*/)
 {
        _diskstream = ds;
-       _diskstream->set_io (*(_input.get()));
+       _diskstream->set_route (*this);
        _diskstream->set_destructive (_mode == Destructive);
        _diskstream->set_non_layered (_mode == NonLayered);
 
@@ -583,7 +583,7 @@ AudioTrack::roll (nframes_t nframes, sframes_t start_frame, sframes_t end_frame,
                        limit = blimit;
 
                } else {
-                       for (i = 0, n = 1; i < blimit; ++i, ++n) {
+                       for (i = 0, n = 1; i < limit; ++i, ++n) {
                                memcpy (bufs.get_audio (i).data(), b, sizeof (Sample) * nframes); 
                                if (n < diskstream->n_channels().n_audio()) {
                                        tmpb = diskstream->playback_buffer(n);
@@ -592,6 +592,13 @@ AudioTrack::roll (nframes_t nframes, sframes_t start_frame, sframes_t end_frame,
                                        }
                                }
                        }
+
+                       /* try to leave any MIDI buffers alone */
+                       
+                       ChanCount chn;
+                       chn.set_audio (limit);
+                       chn.set_midi (_input->n_ports().n_midi());
+                       bufs.set_count (chn);
                }
 
                /* don't waste time with automation if we're recording or we've just stopped (yes it can happen) */