Reset: sound manager can be shutdown cleanly
This commit is contained in:
parent
9a77efacd9
commit
6eb4e833ae
2 changed files with 19 additions and 8 deletions
|
@ -17,6 +17,10 @@
|
||||||
// Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
// Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
||||||
//
|
//
|
||||||
|
|
||||||
|
#ifdef HAVE_CONFIG_H
|
||||||
|
# include <config.h>
|
||||||
|
#endif
|
||||||
|
|
||||||
#include <simgear/sound/soundmgr_openal.hxx>
|
#include <simgear/sound/soundmgr_openal.hxx>
|
||||||
|
|
||||||
#include "soundmanager.hxx"
|
#include "soundmanager.hxx"
|
||||||
|
@ -50,8 +54,6 @@ FGSoundManager::FGSoundManager()
|
||||||
_enabled(false),
|
_enabled(false),
|
||||||
_listener(new Listener(this))
|
_listener(new Listener(this))
|
||||||
{
|
{
|
||||||
SGPropertyNode_ptr scenery_loaded = fgGetNode("sim/sceneryloaded", true);
|
|
||||||
scenery_loaded->addChangeListener(_listener);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
FGSoundManager::~FGSoundManager()
|
FGSoundManager::~FGSoundManager()
|
||||||
|
@ -78,9 +80,20 @@ void FGSoundManager::init()
|
||||||
_viewYoffset = _currentView->getNode("y-offset-m", true);
|
_viewYoffset = _currentView->getNode("y-offset-m", true);
|
||||||
_viewZoffset = _currentView->getNode("z-offset-m", true);
|
_viewZoffset = _currentView->getNode("z-offset-m", true);
|
||||||
|
|
||||||
|
SGPropertyNode_ptr scenery_loaded = fgGetNode("sim/sceneryloaded", true);
|
||||||
|
scenery_loaded->addChangeListener(_listener.get());
|
||||||
|
|
||||||
reinit();
|
reinit();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void FGSoundManager::shutdown()
|
||||||
|
{
|
||||||
|
SGPropertyNode_ptr scenery_loaded = fgGetNode("sim/sceneryloaded", true);
|
||||||
|
scenery_loaded->removeChangeListener(_listener.get());
|
||||||
|
|
||||||
|
SGSoundMgr::shutdown();
|
||||||
|
}
|
||||||
|
|
||||||
void FGSoundManager::reinit()
|
void FGSoundManager::reinit()
|
||||||
{
|
{
|
||||||
_is_initialized = false;
|
_is_initialized = false;
|
||||||
|
|
|
@ -20,10 +20,7 @@
|
||||||
#ifndef __FG_SOUNDMGR_HXX
|
#ifndef __FG_SOUNDMGR_HXX
|
||||||
#define __FG_SOUNDMGR_HXX 1
|
#define __FG_SOUNDMGR_HXX 1
|
||||||
|
|
||||||
#ifdef HAVE_CONFIG_H
|
#include <memory>
|
||||||
# include <config.h>
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#include <simgear/props/props.hxx>
|
#include <simgear/props/props.hxx>
|
||||||
#include <simgear/structure/subsystem_mgr.hxx>
|
#include <simgear/structure/subsystem_mgr.hxx>
|
||||||
#include <simgear/sound/soundmgr_openal.hxx>
|
#include <simgear/sound/soundmgr_openal.hxx>
|
||||||
|
@ -36,9 +33,10 @@ class FGSoundManager : public SGSoundMgr
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
FGSoundManager();
|
FGSoundManager();
|
||||||
~FGSoundManager();
|
virtual ~FGSoundManager();
|
||||||
|
|
||||||
void init(void);
|
void init(void);
|
||||||
|
virtual void shutdown();
|
||||||
void update(double dt);
|
void update(double dt);
|
||||||
void reinit(void);
|
void reinit(void);
|
||||||
|
|
||||||
|
@ -54,7 +52,7 @@ private:
|
||||||
SGPropertyNode_ptr _viewPosLon, _viewPosLat, _viewPosElev;
|
SGPropertyNode_ptr _viewPosLon, _viewPosLat, _viewPosElev;
|
||||||
SGPropertyNode_ptr _velocityNorthFPS, _velocityEastFPS, _velocityDownFPS;
|
SGPropertyNode_ptr _velocityNorthFPS, _velocityEastFPS, _velocityDownFPS;
|
||||||
SGPropertyNode_ptr _viewXoffset, _viewYoffset, _viewZoffset;
|
SGPropertyNode_ptr _viewXoffset, _viewYoffset, _viewZoffset;
|
||||||
Listener* _listener;
|
std::auto_ptr<Listener> _listener;
|
||||||
};
|
};
|
||||||
#else
|
#else
|
||||||
#include "Main/fg_props.hxx"
|
#include "Main/fg_props.hxx"
|
||||||
|
|
Loading…
Reference in a new issue