Fix CI errors. (#993)
This commit is contained in:
@@ -25,6 +25,10 @@ fun getSampleText(lang: String): String {
|
||||
text = "Aquest és un motor de text a veu que utilitza Kaldi de nova generació"
|
||||
}
|
||||
|
||||
"cym" -> {
|
||||
text = "Peiriant testun-i-lais yw hwn sy'n defnyddio Kaldi'r genhedlaeth nesaf"
|
||||
}
|
||||
|
||||
"ces" -> {
|
||||
text = "Toto je převodník textu na řeč využívající novou generaci kaldi"
|
||||
}
|
||||
|
||||
@@ -93,6 +93,7 @@ class MainActivity : ComponentActivity() {
|
||||
TtsEngine.speakerId = 0
|
||||
}
|
||||
}
|
||||
preferenceHelper.setSid(TtsEngine.speakerId)
|
||||
},
|
||||
label = {
|
||||
Text("Speaker ID: (0-${numSpeakers - 1})")
|
||||
|
||||
@@ -5,6 +5,7 @@ class PreferenceHelper(context: Context) {
|
||||
|
||||
private val PREFS_NAME = "com.k2fsa.sherpa.onnx.tts.engine"
|
||||
private val SPEED_KEY = "speed"
|
||||
private val SID_KEY = "speaker_id"
|
||||
|
||||
private val sharedPreferences: SharedPreferences =
|
||||
context.getSharedPreferences(PREFS_NAME, Context.MODE_PRIVATE)
|
||||
@@ -18,4 +19,14 @@ class PreferenceHelper(context: Context) {
|
||||
fun getSpeed(): Float {
|
||||
return sharedPreferences.getFloat(SPEED_KEY, 1.0f)
|
||||
}
|
||||
|
||||
fun setSid(value: Int) {
|
||||
val editor = sharedPreferences.edit()
|
||||
editor.putInt(SID_KEY, value)
|
||||
editor.apply()
|
||||
}
|
||||
|
||||
fun getSid(): Int {
|
||||
return sharedPreferences.getInt(SID_KEY, 0)
|
||||
}
|
||||
}
|
||||
@@ -138,6 +138,7 @@ object TtsEngine {
|
||||
)
|
||||
|
||||
speed = PreferenceHelper(context).getSpeed()
|
||||
speakerId = PreferenceHelper(context).getSid()
|
||||
|
||||
tts = OfflineTts(assetManager = assets, config = config)
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user