From 3d19352f13c2258cfdc6c9cbd25c5bed98b156fe Mon Sep 17 00:00:00 2001 From: ehofman Date: Mon, 23 Nov 2009 09:35:59 +0000 Subject: [PATCH] proper listener velocity calculation, this has no effect yet but is required when other models start emitting sounds. --- src/Main/viewmgr.cxx | 6 +++--- src/Model/acmodel.cxx | 8 ++++---- src/Model/acmodel.hxx | 4 ++-- src/Sound/sample_queue.cxx | 1 + 4 files changed, 10 insertions(+), 9 deletions(-) diff --git a/src/Main/viewmgr.cxx b/src/Main/viewmgr.cxx index dd1299be9..270c579e0 100644 --- a/src/Main/viewmgr.cxx +++ b/src/Main/viewmgr.cxx @@ -338,15 +338,15 @@ 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_position( abs_viewer_position, loop_view->getPosition() ); smgr->set_orientation( current_view_orientation ); // get the model velocity - SGVec3f velocity = SGVec3f::zeros(); + SGVec3d velocity = SGVec3d::zeros(); if ( !stationary() ) { velocity = globals->get_aircraft_model()->getVelocity(); } - smgr->set_velocity(velocity); + smgr->set_velocity( velocity ); } void diff --git a/src/Model/acmodel.cxx b/src/Model/acmodel.cxx index 1da7e3759..2df6e0abf 100644 --- a/src/Model/acmodel.cxx +++ b/src/Model/acmodel.cxx @@ -132,10 +132,10 @@ FGAircraftModel::update (double dt) _roll->getDoubleValue()); _fx->set_orientation( orient ); - SGVec3d vel = SGVec3d( _speed_n->getDoubleValue(), - _speed_e->getDoubleValue(), - _speed_d->getDoubleValue() ); - _fx->set_velocity( vel ); + _velocity = SGVec3d( _speed_n->getDoubleValue(), + _speed_e->getDoubleValue(), + _speed_d->getDoubleValue() ); + _fx->set_velocity( _velocity ); } diff --git a/src/Model/acmodel.hxx b/src/Model/acmodel.hxx index da3c844f5..59e6034dd 100644 --- a/src/Model/acmodel.hxx +++ b/src/Model/acmodel.hxx @@ -39,12 +39,12 @@ public: virtual void unbind (); virtual void update (double dt); virtual SGModelPlacement * get3DModel() { return _aircraft; } - virtual SGVec3f& getVelocity() { return _velocity; } + virtual SGVec3d& getVelocity() { return _velocity; } private: SGModelPlacement * _aircraft; - SGVec3f _velocity; + SGVec3d _velocity; SGSharedPtr _fx; SGPropertyNode_ptr _lon; diff --git a/src/Sound/sample_queue.cxx b/src/Sound/sample_queue.cxx index 9d7140165..863cbcbdc 100644 --- a/src/Sound/sample_queue.cxx +++ b/src/Sound/sample_queue.cxx @@ -44,6 +44,7 @@ FGSampleQueue::FGSampleQueue ( SGSoundMgr *smgr, const string &refname ) : { SGSampleGroup::_smgr = smgr; SGSampleGroup::_smgr->add(this, refname); + SGSampleGroup::_refname = refname; } -- 2.39.5