U
    Ä¶öbî  ã                   @   sl   d Z ddlmZ ddlmZmZ ddlmZ ddlm	Z	 dd„ Z
dd	„ Zd
d„ Zg Zddd„Zddd„ZdS )zDecode audio files.é   )Úffdec)ÚDecodeErrorÚNoBackendError)Úversion)Ú	AudioFilec               	   C   s|   zddl } W n tk
r"   Y dS X z|  dd¡ W n ttfk
rN   Y dS X zddlm} W n tk
rv   Y dS X dS )zSDetermine whether Gstreamer and the Python GObject bindings are
    installed.
    é    NFÚGstz1.0)r   T)ÚgiÚImportErrorZrequire_versionÚ
ValueErrorÚAttributeErrorZgi.repositoryr   )r	   r   © r   úR/var/www/html/UseVoiceDocker/env/lib/python3.8/site-packages/audioread/__init__.pyÚ_gst_available   s    r   c                  C   s   ddl } | j d¡}|dk	S )zUDetermines whether CoreAudio is available (i.e., we're running on
    Mac OS X).
    r   NZAudioToolbox)Zctypes.utilÚutilZfind_library)ÚctypesÚlibr   r   r   Ú_ca_available-   s    r   c                  C   s,   zddl } W n tk
r"   Y dS X dS dS )z4Determines whether the pymad bindings are available.r   NFT)Úmadr
   )r   r   r   r   Ú_mad_available6   s
    r   Fc                 C   sž   t r| st S ddlm} |jg}tƒ r>ddlm} | |j¡ tƒ r\ddlm	} | |j
¡ tƒ rzddlm} | |j¡ t ¡ rŽ| tj¡ |t dd…< t S )a   Returns a list of backends that are available on this system.

    The list of backends is cached after the first call.
    If the parameter `flush_cache` is set to `True`, then the cache
    will be flushed and the backend list will be reconstructed.
    r   )Úrawread)Úmacca)Úgstdec)ÚmaddecN)ÚBACKENDSÚ r   ZRawAudioFiler   r   ÚappendZExtAudioFiler   r   ZGstAudioFiler   r   ZMadAudioFiler   Ú	availableZFFmpegAudioFile)Zflush_cacher   Úresultr   r   r   r   r   r   Úavailable_backendsD   s"    r   Nc              	   C   sF   |dkrt ƒ }|D ](}z|| ƒW   S  tk
r8   Y qX qtƒ ‚dS )a$  Open an audio file using a library that is available on this
    system.

    The optional `backends` parameter can be a list of audio file
    classes to try opening the file with. If it is not provided,
    `audio_open` tries all available backends. If you call this function
    many times, you can avoid the cost of checking for available
    backends every time by calling `available_backends` once and passing
    the result to each `audio_open` call.

    If all backends fail to read the file, a NoBackendError exception is
    raised.
    N)r   r   r   )ÚpathZbackendsZBackendClassr   r   r   Ú
audio_openl   s    r!   )F)N)Ú__doc__r   r   Ú
exceptionsr   r   r   Ú__version__Úbaser   r   r   r   r   r   r!   r   r   r   r   Ú<module>   s   	
(