whoops dont sleep use some ctx
This commit is contained in:
@@ -68,6 +68,9 @@ func (v01 *V01) _tts(text string) error {
|
||||
speaker.Init(format.SampleRate, format.SampleRate.N(time.Second/30))
|
||||
speaker.Play(&effects.Volume{Streamer: beep.ResampleRatio(4, 1, &beep.Ctrl{Streamer: beep.Loop(1, decoder)})})
|
||||
duration := time.Duration(decoder.Len()) * format.SampleRate.D(1)
|
||||
time.Sleep(duration)
|
||||
select {
|
||||
case <-v01.ctx.Done():
|
||||
case <-time.After(duration):
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user