diff options
author | Carl Hetherington <carl@carlh.net> | 2012-06-16 18:18:30 +0000 |
---|---|---|
committer | Carl Hetherington <carl@carlh.net> | 2012-06-16 18:18:30 +0000 |
commit | daffec502e634b812b306f6dce60955ed5b2a467 (patch) | |
tree | 6e3603d2bb3d1f5a371405a6176c1b0959933d2c /libs/ardour/audioregion.cc | |
parent | 5ac22e9095d5f851b5238029e3f813bc86fe2280 (diff) |
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
Diffstat (limited to 'libs/ardour/audioregion.cc')
-rw-r--r-- | libs/ardour/audioregion.cc | 9 |
1 files changed, 7 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<AudioSource> src = boost::dynamic_pointer_cast<AudioSource> (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); } } |