@@ -56,45 +56,52 @@ class MainActivity : ComponentActivity() {
56
56
TopAppBar (title = { Text (" Next-gen Kaldi: TTS" ) })
57
57
}) {
58
58
Box (modifier = Modifier .padding(it)) {
59
- Column {
60
- Row {
61
- Text (" Speed" )
59
+ Column (modifier = Modifier .padding( 16 .dp)) {
60
+ Column {
61
+ Text (" Speed " + String .format( " %.1f " , TtsEngine .speed) )
62
62
Slider (
63
63
value = TtsEngine .speedState.value,
64
64
onValueChange = { TtsEngine .speed = it },
65
- valueRange = 0.2F .. 3.0F
65
+ valueRange = 0.2F .. 3.0F ,
66
+ modifier = Modifier .fillMaxWidth()
66
67
)
67
68
}
68
69
var testText by remember { mutableStateOf(" " ) }
69
70
71
+
72
+ val numSpeakers = TtsEngine .tts!! .numSpeakers()
73
+ if (numSpeakers > 1 ) {
74
+ OutlinedTextField (
75
+ value = TtsEngine .speakerIdState.value.toString(),
76
+ onValueChange = {
77
+ if (it.isEmpty() || it.isBlank()) {
78
+ TtsEngine .speakerId = 0
79
+ } else {
80
+ TtsEngine .speakerId = it.toString().toInt()
81
+ }
82
+ },
83
+ label = {
84
+ Text (" Speaker ID: (0-${numSpeakers - 1 } )" )
85
+ },
86
+ keyboardOptions = KeyboardOptions (keyboardType = KeyboardType .Number ),
87
+ modifier = Modifier
88
+ .fillMaxWidth()
89
+ .padding(bottom = 16 .dp)
90
+ .wrapContentHeight(),
91
+ )
92
+ }
93
+
70
94
OutlinedTextField (
71
95
value = testText,
72
96
onValueChange = { testText = it },
73
- label = { Text (" Test text" ) },
97
+ label = { Text (" Please input your text here " ) },
74
98
modifier = Modifier
75
99
.fillMaxWidth()
76
- .wrapContentHeight( )
77
- .padding( 16 .dp ),
100
+ .padding(bottom = 16 .dp )
101
+ .wrapContentHeight( ),
78
102
singleLine = false ,
79
103
)
80
104
81
- val numSpeakers = TtsEngine .tts!! .numSpeakers()
82
- if (numSpeakers > 1 ) {
83
- Row {
84
- Text (" Speaker ID: (0-${numSpeakers - 1 } )" )
85
- OutlinedTextField (
86
- value = TtsEngine .speakerIdState.value.toString(),
87
- onValueChange = {
88
- if (it.isEmpty() || it.isBlank()) {
89
- TtsEngine .speakerId = 0
90
- } else {
91
- TtsEngine .speakerId = it.toString().toInt()
92
- }
93
- },
94
- keyboardOptions = KeyboardOptions (keyboardType = KeyboardType .Number )
95
- )
96
- }
97
- }
98
105
Row {
99
106
Button (
100
107
modifier = Modifier .padding(20 .dp),
0 commit comments