+
    Qi<&  c                  sT  a  0 t $ R t^ RIHt RtRtRtRtRt^ RI	t	^ RI
HtHtHt ^R	IHt ^R
IHt ^RIHt ^RIHt ^RIHt ]'       d   ^ RIHt ^RIHt ^RIHt RsR]R&   R R ltR R ltR'R R lltR R ltR R ltR(R R llt R'R R  llt!R'R! R" llt"R# R$ lt#R% R& lt$R# ))z+Manages the default speech server for Orca.)annotationsz$Id$z
$Revision$z$Date$z-Copyright (c) 2005-2009 Sun Microsystems Inc.ZLGPLN)AnyCallableTYPE_CHECKING)debug)settings)speech_generator)ACSS)VoiceFamily)
ModuleType)input_event)speechserver speechserver.SpeechServer | None_speechserverc               $    V ^8  d   QhRRRRRR/# )   module_namestrspeech_server_infozlist[str] | NonereturnNone Zformat   "0/usr/lib/python3.14/site-packages/orca/speech.py__annotate__r   2   s#     #< #<S #<>N #<SW #<    c                s   V '       g   R # R p \         P                  ! RV  24      pT'       g.   RT  2p\        P                  ! \        P                  TR4       R # \        P                  pT'       d   TP                  P                  T4      s\        '       gM   TP                  P                  4       sT'       d+   RT.p\        P                  ! \        P                  TR4       \        '       g.   RT  2p\        P                  ! \        P                  TR4       R # R #   \         dS     \         P                  ! T 4      p EL   \         d*    \        P                  ! \        P
                  4         ELSi ; ii ; i)Nzorca.z!SPEECH: Failed to import module: Tz!SPEECH: Invalid speechServerInfo:z&SPEECH: No speech server for factory: )	importlibZimport_moduleZImportErrorr   Zprint_exceptionZLEVEL_SEVEREprint_messageZLEVEL_WARNINGr   speechServerInfoZSpeechServerget_speech_serverr   print_tokens
LEVEL_INFO)r   r   Zfactorymsgtokens   &&   r   _init_speech_serverr$   2   s6    !%G6))E+*?@ 1+?E//d;!22,,>>?QR=,,>>@9;MNFu//>=6{mDE//d; /  6	6--k:G 	6!!%"4"455	66s)   D" "E?.E/E;6E?:E;;E?c                   V ^8  d   QhRR/# r   r   r   r   r   r   r   r   r   W   s     "G "Gd "Gr   c                 sT   \         P                  ! \         P                  RR4       \        '       d)   \         P                  ! \         P                  RR4       R# \        P
                  '       d3   \        \        R\        P
                  4       \        \        RRR.4       \        P                  p \        V \        P                  4       \        '       gK   \        P                  pV F4  p V \        P                  8w  g   K  \        V R4       \        '       g   K4   M	  \        '       d,   R	V .p\         P                  ! \         P                  VR4       M(R
p\         P                  ! \         P                  VR4       \         P                  ! \         P                  RR4       R# )zInitializes the speech server.zSPEECH: InitializingTzSPEECH: Already initializedNspeechServerFactoryr   zDefault SynthesizerZdefaultz$SPEECH: Using speech server factory:zSPEECH: Not availablezSPEECH: Initialized)r   r   r    r   r   ZspeechSystemOverrideZsetattrr'   r$   r   ZspeechFactoryModulesr   )r   Zmodule_namesr"   r!   s       r   initr(   W   s&    
((*@$G}E,,.KTR
 $$$/1N1NO,/Di.PQ..KX%>%>?=44'Kh:::#K6 =	 ( }8+F5++VT:%E,,c48	((*?Fr   c               s     V ^8  d   QhRRRR/# )r   acssz3ACSS | dict[str, Any] | list[dict[str, Any]] | Noner   r   r   r   r   r   r   r   {   s     0 0L 0X\ 0r   c                s   \        V \        4      '       d8   V P                  V P                  4      p \	        V4      pWV P                  &   V # \        V \        4      '       d#   \        V 4      ^8X  d   \        V ^ ,          4      # \        V \        4      '       d   \        V 4      # \        P                  p\        V\        P                  ,          4      #   \
        \        3 d    \	        / 4      p Li ; i)i   )
