
    Pi                     ,    d Z ddlZ G d d          ZdS )z.Voice struct from Espeak API exposed to Python    Nc                       e Zd ZdZddededefdZed             Zed             Zed	             Z	ddZ
d Z G d dej                  Zd Zedefd            ZdS )EspeakVoicez=A helper class to expose voice structures within C and Python namelanguage
identifierc                 0    || _         || _        || _        d S N)_name	_language_identifier)selfr   r   r   s       s/home/jaya/work/projects/VOICE-AGENT/VIET/agent-env/lib/python3.11/site-packages/phonemizer/backend/espeak/voice.py__init__zEspeakVoice.__init__   s    
!%    c                     | j         S )z
Voice name)r   r   s    r   r   zEspeakVoice.name   s     zr   c                     | j         S )zLanguage code)r   r   s    r   r   zEspeakVoice.language#   s     ~r   c                     | j         S )z+Path to the voice file wrt espeak data path)r   r   s    r   r   zEspeakVoice.identifier(   s     r   otherc                 b    | j         |j         k    o| j        |j        k    o| j        |j        k    S r
   r   r   r   )r   r   s     r   __eq__zEspeakVoice.__eq__-   s6    	UZ' 4/45#33	5r   c                 D    t          | j        | j        | j        f          S r
   )hashr   r   r   r   s    r   __hash__zEspeakVoice.__hash__3   s    TYt?@@@r   c                   F    e Zd ZdZdej        fdej        fdej        fgZdS )EspeakVoice.VoiceStructa  A helper class to fetch voices information from the espeak library.

        The espeak_VOICE struct is defined in speak_lib.h from the espeak code.
        Here we use only name (voice name), languages (language code) and
        identifier (voice file) information.

        r   	languagesr   N)__name__
__module____qualname____doc__ctypesc_char_p_fields_ r   r   VoiceStructr   6   s?        	 	 V_%&/*6?+-r   r(   c                     |                      | j        r| j                            d          nd| j        r| j                            d          nd| j        r| j                            d          nd          S )z:Converts the Voice instance to  an espeak ctypes structureutf8N)r(   r   encoder   r   r   s    r   	to_ctypeszEspeakVoice.to_ctypesC   sz    (,	;DIV$$$t,0MCDM  (((t.2oGDO""6***4I I 	Ir   structc                      | |j         pd                                |j        pd                                dd         |j        pd                                          S )z>Returns a Voice instance built from an espeak ctypes structurer      0   Nr   )r   decoder   r   )clsr-   s     r   from_ctypeszEspeakVoice.from_ctypesJ   sj     s+$,,..&.$6688<)0S88::	< < < 	<r   N)r   r   r   )r   r   )r    r!   r"   r#   strr   propertyr   r   r   r   r   r$   	Structurer(   r,   classmethodr3   r'   r   r   r   r      s%       GG& &S & &s & & & &
   X   X     X 5 5 5 5A A A- - - - -f& - - -I I I < < < < [< < <r   r   )r#   r$   r   r'   r   r   <module>r8      sH    5 4 
;< ;< ;< ;< ;< ;< ;< ;< ;< ;<r   