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.
This commit is contained in:
nhmall
2023-02-07 00:44:36 -05:00
parent 7aeba46690
commit fbd9a7bae8
48 changed files with 524 additions and 93 deletions

View File

@@ -26,6 +26,7 @@
char * stripdigits (char *)
unsigned Strlen_ (const char *str, const char *, int)
char * eos (char *)
const char * c_eos (const char *)
boolean str_start_is (const char *, const char *, boolean)
boolean str_end_is (const char *, const char *)
int str_lines_maxlen (const char *)
@@ -224,6 +225,14 @@ eos(register char *s)
return s;
}
const char *
c_eos(const char *s)
{
while (*s)
s++; /* s += strlen(s); */
return s;
}
/* like strlen(3) but returns unsigned and panics if string is unreasonably long */
unsigned
Strlen_(const char *str, const char *file, int line){