isinstancer   getZFAMILYr   	TypeError
ValueErrorlistlenZdictr   voicesDEFAULT_VOICE)r)   Zfamilyr0   s   &  r   __resolve_acssr2   {   s    $$++&	% (F #T[[$#d)q.DG}$Dz__Fx--.// :& 	% _F	%s   C C65C6c               r   )r   utterance_iteratorr   progress_callbackzCallable[..., Any]r   r   r   r   r   r   r   r      s'     
B 
B 
B8J 
Bt 
Br   c                s    \         P                  '       d   R# \        '       d   \        P                  W4       R# V  F;  w  r#RVP                   R2p\
        P                  ! \
        P                  VR4       K=  	  R# )z+Speaks each item in the utterance_iterator.NSPEECH OUTPUT: ''T)r   silenceSpeechr   say_allZ	utterancer   r   r    )r3   r4   ZcontextZ_acsslog_liner#   r   r8   r8      sa     }0D 2W)'*;*;)<A>H 0 0(DA !3r   c               (    V ^8  d   QhRRRRRRRR/# )	r   textr   r)   ACSS | dict[str, Any] | None	interruptboolr   r   r   r   r   r   r   r      s)     9 9 98 9T 9d 9r   c                s`   \         '       g1   RV  RV 2p\        P                  ! \        P                  VR4       R# \	        \
        P                  P                  \
        P                  4      4      p VP                  \        V4      4       \        V4      pRV  RV 2p\        P                  ! \        P                  VR4       \         P                  WV4       R#   \        \        \        3 d9   pRT RT 2p\        P                  ! \        P                  TR4        Rp?LRp?ii ; i)z2Speaks the individual string using the given ACSS.r5   ' TNz&SPEECH: Exception updating voice with z: )r   r   r   r    r   r   r0   r+   r1   updater2   r,   r-   ZAttributeErrorspeak)r;   r)   r=   r9   Zvoiceerrorr!   Zresolved_voices   &&&     r   _speakrC      s     =%dV2dV4E,,h=$$X%;%;<=E9^D)*
 $E*NTF"^$4
5C	((#t4i8 z>2 96tfBugFE,,c4889s   4C D-5.D((D-c               r:   )	r   contentr   r)   r<   r=   r>   r   r   r   r   r   r   r   r      s*     ?0 ?03 ?0: ?0d ?0^b ?0r   c                s   \         P                  '       d   R# \        \        \        P
                  \        3pRp\        W4      '       g:   \        P                  ! \        P                  V\        V 4      ,           RR4       R# \        V \        4      '       d0   RV  RV 2p\        P                  ! \        P                  VR4       M,RV RV.p\        P                  ! \        P                  VR4       \        V \        4      '       d   \        WV4       \        V \        4      '       g   R# . pTpVe   \        V4      pV  EF  p	\        W4      '       g:   \        P                  ! \        P                  V\        V	4      ,           RR4       KN  \        V	\        4      '       d   \        WV4       Kr  \        V	\        4      '       d'   \        V	4      '       d   VP                  V	4       K  K  V'       g   K  \        V4      p
. p\        V	\        P
                  4      '       dJ   VR,          '       d:   VR,          R,          P!                  4       '       d   VR;;,          R,          uu&   M\        V	\        4      '       dl   V
P#                  V	4       Vf   T
pW8X  d   EKd  R	V
R
V.p\        P                  ! \        P                  VR4       VP                  VP%                  4       4       V'       d   RP'                  V4      p\        WV4       T
pTpEK  	  V'       d    RP'                  V4      p\        WV4       R# R# )zSpeaks the given content.  The content can be either a simple
string or an array of arrays of objects returned by a speech
generator.Nz$SPEECH: Bad content sent to speak():TzSPEECH: Speak 'z' acss: zSPEECH: Speakz, acss:Z.zSPEECH: New voicez != active voice i)r   r7   r   r.   r   ZPauser   r*   r   r   r    r   rC   rA   r/   ZappendZisalnumr@   ZpopZjoin)rD   r)   r=   Zvalid_typesrB   r!   r"   Zto_speakZactive_voiceZelementZ	new_voiceZnew_items_to_speakZstrings   &&&          r   rA   rA      sy   
 .44d;K2Eg++E,,ec'l.BD$O'3y7E,,c48!7It<5++VT:'3wi(gt$$HLDz'// 0 0%#g,2FdS&&'+%%7||( XT
I!#'#3#9#9::B<<HRL$4$<$<$>$>RLC'LGT**  )'#,L,-y:Ll[""5#3#3VTB"))(,,.9(+vY7$L)H9 < (#vY/ r   c               r   )r   eventzinput_event.KeyboardEventr)   r<   r   r   r   r   r   r   r   r      s&     3 3$3
&3 
3r   c                sT   \         P                  '       d   R# V P                  4       p\        V4      pV RV P	                  4        2pRVP                  4        RV 2p\        P                  ! \        P                  VR4       \        '       d   \        P                  W4       R# R# )z;Speaks event immediately using the voice specified by acss.NrE   r5   r?   T)r   r7   Zget_key_namer2   Zget_locking_state_stringZstripr   r   r    r   speak_key_event)rF   r)   Zkey_namer!   r9   r#   r   rG   rG      s     !!#H$DJa6689
:C!#))+b7H	(((D9}%%e2 r   c               r   )r   	characterr   r)   r<   r   r   r   r   r   r   r   r      s#     < <s <*F <RV <r   c                s    \         P                  '       d   R# \        V4      pRV  R2pW!.p\        P                  ! \        P
                  VR4       \        '       d   \        P                  WR7       R# R# )z?Speaks character immediately using the voice specified by acss.Nr5   r6   T)r)   )r   r7   r2   r   r   r    r   speak_character)rH   r)   r9   r"   s   &&  r   rI   rI      sf     $D!)A.HF	u''6}%%i%; r   c               r%   )r   r   r   r   r   r   r   r   r   
  s      ; r   c                 s    \         # )z"Returns the current speech server.r   r   r   r   r   r   
  s
     r   c               r%   r&   r   r   r   r   r   r     s       r   c                 s
    Rs R# )z>This is a sad workaround for the current global _speechserver.NrJ   r   r   r   deprecated_clear_serverrK     s	     Mr   )N)NT)%__conditional_annotations__Z__doc__Z
__future__r    Z__id__Z__version__Z__date__Z__copyright__Z__license__r   Ztypingr   r   r   Z r   r   r   r)   r   r   r   Ztypesr	   r
   r   Z__annotations__r$   r(   r2   r8   rC   rA   rG   rI   r   rK   )rL   s   @r   <module>rM      s   , 2 "?  / /     %  37/ 6#<J"GH0 
B9(?0B3"<
r   