2016년 12월 25일 일요일

Can I interrupt an active text-to-speach action.


I made an app that displays information about a museum object. This information can be several lines long. The user can, by pressing a button, start a text-to-speach action so the information is read to the user. The way it is now, the text-to-speach continues when the user, for some reason, has selected another screen. I would like to be able to interrupt the text-to-speach action in such a case. Is this possible?

--
I suggest queueing up individual sentences onto a list, serviced by the speech component.
Each time a spoken sentence ends, start saying the next sentence and drop the head (slot 1) of the queue.
Have the Screen Change button post the request to a global variable, but not change screens if the speech queue is non-empty.

For more responsive screen changes, have the speech queue service routine check the global screen change request variable
before starting the next sentence.  If a screen change request is pending, switch screens without any more speech action.

See this sample in the Gallery for interrupt-able speech ...

-- 

댓글 없음:

댓글 쓰기