From 5cb04946b0c0b883fc01a981ee9648eb1fb7e36e Mon Sep 17 00:00:00 2001 From: mfranz Date: Sat, 23 Jun 2007 16:48:01 +0000 Subject: [PATCH] don't only complain that the volume is larger than 1.0, but say how much it actually is --- simgear/sound/xmlsound.cxx | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/simgear/sound/xmlsound.cxx b/simgear/sound/xmlsound.cxx index c4b65233..078dffd7 100644 --- a/simgear/sound/xmlsound.cxx +++ b/simgear/sound/xmlsound.cxx @@ -424,15 +424,15 @@ SGXmlSound::update (double dt) // // Change sample state // + + double vol = volume_offset + volume; + if (vol > 1.0) { + SG_LOG(SG_GENERAL, SG_WARN, "Sound volume too large for '" + << _name << "': " << vol << " -> clipping to 1.0"); + vol = 1.0; + } + _sample->set_volume(vol); _sample->set_pitch( pitch_offset + pitch ); - if ((volume_offset + volume ) > 1.0) - { - _sample->set_volume( 1.0 ); - SG_LOG(SG_GENERAL, SG_WARN, - "Volume larger than 1.0 in configuration for '" << _name - << "', clipping."); - } else - _sample->set_volume( volume_offset + volume ); // -- 2.39.5