bug 172 followup: display correct semitones and restore non-inverted tempo values for Sliding Time Effect

This commit is contained in:
mchinen 2011-01-29 22:32:39 +00:00
parent 84c6013a17
commit ecbff8fee2
1 changed files with 12 additions and 4 deletions

View File

@ -103,10 +103,15 @@ bool EffectTimeScale::TransferParameters( Shuttle & shuttle )
return true;
}
inline double InvertedPercentChangeToRatio(double percentChange)
{
//mchinen hack: invert the ratio so it works with the sbsms bug which requires the reciprocal number.
return 1.0/(1.0 + percentChange / 100.0);
}
inline double PercentChangeToRatio(double percentChange)
{
//mchinen hack: invert the ratio so it works with the sbsms bug.
return 1.0/(1.0 + percentChange / 100.0);
return 1.0 + percentChange / 100.0;
}
inline double HalfStepsToPercentChange(double halfSteps)
@ -116,13 +121,16 @@ inline double HalfStepsToPercentChange(double halfSteps)
inline double PercentChangeToHalfSteps(double percentChange)
{
// mchinen: hack: take the negative of this so the correct value is displayed
// (see the InvertedPercentChangeToRatio hack for why this is needed)
return 17.312340490667560888319096172023 * log(PercentChangeToRatio(percentChange));
}
bool EffectTimeScale::Process()
{
double pitchStart = PercentChangeToRatio(m_PitchPercentChangeStart);
double pitchEnd = PercentChangeToRatio(m_PitchPercentChangeEnd);
// The pitch part of sbsms is backwards, so use an inverted function
double pitchStart = InvertedPercentChangeToRatio(m_PitchPercentChangeStart);
double pitchEnd = InvertedPercentChangeToRatio(m_PitchPercentChangeEnd);
double rateStart = PercentChangeToRatio(m_RatePercentChangeStart);
double rateEnd = PercentChangeToRatio(m_RatePercentChangeEnd);
this->EffectSBSMS::setParameters(rateStart,rateEnd,pitchStart,pitchEnd,m_PreAnalyze);