host: volume option; docs: voice adjustments beyond speed (volume, Flextalk profile)

This commit is contained in:
Fisto
2026-09-15 13:38:36 +02:00
parent 6f131b1f9e
commit 2ced066de2
4 changed files with 48 additions and 6 deletions
+12 -3
View File
@@ -157,7 +157,7 @@ static void usage(void)
fprintf(stderr,
"usage: sapi4host -l\n"
" sapi4host -v <voice> -t <text> -o <out.wav>"
" [-p pitch] [-s speed]\n");
" [-p pitch] [-s speed] [-V volume]\n");
}
/* ------------------------------------------------------------------ */
@@ -168,6 +168,7 @@ int main(int argc, char **argv)
{
const char *voice = NULL, *text = NULL, *out = NULL;
int pitch = -1, speed = -1;
long volume = -1;
int i;
TTSMODEINFO mode;
@@ -182,6 +183,7 @@ int main(int argc, char **argv)
else if (!strcmp(argv[i], "-o")) out = argv[++i];
else if (!strcmp(argv[i], "-p")) pitch = atoi(argv[++i]);
else if (!strcmp(argv[i], "-s")) speed = atoi(argv[++i]);
else if (!strcmp(argv[i], "-V")) volume = strtol(argv[++i], NULL, 0);
else { usage(); return 2; }
}
if (!voice || !text || !out) { usage(); return 2; }
@@ -257,9 +259,9 @@ int main(int argc, char **argv)
return 1;
}
/* Pitch and speed are optional: when unset, leave the engine's own
/* Pitch, speed and volume are optional: when unset, leave the engine's own
voice profile untouched (probing/setting would override it). */
if (pitch >= 0 || speed >= 0) {
if (pitch >= 0 || speed >= 0 || volume >= 0) {
WORD pmin = 0, pmax = 0;
DWORD smin = 0, smax = 0;
@@ -284,6 +286,13 @@ int main(int argc, char **argv)
printf("speed: %d (%lu..%lu)\n",
speed, (unsigned long)smin, (unsigned long)smax);
}
if (volume >= 0) {
DWORD vdef = 0;
attr->lpVtbl->VolumeGet(attr, &vdef);
attr->lpVtbl->VolumeSet(attr, (DWORD)volume);
printf("volume: %ld (default %lu)\n",
volume, (unsigned long)vdef);
}
}
{