Commit Graph

19 Commits

Author SHA1 Message Date
nhmall
87d339cd85 fix achievement sounds in the macsound interface
> With sounds on, using #levelchange to drop more than one level only
> gave the level-loss sound effect once.

Fix the underlying issue within macsound.m by allowing the currently
playing sound to run to its completion prior to starting the next.

This also backs out the acknowledgment --More-- that was added after
the sound issue first materialized and puts it back to the way it was
the past several releases.
2023-03-02 20:30:05 -05:00
nhmall
a443747211 eliminate some Xcode warnings on macsound.m 2023-02-09 12:10:22 -05:00
nhmall
2c89196627 fix macsound build error with certain combo of preprocess defines 2023-02-07 01:09:08 -05:00
nhmall
fbd9a7bae8 another update to the soundlib interface
sound_verbal(char *text, int32_t gender, int32_t tone, int32_t vol,
             int32_t moreinfo);
    -- NetHack will call this function when it wants to pass text of
       spoken language by a character or creature within the game.
    -- text is a transcript of what has been spoken.
    -- gender indicates MALE or FEMALE sounding voice.
    -- tone indicates the tone of the voice.
    -- vol is the volume (1% - 100%) for the sound.
    -- moreinfo is used to provide additional information to the soundlib.
    -- there may be some accessibility uses for this function.

It may be useful for accessibility purposes too.

A preliminary implementation has been attempted for macsound to test
the interface on macOS. No tinkering of the voices has been done.

Use of the test implementation requires the following at build time with make.
    WANT_SPEECH=1
That needs to be included on the make command line to enable the test code,
otherwise just the interface update is compiled in.

I don't know for certain when AVSpeechSynthesizer went into macOS, but older versions
likely don't support it, and would just leave off the WANT_SPEECH=1.

If built with WANT_SPEECH=1, the 'voices' NetHack option needs to be enabled.

It was a bit strange, when I first started up the test, to hear Asidonhopo,
the shopkeeper, talking to me as I entered his shop and interacted with him.
2023-02-07 00:44:36 -05:00
nhmall
20c6e1b6e6 macsound: 2 params are UNUSED always 2023-02-05 11:53:19 -05:00
nhmall
47c44e4907 typo fix in macsound.m 2023-02-05 11:41:59 -05:00
nhmall
5034f7f936 update macsound to support 'volume' interface parameter 2023-02-05 11:32:12 -05:00
nhmall
d14ed8b9de enable achievement sounds in macsound
Requires rebuild of your Makefiles via hints file (for new stock wav additions).

If you've been testing by copying the wav files manually to
~/Library/Sounds, you'll need to copy them again to pick up
the additional wav files.
2023-02-04 15:37:17 -05:00
nhmall
36ca64acdb start to add some SOUND_TRIGGER_ACHIEVEMENTS code
Start to add supporting code to windsound and macsound. The latter
remains commented out because I haven't had a chance to try
it on macOS yet.

In order to test it out, I added two more stock sounds:
sa2_xplevelup and sa2_xpleveldown.
2023-02-04 14:28:59 -05:00
nhmall
9d3dda1e1d mac typo and some warnings 2023-02-03 15:12:42 -05:00
nhmall
2acd8e7b29 update soundlib interface
Add SOUND_TRIGGER_AMBIENCE
2023-02-03 13:32:44 -05:00
nhmall
8ee42f5644 further work on soundlib support code
move some inline code into functions
replace some magic numbers

The mingw code is not tested yet.
2023-01-31 22:19:29 -05:00
nhmall
90895330c5 soundlib terminology update - sound_triggers
Switch to using the term "sound triggers" for things that
result in a call to one of the soundlib routines.

SNDCAP_* renamed to SOUND_TRIGGER_*
sndcap field in the sound_procs struct changed to sound_triggers
2023-01-27 22:21:53 -05:00
nhmall
219c1155f8 a missing break and an incorrect magic number 2023-01-26 22:39:14 -05:00
nhmall
1b8edf852f more Soundeffects fiddling 2023-01-25 14:23:22 -05:00
nhmall
a48e32a1f9 add missing Magic_Flute files 2023-01-25 01:16:08 -05:00
nhmall
5171fcdc1d some macsound instrument play refinements
Also some better core placement of some of the Hero_playnotes calls.
2023-01-24 13:02:29 -05:00
nhmall
9f1493e0ad remove a multi-line debug/dev comment 2023-01-24 00:45:45 -05:00
nhmall
3d908c49ef 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.
2023-01-23 23:50:43 -05:00