-
-
Notifications
You must be signed in to change notification settings - Fork 112
Add setting for accepting longer user silences #304
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: master
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -49,6 +49,7 @@ import org.stypox.dicio.io.input.vosk.VoskState.NotDownloaded | |
import org.stypox.dicio.io.input.vosk.VoskState.NotInitialized | ||
import org.stypox.dicio.io.input.vosk.VoskState.NotLoaded | ||
import org.stypox.dicio.io.input.vosk.VoskState.Unzipping | ||
import org.stypox.dicio.settings.datastore.UserSettings | ||
import org.stypox.dicio.ui.util.Progress | ||
import org.stypox.dicio.util.FileToDownload | ||
import org.stypox.dicio.util.LocaleUtils | ||
|
@@ -69,6 +70,7 @@ class VoskInputDevice( | |
@ApplicationContext appContext: Context, | ||
private val okHttpClient: OkHttpClient, | ||
localeManager: LocaleManager, | ||
private val settings: UserSettings, | ||
) : SttInputDevice { | ||
|
||
private val _state: MutableStateFlow<VoskState> | ||
|
@@ -85,7 +87,6 @@ class VoskInputDevice( | |
private val modelDirectory: File get() = File(filesDir, "vosk-model") | ||
private val modelExistFileCheck: File get() = File(modelDirectory, "ivector") | ||
|
||
|
||
init { | ||
// Run blocking, because the locale is always available right away since LocaleManager also | ||
// initializes in a blocking way. Moreover, if VoskInputDevice were not initialized straight | ||
|
@@ -429,7 +430,7 @@ class VoskInputDevice( | |
eventListener: (InputEvent) -> Unit, | ||
) { | ||
_state.value = Listening(speechService, eventListener) | ||
speechService.startListening(VoskListener(this, eventListener, speechService)) | ||
speechService.startListening(VoskListener(this, eventListener, settings.sttSilenceDuration, speechService)) | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Is there a way to set |
||
} | ||
|
||
/** | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -30,6 +30,7 @@ import org.stypox.dicio.settings.datastore.SttPlaySound | |
import org.stypox.dicio.settings.datastore.Theme | ||
import org.stypox.dicio.settings.datastore.WakeDevice | ||
import org.stypox.dicio.settings.ui.BooleanSetting | ||
import org.stypox.dicio.settings.ui.IntSetting | ||
import org.stypox.dicio.settings.ui.ListSetting | ||
|
||
|
||
|
@@ -168,6 +169,15 @@ fun speechOutputDevice() = ListSetting( | |
), | ||
) | ||
|
||
@Composable | ||
fun sttSilenceDuration() = IntSetting( | ||
title = stringResource(R.string.pref_stt_silence_duration_title), | ||
icon = Icons.AutoMirrored.Filled.Send, | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I'd use a different icon here, like |
||
description = @Composable { stringResource(R.string.pref_stt_silence_duration_description, it) }, | ||
minimum = 1, | ||
maximum = 7, | ||
) | ||
|
||
@Composable | ||
fun sttAutoFinish() = BooleanSetting( | ||
title = stringResource(R.string.pref_stt_auto_finish_title), | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If the user changes the settings after this has been built, the old
settings
instance will remain. It's probably better to maintain the previous code for the rest of the class and instead passdataStore
here.