typedef struct SoundControl SoundControl;
static struct ArtworkListInfo *sound_info = NULL;
+#if 0
static SoundInfo **Sound = NULL;
+#endif
static MusicInfo **Music = NULL;
-static int num_sounds = 0, num_music = 0;
+#if 0
+static int num_sounds = 0;
+#endif
+static int num_music = 0;
static int stereo_volume[SOUND_MAX_LEFT2RIGHT + 1];
static void ReloadCustomMusic();
static void FreeSound(void *);
+static SoundInfo *getSoundInfoEntryFromSoundID(int);
+
/* ------------------------------------------------------------------------- */
/* functions for native (non-SDL) Unix audio/mixer support */
if (audio.device_fd)
close(audio.device_fd);
- if (IS_PARENT_PROCESS())
+ if (IS_PARENT_PROCESS() && HAS_CHILD_PROCESS())
kill(audio.mixer_pid, SIGTERM);
}
/* "ioctl()" expects pointer to 'int' value for stereo flag
(boolean is defined as 'char', which will not work here) */
unsigned int fragment_spec = 0;
- int fragment_size_query;
+ int fragment_size_query = -1;
int stereo = TRUE;
struct
{
if (leveldir_current == NULL) /* should never happen */
Error(ERR_EXIT, "leveldir_current == NULL");
+ memset(&snd_ctrl, 0, sizeof(SoundControl)); /* to make valgrind happy */
+
snd_ctrl.active = FALSE;
snd_ctrl.state = type;
snd_ctrl.data_len = strlen(set_identifier) + 1;
{
SoundInfo *snd_info;
int i, k;
+ int num_sounds = getSoundListSize();
#if 0
printf("NEW SOUND %d ARRIVED [%d] [%d ACTIVE CHANNELS]\n",
else if (snd_ctrl.nr >= num_sounds)
return;
+#if 0
snd_info = (IS_MUSIC(snd_ctrl) ? Music[snd_ctrl.nr] : Sound[snd_ctrl.nr]);
+#else
+ snd_info = (IS_MUSIC(snd_ctrl) ? Music[snd_ctrl.nr] :
+ getSoundInfoEntryFromSoundID(snd_ctrl.nr));
+#endif
+
if (snd_info == NULL)
return;
&sound_info->dynamic_file_list[list_pos]);
}
+static SoundInfo *getSoundInfoEntryFromSoundID(int pos)
+{
+ int num_list_entries = sound_info->num_file_list_entries;
+ int list_pos = (pos < num_list_entries ? pos : pos - num_list_entries);
+ SoundInfo **snd_info =
+ (SoundInfo **)(pos < num_list_entries ? sound_info->artwork_list :
+ sound_info->dynamic_artwork_list);
+
+ return snd_info[list_pos];
+}
+
int getSoundListPropertyMappingSize()
{
return sound_info->num_property_mapping_entries;
sound_info->num_dynamic_file_list_entries = 0;
sound_info->file_list =
- getFileListFromConfigList(config_list, config_suffix_list,
+ getFileListFromConfigList(config_list, config_suffix_list, ignore_tokens,
num_file_list_entries);
sound_info->dynamic_file_list = NULL;
sound_info->load_artwork = Load_WAV;
sound_info->free_artwork = FreeSound;
+#if 0
num_sounds = sound_info->num_file_list_entries;
Sound = (SoundInfo **)sound_info->artwork_list;
+#endif
}
static MusicInfo *Load_MOD(char *filename)
else if (stereo_position > SOUND_MAX_RIGHT)
stereo_position = SOUND_MAX_RIGHT;
+ memset(&snd_ctrl, 0, sizeof(SoundControl)); /* to make valgrind happy */
+
snd_ctrl.active = TRUE;
snd_ctrl.nr = nr;
snd_ctrl.volume = volume;
if (!audio.sound_available)
return;
+ memset(&snd_ctrl, 0, sizeof(SoundControl)); /* to make valgrind happy */
+
snd_ctrl.active = FALSE;
snd_ctrl.nr = nr;
snd_ctrl.state = state;
LoadArtworkConfig(sound_info);
ReloadCustomArtworkList(sound_info);
+
+#if 0
+ num_sounds = getSoundListSize();
+#endif
}
static void ReloadCustomMusic()