1 /* ************************************************************************* *
2     OldSkoolGravityGame (OSGG) Lunar Lander-like game for linux.
3     Copyright (C) 2008 Jimmy Christensen ( dusted at dusted dot dk )
4 
5     This program is free software: you can redistribute it and/or modify
6     it under the terms of the GNU General Public License as published by
7     the Free Software Foundation, either version 3 of the License, or
8     (at your option) any later version.
9 
10     This program is distributed in the hope that it will be useful,
11     but WITHOUT ANY WARRANTY; without even the implied warranty of
12     MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
13     GNU General Public License for more details.
14 
15     You should have received a copy of the GNU General Public License
16     along with this program.  If not, see <http://www.gnu.org/licenses/>.
17  * ************************************************************************* */
18 
19 #include <vector>
20 #include <SDL/SDL_mixer.h>
21 #include <iostream>
22 
23 
24 #ifndef DATADIR
25     #define DATADIR "./"
26 #endif
27 
28 using namespace std;
29 
30 extern bool soundOn;
31 enum { sfxNozzle, sfxBoom, sfxLaser };
32 #define SNDSAMPLES 3
33 
34 struct sampleQueuedItem {
35   int s,num;
36 };
37 
38 class soundClass {
39   private:
40   #ifndef NOSOUND
41   //The actual sound samples
42   Mix_Chunk *sample[SNDSAMPLES];
43   //List of queued samples
44   vector<struct sampleQueuedItem> q;
45   void loadSample(const char *SampleName, int sampleNum);
46 
47   int m; //Secret undocumented variable
48   void loadsounds();
49 
50   int nozzleCh;
51   bool nozzleOn;
52 
53   #endif
54 
55   public:
56   bool init();
57   void play();
58   void add(int i);
59   ~soundClass();
60 };
61