13
0

Fix declicking for phase inverted routes by stopping

process_output_buffers() from inverting the phase of a buffer twice. 
Also fixed bug in apply_declick() which resulted in incorrect phases for 
even buffers of p-reversed routes.



git-svn-id: svn://localhost/ardour2/trunk@906 d708f5d6-7413-0410-9779-e7cbd77b26cf
This commit is contained in:
Sampo Savolainen 2006-09-05 17:53:54 +00:00
parent e513d106d7
commit babf75d871
2 changed files with 15 additions and 12 deletions

View File

@ -203,18 +203,21 @@ IO::apply_declick (vector<Sample *>& bufs, uint32_t nbufs, jack_nframes_t nframe
/* now ensure the rest of the buffer has the target value
applied, if necessary.
*/
if (declick != nframes) {
float this_target;
if (invert_polarity) {
target = -target;
this_target = -target;
} else {
this_target = target;
}
if (target == 0.0) {
if (this_target == 0.0) {
memset (&buffer[declick], 0, sizeof (Sample) * (nframes - declick));
} else if (target != 1.0) {
} else if (this_target != 1.0) {
for (jack_nframes_t nx = declick; nx < nframes; ++nx) {
buffer[nx] *= target;
buffer[nx] *= this_target;
}
}
}

View File

@ -262,17 +262,17 @@ Route::process_output_buffers (vector<Sample*>& bufs, uint32_t nbufs,
-------------------------------------------------------------------------------------------------- */
if (declick > 0) {
apply_declick (bufs, nbufs, nframes, 0.0, 1.0, _phase_invert);
apply_declick (bufs, nbufs, nframes, 0.0, 1.0, false);
_pending_declick = 0;
} else if (declick < 0) {
apply_declick (bufs, nbufs, nframes, 1.0, 0.0, _phase_invert);
apply_declick (bufs, nbufs, nframes, 1.0, 0.0, false);
_pending_declick = 0;
} else {
/* no global declick */
if (solo_gain != dsg) {
apply_declick (bufs, nbufs, nframes, solo_gain, dsg, _phase_invert);
apply_declick (bufs, nbufs, nframes, solo_gain, dsg, false);
solo_gain = dsg;
}
}
@ -289,7 +289,7 @@ Route::process_output_buffers (vector<Sample*>& bufs, uint32_t nbufs,
}
if (!_soloed && _mute_affects_pre_fader && (mute_gain != dmg)) {
apply_declick (bufs, nbufs, nframes, mute_gain, dmg, _phase_invert);
apply_declick (bufs, nbufs, nframes, mute_gain, dmg, false);
mute_gain = dmg;
mute_declick_applied = true;
}
@ -359,7 +359,7 @@ Route::process_output_buffers (vector<Sample*>& bufs, uint32_t nbufs,
if (!_soloed && (mute_gain != dmg) && !mute_declick_applied && _mute_affects_post_fader) {
apply_declick (bufs, nbufs, nframes, mute_gain, dmg, _phase_invert);
apply_declick (bufs, nbufs, nframes, mute_gain, dmg, false);
mute_gain = dmg;
mute_declick_applied = true;
}
@ -525,7 +525,7 @@ Route::process_output_buffers (vector<Sample*>& bufs, uint32_t nbufs,
}
if (!_soloed && (mute_gain != dmg) && !mute_declick_applied && _mute_affects_control_outs) {
apply_declick (bufs, nbufs, nframes, mute_gain, dmg, _phase_invert);
apply_declick (bufs, nbufs, nframes, mute_gain, dmg, false);
mute_gain = dmg;
mute_declick_applied = true;
}
@ -570,7 +570,7 @@ Route::process_output_buffers (vector<Sample*>& bufs, uint32_t nbufs,
----------------------------------------------------------------------*/
if (!_soloed && (mute_gain != dmg) && !mute_declick_applied && _mute_affects_main_outs) {
apply_declick (bufs, nbufs, nframes, mute_gain, dmg, _phase_invert);
apply_declick (bufs, nbufs, nframes, mute_gain, dmg, false);
mute_gain = dmg;
mute_declick_applied = true;
}