o
    %Æ&iÔ  ã                   @   s`   d Z ddlmZ ddlmZ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-Multi-library, cross-platform audio decoding.é   )Úffdec)ÚDecodeErrorÚNoBackendError)Ú	AudioFilec               	   C   st   zddl } W n
 ty   Y dS w z|  dd¡ W n ttfy%   Y dS w z	ddlm} W dS  ty9   Y dS w )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   ú=C:\wamp64\www\opt\env\Lib\site-packages\audioread/__init__.pyÚ_gst_available   s    ÿÿýÿr   c                  C   s   ddl } | j d¡}|du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 dS  ty   Y dS w )z4Determines whether the pymad bindings are available.r   NFT)Úmadr	   )r   r   r   r   Ú_mad_available5   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ƒ r=ddlm} | |j¡ t ¡ rG| 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_backendsC   s"   r   Nc              	   C   s>   |du rt ƒ }|D ]}z|| ƒW   S  ty   Y q	w tƒ ‚)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   )ÚpathÚbackendsZBackendClassr   r   r   Ú
audio_openk   s   ÿr!   )F)N)Ú__doc__r   r   Ú
exceptionsr   r   Úbaser   r   r   r   r   r   r!   r   r   r   r   Ú<module>   s   	
(