SlackBuildsOrg/audio/stretchplayer/stretch_25_125.diff
B. Watson 6a87a41a89
audio/stretchplayer: Added (audio player with pitch/speed control).
Signed-off-by: Willy Sudiarto Raharjo <willysr@slackbuilds.org>
2022-01-25 14:44:35 +07:00

35 lines
1 KiB
Diff

diff --git a/src/Engine.hpp b/src/Engine.hpp
index 873ec4d..0d3c988 100644
--- a/src/Engine.hpp
+++ b/src/Engine.hpp
@@ -60,7 +60,7 @@ public:
return _stretch;
}
void set_stretch(float str) {
- if(str > 0.5 && str < 2.0) {
+ if(str > 0.2499 && str < 1.2501) { /* would be 'if(str >= 0.25 && str <= 1.25)', but floating point is tricky... */
_stretch = str;
//_state_changed = true;
}
diff --git a/src/PlayerWidget.cpp b/src/PlayerWidget.cpp
index e906446..489856b 100644
--- a/src/PlayerWidget.cpp
+++ b/src/PlayerWidget.cpp
@@ -234,7 +234,7 @@ namespace StretchPlayer
void PlayerWidget::stretch(int pos)
{
- _engine->set_stretch( 0.5 + double(pos)/1000.0 );
+ _engine->set_stretch( 0.25 + double(pos)/1000.0 );
}
void PlayerWidget::volume(int vol)
@@ -322,7 +322,7 @@ namespace StretchPlayer
_volume->setValue( _to_fader(vol) );
_status->volume( _volume->value() / 1000.0 );
- _stretch->setValue( (sch-0.5) * 1000 );
+ _stretch->setValue( (sch-0.25) * 1000 );
_status->update();
}