]> git.mxchange.org Git - flightgear.git/blob - src/Sound/fg_sound.hxx
Patch from Andy Ross:
[flightgear.git] / src / Sound / fg_sound.hxx
1 // fg_sound.hxx -- Sound class implementation
2 //
3 // Started by Erik Hofman, February 2002
4 //
5 // Copyright (C) 2002  Erik Hofman - erik@ehofman.com
6 //
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.
11 //
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.
16 //
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.
20 //
21 // $Id$
22
23 #ifndef __FGSOUND_HXX
24 #define __FGSOUND_HXX 1
25
26 #ifdef HAVE_CONFIG_H
27 #  include <config.h>
28 #endif
29
30 #include <simgear/compiler.h>
31 #include <Main/fgfs.hxx>
32 #include <Main/globals.hxx>
33
34 #include "soundmgr.hxx"
35
36 /**
37  * Class for handling one sound.
38  *
39  */
40 class FGSound : public FGSubsystem
41 {
42
43 public:
44
45   enum { MAXPROP=5 };
46   enum { LIN=0, LOG, LN };
47   enum { ONCE=0, LOOPED };
48   enum { LEVEL=0, INVERTED, FLIPFLOP };
49
50   FGSound(const SGPropertyNode *);
51   virtual ~FGSound();
52
53   virtual void init ();
54   virtual void bind ();
55   virtual void unbind ();
56   virtual void update (int dt);
57
58 private:
59
60   const SGPropertyNode * _node;
61
62   FGSimpleSound * _sample;
63   const SGPropertyNode * _property;
64
65   bool _active;
66
67   int _mode;
68   int _type;
69   string _name;
70   float _factor;
71
72 #if 0
73   // Sound source (distance, horizontal position in degrees and 
74   // vertical position in degrees)
75   struct {
76         float dist;
77         float hor;
78         float vert;
79   } _pos;
80 #endif
81
82   // Sound properties
83   typedef struct {
84         const SGPropertyNode * prop;
85         float factor;
86         int type;
87         float offset;
88         float min;
89         float max;
90         bool subtract;
91   } _snd_prop;
92
93   vector<_snd_prop> _volume;
94   vector<_snd_prop> _pitch;
95
96 };
97
98 #endif