pull/34/head
kunfei 5 years ago
parent 6cd6fbbf4a
commit 0ca3931b18
  1. 5
      app/src/main/java/io/legado/app/service/HttpReadAloudService.kt
  2. 22
      app/src/main/res/values/arrays.xml
  3. 6
      app/src/main/res/xml/pref_config_aloud.xml

@ -5,6 +5,7 @@ import android.content.Context
import android.content.Intent import android.content.Intent
import android.media.MediaPlayer import android.media.MediaPlayer
import io.legado.app.constant.Bus import io.legado.app.constant.Bus
import io.legado.app.utils.getPrefInt
import io.legado.app.utils.postEvent import io.legado.app.utils.postEvent
import kotlinx.coroutines.launch import kotlinx.coroutines.launch
import org.jetbrains.anko.toast import org.jetbrains.anko.toast
@ -30,7 +31,9 @@ class HttpReadAloudService : BaseReadAloudService(),
private fun getAudioPath(): String { private fun getAudioPath(): String {
val audioText = contentList[nowSpeak] val audioText = contentList[nowSpeak]
return "http://tts.baidu.com/text2audio?idx=1&tex=$audioText&cuid=baidu_speech_demo&cod=2&lan=zh&ctp=1&pdt=1&spd=4&per=6&vol=5&pit=5&_res_tag_=audio" val spd = getPrefInt("ttsSpeechRate", 5) + 5
val per = getPrefInt("ttsSpeechPer")
return "http://tts.baidu.com/text2audio?idx=1&tex=$audioText&cuid=baidu_speech_demo&cod=2&lan=zh&ctp=1&pdt=1&spd=$spd&per=$per&vol=5&pit=5&_res_tag_=audio"
} }
override fun play() { override fun play() {

@ -1,5 +1,27 @@
<?xml version="1.0" encoding="utf-8"?> <?xml version="1.0" encoding="utf-8"?>
<resources> <resources>
<string-array name="tts_speech_per">
<item>普通女声</item>
<item>普通男声</item>
<item>度逍遥</item>
<item>百度丫丫</item>
<item>百度骚男</item>
<item>百度暖女</item>
<item>百度评书</item>
<item>百度主持</item>
</string-array>
<string-array name="tts_speech_per_value">
<item>0</item>
<item>1</item>
<item>2</item>
<item>3</item>
<item>4</item>
<item>5</item>
<item>6</item>
<item>7</item>
</string-array>
<string-array name="bookshelf_layout"> <string-array name="bookshelf_layout">
<item>@string/layout_list</item> <item>@string/layout_list</item>
<item>@string/layout_grid3</item> <item>@string/layout_grid3</item>

@ -14,5 +14,11 @@
android:key="readAloudOnLine" android:key="readAloudOnLine"
app:iconSpaceReserved="false" /> app:iconSpaceReserved="false" />
<androidx.preference.ListPreference
android:key="ttsSpeechPer"
android:title="在线朗读音色"
android:entries="@array/tts_speech_per"
android:entryValues="@array/tts_speech_per_value"
app:iconSpaceReserved="false" />
</androidx.preference.PreferenceScreen> </androidx.preference.PreferenceScreen>
Loading…
Cancel
Save