From daffec502e634b812b306f6dce60955ed5b2a467 Mon Sep 17 00:00:00 2001 From: Carl Hetherington Date: Sat, 16 Jun 2012 18:18:30 +0000 Subject: [PATCH] Return silence from read_from_sources() if we try to read a channel that our source does not have (if replicate-missing-region-channels is turned off); should fix #4934. git-svn-id: svn://localhost/ardour2/branches/3.0@12741 d708f5d6-7413-0410-9779-e7cbd77b26cf --- libs/ardour/audioregion.cc | 9 +++++++-- libs/surfaces/mackie/strip.cc | 1 + 2 files changed, 8 insertions(+), 2 deletions(-) diff --git a/libs/ardour/audioregion.cc b/libs/ardour/audioregion.cc index 4b85819d6e..4c7979dbfc 100644 --- a/libs/ardour/audioregion.cc +++ b/libs/ardour/audioregion.cc @@ -760,8 +760,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 src = boost::dynamic_pointer_cast (srcs[channel]); @@ -769,6 +769,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); } } diff --git a/libs/surfaces/mackie/strip.cc b/libs/surfaces/mackie/strip.cc index f71e3520ed..2b4368f4bb 100644 --- a/libs/surfaces/mackie/strip.cc +++ b/libs/surfaces/mackie/strip.cc @@ -70,6 +70,7 @@ Strip::Strip (Surface& s, const std::string& name, int index, const map