U
    -e                     @   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-Multi-library, cross-platform audio decoding.   )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   S/var/www/html/Darija-Ai-Train/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)ctypes.utilutil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   )path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   	
(