
V%\c           @  s   d  d l  m Z d  d l Z d  d l Z d  d l Z d  d l Z d  d l Z d e f d     YZ	 d a d a d a d   Z d   Z d   Z d	   Z e e d
  Z d   Z e a d   Z d S(   i(   t   print_functionNt   TTSRootc           B  s   e  Z d  Z RS(   s   
    An exception that can be used to cause the TTS system to read the text
    of the root displayable, rather than text of the currently focused
    displayable.
    (   t   __name__t
   __module__t   __doc__(    (    (    sj   C:\Users\romet\Desktop\TwistedScarlett Patreon Pack #13\FriendshipwithBenefits-0.1-pc\renpy\display\tts.pyR      s   t    c           C  s.   t  d  k	 r* t  j   d  k	 r* d  a  q* n  d  S(   N(   t   processt   Nonet   poll(    (    (    sj   C:\Users\romet\Desktop\TwistedScarlett Patreon Pack #13\FriendshipwithBenefits-0.1-pc\renpy\display\tts.pyt   periodic1   s    c           C  s
   t  d  k	 S(   N(   R   R   (    (    (    sj   C:\Users\romet\Desktop\TwistedScarlett Patreon Pack #13\FriendshipwithBenefits-0.1-pc\renpy\display\tts.pyt	   is_active9   s    c         C  se  t  d k	 r1 y t  j   t  j   Wq1 q1 Xn  d a  |  j   }  |  sM d St j j j d k r y# t	 j
 j t	 j |  j d   Wn n Xd St j j j d k r t j j   d St j j } d t j k r t j t j d | |   g  a  nht j rbt j j d k r2t j d | |   g  a  qat j d d | t j j  | |   g  a  n t j rt j j d k rt j d | |   g  a  qat j d d | t j j  | |   g  a  n t j rat j j d k rd	 } n t j j } t j j t j j t j  d
  } |  j d d  }  t j d | |  | |   | |  g  a  n  d S(   sM   
    Default function which speaks messages using an os-specific method.
    Nt	   clipboards   utf-8t   debugt   RENPY_TTS_COMMANDt   espeaks   -vt   says   default voices   say.vbst   "R   t   wscript(    R   R   t	   terminatet   waitt   stript   renpyt   gamet   preferencest   self_voicingt   pygamet   scrapt   putt
   SCRAP_TEXTt   encodet   exportst   restart_interactiont   fsencodet   ost   environt
   subprocesst   Popent   linuxt   configt	   tts_voicet	   macintosht   windowst   patht   joint   dirnamet   syst
   executablet   replace(   t   sR    t   voicet   say_vbs(    (    sj   C:\Users\romet\Desktop\TwistedScarlett Patreon Pack #13\FriendshipwithBenefits-0.1-pc\renpy\display\tts.pyt   default_tts_function>   sJ    
#%	0	0		$c         C  s(   y t  j j |   Wn n Xg  a d S(   sB   
    Speaks the queued messages using the specified function.
    N(   R   R&   t   tts_functiont   queue(   R0   (    (    sj   C:\Users\romet\Desktop\TwistedScarlett Patreon Pack #13\FriendshipwithBenefits-0.1-pc\renpy\display\tts.pyt   tts   s
    c         C  sD   | r t  j j j r d S| r6 t  j j |   }  n  t |   d S(   sL   
    This is called by the system to queue the speaking of message `s`.
    N(   R   R   R   R   t   translationt   translate_stringR6   (   R0   t	   translatet   force(    (    sj   C:\Users\romet\Desktop\TwistedScarlett Patreon Pack #13\FriendshipwithBenefits-0.1-pc\renpy\display\tts.pyt   speak   s
    c         C  s
   |  a  d  S(   N(   t   root(   t   d(    (    sj   C:\Users\romet\Desktop\TwistedScarlett Patreon Pack #13\FriendshipwithBenefits-0.1-pc\renpy\display\tts.pyt   set_root   s    c         C  sM  t  j j j } | sJ t r@ | a t t  j j d  d t n  d a	 d Sd } t s | a | d k r} t  j j d  } q t  j j d  } n  x4 t  j
 j D]& } | r t  j j j |  r d Sq W|  d k r t }  n  xE t r%y |  j   } PWq t k
 r!|  t k rd St }  q Xq W| t	 k rI| a	 t | |  n  d S(   sH   
    Causes the TTS system to read the text of the displayable `d`.
    s   Self-voicing disabled.R:   R   NR   s   Clipboard voicing enabled. s   Self-voicing enabled. (   R   R   R   R   t   old_self_voicingR;   R7   R8   t   Truet   lastR&   t   tts_voice_channelst   audiot   musict   get_playingR   R<   t   _tts_allR   R6   (   R=   R   t   prefixt   iR0   (    (    sj   C:\Users\romet\Desktop\TwistedScarlett Patreon Pack #13\FriendshipwithBenefits-0.1-pc\renpy\display\tts.pyt   displayable   s:    		(   t
   __future__R    R-   R!   t   renpy.audioR   R#   R   t	   ExceptionR   R   R<   RA   R   R	   R
   R3   R6   R@   t   FalseR;   R>   R?   RI   (    (    (    sj   C:\Users\romet\Desktop\TwistedScarlett Patreon Pack #13\FriendshipwithBenefits-0.1-pc\renpy\display\tts.pyt   <module>   s"   				B		