take initial stab at macsound interface

Use macOS AppKit framework routines for a first cut at a
macsound soundlib interface.

Requires WANT_MACSOUND=1 on build.

Nothing has been done to move the stock sounds into the resources
of a bundle, so after building, if you want to try the stock sounds
out:
	cp sound/wav/*.wav ~/Library/Sounds

Because the NSSound macOS routines always do the search, supposedly
the following locations are searched in this order:
   1. the application’s main bundle
   2. ~/Library/Sounds
   3. /Library/Sounds
   4. /Network/Library/Sounds
   5. /System/Library/Sounds

Although not specifically implemented as of yet, it may be pretty
close to being able to put soundeffects wav files (by se_ name)
into ~/Library/Sounds working for the SND_SOUNDEFFECTS_AUTOMAP feature.

Feedback is welcome. Contributions for improving it are even more
welcome.

The new soundlib supporting file is named
sound/macsound/macsound.m since it's got objective C in it.

Known bugs and glitches:

The Hero_playnotes on a set of 5 notes goes too fast, so there
needs to be a slight delay added between the note of a multi-note
play.
This commit is contained in:
nhmall
2023-01-23 23:50:43 -05:00
parent ae6bb2420b
commit 3d908c49ef
14 changed files with 524 additions and 50 deletions

View File

@@ -2469,9 +2469,11 @@ extern void freedynamicdata(void);
extern void store_savefileinfo(NHFILE *);
extern void store_savefileinfo(NHFILE *);
extern int nhdatatypes_size(void);
#if 0
extern void assignlog(char *, char*, int);
extern FILE *getlog(NHFILE *);
extern void closelog(NHFILE *);
#endif
/* ### sfstruct.c ### */

View File

@@ -66,7 +66,7 @@
*/
enum soundlib_ids {
soundlib_unassigned = 0,
soundlib_nosound,
#ifdef SND_LIB_QTSOUND
soundlib_qtsound,
#endif
@@ -94,7 +94,9 @@ enum soundlib_ids {
#ifdef SND_LIB_WINDSOUND
soundlib_windsound,
#endif
soundlib_nosound
#ifdef SND_LIB_MACSOUND
soundlib_macsound
#endif
};
struct sound_procs {
@@ -111,7 +113,7 @@ struct sound_procs {
extern struct sound_procs sndprocs;
#define SOUNDID(soundname) #soundname, soundlib_##soundname
#define SOUNDID(soundname) #soundname, ((enum soundlib_ids) soundlib_##soundname)
/*
* SOUNDCAP
@@ -367,7 +369,7 @@ enum sound_effect_entries {
|| defined(SND_LIB_OPENAL) || defined(SND_LIB_SDL_MIXER) \
|| defined(SND_LIB_MINIAUDIO) || defined(SND_LIB_FMOD) \
|| defined(SND_LIB_SOUND_ESCCODES) || defined(SND_LIB_VISSOUND) \
|| defined(SND_LIB_WINDSOUND)
|| defined(SND_LIB_WINDSOUND) || defined(SND_LIB_MACSOUND)
#define SND_LIB_INTEGRATED /* shortcut for conditional code in other files */