Add speed control

This commit is contained in:
Cohee
2024-04-02 22:52:51 +03:00
parent f13e718dc7
commit 54a6f4bc62
4 changed files with 29 additions and 4 deletions

View File

@ -78,9 +78,6 @@ class EventSourceStream {
}
}
const defaultDelayMs = 20;
const punctuationDelayMs = 500;
/**
* Gets a delay based on the character.
* @param {string} s The character.
@ -91,6 +88,10 @@ function getDelay(s) {
return 0;
}
const speedFactor = Math.max(100 - power_user.smooth_streaming_speed, 1);
const defaultDelayMs = speedFactor * 0.4;
const punctuationDelayMs = defaultDelayMs * 25;
if ([',', '\n'].includes(s)) {
return punctuationDelayMs / 2;
}