]> git.mxchange.org Git - simgear.git/blobdiff - simgear/sound/xmlsound.cxx
don't only complain that the volume is larger than 1.0, but say how much
[simgear.git] / simgear / sound / xmlsound.cxx
index 74ef4713b097766487eb11db93a3a160f707afc0..078dffd76bfa92ea28c6631ac902ad628acdcaa6 100644 (file)
@@ -237,7 +237,7 @@ SGXmlSound::init(SGPropertyNode *root, SGPropertyNode *node, SGSoundMgr *sndmgr,
    SGPropertyNode_ptr pos = node->getChild("position");
    if ( pos != NULL ) {
        offset_pos[0] = pos->getDoubleValue("x", 0.0);
-       offset_pos[1] = pos->getDoubleValue("y", 0.0);
+       offset_pos[1] = -pos->getDoubleValue("y", 0.0);
        offset_pos[2] = pos->getDoubleValue("z", 0.0);
    }
 
@@ -252,7 +252,7 @@ SGXmlSound::init(SGPropertyNode *root, SGPropertyNode *node, SGSoundMgr *sndmgr,
    pos = node->getChild("orientation");
    if ( pos != NULL ) {
       dir[0] = pos->getDoubleValue("x", 0.0);
-      dir[1] = pos->getDoubleValue("y", 0.0);
+      dir[1] = -pos->getDoubleValue("y", 0.0);
       dir[2] = pos->getDoubleValue("z", 0.0);
       inner = pos->getDoubleValue("inner-angle", 360.0);
       outer = pos->getDoubleValue("outer-angle", 360.0);
@@ -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 );
 
 
    //