| 2182 | } |
| 2183 | |
| 2184 | void |
| 2185 | sound_speak(const char *text SPEECHONLY) |
| 2186 | { |
| 2187 | #ifdef SND_SPEECH |
| 2188 | const char *cp1, *cp2; |
| 2189 | char *cpdst; |
| 2190 | char buf[BUFSZ + BUFSZ]; |
| 2191 | |
| 2192 | if (!text || (text && *text == '\0')) |
| 2193 | return; |
| 2194 | if (iflags.voices && soundprocs.sound_verbal |
| 2195 | && (soundprocs.sound_triggers & SOUND_TRIGGER_VERBAL)) { |
| 2196 | cp1 = text; |
| 2197 | cpdst = buf; |
| 2198 | cp2 = c_eos(cp1); |
| 2199 | cp2--; /* last non-NUL */ |
| 2200 | *cpdst = '\0'; |
| 2201 | if ((gp.pline_flags & PLINE_VERBALIZE) != 0) { |
| 2202 | if (*cp1 == '"') |
| 2203 | cp1++; |
| 2204 | if (*cp2 == '"') |
| 2205 | cp2--; |
| 2206 | } |
| 2207 | /* cp1 -> 1st, cp2 -> last non-nul) */ |
| 2208 | if ((unsigned)(cp2 - cp1) < (sizeof buf - 1U)) { |
| 2209 | while (cp1 <= cp2) { |
| 2210 | *cpdst = *cp1; |
| 2211 | cp1++; |
| 2212 | cpdst++; |
| 2213 | } |
| 2214 | *cpdst = '\0'; |
| 2215 | } |
| 2216 | (*soundprocs.sound_verbal)(buf, gv.voice.gender, gv.voice.tone, |
| 2217 | gv.voice.volume, gv.voice.moreinfo); |
| 2218 | } |
| 2219 | #endif |
| 2220 | } |
| 2221 | |
| 2222 | /*sounds.c*/ |
no test coverage detected