qualitymapperdialog.cpp \ util.cpp:

- updated updateXQualityLabel and relative2QualityValf methods
- added call to updateXQualityLabel at xSpinbox value change
This commit is contained in:
Paolo Cignoni cignoni 2008-02-18 14:49:14 +00:00
parent 57192facc9
commit 29a27053cd
2 changed files with 4 additions and 2 deletions

View File

@ -1094,6 +1094,8 @@ void QualityMapperDialog::on_xSpinBox_valueChanged(double newX)
this->manageBorderTfHandles(_currentTfHandle);
//restoring the correct order for TfHandles (they're drawn in the same order as they're stored)
this->updateTfHandlesOrder(_currentTfHandle->getChannel());
//updating x-quality Label
this->updateXQualityLabel(_currentTfHandle->getRelativeX());
//refresh of TF
this->drawTransferFunction();
}
@ -1255,7 +1257,7 @@ void QualityMapperDialog::on_TF_view_doubleClicked(QPointF pos)
void QualityMapperDialog::updateXQualityLabel(float xPos)
{
float exp = log10(0.5f) / log10((float)_equalizerMidHandlePercentilePosition);
float exp = log10((float)_equalizerMidHandlePercentilePosition) / log10(0.5f);
_currentTfHandleQualityValue.setNum(relative2QualityValf(xPos, ui.minSpinBox->value(), ui.maxSpinBox->value(), exp));
ui.xQualityLabel->setText(_currentTfHandleQualityValue);
}

View File

@ -20,7 +20,7 @@ int absolute2RelativeVali(float absolute_val, float max_val)
float relative2QualityValf(float relative_val, float min_q, float max_q, float exp)
{
assert( (relative_val>=-1.0f) && (relative_val<=2.0f) );
assert( (exp>=0) && (exp<=1) );
// assert( (exp>=0) && (exp<=1) );
assert(min_q<=max_q);
relative_val = pow( relative_val, exp );
return ( relative_val * (max_q - min_q) ) + min_q;