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/sound/sample_group.hxx>
34 #include <simgear/math/SGMath.hxx>
39 * Generator for FlightGear sound effects.
41 * This module uses a FGSampleGroup class to generate sound effects based
42 * on current flight conditions. The sound manager must be initialized
43 * before this object is.
45 * Note: this module supports two separate sound mechanisms concurrently.
47 * 1. This module will load and play a set of sound effects defined in an
48 * xml file and tie them to various property states.
49 * 2. This modules also maintains a queue of 'message' audio files. These
50 * are played sequentially with no overlap until the queue is finished.
51 * This second mechanims is useful for things like tutorial messages or
52 * background atc chatter.
54 class FGFX : public SGSampleGroup
59 FGFX ( SGSoundMgr *smgr, const string &refname );
63 virtual void reinit ();
64 virtual void update (double dt);
67 * add a sound sample to the message queue which is played sequentially
70 void play_message( SGSoundSample *_sample );
71 void play_message( const std::string& path, const std::string& fname, double volume );
75 void update_pos_and_orientation(double dt);
77 SGVec3d last_visitor_pos;
78 SGVec3d last_model_pos;
80 std::vector<SGXmlSound *> _sound;
81 std::queue<SGSoundSample *> _samplequeue;
86 SGPropertyNode_ptr _pause;
87 SGPropertyNode_ptr _volume;