projects
/
rocksndiamonds.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
rnd-20001204-1-src
[rocksndiamonds.git]
/
src
/
libgame
/
sound.c
diff --git
a/src/libgame/sound.c
b/src/libgame/sound.c
index 745e3cd9d9004c64bc92bffbff100ae56c9fb613..a7298a84d811122997367b65cc1bd7637211aec0 100644
(file)
--- a/
src/libgame/sound.c
+++ b/
src/libgame/sound.c
@@
-1,23
+1,28
@@
/***********************************************************
/***********************************************************
-*
Rocks'n'Diamonds -- McDuffin Strikes Back!
*
+*
Artsoft Retro-Game Library
*
*----------------------------------------------------------*
*----------------------------------------------------------*
-*
(c) 1995-98 Artsoft Entertainment
*
-*
Holger Schemel
*
-*
Oststrasse 11a
*
-*
33604 Bielefeld
*
-*
phone: ++49 +521 290471
*
-*
email: aeglos@valinor.owl.de
*
+*
(c) 1994-2000 Artsoft Entertainment
*
+*
Holger Schemel
*
+*
Detmolder Strasse 189
*
+*
33604 Bielefeld
*
+*
Germany
*
+*
e-mail: info@artsoft.org
*
*----------------------------------------------------------*
*----------------------------------------------------------*
-*
sound.c
*
+*
sound.c
*
***********************************************************/
***********************************************************/
-#include
"libgame.h"
-
-#include
"main_TMP.h"
+#include
<sys/time.h>
+#include <unistd.h>
+#include
<fcntl.h>
#include "sound.h"
#include "misc.h"
#include "sound.h"
#include "misc.h"
+
+static int num_sounds = 0;
+static struct SampleInfo *Sound = NULL;
+
+
/*** THE STUFF BELOW IS ONLY USED BY THE SOUND SERVER CHILD PROCESS ***/
static int playing_sounds = 0;
/*** THE STUFF BELOW IS ONLY USED BY THE SOUND SERVER CHILD PROCESS ***/
static int playing_sounds = 0;
@@
-101,6
+106,7
@@
void UnixOpenAudio(struct AudioSystemInfo *audio)
audio->device_name = audio_device_name[i];
audio->sound_available = TRUE;
audio->device_name = audio_device_name[i];
audio->sound_available = TRUE;
+ audio->sound_enabled = TRUE;
#if defined(AUDIO_STREAMING_DSP)
audio->loops_available = TRUE;
#if defined(AUDIO_STREAMING_DSP)
audio->loops_available = TRUE;
@@
-785,11
+791,18
@@
static int ulaw_to_linear(unsigned char ulawbyte)
/*** THE STUFF BELOW IS ONLY USED BY THE MAIN PROCESS ***/
/*** THE STUFF BELOW IS ONLY USED BY THE MAIN PROCESS ***/
+void AllocSoundArray(int num)
+{
+ num_sounds = num;
+ Sound = checked_calloc(num_sounds * sizeof(struct SampleInfo));
+}
+
#define CHUNK_ID_LEN 4 /* IFF style chunk id length */
#define WAV_HEADER_SIZE 20 /* size of WAV file header */
#define CHUNK_ID_LEN 4 /* IFF style chunk id length */
#define WAV_HEADER_SIZE 20 /* size of WAV file header */
-boolean LoadSound(
struct SampleInfo *snd_info
)
+boolean LoadSound(
int sound_nr, char *sound_name
)
{
{
+ struct SampleInfo *snd_info = &Sound[sound_nr];
char filename[256];
char *sound_ext = "wav";
#if !defined(TARGET_SDL)
char filename[256];
char *sound_ext = "wav";
#if !defined(TARGET_SDL)
@@
-802,6
+815,8
@@
boolean LoadSound(struct SampleInfo *snd_info)
#endif
#endif
#endif
#endif
+ snd_info->name = sound_name;
+
sprintf(filename, "%s/%s/%s.%s",
options.ro_base_directory, SOUNDS_DIRECTORY,
snd_info->name, sound_ext);
sprintf(filename, "%s/%s/%s.%s",
options.ro_base_directory, SOUNDS_DIRECTORY,
snd_info->name, sound_ext);
@@
-907,7
+922,7
@@
void PlaySoundExt(int nr, int volume, int stereo, boolean loop)
{
struct SoundControl snd_ctrl = emptySoundControl;
{
struct SoundControl snd_ctrl = emptySoundControl;
- if (!audio.sound_available || !
setup.soun
d)
+ if (!audio.sound_available || !
audio.sound_enable
d)
return;
if (volume<PSND_MIN_VOLUME)
return;
if (volume<PSND_MIN_VOLUME)
@@
-940,7
+955,7
@@
void PlaySoundExt(int nr, int volume, int stereo, boolean loop)
if (write(audio.soundserver_pipe[1], &snd_ctrl, sizeof(snd_ctrl)) < 0)
{
Error(ERR_WARN, "cannot pipe to child process - no sounds");
if (write(audio.soundserver_pipe[1], &snd_ctrl, sizeof(snd_ctrl)) < 0)
{
Error(ERR_WARN, "cannot pipe to child process - no sounds");
- audio.sound_available = FALSE;
+ audio.sound_available =
audio.sound_enabled =
FALSE;
return;
}
#else
return;
}
#else
@@
-1005,7
+1020,7
@@
void StopSoundExt(int nr, int method)
if (write(audio.soundserver_pipe[1], &snd_ctrl, sizeof(snd_ctrl)) < 0)
{
Error(ERR_WARN, "cannot pipe to child process - no sounds");
if (write(audio.soundserver_pipe[1], &snd_ctrl, sizeof(snd_ctrl)) < 0)
{
Error(ERR_WARN, "cannot pipe to child process - no sounds");
- audio.sound_available = FALSE;
+ audio.sound_available =
audio.sound_enabled =
FALSE;
return;
}
#else
return;
}
#else