46
46
#if defined(HAVE_SDL) || defined(sgi)
69
FIRE_PLASMA_OTHER_WAV,
71
SBEXPLOSION_OTHER_WAV,
49
FIRE_TORP_WAV, /* 1 */
51
FIRE_PLASMA_WAV, /* 3 */
52
EXPLOSION_WAV, /* 4 */
53
SBEXPLOSION_WAV, /* 5 */
56
SHIELD_DOWN_WAV, /* 8 */
57
SHIELD_UP_WAV, /* 9 */
58
TORP_HIT_WAV, /* 10 */
59
REDALERT_WAV, /* 11 */
61
ENTER_SHIP_WAV, /* 13 */
62
SELF_DESTRUCT_WAV, /* 14 */
63
PLASMA_HIT_WAV, /* 15 */
67
FIRE_TORP_OTHER_WAV, /* 19 */
68
PHASER_OTHER_WAV, /* 20 */
69
FIRE_PLASMA_OTHER_WAV, /* 21 */
70
EXPLOSION_OTHER_WAV, /* 22 */
71
SBEXPLOSION_OTHER_WAV, /* 23 */
894
893
sounds[CLOAK_WAV] = Mix_LoadWAV(DATAFILE("nt_cloaked.wav"));
895
894
sounds[ENTER_SHIP_WAV] = Mix_LoadWAV(DATAFILE("nt_enter_ship.wav"));
896
895
sounds[EXPLOSION_WAV] = Mix_LoadWAV(DATAFILE("nt_explosion.wav"));
896
sounds[SBEXPLOSION_WAV] = Mix_LoadWAV(DATAFILE("nt_sbexplosion.wav"));
897
897
sounds[EXPLOSION_OTHER_WAV] = Mix_LoadWAV(DATAFILE("nt_explosion_other.wav"));
898
898
sounds[FIRE_PLASMA_WAV] = Mix_LoadWAV(DATAFILE("nt_fire_plasma.wav"));
899
899
sounds[FIRE_TORP_WAV] = Mix_LoadWAV(DATAFILE("nt_fire_torp.wav"));
910
910
sounds[UNCLOAK_WAV] = Mix_LoadWAV(DATAFILE("nt_uncloak.wav"));
911
911
sounds[REDALERT_WAV] = Mix_LoadWAV(DATAFILE("nt_warning.wav"));
913
#ifdef SOUND_WARN_MISSING
913
914
for (i=0; i < NUM_WAVES; i++) {
914
915
if (!sounds[i]) {
915
(void) fprintf(stderr, "Mix_LoadWAV sound[%d] could not be loaded."
916
(void) fprintf(stderr, "Mix_LoadWAV sound[%d] could not be loaded.\n"
916
917
"Check soundDir in your .netrekrc: %s\n", i, Mix_GetError());
972
973
if ((sd=getenv("SOUNDDIR")) != NULL)
973
974
sounddir = strdup(sd);
975
977
sounddir = "/usr/local/games/netrek-sgi/sounds";
979
sounddir = "/usr/share/sounds/netrek-client-cow";
977
982
if (!isDirectory(sounddir)) {
978
(void) fprintf(stderr, "%s is not a directory, sound will not work\n", sounddir);
984
if (!isDirectory(sounddir)) {
985
(void) fprintf(stderr, "sound directory missing\n", sounddir);
981
991
err = sfxInit(sounddir, 3); /* initialize up to three audio ports */
1038
1048
printf("Init_Sound using SDL\n");
1041
/* Initialize the SDL library */
1042
if (SDL_Init(SDL_INIT_AUDIO) < 0) {
1043
fprintf(stderr, "Couldn't initialize SDL: %s\n",SDL_GetError());
1047
/* Open the audio device at 8000 Hz 8 bit Microsoft PCM */
1048
if (Mix_OpenAudio(8000, AUDIO_U8, 1, 512) < 0) {
1049
fprintf(stderr,"Mix_OpenAudio: %s\n", Mix_GetError());
1053
/* If we successfully loaded the wav files, so shut-off sound_init and play
1057
if (Mix_PlayChannel(-1, sounds[INTRO_WAV], 0) < 0) {
1058
fprintf(stderr, "Mix_PlayChannel: %s\n", Mix_GetError());
1051
/* Initialize the SDL library */
1052
if (SDL_Init(SDL_INIT_AUDIO) < 0) {
1053
fprintf(stderr, "Couldn't initialize SDL: %s\n",SDL_GetError());
1057
/* Open the audio device at 8000 Hz 8 bit Microsoft PCM */
1058
if (Mix_OpenAudio(8000, AUDIO_U8, 1, 512) < 0) {
1059
fprintf(stderr,"Mix_OpenAudio: %s\n", Mix_GetError());
1063
Mix_AllocateChannels(16);
1065
/* If we successfully loaded the wav files, so shut-off
1066
sound_init and play the introduction */
1068
if (sounds[INTRO_WAV])
1069
if (Mix_PlayChannel(-1, sounds[INTRO_WAV], 0) < 0) {
1070
fprintf(stderr, "Mix_PlayChannel: %s\n", Mix_GetError());
1062
if (InitSound() == -1) {
1070
strcpy(sound_prefix, sounddir);
1071
strcat(sound_prefix, "/");
1074
strcpy(buf, sounddir);
1075
strcat(buf, "/nt_intro");
1074
if (InitSound() == -1) {
1082
strcpy(sound_prefix, sounddir);
1083
strcat(sound_prefix, "/");
1086
strcpy(buf, sounddir);
1087
strcat(buf, "/nt_intro");
1082
1093
#if defined(HAVE_SDL) || defined(sgi)
1158
1169
sfxPlay(sounds[waveform]);
1161
if (Mix_PlayChannel(-1, sounds[waveform], 0) < 0) {
1162
(void) fprintf(stderr, "Mix_PlayChannel: %s\n", Mix_GetError());
1172
if (sounds[waveform])
1173
if (Mix_PlayChannel(-1, sounds[waveform], 0) < 0) {
1174
(void) fprintf(stderr, "Mix_PlayChannel: %s\n", Mix_GetError());