1 // sound.hxx -- Sound class implementation
3 // Started by Erik Hofman, February 2002
5 // Copyright (C) 2002 Erik Hofman - erik@ehofman.com
7 // This program is free software; you can redistribute it and/or
8 // modify it under the terms of the GNU General Public License as
9 // published by the Free Software Foundation; either version 2 of the
10 // License, or (at your option) any later version.
12 // This program is distributed in the hope that it will be useful, but
13 // WITHOUT ANY WARRANTY; without even the implied warranty of
14 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
15 // General Public License for more details.
17 // You should have received a copy of the GNU General Public License
18 // along with this program; if not, write to the Free Software
19 // Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
25 * Provides a class to manage a single sound event including things
26 * like looping, volume and pitch changes.
30 #define _SG_SOUND_HXX 1
33 # error This library requires C++
36 #include <simgear/compiler.h>
37 #include <simgear/props/condition.hxx>
39 #include "soundmgr.hxx"
41 static const double MAX_TRANSIT_TIME = 0.1; // 100 ms.
45 * Class for handling one sound event.
56 virtual void init (SGPropertyNode *, SGPropertyNode *, SGSoundMgr *,
58 virtual void update (double dt);
65 enum { ONCE=0, LOOPED, IN_TRANSIT };
66 enum { LEVEL=0, INVERTED, FLIPFLOP };
70 SGPropertyNode * prop;
83 SGSimpleSound * _sample;
85 SGCondition * _condition;
86 SGPropertyNode * _property;
94 double _stopping; // time after the sound should have stopped.
95 // This is usefull for lost packets in in-trasit mode.
97 vector<_snd_prop> _volume;
98 vector<_snd_prop> _pitch;
102 #endif // _SG_SOUND_HXX