update soundlib interface

Add SOUND_TRIGGER_AMBIENCE
This commit is contained in:
nhmall
2023-02-03 13:32:44 -05:00
parent 1b5414c833
commit 2acd8e7b29
7 changed files with 118 additions and 23 deletions
+11 -1
View File
@@ -26,12 +26,15 @@ static void macsound_achievement(schar, schar, int32_t);
static void macsound_soundeffect(char *, int32_t, int32_t);
static void macsound_hero_playnotes(int32_t, const char *, int32_t);
static void macsound_play_usersound(char *, int32_t, int32_t);
static void macsounde_ambience(int32_t, int32_t, int32_t);
static int affiliate(int32_t seid, const char *soundname);
/*
* Sound capabilities that can be enabled:
* SOUND_TRIGGER_USERSOUNDS | SOUND_TRIGGER_HEROMUSIC
* | SOUND_TRIGGER_ACHIEVEMENTS | SOUND_TRIGGER_SOUNDEFFECTS,
* | SOUND_TRIGGER_ACHIEVEMENTS | SOUND_TRIGGER_SOUNDEFFECTS
* | SOUND_TRIGGER_AMBIENCE,
*/
struct sound_procs macsound_procs = {
@@ -43,6 +46,7 @@ struct sound_procs macsound_procs = {
macsound_soundeffect,
macsound_hero_playnotes,
macsound_play_usersound,
macsound_ambience,
};
static void
@@ -66,6 +70,12 @@ macsound_achievement(schar ach1 UNUSED, schar ach2 UNUSED, int32_t repeat UNUSED
}
static void
macsound_ambience(int32_t ambienceid, int32_t ambience_action,
int32_t hero_proximity)
{
}
/* magic number 47 is the current number of sound_ files to include */
#define EXTRA_SOUNDS 47
+18 -8
View File
@@ -23,6 +23,8 @@ static void windsound_achievement(schar, schar, int32_t);
static void windsound_soundeffect(char *, int32_t, int32_t);
static void windsound_hero_playnotes(int32_t instrument, const char *str, int32_t volume);
static void windsound_play_usersound(char *, int32_t, int32_t);
static void windsound_ambience(int32_t ambienceid, int32_t ambience_action,
int32_t hero_proximity);
/* supporting routines */
static void adjust_soundargs_for_compiler(int32_t *, DWORD *, char **);
@@ -31,32 +33,39 @@ static void maybe_preinsert_directory(int32_t, char *, char *, size_t);
struct sound_procs windsound_procs = {
SOUNDID(windsound),
SOUND_TRIGGER_USERSOUNDS | SOUND_TRIGGER_SOUNDEFFECTS
| SOUND_TRIGGER_HEROMUSIC,
| SOUND_TRIGGER_HEROMUSIC | SOUND_TRIGGER_AMBIENCE,
windsound_init_nhsound,
windsound_exit_nhsound,
windsound_achievement,
windsound_soundeffect,
windsound_hero_playnotes,
windsound_play_usersound,
windsound_ambience,
};
void
static void
windsound_init_nhsound(void)
{
/* No steps required */
}
void
static void
windsound_exit_nhsound(const char *reason)
{
}
void
static void
windsound_achievement(schar ach1, schar ach2, int32_t repeat)
{
}
void
static void
windsound_ambience(int32_t ambienceid, int32_t ambience_action,
int32_t hero_proximity)
{
}
static void
windsound_soundeffect(char *desc, int32_t seid, int32_t volume)
{
#ifdef SND_SOUNDEFFECTS_AUTOMAP
@@ -86,7 +95,7 @@ windsound_soundeffect(char *desc, int32_t seid, int32_t volume)
#define WAVEMUSIC_SOUNDS
void
static void
windsound_hero_playnotes(int32_t instrument, const char *str, int32_t volume)
{
#ifdef WAVEMUSIC_SOUNDS
@@ -174,14 +183,15 @@ windsound_hero_playnotes(int32_t instrument, const char *str, int32_t volume)
#endif
}
void
static void
windsound_play_usersound(char *filename, int32_t volume UNUSED, int32_t idx UNUSED)
{
/* pline("play_usersound: %s (%d).", filename, volume); */
(void) sndPlaySound(filename, SND_ASYNC | SND_NODEFAULT | SND_FILENAME);
}
static void adjust_soundargs_for_compiler(
static void
adjust_soundargs_for_compiler(
int32_t *sefilename_flags,
DWORD *fdwsound,
char **dirbuf)