tweak config param for automation sampling interval, set to 500msec by default, and...
[ardour.git] / libs / ardour / audioregion.cc
index 4b85819d6e322030a93d1b6a4e7c082af0b1595f..577f12c78e8ed2c75eba41a6b3997a5e0fa91b49 100644 (file)
@@ -26,7 +26,7 @@
 
 #include <boost/scoped_array.hpp>
 
-#include <glibmm/thread.h>
+#include <glibmm/threads.h>
 
 #include "pbd/basename.h"
 #include "pbd/xml++.h"
@@ -39,6 +39,7 @@
 #include "ardour/audioregion.h"
 #include "ardour/session.h"
 #include "ardour/dB.h"
+#include "ardour/debug.h"
 #include "ardour/playlist.h"
 #include "ardour/audiofilesource.h"
 #include "ardour/region_factory.h"
@@ -712,6 +713,8 @@ AudioRegion::read_at (Sample *buf, Sample *mixdown_buffer, float *gain_buffer,
        framecnt_t const N = to_read - fade_in_limit - fade_out_limit;
        if (N > 0) {
                if (opaque ()) {
+                       DEBUG_TRACE (DEBUG::AudioPlayback, string_compose ("Region %1 memcpy into buf @ %2 + %3, from mixdown buffer @ %4 + %5, len = %6 cnt was %7\n",
+                                                                          name(), buf, fade_in_limit, mixdown_buffer, fade_in_limit, N, cnt));
                        memcpy (buf + fade_in_limit, mixdown_buffer + fade_in_limit, N * sizeof (Sample));
                } else {
                        mix_buffers_no_gain (buf + fade_in_limit, mixdown_buffer + fade_in_limit, N);
@@ -760,8 +763,8 @@ AudioRegion::read_from_sources (SourceList const & srcs, framecnt_t limit, Sampl
                */
 
                if (Config->get_replicate_missing_region_channels()) {
-                       /* track is N-channel, this region has less channels, so use a relevant channel
-                        */
+
+                       /* copy an existing channel's data in for this non-existant one */
 
                        uint32_t channel = n_channels() % chan_n;
                        boost::shared_ptr<AudioSource> src = boost::dynamic_pointer_cast<AudioSource> (srcs[channel]);
@@ -769,6 +772,11 @@ AudioRegion::read_from_sources (SourceList const & srcs, framecnt_t limit, Sampl
                        if (src->read (buf, _start + internal_offset, to_read) != to_read) {
                                return 0; /* "read nothing" */
                        }
+
+               } else {
+                       
+                       /* use silence */
+                       memset (buf, 0, sizeof (Sample) * to_read);
                }
        }