float volume = arg->getFloatValue("volume");
// cout << "playing " << path << " / " << file << endl;
try {
- static FGSampleQueue *queue = 0;
+ FGSampleQueue *queue = globals->get_chatter_queue();
if ( !queue ) {
- queue = new FGSampleQueue(smgr, "chatter");
- queue->tie_to_listener();
+ queue = new FGSampleQueue(smgr, "chatter");
+ queue->tie_to_listener();
+ globals->set_chatter_queue(queue);
}
SGSoundSample *msg = new SGSoundSample(file.c_str(), path);
globals->set_renderer(NULL);
globals->set_matlib(NULL);
- simgear::SGModelLib::resetPropertyRoot();
+ globals->set_chatter_queue(NULL);
+ simgear::SGModelLib::resetPropertyRoot();
+
globals->resetPropertyRoot();
globals->restoreInitialState();
#include <Navaids/navlist.hxx>
#include <Viewer/renderer.hxx>
#include <Viewer/viewmgr.hxx>
+#include <Sound/sample_queue.hxx>
#include "globals.hxx"
#include "locale.hxx"
initial_waypoints( NULL ),
fontcache ( new FGFontCache ),
channellist( NULL ),
- haveUserSettings(false)
+ haveUserSettings(false),
+ _chatter_queue(NULL)
{
SGPropertyNode* root = new SGPropertyNode;
props = SGPropertyNode_ptr(root);
// renderer touches subsystems during its destruction
set_renderer(NULL);
_scenery.clear();
-
+ _chatter_queue.clear();
+
delete subsystem_mgr;
subsystem_mgr = NULL; // important so ::get_subsystem returns NULL
matlib = m;
}
+FGSampleQueue* FGGlobals::get_chatter_queue() const
+{
+ return _chatter_queue;
+}
+
+void FGGlobals::set_chatter_queue(FGSampleQueue* queue)
+{
+ _chatter_queue = queue;
+}
+
// end of globals.cxx
class FGViewer;
class FGRenderer;
class FGFontCache;
-
+class FGSampleQueue;
/**
* Bucket for subsystem pointers representing the sim's state.
* helper to initialise standard properties on a new property tree
*/
void initProperties();
+
+ SGSharedPtr<FGSampleQueue> _chatter_queue;
public:
FGGlobals();
* Save user settings in autosave.xml
*/
void saveUserSettings();
+
+ FGSampleQueue* get_chatter_queue() const;
+ void set_chatter_queue(FGSampleQueue* queue);
};
FGSampleQueue::~FGSampleQueue ()
{
- while ( ! _messages.empty() ) {
- delete _messages.front();
- _messages.pop();
- }
}
SGPropertyNode_ptr scenery_loaded = fgGetNode("sim/sceneryloaded", true);
scenery_loaded->removeChangeListener(_listener.get());
+ stop();
+
SGSoundMgr::shutdown();
}