
    rHJj                     $    d Z ddlZ G d d      Zy)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y)EspeakVoicez=A helper class to expose voice structures within C and Pythonnamelanguage
identifierc                 .    || _         || _        || _        y N)_name	_language_identifier)selfr   r   r   s       i/Users/ahmed/devFolder/claude-voice/.venv/lib/python3.12/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     zz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   c                     | j                   |j                   k(  xr4 | j                  |j                  k(  xr | j                  |j                  k(  S r	   r   r   r   )r   others     r   __eq__zEspeakVoice.__eq__-   sC    		UZZ' 4/45#3#33	5r   c                 Z    t        | j                  | j                  | j                  f      S r	   )hashr   r   r   r   s    r   __hash__zEspeakVoice.__hash__3   s     TYYt?@@r   c                   b    e Zd ZdZdej
                  fdej
                  fdej
                  fgZy)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   s4    	 V__%&//*6??+-r   r'   c                    | j                  | j                  r| j                  j                  d      nd| j                  r| j                  j                  d      nd| j                  r| j                  j                  d            S 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   sv    (,		DIIV$t,0MMDMM  (t.2ooDOO""6*I 	I DHI 	Ir   structc                      | |j                   xs dj                         |j                  xs dj                         dd |j                  xs dj                               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   s[     ++$,,.&&.$668<))0S88:	< 	<r   N) r3   r3   )r   r   )r   r    r!   r"   strr   propertyr   r   r   r   r   r#   	Structurer'   r+   classmethodr2   r&   r   r   r   r      s    G&S & &s &
        5A-f&& -I < < <r   r   )r"   r#   r   r&   r   r   <module>r8      s    5 
;< ;<r   