13
0

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
This commit is contained in:
Carl Hetherington 2012-06-16 18:18:30 +00:00
parent 5ac22e9095
commit daffec502e
2 changed files with 8 additions and 2 deletions

View File

@ -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);
}
}

View File

@ -70,6 +70,7 @@ Strip::Strip (Surface& s, const std::string& name, int index, const map<Button::
, _fader_touch (0)
, _vpot (0)
, _fader (0)
, _meter (0)
, _index (index)
, _surface (&s)
, _controls_locked (false)