1
0
Fork 0

proper listener velocity calculation, this has no effect yet but is required when other models start emitting sounds.

This commit is contained in:
ehofman 2009-11-23 09:35:59 +00:00 committed by Tim Moore
parent 934ce52a23
commit 3d19352f13
4 changed files with 10 additions and 9 deletions

View file

@ -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

View file

@ -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 );
}

View file

@ -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<FGFX> _fx;
SGPropertyNode_ptr _lon;

View file

@ -44,6 +44,7 @@ FGSampleQueue::FGSampleQueue ( SGSoundMgr *smgr, const string &refname ) :
{
SGSampleGroup::_smgr = smgr;
SGSampleGroup::_smgr->add(this, refname);
SGSampleGroup::_refname = refname;
}