
    Fd5                     Z    d Z ddlZddlZddlmZ ddlmZ ddlmZ  G d de          Z	dS )z!Base class for all voice classes.    N)Lock)Config)AbstractSingletonc                       e Zd ZdZdefdZddededefdZ	e
j        dd
            Ze
j        ddededefd            Zd	S )	VoiceBasez+
    Base class for all voice classes.
    configc                     d| _         d| _        d| _        g | _        t	                      | _        |                     |           dS )z-
        Initialize the voice class.
        N)_url_headers_api_key_voicesr   _mutex_setup)selfr   s     GC:\Users\Administrator\Downloads\Auto-GPT-master\autogpt\speech\base.py__init__zVoiceBase.__init__   sC     	ffF    r   textvoice_indexreturnc                     t          j        dd|          }| j        5  |                     ||          cddd           S # 1 swxY w Y   dS )z
        Say the given text.

        Args:
            text (str): The text to say.
            voice_index (int): The index of the voice to use.
        z]\b(?:https?://[-\w_.]+/?\w[-\w_.]*\.(?:[-\w_.]+/?\w[-\w_.]*\.)?[a-z]+(?:/[-\w_.%]+)*\b(?!\.)) N)resubr   _speechr   r   r   s      r   sayzVoiceBase.say   s     vl
 

 [ 	3 	3<<k22	3 	3 	3 	3 	3 	3 	3 	3 	3 	3 	3 	3 	3 	3 	3 	3 	3 	3s   AAANc                     dS )z1
        Setup the voices, API key, etc.
        N )r   s    r   r   zVoiceBase._setup*         r   c                     dS )z_
        Play the given text.

        Args:
            text (str): The text to play.
        Nr   r   s      r   r   zVoiceBase._speech0   r    r   )r   )r   N)__name__
__module____qualname____doc__r   r   strintboolr   abcabstractmethodr   r   r   r   r   r   r   
   s         	v 	 	 	 	3 3 3# 3d 3 3 3 3  	   
 	 C c $      r   r   )
r%   r)   r   	threadingr   autogpt.configr   autogpt.singletonr   r   r   r   r   <module>r.      s    ' ' 



 				       ! ! ! ! ! ! / / / / / /- - - - -! - - - - -r   