v/GTT
1
0
mirror of https://github.com/eeeXun/GTT.git synced 2025-05-21 01:50:36 -07:00
eeeXun 13e9f96c2b refactor: defer SoundLock.Release function in PlayTTS
SoundLock should release before leaving the PlayTTS function
2023-03-10 21:02:06 +08:00

24 lines
426 B
Go

package argostranslate
import (
"errors"
)
func (t *ArgosTranslate) LockAvailable() bool {
return t.SoundLock.Available()
}
func (t *ArgosTranslate) LockAcquire() {
t.SoundLock.Acquire()
}
func (t *ArgosTranslate) StopTTS() {
t.SoundLock.Stop = true
}
func (t *ArgosTranslate) PlayTTS(lang, message string) error {
defer t.SoundLock.Release()
return errors.New(t.EngineName + " does not support text to speech")
}