| 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/props/props.hxx> |
| 33 | #include <simgear/sound/sample_group.hxx> |
| 34 | |
| 35 | class SGSoundSample; |
| 36 | |
| 37 | /** |
| 38 | * FlightGear sample queue class |
| 39 | * |
| 40 | * This modules maintains a queue of 'message' audio files. These |
| 41 | * are played sequentially with no overlap until the queue is finished. |
| 42 | * This second mechanisms is useful for things like tutorial messages or |
| 43 | * background ATC chatter. |
| 44 | */ |
| 45 | class FGSampleQueue : public SGSampleGroup |
| 46 | { |
| 47 | |
| 48 | public: |
| 49 | |
| 50 | FGSampleQueue ( SGSoundMgr *smgr, const std::string &refname ); |
| 51 | virtual ~FGSampleQueue (); |
| 52 | |
| 53 | virtual void update (double dt); |
| 54 | |
| 55 | inline void add (SGSharedPtr<SGSoundSample> msg) { _messages.push(msg); } |
| 56 | |
| 57 | private: |
| 58 | |
| 59 | std::queue< SGSharedPtr<SGSoundSample> > _messages; |
| 60 | |
| 61 | bool last_enabled; |
| 62 | double last_volume; |
| 63 | |
| 64 | SGPropertyNode_ptr _enabled; |
| 65 | SGPropertyNode_ptr _volume; |
| 66 | }; |
| 67 | |
| 68 | |
| 69 | #endif |
| 70 | |
| 71 | // end of fg_fx.hxx |