From: nhmall Date: Tue, 24 Jan 2023 04:50:43 +0000 (-0500) Subject: take initial stab at macsound interface X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=3d908c49ef50ce5662e8d893c78d3c9e8b359d23;p=nethack 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. --- diff --git a/include/extern.h b/include/extern.h index e6505b313..13455c240 100644 --- a/include/extern.h +++ b/include/extern.h @@ -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 ### */ diff --git a/include/sndprocs.h b/include/sndprocs.h index 7c3dfac9c..15fe2f11b 100644 --- a/include/sndprocs.h +++ b/include/sndprocs.h @@ -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 */ diff --git a/sound/macsound/macsound.m b/sound/macsound/macsound.m new file mode 100644 index 000000000..f12324812 --- /dev/null +++ b/sound/macsound/macsound.m @@ -0,0 +1,327 @@ +/* macsound.m */ +/* Copyright Michael Allison, 2023 */ +/* NetHack may be freely redistributed. See license for details. */ + +#include "hack.h" + +#ifdef DEBUG +#undef DEBUG +#endif + +/* #import */ +#import + +/* + * Sample sound interface for NetHack + * + * Replace 'macsound' with your soundlib name in this template file. + * Should be placed in ../sound/macsound/. + */ + +#define soundlib_macsound soundlib_nosound + 1 + +static void macsound_init_nhsound(void); +static void macsound_exit_nhsound(const char *); +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 int affiliate(int32_t seid, const char *soundname); + +struct sound_procs macsound_procs = { + SOUNDID(macsound), +// SNDCAP_USERSOUNDS | SNDCAP_HEROMUSIC +// | SNDCAP_ACHIEVEMENTS |SNDCAP_SOUNDEFFECTS, + SNDCAP_USERSOUNDS | SNDCAP_HEROMUSIC | SNDCAP_SOUNDEFFECTS, + macsound_init_nhsound, + macsound_exit_nhsound, + macsound_achievement, + macsound_soundeffect, + macsound_hero_playnotes, + macsound_play_usersound, +}; + +/* + * + * Types of potential sound supports (all are optionally implemented): + * + * SNDCAP_USERSOUNDS User-specified sounds that play based on config + * file entries that identify a regular expression + * to match against message window text, and identify + * an external sound file to load in response. + * The sound interface function pointer used to invoke + * it: + * + * void (*sound_play_usersound)(char *filename, + * int32_t volume, int32_t idx); + * + * SNDCAP_HEROMUSIC Invoked by the core when the in-game hero is + * playing a tune on an instrument. The sound + * interface function pointer used to invoke it: + * + * void (*sound_hero_playnotes)(int32_t instrument, + * char *str, int32_t volume); + * + * SNDCAP_ACHIEVEMENTS Invoked by the core when an in-game achievement + * is reached. The soundlib routines could play + * appropriate theme or mood music in response. + * There would need to be a way to map the + * achievements to external user-specified sounds. + * The sound interface function pointer used to + * invoke it: + * + * void (*sound_achievement)(schar, schar, + * int32_t); + * + * SNDCAP_SOUNDEFFECTS Invoked by the core when something + * sound-producing happens in the game. The soundlib + * routines could play an appropriate sound effect + * in response. They can be public-domain or + * suitably-licensed stock sounds included with the + * game source and made available during the build + * process, or (not-yet-implemented) a way to + * tie particular sound effects to a user-specified + * sound macsounds in a config file. The sound + * interface function pointer used to invoke it: + * + * void (*sound_soundeffect)(char *desc, int32_t, + * int32_t volume); + * + * The routines below would call into your sound library. + * to fulfill the functionality. + */ + +static void +macsound_init_nhsound(void) +{ + /* Initialize external sound library */ +} + +static void +macsound_exit_nhsound(const char *reason UNUSED) +{ + /* Close / Terminate external sound library */ + +} + +/* fulfill SNDCAP_ACHIEVEMENTS */ +static void +macsound_achievement(schar ach1 UNUSED, schar ach2 UNUSED, int32_t repeat UNUSED) +{ + + +} + +/* magic number 40 is the current number of sound_ files to include */ +#define EXTRA_SOUNDS 40 + +static int32_t affiliation[number_of_se_entries + EXTRA_SOUNDS] = { 0 }; +static NSString *soundstring[number_of_se_entries + EXTRA_SOUNDS]; +static NSSound *seSound[number_of_se_entries + EXTRA_SOUNDS]; + +/* fulfill SNDCAP_SOUNDEFFECTS */ +static void +macsound_soundeffect(char *desc UNUSED, int32_t seid, int volume UNUSED) +{ +#ifdef SND_SOUNDEFFECTS_AUTOMAP + + /* 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 + */ + + char buf[1024]; + const char *soundname; + + if (seid <= se_zero_invalid || seid >= number_of_se_entries) + return; + if (!affiliation[seid]) { + soundname = get_sound_effect_filename(seid, buf, sizeof buf, 1); + if (soundname) { + affiliate(seid, soundname); + } + } + if (affiliation[seid]) { + if ([seSound[seid] isPlaying]) + [seSound[seid] stop]; + [seSound[seid] play]; + } +#endif +} + +#define WAVEMUSIC_SOUNDS + +/* + 0 sound_Bell.wav + 1 sound_Drum_Of_Earthquake.wav + 2 sound_Fire_Horn.wav + 3 sound_Frost_Horn.wav + 4 sound_Leather_Drum.wav + 5 sound_Bugle_A.wav + 6 sound_Bugle_B.wav + 7 sound_Bugle_C.wav + 8 sound_Bugle_D.wav + 9 sound_Bugle_E.wav +10 sound_Bugle_F.wav +11 sound_Bugle_G.wav +12 sound_Magic_Harp_A.wav +13 sound_Magic_Harp_B.wav +14 sound_Magic_Harp_C.wav +15 sound_Magic_Harp_D.wav +16 sound_Magic_Harp_E.wav +17 sound_Magic_Harp_F.wav +18 sound_Magic_Harp_G.wav +19 sound_Tooled_Horn_A.wav +20 sound_Tooled_Horn_B.wav +21 sound_Tooled_Horn_C.wav +22 sound_Tooled_Horn_D.wav +23 sound_Tooled_Horn_E.wav +24 sound_Tooled_Horn_F.wav +25 sound_Tooled_Horn_G.wav +26 sound_Wooden_Flute_A.wav +27 sound_Wooden_Flute_B.wav +28 sound_Wooden_Flute_C.wav +29 sound_Wooden_Flute_D.wav +30 sound_Wooden_Flute_E.wav +31 sound_Wooden_Flute_F.wav +32 sound_Wooden_Flute_G.wav +33 sound_Wooden_Harp_A.wav +34 sound_Wooden_Harp_B.wav +35 sound_Wooden_Harp_C.wav +36 sound_Wooden_Harp_D.wav +37 sound_Wooden_Harp_E.wav +38 sound_Wooden_Harp_F.wav +39 sound_Wooden_Harp_G.wav +*/ + + +/* fulfill SNDCAP_HEROMUSIC */ +static void macsound_hero_playnotes(int32_t instrument, + const char *str, int32_t vol UNUSED) +{ +#ifdef WAVEMUSIC_SOUNDS + uint32_t pseudo_seid; + boolean has_note_variations = FALSE; + char resourcename[120], *end_of_res = 0; + const char *c = 0; + + if (!str) + return; + resourcename[0] = '\0'; + switch(instrument) { + case ins_tinkle_bell: + Strcpy(resourcename, "sound_Bell"); + pseudo_seid = 0; + break; + case ins_taiko_drum: /* DRUM_OF_EARTHQUAKE */ + Strcpy(resourcename, "sound_Drum_Of_Earthquake"); + pseudo_seid = 1; + break; + case ins_baritone_sax: /* FIRE_HORN */ + Strcpy(resourcename, "sound_Fire_Horn"); + pseudo_seid = 2; + break; + case ins_french_horn: /* FROST_HORN */ + Strcpy(resourcename, "sound_Frost_Horn"); + pseudo_seid = 3; + break; + case ins_melodic_tom: /* LEATHER_DRUM */ + Strcpy(resourcename, "sound_Leather_Drum"); + pseudo_seid = 4; + break; + case ins_trumpet: /* BUGLE */ + Strcpy(resourcename, "sound_Bugle"); + has_note_variations = TRUE; + pseudo_seid = 5; + break; + case ins_cello: /* MAGIC_HARP */ + Strcpy(resourcename, "sound_Magic_Harp"); + has_note_variations = TRUE; + pseudo_seid = 12; + case ins_english_horn: /* TOOLED_HORN */ + Strcpy(resourcename, "sound_Tooled_Horn"); + has_note_variations = TRUE; + pseudo_seid = 19; + break; + case ins_flute: /* WOODEN_FLUTE */ + Strcpy(resourcename, "sound_Wooden_Flute"); + has_note_variations = TRUE; + pseudo_seid = 26; + break; + case ins_orchestral_harp: /* WOODEN_HARP */ + Strcpy(resourcename, "sound_Wooden_Harp"); + has_note_variations = TRUE; + pseudo_seid = 33; + break; + case ins_pan_flute: /* MAGIC_FLUTE */ + /* wav files for sound_Magic_Flute not added yet */ + Strcpy(resourcename, "sound_Wooden_Flute"); + has_note_variations = TRUE; + pseudo_seid = 26; + break; + } + pseudo_seid += number_of_se_entries; /* get past se_ entries */ + + if (has_note_variations) { + int i, idx = 0, notecount = strlen(str); + static const char *const note_suffixes[] + = { "_A", "_B", "_C", "_D", "_E", "_F", "_G" }; + + end_of_res = eos(resourcename); + c = str; + for (i = 0; i < notecount; ++i) { + if (*c >= 'A' && *c <= 'G') { + idx = (*c) - 'A'; + pseudo_seid += idx; + if (pseudo_seid >= SIZE(affiliation)) + break; + Strcpy(end_of_res, note_suffixes[idx]); + if (!affiliation[pseudo_seid]) { + affiliate(pseudo_seid, resourcename); + } + if (affiliation[pseudo_seid]) { + if ([seSound[pseudo_seid] isPlaying]) + [seSound[pseudo_seid] stop]; + [seSound[pseudo_seid] play]; + } + } + c++; + } + } else { + if (!affiliation[pseudo_seid]) { + affiliate(pseudo_seid, resourcename); + } + if (affiliation[pseudo_seid]) { + if ([seSound[pseudo_seid] isPlaying]) + [seSound[pseudo_seid] stop]; + [seSound[pseudo_seid] play]; + } + } +#endif +} + +/* fulfill SNDCAP_USERSOUNDS */ +static void +macsound_play_usersound(char *filename UNUSED, int volume UNUSED, int idx UNUSED) +{ + +} + +static int +affiliate(int32_t seid, const char *soundname) +{ + if (!soundname || seid <= se_zero_invalid || seid >= SIZE(affiliation)) + return 0; + + if (!affiliation[seid]) { + affiliation[seid] = seid; + soundstring[seid] = [NSString stringWithUTF8String:soundname]; + seSound[seid] = [NSSound soundNamed:soundstring[seid]]; + } + return 1; +} +/* end of macsound.m */ + diff --git a/src/apply.c b/src/apply.c index e5c526b7b..210fad4bb 100644 --- a/src/apply.c +++ b/src/apply.c @@ -1175,6 +1175,7 @@ use_bell(struct obj **optr) && invocation_pos(u.ux, u.uy) && !On_stairs(u.ux, u.uy)); + Hero_playnotes(obj_to_instr(obj), "C", 100); You("ring %s.", the(xname(obj))); if (Underwater || (u.uswallow && ordinary)) { diff --git a/src/decl.c b/src/decl.c index 286cf054f..60efafcbe 100644 --- a/src/decl.c +++ b/src/decl.c @@ -207,7 +207,7 @@ const struct instance_globals_a g_init_a = { /* shk.c */ FALSE, /* auto_credit */ /* sounds.c */ - soundlib_unassigned, /* enum soundlib_ids active_soundlib */ + soundlib_nosound, /* enum soundlib_ids active_soundlib */ /* trap.c */ { 0, 0, FALSE }, /* acid_ctx */ diff --git a/src/music.c b/src/music.c index d8a48549c..0a3f5e96c 100644 --- a/src/music.c +++ b/src/music.c @@ -506,7 +506,6 @@ do_improvisation(struct obj* instr) itmp.otyp -= 1; mundane = TRUE; } - Hero_playnotes(obj_to_instr(&itmp), "C", 50); #define PLAY_NORMAL 0x00 #define PLAY_STUNNED 0x01 @@ -575,6 +574,7 @@ do_improvisation(struct obj* instr) case MAGIC_FLUTE: /* Make monster fall asleep */ consume_obj_charge(instr, TRUE); + Hero_playnotes(obj_to_instr(&itmp), "C", 50); You("%sproduce %s music.", !Deaf ? "" : "seem to ", Hallucination ? "piped" : "soft"); put_monsters_to_sleep(u.ulevel * 5); @@ -582,6 +582,7 @@ do_improvisation(struct obj* instr) break; case WOODEN_FLUTE: /* May charm snakes */ do_spec &= (rn2(ACURR(A_DEX)) + u.ulevel > 25); + Hero_playnotes(obj_to_instr(&itmp), "C", 50); if (!Deaf) pline("%s.", Tobjnam(instr, do_spec ? "trill" : "toot")); else @@ -601,12 +602,14 @@ do_improvisation(struct obj* instr) if ((damage = zapyourself(instr, TRUE)) != 0) { char buf[BUFSZ]; + Hero_playnotes(obj_to_instr(&itmp), "C", 50); Sprintf(buf, "using a magical horn on %sself", uhim()); losehp(damage, buf, KILLED_BY); /* fire or frost damage */ } } else { int type = BZ_OFS_AD((instr->otyp == FROST_HORN) ? AD_COLD : AD_FIRE); + Hero_playnotes(obj_to_instr(&itmp), "C", 50); if (!Blind) pline("A %s blasts out of the horn!", flash_str(type, FALSE)); ubuzz(BZ_U_WAND(type), rn1(6, 6)); @@ -614,6 +617,7 @@ do_improvisation(struct obj* instr) makeknown(instr->otyp); break; case TOOLED_HORN: /* Awaken or scare monsters */ + Hero_playnotes(obj_to_instr(&itmp), "C", 50); if (!Deaf) You("produce a frightful, grave sound."); else @@ -622,6 +626,7 @@ do_improvisation(struct obj* instr) exercise(A_WIS, FALSE); break; case BUGLE: /* Awaken & attract soldiers */ + Hero_playnotes(obj_to_instr(&itmp), "C", 50); if (!Deaf) You("extract a loud noise from %s.", yname(instr)); else @@ -632,6 +637,7 @@ do_improvisation(struct obj* instr) case MAGIC_HARP: /* Charm monsters */ consume_obj_charge(instr, TRUE); + Hero_playnotes(obj_to_instr(&itmp), "C", 50); if (!Deaf) pline("%s very attractive music.", Tobjnam(instr, "produce")); else @@ -641,6 +647,7 @@ do_improvisation(struct obj* instr) break; case WOODEN_HARP: /* May calm Nymph */ do_spec &= (rn2(ACURR(A_DEX)) + u.ulevel > 25); + Hero_playnotes(obj_to_instr(&itmp), "C", 50); if (!Deaf) pline("%s %s.", Yname2(instr), do_spec ? "produces a lilting melody" : "twangs"); @@ -657,6 +664,7 @@ do_improvisation(struct obj* instr) mundane is flagged */ consume_obj_charge(instr, TRUE); + Hero_playnotes(obj_to_instr(&itmp), "C", 50); You("produce a heavy, thunderous rolling!"); pline_The("entire %s is shaking around you!", generic_lvl_desc()); do_earthquake((u.ulevel - 1) / 3 + 1); @@ -666,6 +674,7 @@ do_improvisation(struct obj* instr) break; case LEATHER_DRUM: /* Awaken monsters */ if (!mundane) { + Hero_playnotes(obj_to_instr(&itmp), "C", 50); if (!Deaf) { You("beat a deafening row!"); incr_itimeout(&HDeaf, rn1(20, 30)); @@ -674,6 +683,8 @@ do_improvisation(struct obj* instr) } exercise(A_WIS, FALSE); } else + /* TODO maybe: sound effects for these riffs */ + Hero_playnotes(obj_to_instr(&itmp), "C", 50); You("%s %s.", rn2(2) ? "butcher" : rn2(2) ? "manage" : "pull off", an(beats[rn2(SIZE(beats))])); @@ -862,6 +873,7 @@ obj_to_instr(struct obj *obj) { break; case MAGIC_HARP: ret_instr = ins_cello; + break; case BELL: case BELL_OF_OPENING: ret_instr = ins_tinkle_bell; diff --git a/src/sounds.c b/src/sounds.c index f5ae0c161..7a5956393 100644 --- a/src/sounds.c +++ b/src/sounds.c @@ -1583,7 +1583,20 @@ extern struct sound_procs vissound_procs; #ifdef SND_LIB_WINDSOUND extern struct sound_procs windsound_procs; #endif -extern struct sound_procs nosound_procs; +#ifdef SND_LIB_MACSOUND +extern struct sound_procs macsound_procs; +#endif + +struct sound_procs nosound_procs = { + SOUNDID(nosound), + 0L, + (void (*)(void)) 0, /* init_nhsound */ + (void (*)(const char *)) 0, /* exit_nhsound */ + (void (*)(schar, schar, int32_t)) 0, /* achievement */ + (void (*)(char *, int32_t, int32_t)) 0, /* sound effect */ + (void (*)(int32_t, const char *, int32_t)) 0, /* hero_playnotes */ + (void (*)(char *, int32_t, int32_t)) 0, /* play_usersound */ +}; /* The order of these array entries must match the order of the enum soundlib_ids in sndprocs.h */ @@ -1591,7 +1604,7 @@ extern struct sound_procs nosound_procs; static struct sound_choices { struct sound_procs *sndprocs; } soundlib_choices[] = { - { (struct sound_procs *) 0 }, + { &nosound_procs }, /* default, built-in */ #ifdef SND_LIB_QTSOUND { &qtsound_procs }, #endif @@ -1613,13 +1626,15 @@ static struct sound_choices { #ifdef SND_LIB_SOUND_ESCCODES { &esccodes_procs }, #endif +#ifdef SND_LIB_VISSOUND + { &vissound_procs }, +#endif #ifdef SND_LIB_WINDSOUND { &windsound_procs }, #endif -#ifdef SND_LIB_VISSOUND - { &vissound_procs }, +#ifdef SND_LIB_MACSOUND + { &macsound_procs }, #endif - { &nosound_procs }, /* default, built-in */ }; void @@ -1627,33 +1642,27 @@ activate_chosen_soundlib(void) { enum soundlib_ids idx = gc.chosen_soundlib; - if (idx <= soundlib_unassigned || idx > soundlib_nosound) + if (idx < soundlib_nosound || idx >= SIZE(soundlib_choices)) idx = soundlib_nosound; - if (ga.active_soundlib != soundlib_unassigned - || ga.active_soundlib != idx) { + if (ga.active_soundlib != soundlib_nosound || idx != soundlib_nosound) { if (soundprocs.sound_exit_nhsound) (*soundprocs.sound_exit_nhsound)("assigning a new sound library"); - ga.active_soundlib = soundlib_unassigned; } soundprocs = *soundlib_choices[idx].sndprocs; if (soundprocs.sound_init_nhsound) (*soundprocs.sound_init_nhsound)(); ga.active_soundlib = soundprocs.soundlib_id; + gc.chosen_soundlib = ga.active_soundlib; } void assign_soundlib(int idx) { - if (idx <= soundlib_unassigned || idx > soundlib_nosound) + if (idx < soundlib_nosound || idx >= SIZE(soundlib_choices)) idx = soundlib_nosound; - if (ga.active_soundlib != soundlib_unassigned) { - if (soundprocs.sound_exit_nhsound) - (*soundprocs.sound_exit_nhsound)("assigning a new sound library"); - ga.active_soundlib = soundlib_unassigned; - } - gc.chosen_soundlib = soundlib_choices[idx].sndprocs->soundlib_id; + gc.chosen_soundlib = (uint32_t) soundlib_choices[idx].sndprocs->soundlib_id; } #if 0 @@ -1718,7 +1727,7 @@ get_soundlib_name(char *dest, int maxlen) const char *src; idx = ga.active_soundlib; - if (idx > soundlib_unassigned && idx <= soundlib_nosound) { + if (idx >= soundlib_nosound && idx < SIZE(soundlib_choices)) { src = soundlib_choices[idx].sndprocs->soundname; for (count = 1; count < maxlen; count++) { if (*src == ',' || *src == '\0') @@ -1744,20 +1753,7 @@ static void nosound_resume_nhsound(void); static void nosound_achievement(schar, schar, int32_t); static void nosound_soundeffect(int32_t, int32_t); static void nosound_play_usersound(char *, int32_t, int32_t); -#endif -struct sound_procs nosound_procs = { - SOUNDID(nosound), - 0L, - (void (*)(void)) 0, /* init_nhsound */ - (void (*)(const char *)) 0, /* exit_nhsound */ - (void (*)(schar, schar, int32_t)) 0, /* achievement */ - (void (*)(char *, int32_t, int32_t)) 0, /* sound effect */ - (void (*)(int32_t, const char *, int32_t)) 0, /* hero_playnotes */ - (void (*)(char *, int32_t, int32_t)) 0, /* play_usersound */ -}; - -#if 0 static void nosound_init_nhsound(void) { @@ -1778,6 +1774,11 @@ nosound_soundeffect(int32_t seid, int volume) { } +static void +nosound_hero_playnotes(int32_t instr, const char *notes, int32_t vol) +{ +} + static void nosound_play_usersound(char *filename, int volume, int idx) { diff --git a/sys/share/uudecode.c b/sys/share/uudecode.c index 8dc9a946c..3a73dd087 100644 --- a/sys/share/uudecode.c +++ b/sys/share/uudecode.c @@ -45,7 +45,7 @@ */ #ifndef lint -static char sccsid[] = "@(#)uudecode.c 5.5 (Berkeley) 7/6/88"; +/* static char sccsid[] = "@(#)uudecode.c 5.5 (Berkeley) 7/6/88"; */ #endif /* not lint */ #ifdef __MSDOS__ /* For Turbo C */ @@ -60,6 +60,10 @@ static char sccsid[] = "@(#)uudecode.c 5.5 (Berkeley) 7/6/88"; #endif #endif +#if __APPLE__ +#include "config.h" +#endif + /* * uudecode [input] * @@ -126,13 +130,13 @@ main(int argc, char **argv) } (void) sscanf(buf, "begin %o %s", &mode, dest); -#if !defined(MSDOS) && !defined(VMS) && !defined(WIN32) +#if !defined(MSDOS) && !defined(VMS) && !defined(WIN32) && !defined(MACOS) /* handle ~user/file format */ if (dest[0] == '~') { char *sl; struct passwd *getpwnam(); struct passwd *user; - char dnbuf[100], *index(), *strcat(), *strcpy(); + char dnbuf[100], *strchr(), *strcat(), *strcpy(); sl = strchr(dest, '/'); if (sl == NULL) { @@ -235,7 +239,7 @@ outdec(char *p, FILE *f, int n) putc(c3, f); } -#if !defined(MSDOS) && !defined(VMS) && !defined(WIN32) +#if !defined(MSDOS) && !defined(VMS) && !defined(WIN32) && !defined(MACOS) /* * Return the ptr in sp at which the character c appears; * NULL if not found diff --git a/sys/unix/Makefile.src b/sys/unix/Makefile.src index 408cc3dac..684e69cc2 100644 --- a/sys/unix/Makefile.src +++ b/sys/unix/Makefile.src @@ -539,9 +539,9 @@ HACKINCL = align.h artifact.h artilist.h attrib.h botl.h \ micro.h mkroom.h monattk.h mondata.h monflag.h monst.h monsters.h \ obj.h objects.h objclass.h optlist.h patchlevel.h pcconf.h \ permonst.h prop.h rect.h region.h sym.h defsym.h rm.h sp_lev.h \ - spell.h sys.h system.h tcap.h timeout.h tradstdc.h trap.h unixconf.h \ - vision.h vmsconf.h wintty.h wincurs.h winX.h winprocs.h wintype.h \ - you.h youprop.h + spell.h sndprocs.h sys.h system.h tcap.h timeout.h tradstdc.h \ + trap.h unixconf.h vision.h vmsconf.h wintty.h wincurs.h winX.h \ + winprocs.h wintype.h you.h youprop.h HSOURCES = $(HACKINCL) dgn_file.h @@ -591,7 +591,7 @@ HOBJ = $(TARGETPFX)allmain.o $(TARGETPFX)alloc.o \ $(TARGETPFX)were.o $(TARGETPFX)wield.o $(TARGETPFX)windows.o \ $(TARGETPFX)wizard.o $(TARGETPFX)worm.o $(TARGETPFX)worn.o \ $(TARGETPFX)write.o $(TARGETPFX)zap.o \ - $(REGEXOBJ) $(RANDOBJ) $(SYSOBJ) $(WINOBJ) $(HINTOBJ) \ + $(REGEXOBJ) $(RANDOBJ) $(SYSOBJ) $(WINOBJ) $(HINTOBJ) $(SNDLIBOBJ) \ $(TARGETPFX)version.o # DATE_O = $(TARGETPFX)date.o @@ -605,7 +605,7 @@ all: $(GAME) pregame: $(PREGAME) -$(GAME): pregame $(MAKEDEFS) $(LUALIB) $(SYSTEM) +$(GAME): pregame $(MAKEDEFS) $(LUALIB) $(WAVS) $(SYSTEM) @echo "$(GAME) is up to date." Sysunix: $(HOSTOBJ) $(HOBJ) $(DATE_O) $(BUILDMORE) Makefile @@ -811,7 +811,7 @@ $(HACK_H): ../include/hack.h $(CONFIG_H) ../include/lint.h ../include/align.h \ ../include/obj.h ../include/engrave.h ../include/you.h \ ../include/attrib.h ../include/monst.h ../include/mextra.h \ ../include/skills.h ../include/timeout.h ../include/flag.h \ - ../include/winprocs.h ../include/sys.h + ../include/winprocs.h ../include/sndprocs.h ../include/sys.h touch $(HACK_H) # $(TARGETPFX)pcmain.o: ../sys/share/pcmain.c $(HACK_H) ../include/dlb.h diff --git a/sys/unix/NetHack.xcodeproj/project.pbxproj b/sys/unix/NetHack.xcodeproj/project.pbxproj index f0a3ffa61..a3b1daadb 100644 --- a/sys/unix/NetHack.xcodeproj/project.pbxproj +++ b/sys/unix/NetHack.xcodeproj/project.pbxproj @@ -141,6 +141,7 @@ 31B8A46121A26AF60055BD01 /* panic.c in Sources */ = {isa = PBXBuildFile; fileRef = 31B8A42721A267E60055BD01 /* panic.c */; }; 31B8A46221A26B020055BD01 /* alloc.c in Sources */ = {isa = PBXBuildFile; fileRef = 31B8A36521A238040055BD01 /* alloc.c */; }; 5439B3BC275AADC600B8FB2F /* date.c in Sources */ = {isa = PBXBuildFile; fileRef = 5439B3BB275AADC600B8FB2F /* date.c */; }; + 543ECF6C297EEF3800A13155 /* macsound.m in Sources */ = {isa = PBXBuildFile; fileRef = 54AEB885297EE7C4005F1B13 /* macsound.m */; }; 54435B52247999CB00804CB3 /* nhlobj.c in Sources */ = {isa = PBXBuildFile; fileRef = 54435B51247999CB00804CB3 /* nhlobj.c */; }; 544768AB239949FA004B9739 /* sfstruct.c in Sources */ = {isa = PBXBuildFile; fileRef = 544768A8239949FA004B9739 /* sfstruct.c */; }; 544768AE23994A17004B9739 /* nhlsel.c in Sources */ = {isa = PBXBuildFile; fileRef = 544768AC23994A17004B9739 /* nhlsel.c */; }; @@ -503,7 +504,17 @@ 544768B523995488004B9739 /* nhlua.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = nhlua.h; path = ../../include/nhlua.h; sourceTree = ""; }; 544768B923995BB7004B9739 /* liblua.a */ = {isa = PBXFileReference; lastKnownFileType = archive.ar; name = liblua.a; path = ../../lib/lua/liblua.a; sourceTree = ""; }; 5462D14723E7B19200969423 /* insight.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; name = insight.c; path = ../../src/insight.c; sourceTree = ""; }; + 548FB9F9297F2B03000D04CF /* sndprocs.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; name = sndprocs.h; path = ../../include/sndprocs.h; sourceTree = ""; }; + 548FB9FA297F2BBD000D04CF /* optlist.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; name = optlist.h; path = ../../include/optlist.h; sourceTree = ""; }; + 548FB9FB297F2BBD000D04CF /* hacklib.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; name = hacklib.h; path = ../../include/hacklib.h; sourceTree = ""; }; + 548FB9FC297F2BBD000D04CF /* warnings.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; name = warnings.h; path = ../../include/warnings.h; sourceTree = ""; }; + 548FB9FD297F2BBD000D04CF /* defsym.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; name = defsym.h; path = ../../include/defsym.h; sourceTree = ""; }; + 548FB9FE297F2BBD000D04CF /* fnamesiz.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; name = fnamesiz.h; path = ../../include/fnamesiz.h; sourceTree = ""; }; + 548FB9FF297F2BBD000D04CF /* objects.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; name = objects.h; path = ../../include/objects.h; sourceTree = ""; }; + 548FBA00297F2BBD000D04CF /* tile.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; name = tile.h; path = ../../include/tile.h; sourceTree = ""; }; + 548FBA01297F2BBD000D04CF /* monsters.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; name = monsters.h; path = ../../include/monsters.h; sourceTree = ""; }; 54A3D3EB282C55A900143F8C /* utf8map.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; name = utf8map.c; path = ../../src/utf8map.c; sourceTree = ""; }; + 54AEB885297EE7C4005F1B13 /* macsound.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; name = macsound.m; path = ../../sound/macsound/macsound.m; sourceTree = ""; }; 54FB2B4A246310A600397C0E /* symbols.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; name = symbols.c; path = ../../src/symbols.c; sourceTree = ""; }; 54FCE8282223261F00F393C8 /* isaac64.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; name = isaac64.c; path = ../../src/isaac64.c; sourceTree = ""; }; BAE8010A27B97760002B3786 /* libnhlua.a */ = {isa = PBXFileReference; explicitFileType = archive.ar; includeInIndex = 0; path = libnhlua.a; sourceTree = BUILT_PRODUCTS_DIR; }; @@ -587,6 +598,8 @@ 3189576821A1FCC100FB2ABE = { isa = PBXGroup; children = ( + 54AEB886297EE7E9005F1B13 /* sound */, + 54AEB885297EE7C4005F1B13 /* macsound.m */, BAE8015827B99D44002B3786 /* nhlualib */, 2A953FB221A3F404007906E5 /* XCode.xcconfig */, 31B8A3F821A23E490055BD01 /* win */, @@ -748,6 +761,15 @@ 3189579621A2046700FB2ABE /* include */ = { isa = PBXGroup; children = ( + 548FB9FD297F2BBD000D04CF /* defsym.h */, + 548FB9FE297F2BBD000D04CF /* fnamesiz.h */, + 548FB9FB297F2BBD000D04CF /* hacklib.h */, + 548FBA01297F2BBD000D04CF /* monsters.h */, + 548FB9FF297F2BBD000D04CF /* objects.h */, + 548FB9FA297F2BBD000D04CF /* optlist.h */, + 548FBA00297F2BBD000D04CF /* tile.h */, + 548FB9FC297F2BBD000D04CF /* warnings.h */, + 548FB9F9297F2B03000D04CF /* sndprocs.h */, 544768B523995488004B9739 /* nhlua.h */, 544768B423995447004B9739 /* isaac64.h */, 3186A3B721A4B0FD0052BF02 /* align.h */, @@ -903,6 +925,13 @@ name = Frameworks; sourceTree = ""; }; + 54AEB886297EE7E9005F1B13 /* sound */ = { + isa = PBXGroup; + children = ( + ); + path = sound; + sourceTree = ""; + }; BAE8015827B99D44002B3786 /* nhlualib */ = { isa = PBXGroup; children = ( @@ -1608,6 +1637,7 @@ 544768AB239949FA004B9739 /* sfstruct.c in Sources */, 31B8A3A721A238060055BD01 /* minion.c in Sources */, 31B8A3F021A23D420055BD01 /* unixtty.c in Sources */, + 543ECF6C297EEF3800A13155 /* macsound.m in Sources */, 31B8A37F21A238060055BD01 /* extralev.c in Sources */, 31B8A39B21A238060055BD01 /* dogmove.c in Sources */, 54A3D3EC282C55A900143F8C /* utf8map.c in Sources */, @@ -1801,7 +1831,7 @@ CLANG_ANALYZER_NUMBER_OBJECT_CONVERSION = YES_AGGRESSIVE; CLANG_CXX_LANGUAGE_STANDARD = "c++98"; CLANG_CXX_LIBRARY = "libc++"; - CLANG_ENABLE_MODULES = NO; + CLANG_ENABLE_MODULES = YES; CLANG_ENABLE_OBJC_ARC = YES; CLANG_ENABLE_OBJC_WEAK = YES; CLANG_WARN_BLOCK_CAPTURE_AUTORELEASING = YES; @@ -1828,6 +1858,7 @@ CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; CODE_SIGN_IDENTITY = "Mac Developer"; COPY_PHASE_STRIP = NO; + DEAD_CODE_STRIPPING = YES; DEBUG_INFORMATION_FORMAT = dwarf; ENABLE_STRICT_OBJC_MSGSEND = YES; ENABLE_TESTABILITY = YES; @@ -1872,6 +1903,9 @@ "-DHACKDIR=\\\"$(NH_INSTALL_DIR)\\\"", "-DSECURE", "-DCURSES_GRAPHICS", + "-DSND_LIB_MACSOUND", + "-DSND_SOUNDEFFECTS_AUTOMAP", + "-DUSER_SOUNDS", ); SDKROOT = macosx; }; @@ -1886,7 +1920,7 @@ CLANG_ANALYZER_NUMBER_OBJECT_CONVERSION = YES_AGGRESSIVE; CLANG_CXX_LANGUAGE_STANDARD = "c++98"; CLANG_CXX_LIBRARY = "libc++"; - CLANG_ENABLE_MODULES = NO; + CLANG_ENABLE_MODULES = YES; CLANG_ENABLE_OBJC_ARC = YES; CLANG_ENABLE_OBJC_WEAK = YES; CLANG_WARN_BLOCK_CAPTURE_AUTORELEASING = YES; @@ -1913,6 +1947,7 @@ CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; CODE_SIGN_IDENTITY = "Mac Developer"; COPY_PHASE_STRIP = NO; + DEAD_CODE_STRIPPING = YES; DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym"; ENABLE_NS_ASSERTIONS = NO; ENABLE_STRICT_OBJC_MSGSEND = YES; @@ -1960,8 +1995,10 @@ buildSettings = { CODE_SIGN_IDENTITY = "-"; CODE_SIGN_STYLE = Automatic; + DEAD_CODE_STRIPPING = YES; GCC_C_LANGUAGE_STANDARD = c99; INSTALL_PATH = "$(NH_INSTALL_DIR)"; + MACOSX_DEPLOYMENT_TARGET = "$(RECOMMENDED_MACOSX_DEPLOYMENT_TARGET)"; "OTHER_LDFLAGS[arch=*]" = "-L${NH_LIB_DIR}/lua"; PRODUCT_NAME = "$(TARGET_NAME)"; }; @@ -1972,8 +2009,10 @@ buildSettings = { CODE_SIGN_IDENTITY = "-"; CODE_SIGN_STYLE = Automatic; + DEAD_CODE_STRIPPING = YES; GCC_C_LANGUAGE_STANDARD = c99; INSTALL_PATH = "$(NH_INSTALL_DIR)"; + MACOSX_DEPLOYMENT_TARGET = "$(RECOMMENDED_MACOSX_DEPLOYMENT_TARGET)"; "OTHER_LDFLAGS[arch=*]" = "-L${NH_LIB_DIR}/lua"; PRODUCT_NAME = "$(TARGET_NAME)"; }; @@ -1984,6 +2023,8 @@ buildSettings = { CODE_SIGN_IDENTITY = "-"; CODE_SIGN_STYLE = Automatic; + DEAD_CODE_STRIPPING = YES; + MACOSX_DEPLOYMENT_TARGET = "$(RECOMMENDED_MACOSX_DEPLOYMENT_TARGET)"; PRODUCT_NAME = "$(TARGET_NAME)"; }; name = Debug; @@ -1993,6 +2034,8 @@ buildSettings = { CODE_SIGN_IDENTITY = "-"; CODE_SIGN_STYLE = Automatic; + DEAD_CODE_STRIPPING = YES; + MACOSX_DEPLOYMENT_TARGET = "$(RECOMMENDED_MACOSX_DEPLOYMENT_TARGET)"; PRODUCT_NAME = "$(TARGET_NAME)"; }; name = Release; @@ -2002,6 +2045,8 @@ buildSettings = { CODE_SIGN_IDENTITY = "-"; CODE_SIGN_STYLE = Automatic; + DEAD_CODE_STRIPPING = YES; + MACOSX_DEPLOYMENT_TARGET = "$(RECOMMENDED_MACOSX_DEPLOYMENT_TARGET)"; PRODUCT_NAME = "$(TARGET_NAME)"; }; name = Debug; @@ -2011,6 +2056,8 @@ buildSettings = { CODE_SIGN_IDENTITY = "-"; CODE_SIGN_STYLE = Automatic; + DEAD_CODE_STRIPPING = YES; + MACOSX_DEPLOYMENT_TARGET = "$(RECOMMENDED_MACOSX_DEPLOYMENT_TARGET)"; PRODUCT_NAME = "$(TARGET_NAME)"; }; name = Release; @@ -2020,6 +2067,8 @@ buildSettings = { CODE_SIGN_IDENTITY = "-"; CODE_SIGN_STYLE = Automatic; + DEAD_CODE_STRIPPING = YES; + MACOSX_DEPLOYMENT_TARGET = "$(RECOMMENDED_MACOSX_DEPLOYMENT_TARGET)"; PRODUCT_NAME = "$(TARGET_NAME)"; }; name = Debug; @@ -2029,6 +2078,8 @@ buildSettings = { CODE_SIGN_IDENTITY = "-"; CODE_SIGN_STYLE = Automatic; + DEAD_CODE_STRIPPING = YES; + MACOSX_DEPLOYMENT_TARGET = "$(RECOMMENDED_MACOSX_DEPLOYMENT_TARGET)"; PRODUCT_NAME = "$(TARGET_NAME)"; }; name = Release; @@ -2043,11 +2094,13 @@ CLANG_WARN_STRICT_PROTOTYPES = YES; CLANG_WARN_UNREACHABLE_CODE = YES; CODE_SIGN_STYLE = Automatic; + DEAD_CODE_STRIPPING = YES; DEVELOPMENT_TEAM = 6978C4Q2VB; EXECUTABLE_PREFIX = lib; GCC_C_LANGUAGE_STANDARD = gnu11; GCC_NO_COMMON_BLOCKS = YES; GCC_WARN_64_TO_32_BIT_CONVERSION = YES; + MACOSX_DEPLOYMENT_TARGET = "$(RECOMMENDED_MACOSX_DEPLOYMENT_TARGET)"; OTHER_CFLAGS = ( "-DNOMAIL", "-DNOTPARMDECL", @@ -2077,11 +2130,13 @@ CLANG_WARN_STRICT_PROTOTYPES = YES; CLANG_WARN_UNREACHABLE_CODE = YES; CODE_SIGN_STYLE = Automatic; + DEAD_CODE_STRIPPING = YES; DEVELOPMENT_TEAM = 6978C4Q2VB; EXECUTABLE_PREFIX = lib; GCC_C_LANGUAGE_STANDARD = gnu11; GCC_NO_COMMON_BLOCKS = YES; GCC_WARN_64_TO_32_BIT_CONVERSION = YES; + MACOSX_DEPLOYMENT_TARGET = "$(RECOMMENDED_MACOSX_DEPLOYMENT_TARGET)"; OTHER_CFLAGS = ( "-DNOMAIL", "-DNOTPARMDECL", diff --git a/sys/unix/hints/include/multiw-2.370 b/sys/unix/hints/include/multiw-2.370 index 3a06bbdd2..b1dc11e48 100644 --- a/sys/unix/hints/include/multiw-2.370 +++ b/sys/unix/hints/include/multiw-2.370 @@ -145,7 +145,8 @@ ifdef WANT_WIN_QT WINCFLAGS += -DQT_GRAPHICS WINSRC += $(WINQTSRC) WINOBJ0 += $(WINQTOBJ) -SNDCFLAGS += -DSND_LIB_QTSOUND -DUSER_SOUNDS +SNDCFLAGS += -DSND_LIB_QTSOUND +HAVE_SNDLIB = 1 # Indicates a sndlib, so USER_SOUNDS gets defined later XTRASRC += tile.c XTRAOBJ += $(TARGETPFX)tile.o # diff --git a/sys/unix/hints/linux.370 b/sys/unix/hints/linux.370 index b80ffea6d..b0e83a6cd 100755 --- a/sys/unix/hints/linux.370 +++ b/sys/unix/hints/linux.370 @@ -113,6 +113,12 @@ endif #MAKEFILE_SRC endif #HAVE_NCURSESW endif #WANT_WIN_CURSES +# HAVE_SNDLIB could have been set in multiw-2 for Qt. +# If it is set, add USER_SOUNDS +ifeq "$(HAVE_SNDLIB)" "1" +SNDCFLAGS+= -DUSER_SOUNDS +endif + CFLAGS+= $(WINCFLAGS) #WINCFLAGS set from multiw-2.370 CFLAGS+= $(SNDCFLAGS) #SNDCFLAGS set from multiw-2.370 CFLAGS+= $(NHCFLAGS) diff --git a/sys/unix/hints/macOS.370 b/sys/unix/hints/macOS.370 index 39c588681..59b7b6b9e 100755 --- a/sys/unix/hints/macOS.370 +++ b/sys/unix/hints/macOS.370 @@ -155,6 +155,21 @@ endif #CURSES_UNICODE=0 endif #CURSES_UNIODE=sys endif #MAKEFILE_SRC +ifdef WANT_MACSOUND +HAVE_SNDLIB = 1 +SNDCFLAGS+= -DSND_LIB_MACSOUND -DSND_SOUNDEFFECTS_AUTOMAP +SNDLIBSRC = ../sound/macsound/macsound.m +SNDLIBOBJ = macsound.o +LFLAGS += -framework AppKit +endif + +# HAVE_SNDLIB could have been set just above, or it could +# have been set in multiw-2 for Qt. Either way, if it is +# set, add USER_SOUNDS +ifeq "$(HAVE_SNDLIB)" "1" +SNDCFLAGS+= -DUSER_SOUNDS +endif + CFLAGS+= $(PKGCFLAGS) $(WINCFLAGS) #WINCFLAGS set from multiw-2.370 CFLAGS+= $(SNDCFLAGS) #SNDCFLAGS set from multiw-2.370 CFLAGS+= $(NHCFLAGS) @@ -373,12 +388,48 @@ VARDIR=$(HACKDIR) # #-INCLUDE gbdates-pre.370 # +ifdef WANT_MACSOUND +WAVDIR = ../sound/wav +SNDWAVS = se_squeak_A se_squeak_B se_squeak_B_flat se_squeak_C se_squeak_D \ + se_squeak_D_flat se_squeak_E se_squeak_E_flat se_squeak_F \ + se_squeak_F_sharp se_squeak_G se_squeak_G_sharp sound_Bell \ + sound_Bugle_A sound_Bugle_B sound_Bugle_C sound_Bugle_D \ + sound_Bugle_E sound_Bugle_F sound_Bugle_G \ + sound_Drum_Of_Earthquake sound_Fire_Horn sound_Frost_Horn \ + sound_Leather_Drum sound_Magic_Harp_A sound_Magic_Harp_B \ + sound_Magic_Harp_C sound_Magic_Harp_D sound_Magic_Harp_E \ + sound_Magic_Harp_F sound_Magic_Harp_G sound_Tooled_Horn_A \ + sound_Tooled_Horn_B sound_Tooled_Horn_C sound_Tooled_Horn_D \ + sound_Tooled_Horn_E sound_Tooled_Horn_F sound_Tooled_Horn_G \ + sound_Wooden_Flute_A sound_Wooden_Flute_B sound_Wooden_Flute_C \ + sound_Wooden_Flute_D sound_Wooden_Flute_E sound_Wooden_Flute_F \ + sound_Wooden_Flute_G sound_Wooden_Harp_A sound_Wooden_Harp_B \ + sound_Wooden_Harp_C sound_Wooden_Harp_D sound_Wooden_Harp_E \ + sound_Wooden_Harp_F sound_Wooden_Harp_G + +WAVS = $(addprefix $(WAVDIR)/, $(addsuffix .wav, $(SNDWAVS))) +endif + #-POST # #-INCLUDE gbdates-post.370 # +ifdef WANT_MACSOUND +$(TARGETPFX)$(SNDLIBOBJ): $(SNDLIBSRC) $(HACK_H) + $(CC) $(CFLAGS) -c -o$@ $(SNDLIBSRC) +$(WAVDIR)/%.wav: ../util/uudecode $(WAVDIR)/%.uu + $^ + mv $(notdir $@) $@ + +../util/uudecode: uudecode.o + $(CC) $(LFLAGS) uudecode.o -o $@ + +uudecode.o: ../sys/share/uudecode.c + $(CC) $(CFLAGS) -c -o $@ ../sys/share/uudecode.c +endif # WANT_MACSOUND + ifdef WANT_LIBNH $(TARGETPFX)libnh.a: $(HOBJ) $(LIBNHSYSOBJ) ../lib/lua/liblua.a $(AR) rcs $@ $(HOBJ) $(LIBNHSYSOBJ) ../lib/lua/liblua.a diff --git a/sys/unix/unixmain.c b/sys/unix/unixmain.c index 01dcf220e..a570e5d94 100644 --- a/sys/unix/unixmain.c +++ b/sys/unix/unixmain.c @@ -102,6 +102,18 @@ main(int argc, char *argv[]) choose_windows(DEFAULT_WINDOW_SYS); +#ifdef SND_LIB_INTEGRATED + /* One of the soundlib interfaces was integrated on build. + * We can leave a hint here for activate_chosen_soundlib later. + * assign_soundlib() just sets an indicator, it doesn't initialize + * any soundlib, and the indicator could be overturned before + * activate_chosen_soundlib() gets called. + */ +#if defined(SND_LIB_MACSOUND) && !defined(SND_LIB_QTSOUND) + assign_soundlib(soundlib_macsound); +#endif +#endif + #ifdef CHDIR /* otherwise no chdir() */ /* * See if we must change directory to the playground.