Veskslop command wrapper, optional pitch/speed, measured calibration

This commit is contained in:
Fisto
2026-09-15 11:49:13 +02:00
parent 2a00496cfe
commit 4bed006ea9
5 changed files with 254 additions and 58 deletions
+27 -23
View File
@@ -257,30 +257,34 @@ int main(int argc, char **argv)
return 1;
}
WORD pmin = 0, pmax = 0, pdef = 0;
DWORD smin = 0, smax = 0, sdef = 0;
attr->lpVtbl->PitchGet(attr, &pdef);
attr->lpVtbl->SpeedGet(attr, &sdef);
attr->lpVtbl->PitchSet(attr, TTSATTR_MINPITCH);
attr->lpVtbl->PitchGet(attr, &pmin);
attr->lpVtbl->PitchSet(attr, TTSATTR_MAXPITCH);
attr->lpVtbl->PitchGet(attr, &pmax);
attr->lpVtbl->SpeedSet(attr, TTSATTR_MINSPEED);
attr->lpVtbl->SpeedGet(attr, &smin);
attr->lpVtbl->SpeedSet(attr, TTSATTR_MAXSPEED);
attr->lpVtbl->SpeedGet(attr, &smax);
/* Pitch and speed are optional: when unset, leave the engine's own
voice profile untouched (probing/setting would override it). */
if (pitch >= 0 || speed >= 0) {
WORD pmin = 0, pmax = 0;
DWORD smin = 0, smax = 0;
if (pitch < 0) pitch = pdef;
if (speed < 0) speed = sdef;
if (pitch < (int)pmin) pitch = pmin;
if (pitch > (int)pmax) pitch = pmax;
if (speed < (int)smin) speed = smin;
if (speed > (int)smax) speed = smax;
printf("pitch: %d (%d..%d) speed: %d (%lu..%lu)\n",
pitch, pmin, pmax, speed, (unsigned long)smin, (unsigned long)smax);
attr->lpVtbl->PitchSet(attr, (WORD)pitch);
attr->lpVtbl->SpeedSet(attr, (DWORD)speed);
if (pitch >= 0) {
attr->lpVtbl->PitchSet(attr, TTSATTR_MINPITCH);
attr->lpVtbl->PitchGet(attr, &pmin);
attr->lpVtbl->PitchSet(attr, TTSATTR_MAXPITCH);
attr->lpVtbl->PitchGet(attr, &pmax);
if (pitch < (int)pmin) pitch = pmin;
if (pitch > (int)pmax) pitch = pmax;
attr->lpVtbl->PitchSet(attr, (WORD)pitch);
printf("pitch: %d (%d..%d)\n", pitch, pmin, pmax);
}
if (speed >= 0) {
attr->lpVtbl->SpeedSet(attr, TTSATTR_MINSPEED);
attr->lpVtbl->SpeedGet(attr, &smin);
attr->lpVtbl->SpeedSet(attr, TTSATTR_MAXSPEED);
attr->lpVtbl->SpeedGet(attr, &smax);
if (speed < (int)smin) speed = smin;
if (speed > (int)smax) speed = smax;
attr->lpVtbl->SpeedSet(attr, (DWORD)speed);
printf("speed: %d (%lu..%lu)\n",
speed, (unsigned long)smin, (unsigned long)smax);
}
}
{
DWORD regkey = 0;