Apply voice settings to a live microphone in one place
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
@@ -77,4 +77,19 @@ public interface VoiceInput extends Microphone {
|
||||
|
||||
/** Called when speech is detected while the microphone is muted. */
|
||||
void setMutedTalkListener(Runnable listener);
|
||||
|
||||
/** Takes on the voice settings, as they stand now, while capturing. */
|
||||
default void apply(Settings settings) {
|
||||
setMode(settings.inputMode);
|
||||
setVadMode(settings.vadMode);
|
||||
setThresholdDb(settings.vadThresholdDb);
|
||||
setSpeechThreshold(settings.speechThreshold);
|
||||
setVadOverPtt(settings.vadOverPtt);
|
||||
setInputGain(settings.inputVolume);
|
||||
setNoiseSuppression(settings.denoise);
|
||||
setDenoiserLevel(settings.denoiserLevel);
|
||||
setTypingAttenuation(settings.typingAttenuation);
|
||||
setAgc(settings.agc);
|
||||
setOpusParameters(OpusParameters.from(settings));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -2,7 +2,6 @@ package com.ts3client.ui;
|
||||
|
||||
import com.formdev.flatlaf.util.UIScale;
|
||||
import com.ts3client.audio.AudioBackend;
|
||||
import com.ts3client.audio.OpusParameters;
|
||||
import com.ts3client.audio.VoiceInput;
|
||||
import com.ts3client.audio.VoiceOutput;
|
||||
import com.ts3client.config.Settings;
|
||||
@@ -150,19 +149,7 @@ public final class SettingsDialog extends JDialog {
|
||||
hotkeysPanel.apply();
|
||||
settings.save();
|
||||
|
||||
applyLive(m -> {
|
||||
m.setMode(settings.inputMode);
|
||||
m.setVadMode(settings.vadMode);
|
||||
m.setThresholdDb(settings.vadThresholdDb);
|
||||
m.setSpeechThreshold(settings.speechThreshold);
|
||||
m.setVadOverPtt(settings.vadOverPtt);
|
||||
m.setInputGain(settings.inputVolume);
|
||||
m.setNoiseSuppression(settings.denoise);
|
||||
m.setDenoiserLevel(settings.denoiserLevel);
|
||||
m.setTypingAttenuation(settings.typingAttenuation);
|
||||
m.setAgc(settings.agc);
|
||||
m.setOpusParameters(OpusParameters.from(settings));
|
||||
});
|
||||
applyLive(m -> m.apply(settings));
|
||||
if (livePlayback != null) {
|
||||
livePlayback.setMasterVolume(settings.outputVolume);
|
||||
livePlayback.setOutputDevice(settings.outputDevice);
|
||||
|
||||
Reference in New Issue
Block a user