X-Git-Url: https://git.mxchange.org/?a=blobdiff_plain;f=simgear%2Fenvironment%2Fvisual_enviro.cxx;h=b0cb219059f4b8ceecf844b8d7cb3581a0c85886;hb=aa2ed5fb0cb16766f440231f23581bb90e9963d8;hp=fb2cfa6dd0c5a8f3f5afd52bcb7c9b04aac0d1ea;hpb=ad6129816d1c1d064748382547a1bc9f3d9a67c3;p=simgear.git diff --git a/simgear/environment/visual_enviro.cxx b/simgear/environment/visual_enviro.cxx index fb2cfa6d..b0cb2190 100644 --- a/simgear/environment/visual_enviro.cxx +++ b/simgear/environment/visual_enviro.cxx @@ -30,7 +30,7 @@ #include #include #include -#include +#include #include #include #include @@ -175,7 +175,7 @@ SGEnviro::SGEnviro() : lightning_enable_state(false), elapsed_time(0.0), dt(0.0), - soundMgr(NULL), + sampleGroup(NULL), snd_active(false), snd_dist(0.0), min_time_before_lt(0.0), @@ -189,6 +189,8 @@ SGEnviro::SGEnviro() : } SGEnviro::~SGEnviro(void) { + if (sampleGroup) delete sampleGroup; + // OSGFIXME return; list_of_lightning::iterator iLightning; @@ -530,8 +532,8 @@ void SGEnviro::drawRain(double pitch, double roll, double heading, double hspeed } -void SGEnviro::set_soundMgr(SGSoundMgr *mgr) { - soundMgr = mgr; +void SGEnviro::set_sampleGroup(SGSampleGroup *sgr) { + sampleGroup = sgr; } void SGEnviro::drawPrecipitation(double rain_norm, double snow_norm, double hail_norm, double pitch, double roll, double heading, double hspeed) { @@ -616,7 +618,7 @@ void SGLightning::lt_build(void) { top[PY] = alt; top[PZ] = 0; lt_build_tree_branch(0, top, 1.0, 50, top[PY] / 8.0); - if( ! sgEnviro.soundMgr ) + if( ! sgEnviro.sampleGroup ) return; Point3D start( sgEnviro.last_lon*SG_DEGREES_TO_RADIANS, sgEnviro.last_lat*SG_DEGREES_TO_RADIANS, 0.0 ); Point3D dest( lon*SG_DEGREES_TO_RADIANS, lat*SG_DEGREES_TO_RADIANS, 0.0 ); @@ -737,7 +739,7 @@ void SGEnviro::drawLightning(void) { return; list_of_lightning::iterator iLightning; // play 'thunder' for lightning - if( snd_active ) + if( snd_active ) { if( !snd_playing ) { // wait until sound has reached us snd_timer += dt; @@ -751,20 +753,21 @@ void SGEnviro::drawLightning(void) { double ax = 0.0, ay = 0.0; ax = cos(course) * dist; ay = sin(course) * dist; - SGSharedPtr snd = soundMgr->find("thunder"); + SGSharedPtr snd = sampleGroup->find("thunder"); if( snd ) { - ALfloat pos[3]={ax, ay, -sgEnviro.last_alt }; - snd->set_source_pos(pos); + SGVec3d pos = SGVec3d(ax, ay, -sgEnviro.last_alt); + snd->set_position(pos); snd->play_once(); } } } else { - if( !soundMgr->is_playing("thunder") ) { + if( !sampleGroup->is_playing("thunder") ) { snd_active = false; snd_playing = false; } } + } if( ! lightning_enable_state ) return;