1 /***************************************************************************
2                           sfx.h  -  description
3                              -------------------
4     begin                : Fri Aug 16 2002
5     copyright            : (C) 2002 by Giuseppe D'Aqui'
6     email                : kumber@tiscalinet.it
7  ***************************************************************************/
8 
9 /***************************************************************************
10  *                                                                         *
11  *   This program is free software; you can redistribute it and/or modify  *
12  *   it under the terms of the GNU General Public License, Version 2, as published by  *
13  *   the Free Software Foundation.                                   *
14  *                                                                         *
15  ***************************************************************************/
16 
17 #include "dephine.h"
18 
19 #include <vector>
20 
21 
22 #ifndef SFX_H
23 #define SFX_H
24 
25 class Sample;
26 
27 enum Sample_Type{	SFX_BOULDER_FALL,
28 									SFX_EMERALD_EAT,
29 									SFX_SAPPHIRE_EAT,
30 									SFX_GAME_GAMEOVER,
31 									SFX_DOOR_PASS,
32 									SFX_EMERALD_FALL,
33 									SFX_SAPPHIRE_FALL,
34 									SFX_GRASS_EAT,
35 									SFX_KEY_EAT,
36 									SFX_PLAYER_MOVE,
37 									SFX_MONSTER_MOVE,
38 									SFX_WOOD_SMASH,
39 									SFX_GAME_TIMEALARM,
40 									SFX_EXPLOSION
41 								};
42 
43 class Sample_Manager
44 {
45 private:
46 	std::vector<Sample*> m_samples;
47 
48 	Sample* get_sample(Sample_Type sfx);
49 
50 		void load_samples();
51 
52 	enum{
53 			m_channels_monsters,
54 			m_channels_boulders,
55 			m_channels_gems,
56 			m_channels_explosions,
57 			m_channels_timealarm
58 	};
59 
60 
61 public:
62 
63 
64 	void init();
65 
66 	void deinit();
67 
68 	void play(Sample_Type type);
69 
70 	Uint32 get_max_volume();
71 
72 	Uint32 get_volume();
73 
74 	void set_volume(Uint32 value);
75 
76 
77 	// begin Singleton stuff
78 
79 private:
80 
81     static Sample_Manager* _instance;
82 
83 protected:
84 
Sample_Manager()85 	Sample_Manager(){};
86 
87 public:
88 
89     static Sample_Manager* instance();
90 
91 // end Singleton stuff
92 
93 };
94 
95 #endif //SFX_H
96