summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPaul Davis <paul@linuxaudiosystems.com>2010-04-17 18:44:00 +0000
committerPaul Davis <paul@linuxaudiosystems.com>2010-04-17 18:44:00 +0000
commit8f5840027893e17eb864bc045cb8afb3a27d686c (patch)
tree234dd338e480fac464d5e907ddd85d6936278846
parent035a8d02bc84519b669872f792a621d7ec222f01 (diff)
add config parameter to control missing-region-channel behaviour. not controllable from GUI in this commit. default behaviour is as in ardour 2.8.7
git-svn-id: svn://localhost/ardour2/branches/2.0-ongoing@6923 d708f5d6-7413-0410-9779-e7cbd77b26cf
-rw-r--r--libs/ardour/ardour/configuration_vars.h1
-rw-r--r--libs/ardour/audioregion.cc33
2 files changed, 22 insertions, 12 deletions
diff --git a/libs/ardour/ardour/configuration_vars.h b/libs/ardour/ardour/configuration_vars.h
index 2a81541e92..31a2ae9140 100644
--- a/libs/ardour/ardour/configuration_vars.h
+++ b/libs/ardour/ardour/configuration_vars.h
@@ -146,6 +146,7 @@ CONFIG_VARIABLE (nframes_t, over_length_long, "over-length-long", 10)
/* miscellany */
+CONFIG_VARIABLE (bool, replicate_missing_region_channels, "replicate-missing-region-channels", false)
CONFIG_VARIABLE (bool, hiding_groups_deactivates_groups, "hiding-groups-deactivates-groups", true)
CONFIG_VARIABLE (bool, verify_remove_last_capture, "verify-remove-last-capture", true)
CONFIG_VARIABLE (bool, no_new_session_dialog, "no-new-session-dialog", false)
diff --git a/libs/ardour/audioregion.cc b/libs/ardour/audioregion.cc
index a25ac839be..301e605a3e 100644
--- a/libs/ardour/audioregion.cc
+++ b/libs/ardour/audioregion.cc
@@ -537,6 +537,10 @@ AudioRegion::_read_at (const SourceList& srcs, nframes_t limit,
nframes_t to_read;
bool raw = (rops == ReadOpsNone);
+ if (n_channels() == 0) {
+ return 0;
+ }
+
if (muted() && !raw) {
return 0; /* read nothing */
}
@@ -583,18 +587,23 @@ AudioRegion::_read_at (const SourceList& srcs, nframes_t limit,
} else {
- /* track is N-channel, this region has less channels, so use a relevant channel
- */
-
- uint32_t channel = n_channels() % chan_n;
-
- if (srcs[channel]->read (mixdown_buffer, _start + internal_offset, to_read) != to_read) {
- return 0; /* "read nothing" */
- }
-
- /* adjust read data count appropriately since this was a duplicate read */
- srcs[channel]->dec_read_data_count (to_read);
-
+ if (Config->get_replicate_missing_region_channels()) {
+ /* track is N-channel, this region has less channels, so use a relevant channel
+ */
+
+ uint32_t channel = n_channels() % chan_n;
+
+ if (srcs[channel]->read (mixdown_buffer, _start + internal_offset, to_read) != to_read) {
+ return 0; /* "read nothing" */
+ }
+
+ /* adjust read data count appropriately since this was a duplicate read */
+ srcs[channel]->dec_read_data_count (to_read);
+
+ } else {
+ /* region has no data for requested channel, so make it silent */
+ memset (mixdown_buffer, 0, to_read * sizeof (Sample));
+ }
}
if (rops & ReadOpsFades) {