]> git.mxchange.org Git - flightgear.git/commitdiff
initlialize _playing for FGATC. Proper listerner orientation based on view offset...
authorehofman <ehofman>
Wed, 28 Oct 2009 14:29:38 +0000 (14:29 +0000)
committerTim Moore <timoore@redhat.com>
Wed, 28 Oct 2009 22:23:53 +0000 (23:23 +0100)
src/ATCDCL/ATC.cxx
src/Main/main.cxx
src/Main/viewer.cxx
src/Main/viewer.hxx
src/Main/viewmgr.cxx
src/Model/acmodel.cxx

index 7e17f1da79775f0fd936eb614af0eaa8661c16ad..b4a17ae9727d54d99d99db4938f691da25ccedc7 100644 (file)
@@ -36,6 +36,7 @@
 
 FGATC::FGATC() :
        _voiceOK(false),
+        _playing(false),
        _sgr(NULL),
        freqClear(true),
        receiving(false),
index 4ab21a8850e5ad0579065aa442cfebc7d225d5db..66bf3c6d848badb4553ccf5c8036143df4a5a789 100644 (file)
@@ -460,8 +460,8 @@ static void fgMainLoop( void ) {
     //   we may want to move this to its own class at some point
     //
     double visibility_meters = fgGetDouble("/environment/visibility-m");
-
     globals->get_tile_mgr()->prep_ssg_nodes( visibility_meters );
+
     // update tile manager for view...
     SGVec3d viewPos = globals->get_current_view()->get_view_pos();
     SGGeod geodViewPos = SGGeod::fromCart(viewPos);
@@ -477,13 +477,10 @@ static void fgMainLoop( void ) {
     // update the view angle as late as possible, but before sound calculations
     globals->get_viewmgr()->update(real_delta_time_sec);
 
-    ////////////////////////////////////////////////////////////////////
     // Update the sound manager last so it can use the CPU while the GPU
     // is processing the scenery (doubled the frame-rate for me) -EMH-
-    ////////////////////////////////////////////////////////////////////
 #ifdef ENABLE_AUDIO_SUPPORT
-    static SGSoundMgr *smgr = globals->get_soundmgr();
-    smgr->update_late(delta_time_sec);
+    globals->get_soundmgr()->update(delta_time_sec);
 #endif
 
     // END Tile Manager udpates
@@ -493,11 +490,12 @@ static void fgMainLoop( void ) {
         fgSetBool("sim/sceneryloaded",true);
 #ifdef ENABLE_AUDIO_SUPPORT
         if (fgGetBool("/sim/sound/enabled") == true)  {
-            smgr->set_volume(fgGetFloat("/sim/sound/volume"));
-            smgr->activate();
+            float volume = fgGetFloat("/sim/sound/volume");
+            globals->get_soundmgr()->set_volume(volume);
+            globals->get_soundmgr()->activate();
         }
         else
-            smgr->stop();
+            globals->get_soundmgr()->stop();
 #endif
     }
 
index 2e34db687f6b62f2261c8ca57c58a56ccc6e6198..8dcfb982dbf5f4913eb0c573e2d9e55019293c7d 100644 (file)
@@ -380,7 +380,7 @@ FGViewer::recalcLookFrom ()
   SGQuatd hlToBody = SGQuatd::fromYawPitchRollDeg(head, pitch, roll);
 
   // The rotation offset, don't know why heading is negative here ...
-  SGQuatd viewOffsetOr
+  mViewOffsetOr
       = SGQuatd::fromYawPitchRollDeg(-_heading_offset_deg, _pitch_offset_deg,
                                      _roll_offset_deg);
 
@@ -396,7 +396,7 @@ FGViewer::recalcLookFrom ()
   SGQuatd q(-0.5, -0.5, 0.5, 0.5);
 
   _absolute_view_pos = position + (ec2body*q).backTransform(_offset_m);
-  mViewOrientation = ec2body*viewOffsetOr*q;
+  mViewOrientation = ec2body*mViewOffsetOr*q;
 }
 
 void
@@ -437,7 +437,7 @@ FGViewer::recalcLookAt ()
   SGQuatd geodEyeHlOr = SGQuatd::fromLonLat(_position);
 
   // the rotation offset, don't know why heading is negative here ...
-  SGQuatd eyeOffsetOr =
+  mViewOffsetOr =
     SGQuatd::fromYawPitchRollDeg(-_heading_offset_deg + 180, _pitch_offset_deg,
                                  _roll_offset_deg);
 
@@ -445,7 +445,7 @@ FGViewer::recalcLookAt ()
   SGVec3d eyeOff(-_offset_m.z(), _offset_m.x(), -_offset_m.y());
   SGQuatd ec2eye = geodEyeHlOr*geodEyeOr;
   SGVec3d eyeCart = SGVec3d::fromGeod(_position);
-  eyeCart += (ec2eye*eyeOffsetOr).backTransform(eyeOff);
+  eyeCart += (ec2eye*mViewOffsetOr).backTransform(eyeOff);
 
   SGVec3d atCart = SGVec3d::fromGeod(_target);
 
index 965e8569a8a8cb3cdf8bb6829c482522f375908c..aa5fb12125d0727e202be729b8cbbdf9df4cda9c 100644 (file)
@@ -201,6 +201,7 @@ public:
     const SGVec3d& get_view_pos() { if ( _dirty ) { recalc(); } return _absolute_view_pos; }
     const SGVec3d& getViewPosition() { if ( _dirty ) { recalc(); } return _absolute_view_pos; }
     const SGQuatd& getViewOrientation() { if ( _dirty ) { recalc(); } return mViewOrientation; }
+    const SGQuatd& getViewOrientationOffset() { if ( _dirty ) { recalc(); } return mViewOffsetOr; }
 
     //////////////////////////////////////////////////////////////////////
     // Part 4: View and frustrum data setters and getters
@@ -247,6 +248,7 @@ private:
     bool _dirty;
 
     SGQuatd mViewOrientation;
+    SGQuatd mViewOffsetOr;
     SGVec3d _absolute_view_pos;
 
     SGGeod _position;
index 6074dcf95119fac9f1005a602c9ac081f6913c6b..cc254991b5b2c7fc06bde2f06101102b3e9e9215 100644 (file)
@@ -299,7 +299,8 @@ FGViewMgr::update (double dt)
   // update audio listener values
   // set the viewer posotion in Cartesian coordinates in meters
   smgr->set_position( abs_viewer_position );
-  smgr->set_orientation(loop_view->getViewOrientation());
+  smgr->set_orientation(loop_view->getViewOrientation(), 
+                        loop_view->getViewOrientationOffset());
 
   // get the model velocity for the in-cockpit view
   SGVec3d velocity = SGVec3d(0,0,0);
index 65104a99022dea3094f2f670f51c374661939042..1a93a49ab15153f3d1bc5c9d16b6a8c529293e8e 100644 (file)
@@ -131,9 +131,10 @@ FGAircraftModel::update (double dt)
                                                 _roll->getDoubleValue());
   _fx->set_orientation( orient );
  
-  _velocity = SGVec3d( -_speed_n->getDoubleValue(),
-                       _speed_e->getDoubleValue(),
-                       _speed_d->getDoubleValue());
+   SGQuatd q(-0.5, -0.5, 0.5, 0.5);
+  _velocity = q.backTransform( SGVec3d( _speed_n->getDoubleValue(),
+                                        _speed_e->getDoubleValue(),
+                                        _speed_d->getDoubleValue()) );
   _fx->set_velocity( _velocity );
 }