Skip to content

Commit

Permalink
fix: 插件TTS的附加数据混乱问题
Browse files Browse the repository at this point in the history
  • Loading branch information
jing332 committed Jul 23, 2023
1 parent fa54a99 commit 12663ed
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ import java.io.ByteArrayInputStream
import java.io.InputStream

open class TtsPluginEngine(
private val pluginTTS: PluginTTS,
val pluginTTS: PluginTTS,
private val context: Context,
override val rhino: RhinoScriptEngine = RhinoScriptEngine(),
override val logger: Logger = Logger(),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -95,8 +95,21 @@ data class PluginTTS(
}

override suspend fun getAudio(speakText: String, rate: Int, pitch: Int): InputStream? {
return pluginEngine?.getAudio(
speakText, rate, pitch
)
pluginEngine?.let {
return if (it.pluginTTS === this) {
it.getAudio(speakText, rate, pitch)
} else {
return TtsPluginEngine(
this,
context,
pluginEngine!!.rhino,
pluginEngine!!.logger
).getAudio(
speakText, rate, pitch
)
}
}

return null
}
}

0 comments on commit 12663ed

Please sign in to comment.