Mercurial > hg > sonic-visualiser
diff audioio/PlaySpeedRangeMapper.cpp @ 60:06b3c3f437e6
* Make audio dial remember its more accurate mapped value as well as its
display position
* Add tool tip support to audio dial to show values
author | Chris Cannam |
---|---|
date | Tue, 17 Oct 2006 13:04:49 +0000 |
parents | 1016a8ceceda |
children | 050d764df239 |
line wrap: on
line diff
--- a/audioio/PlaySpeedRangeMapper.cpp Tue Oct 17 11:42:14 2006 +0000 +++ b/audioio/PlaySpeedRangeMapper.cpp Tue Oct 17 13:04:49 2006 +0000 @@ -28,9 +28,14 @@ PlaySpeedRangeMapper::getPositionForValue(float value) const { // value is percent + float factor = getFactorForValue(value); + int position = getPositionForFactor(factor); + return position; +} - float factor = getFactorForValue(value); - +int +PlaySpeedRangeMapper::getPositionForFactor(float factor) const +{ bool slow = (factor > 1.0); if (!slow) factor = 1.0 / factor; @@ -55,6 +60,13 @@ PlaySpeedRangeMapper::getValueForPosition(int position) const { float factor = getFactorForPosition(position); + float pc = getValueForFactor(factor); + return pc; +} + +float +PlaySpeedRangeMapper::getValueForFactor(float factor) const +{ float pc; if (factor < 1.0) pc = ((1.0 / factor) - 1.0) * 100.0; else pc = (1.0 - factor) * 100.0;