From a0bdec284624820feb0a96a06c0c38e2f07d5e4e Mon Sep 17 00:00:00 2001 From: curt Date: Sat, 24 Apr 2004 19:47:42 +0000 Subject: [PATCH] Clamp pitch values rather than just dumping an error message. --- simgear/sound/sample_openal.hxx | 3 +++ 1 file changed, 3 insertions(+) diff --git a/simgear/sound/sample_openal.hxx b/simgear/sound/sample_openal.hxx index fe79cb68..c6411cbd 100644 --- a/simgear/sound/sample_openal.hxx +++ b/simgear/sound/sample_openal.hxx @@ -124,6 +124,9 @@ public: * Set the pitch of this sample. */ inline void set_pitch( double p ) { + // clamp in the range of 0.01 to 2.0 + if ( p < 0.01 ) { p = 0.01; } + if ( p > 2.0 ) { p = 2.0; } pitch = p; alSourcef( source, AL_PITCH, pitch ); if ( alGetError() != AL_NO_ERROR) { -- 2.39.5