1 // fg_fx.hxx -- Sound effect management class
3 // Started by David Megginson, October 2001
4 // (Reuses some code from main.cxx, probably by Curtis Olson)
6 // Copyright (C) 2001 Curtis L. Olson - http://www.flightgear.org/~curt
8 // This program is free software; you can redistribute it and/or
9 // modify it under the terms of the GNU General Public License as
10 // published by the Free Software Foundation; either version 2 of the
11 // License, or (at your option) any later version.
13 // This program is distributed in the hope that it will be useful, but
14 // WITHOUT ANY WARRANTY; without even the implied warranty of
15 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
16 // General Public License for more details.
18 // You should have received a copy of the GNU General Public License
19 // along with this program; if not, write to the Free Software
20 // Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
27 #include <simgear/compiler.h>
32 #include <simgear/structure/subsystem_mgr.hxx>
33 #include <simgear/math/SGMath.hxx>
40 * Generator for FlightGear sound effects.
42 * This module uses FGSoundMgr to generate sound effects based
43 * on current flight conditions. The sound manager must be initialized
44 * before this object is.
46 * Note: this module supports two separate sound mechanisms concurrently.
48 * 1. This module will load and play a set of sound effects defined in an
49 * xml file and tie them to various property states.
50 * 2. This modules also maintains a queue of 'message' audio files. These
51 * are played sequentially with no overlap until the queue is finished.
52 * This second mechanims is useful for things like tutorial messages or
53 * background atc chatter.
55 class FGFX : public SGSubsystem
64 virtual void reinit ();
66 virtual void unbind ();
67 virtual void update (double dt);
70 * add a sound sample to the message queue which is played sequentially
73 void play_message( SGSoundSample *_sample );
74 void play_message( const std::string& path, const std::string& fname, double volume );
78 void update_pos_and_orientation(SGSoundMgr *smgr, double dt);
79 SGVec3d last_visitor_pos;
80 SGVec3d last_model_pos;
82 std::vector<SGXmlSound *> _sound;
83 std::queue<SGSoundSample *> _samplequeue;
88 SGPropertyNode_ptr _pause;
89 SGPropertyNode_ptr _volume;