2 /* Copyright (c) Taylor Daley, 2023. */
3 /* NetHack may be freely redistributed. See license for details. */
10 static FMOD_SYSTEM
*systemvar
;
11 static FMOD_SOUND
*soundvar
;
12 static FMOD_CHANNEL
*channel1
;
13 static FMOD_CHANNEL
*channelMus
;
15 static void fmod_init_nhsound(void);
16 static void fmod_exit_nhsound(const char *);
17 static void fmod_achievement(schar
, schar
, int32_t);
18 static void fmod_soundeffect(char *, int32_t, int32_t);
19 static void fmod_hero_playnotes(int32_t instrument
, const char *str
, int32_t volume
);
20 static void fmod_play_usersound(char *, int32_t, int32_t);
21 static void fmod_ambience(int32_t, int32_t, int32_t);
22 static void fmod_verbal(char *, int32_t, int32_t, int32_t, int32_t);
24 struct sound_procs fmod_procs
= {
26 SOUND_TRIGGER_USERSOUNDS
| 0,
38 fmod_init_nhsound(void)
40 /* Initialize external sound library */
41 FMOD_System_Create(&systemvar
, FMOD_VERSION
);
42 FMOD_System_Init(systemvar
, 32, FMOD_INIT_NORMAL
, 0);
46 fmod_exit_nhsound(const char *reason
)
48 /* Close / Terminate external sound library */
49 FMOD_System_Close(systemvar
);
50 FMOD_System_Release(systemvar
);
53 /* fulfill SNDCAP_ACHIEVEMENTS */
55 fmod_achievement(schar ach1
, schar ach2
, int32_t repeat
)
57 // to be added in future
60 /* fulfill SNDCAP_SOUNDEFFECTS */
62 fmod_soundeffect(char *desc
, int32_t seid
, int32_t volume
)
64 // to be added in future
67 /* fulfill SNDCAP_HEROMUSIC */
68 static void fmod_hero_playnotes(int32_t instrument
, const char *str
, int32_t volume
)
70 // to be added in future
73 /* fulfill SOUND_TRIGGER_USERSOUNDS */
75 fmod_play_usersound(char *filename
, int32_t volume UNUSED
, int32_t idx UNUSED
)
77 FMOD_System_CreateSound(systemvar
, filename
, FMOD_CREATESAMPLE
, 0,
79 if (strstr(filename
, "music_") != NULL
) {
80 FMOD_Channel_Stop(channelMus
);
81 FMOD_System_PlaySound(systemvar
, soundvar
, 0, 0, &channelMus
);
82 FMOD_Channel_SetMode(channelMus
, FMOD_LOOP_NORMAL
);
84 FMOD_Channel_Stop(channel1
);
85 FMOD_System_PlaySound(systemvar
, soundvar
, 0, 0, &channel1
);
90 fmod_ambience(int32_t ambienceid
, int32_t ambience_action
,
91 int32_t hero_proximity
)
93 // to be added in future
97 fmod_verbal(char *text
, int32_t gender
, int32_t tone
,
98 int32_t vol
, int32_t moreinfo
)
100 // to be added in future
103 #endif /* SND_LIB_FMOD */