fixed threshold calculation

This commit is contained in:
Daniel Sommer 2022-04-21 16:19:14 +02:00
parent 365f8b147b
commit e3a30f9396

View file

@ -46,7 +46,11 @@ class AudioServer {
});
const stats = await stat(this.buffer.file);
this.buffer.size = stats.size;
this.buffer.threshold = (this.buffer.size / 100) / (!isNaN(config.audio?.threshold) || 30);
let divisor = 30;
if (!(isNaN(config.audio?.threshold))) {
divisor = config.audio.threshold;
}
this.buffer.threshold = (this.buffer.size / 100) / divisor;
this.#announceAudioServer();
}