1 
2 /**
3  *
4  * @file sound.h
5  *
6  * Part of the OpenJazz project
7  *
8  * @par History:
9  * - 23rd August 2005: Created OpenJazz.h
10  * - 2nd June 2009: Created sound.h from parts of OpenJazz.h
11  *
12  * @par Licence:
13  * Copyright (c) 2005-2010 Alister Thomson
14  *
15  * OpenJazz is distributed under the terms of
16  * the GNU General Public License, version 2.0
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 St, Fifth Floor, Boston, MA  02110-1301  USA
21  *
22  */
23 
24 #ifndef _SOUND_H
25 #define _SOUND_H
26 
27 
28 #include "OpenJazz.h"
29 
30 
31 // Constants
32 
33 // Sound effects
34 #define S_INVULN   1
35 #define S_MACHGUN  2
36 #define S_BOOM     3
37 #define S_OW       4
38 #define S_YUM      5
39 #define S_FIRE     6
40 #define S_UPLOOP   7
41 #define S_1UP      8
42 #define S_PHOTON   9
43 #define S_WAIT    10
44 #define S_ORB     11
45 #define S_JUMPA   12
46 #define S_GODLIKE 13
47 #define S_YEAHOO  14
48 #define S_BIRDY   15
49 #define S_FLAMER  16
50 #define S_ELECTR  17
51 #define S_SPRING  18
52 #define S_ROCKET  19
53 #define S_STOP    20
54 #define S_BLOCK   21
55 
56 #define MAX_VOLUME 100
57 
58 
59 // Datatype
60 
61 /// Raw sound effect data
62 typedef struct {
63 
64 	unsigned char *data;
65 	char          *name;
66 	int            length;
67 
68 } RawSound;
69 
70 
71 /// Resampled sound effect data
72 typedef struct {
73 
74 	unsigned char *data;
75 	int            length;
76 	int            position;
77 
78 } Sound;
79 
80 
81 // Variables
82 
83 EXTERN RawSound *rawSounds;
84 EXTERN int       nRawSounds;
85 EXTERN Sound    *sounds;
86 
87 #if defined(WIZ) || defined(GP2X)
88 EXTERN int volume;
89 EXTERN int volume_direction;
90 #endif
91 
92 
93 // Functions
94 
95 EXTERN void openAudio      ();
96 EXTERN void closeAudio     ();
97 EXTERN void playMusic      (const char *fileName);
98 EXTERN void pauseMusic     (bool pause);
99 EXTERN void stopMusic      ();
100 EXTERN int  getMusicVolume ();
101 EXTERN void setMusicVolume (int volume);
102 EXTERN int  loadSounds     (const char *fileName);
103 EXTERN void resampleSound  (int index, const char* name, int rate);
104 EXTERN void resampleSounds ();
105 EXTERN void freeSounds     ();
106 EXTERN void playSound      (char index);
107 EXTERN int  getSoundVolume ();
108 EXTERN void setSoundVolume (int volume);
109 
110 #endif
111 
112