13
0

forward port 2.X various changes (not all, but i have a list) ending with 6928

git-svn-id: svn://localhost/ardour2/branches/3.0@7643 d708f5d6-7413-0410-9779-e7cbd77b26cf
This commit is contained in:
Paul Davis 2010-08-17 15:39:50 +00:00
parent c24d323d0c
commit 8d8bc9baca
5 changed files with 41 additions and 1 deletions

View File

@ -1122,6 +1122,14 @@ RCOptionEditor::RCOptionEditor ()
sigc::mem_fun (*_rc_config, &RCConfiguration::set_auto_analyse_audio)
));
add_option (_("Audio"),
new BoolOption (
"replicate-missing-region-channels",
_("Replicate Missing Region Channels"),
sigc::mem_fun (*_rc_config, &RCConfiguration::get_replicate_missing_region_channels),
sigc::mem_fun (*_rc_config, &RCConfiguration::set_replicate_missing_region_channels)
));
/* SOLO AND MUTE */
add_option (_("Solo / mute"),

View File

@ -70,6 +70,7 @@ class AudioSource : virtual public Source,
uint32_t read_data_count() const { return _read_data_count; }
uint32_t write_data_count() const { return _write_data_count; }
void dec_read_data_count(nframes_t);
int read_peaks (PeakData *peaks, framecnt_t npeaks,
framepos_t start, framecnt_t cnt, double samples_per_visual_peak) const;

View File

@ -123,6 +123,7 @@ CONFIG_VARIABLE (float, meter_falloff, "meter-falloff", 32.0f)
/* 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)

View File

@ -356,6 +356,10 @@ AudioRegion::_read_at (const SourceList& /*srcs*/, framecnt_t limit,
framecnt_t to_read;
bool raw = (rops == ReadOpsNone);
if (n_channels() == 0) {
return 0;
}
if (muted() && !raw) {
return 0; /* read nothing */
}
@ -407,7 +411,22 @@ AudioRegion::_read_at (const SourceList& /*srcs*/, framecnt_t limit,
we don't have.
*/
memset (mixdown_buffer, 0, sizeof (Sample) * cnt);
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;
boost::shared_ptr<AudioSource> src = audio_source (channel);
if (src->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 */
src->dec_read_data_count (to_read);
} else {
memset (mixdown_buffer, 0, sizeof (Sample) * cnt);
}
}
if (rops & ReadOpsFades) {

View File

@ -945,3 +945,14 @@ AudioSource::available_peaks (double zoom_factor) const
return (end/sizeof(PeakData)) * _FPP;
}
void
AudioSource::dec_read_data_count (nframes_t cnt)
{
uint32_t val = cnt * sizeof (Sample);
if (val < _read_data_count) {
_read_data_count -= val;
} else {
_read_data_count = 0;
}
}