]> git.mxchange.org Git - simgear.git/commitdiff
Clamp pitch values rather than just dumping an error message.
authorcurt <curt>
Sat, 24 Apr 2004 19:47:42 +0000 (19:47 +0000)
committercurt <curt>
Sat, 24 Apr 2004 19:47:42 +0000 (19:47 +0000)
simgear/sound/sample_openal.hxx

index fe79cb68f8312e3785adeca2be4089c4ef5e9e5f..c6411cbd72df2d9ca8a8ebf12d7281ee03a3982d 100644 (file)
@@ -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) {