|
|
@ -11,6 +11,7 @@ import io.legado.app.constant.EventBus |
|
|
|
import io.legado.app.help.AppConfig |
|
|
|
import io.legado.app.help.AppConfig |
|
|
|
import io.legado.app.help.MediaHelp |
|
|
|
import io.legado.app.help.MediaHelp |
|
|
|
import io.legado.app.lib.dialogs.SelectItem |
|
|
|
import io.legado.app.lib.dialogs.SelectItem |
|
|
|
|
|
|
|
import io.legado.app.model.NoStackTraceException |
|
|
|
import io.legado.app.model.ReadBook |
|
|
|
import io.legado.app.model.ReadBook |
|
|
|
import io.legado.app.utils.* |
|
|
|
import io.legado.app.utils.* |
|
|
|
import java.util.* |
|
|
|
import java.util.* |
|
|
@ -75,12 +76,11 @@ class TTSReadAloudService : BaseReadAloudService(), TextToSpeech.OnInitListener |
|
|
|
super.play() |
|
|
|
super.play() |
|
|
|
kotlin.runCatching { |
|
|
|
kotlin.runCatching { |
|
|
|
MediaHelp.playSilentSound(this@TTSReadAloudService) |
|
|
|
MediaHelp.playSilentSound(this@TTSReadAloudService) |
|
|
|
textToSpeech!!.let { |
|
|
|
val tts = textToSpeech ?: throw NoStackTraceException("tts is null") |
|
|
|
it.speak("", TextToSpeech.QUEUE_FLUSH, null, null) |
|
|
|
tts.speak("", TextToSpeech.QUEUE_FLUSH, null, null) |
|
|
|
for (i in nowSpeak until contentList.size) { |
|
|
|
for (i in nowSpeak until contentList.size) { |
|
|
|
val text = contentList[i].replace(AppPattern.notReadAloudRegex, "") |
|
|
|
val text = contentList[i].replace(AppPattern.notReadAloudRegex, "") |
|
|
|
it.speak(text, TextToSpeech.QUEUE_ADD, null, AppConst.APP_TAG + i) |
|
|
|
tts.speak(text, TextToSpeech.QUEUE_ADD, null, AppConst.APP_TAG + i) |
|
|
|
} |
|
|
|
|
|
|
|
} |
|
|
|
} |
|
|
|
}.onFailure { |
|
|
|
}.onFailure { |
|
|
|
AppLog.put("tts朗读出错", it) |
|
|
|
AppLog.put("tts朗读出错", it) |
|
|
|