]> git.mxchange.org Git - flightgear.git/blob - src/Sound/sample_queue.hxx
Merge branch 'csaba/nan'
[flightgear.git] / src / Sound / sample_queue.hxx
1 // sample_queue.hxx -- sample queue management class
2 //
3 // Started by David Megginson, October 2001
4 // (Reuses some code from main.cxx, probably by Curtis Olson)
5 //
6 // Copyright (C) 2001  Curtis L. Olson - http://www.flightgear.org/~curt
7 //
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.
12 //
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.
17 //
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.
21 //
22 // $Id$
23
24 #ifndef __FGSAMPLE_QUEUE_HXX
25 #define __FGSAMPLE_QUEUE_HXX 1
26
27 #include <simgear/compiler.h>
28
29 #include <queue>
30
31 #include <simgear/structure/subsystem_mgr.hxx>
32 #include <simgear/sound/sample_group.hxx>
33
34 class SGSoundSample;
35
36 /**
37  * FlightGear sample queue class
38  *
39  *    This modules maintains a queue of 'message' audio files.  These
40  *    are played sequentially with no overlap until the queue is finished.
41  *    This second mechanims is useful for things like tutorial messages or
42  *    background atc chatter.
43  */
44 class FGSampleQueue : public SGSampleGroup
45 {
46
47 public:
48
49     FGSampleQueue ( SGSoundMgr *smgr, const string &refname );
50     virtual ~FGSampleQueue ();
51
52     virtual void update (double dt);
53
54     inline void add (SGSharedPtr<SGSoundSample> msg) { _messages.push(msg); }
55
56 private:
57
58     std::queue< SGSharedPtr<SGSoundSample> > _messages;
59
60     bool last_enabled;
61     double last_volume;
62
63     SGPropertyNode_ptr _enabled;
64     SGPropertyNode_ptr _volume;
65 };
66
67
68 #endif
69
70 // end of fg_fx.hxx