1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151
|
/* GNU Robbo
* Copyright (C) 2002-2010 The GNU Robbo Team (see AUTHORS).
*
* GNU Robbo is free software - you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2, or (at your option)
* any later version.
*
* GNU Robbo is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the impled warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with GNU CC; see the file COPYING. If not, write to the
* Free Software Foundation, 59 Temple Place - Suite 330,
* Boston, MA 02111-1307, USA.
*
*/
/*
* Defines
*/
#define SND_FULL 3
#define SND_NORM 2
#define SND_HALF 1
#define SND_MUTE 0
#define SND_QUIET 4
#define SND_CHANNELS 16
#define SND_RATE 44100
/*
* sound effects types
*/
#define SFX_BULLET 1
#define SFX_SCREW 2
#define SFX_BOMB 3
#define SFX_BOX 4
#define SFX_DOOR 5
#define SFX_GUN 6
#define SFX_KEY 7
#define SFX_SHOOT 8
#define SFX_BIRD 9
#define SFX_TELEPORT 10
#define SFX_ROBBO 11
#define SFX_CAPSULE 12
#define SFX_KILL 13
#define SFX_MAGNET 14
#define SFX_EXIT_OPEN 15
#define MUS_MAXSONGS 40
#define SND_SFX_DEFAULT_VOLUME 30
#define SND_MUS_DEFAULT_VOLUME SND_SFX_DEFAULT_VOLUME
struct snd_sample {
int initialized;
int type;
Mix_Chunk *s_sample;
char *fname;
char *rctag;
};
struct snd_music {
int present;
Mix_Music *music;
int playing;
char fname[128];
};
/*
* Variables
*/
extern int sound;
extern int temp_game_sound;
extern int sfx_vol;
extern int temp_sfx_vol;
/*
* if we do not support music, we assume, that volume is sfx_volume
*/
#ifdef HAVE_MUSIC
extern int volume;
#else
#define volume sfx_vol
#endif
/*
* Function prototypes
*/
void volume_up(void);
void volume_down(void);
void load_soundskin(char *fname);
void audio_init(void); /* this one initializes sound
* system - shuld be run only once
*/
void audio_destroy(void); /* this one destroys all audio
* content from the memory, and
* sets sound variable to 0 */
/*
* if you want to use audio again, set sound
* variable to 1 and call audio_init
*/
void load_samples(void); /* loads samples into memory */
void play_sound(int event, int vol); /* this one plays sounds */
/*
* vol can take 3 values: SND_NORM -
* sound is played with volume set in
* sfx_vol
*/
/*
* SND_HALF which is half of sfx_vol,
* and SND_MUTE - which means mute
* sound or no sound at all
*/
int audio_opened(); /* returns 0 if mixer is not initialized */
void audio_open(); /* initializes mixer should be the first
* thing before playing any sound */
void audio_close(); /* closes mixer - done befere exit */
#ifndef HAVE_MUSIC
#define music_stop()
#define make_playlist()
#define music_finished()
#define destroy_playlist()
#define play_music()
#else
void make_playlist(void);
void play_music(void);
void music_finished(void);
void destroy_playlist(void);
void music_stop(void);
#endif
|