
    ujhu	                         d Z ddlmZmZ ddlZej
                  j                         ZdefdZ	defdZ
defd	Zd
efdZdeeef   fdZdee   fdZdee   fdZdefdZy)zModule to change the configuration of libsox, which is used by I/O functions like
:py:mod:`~torchaudio.backend.sox_io_backend` and :py:mod:`~torchaudio.sox_effects`.
    )DictListNseedc                 .    t         j                  |        y)zSet libsox's PRNG

    Args:
        seed (int): seed value. valid range is int32.

    See Also:
        http://sox.sourceforge.net/sox.html
    N)sox_extset_seed)r   s    X/var/www/html/dev/engine/venv/lib/python3.12/site-packages/torchaudio/utils/sox_utils.pyr   r      s     T    	verbosityc                 .    t         j                  |        y)aD  Set libsox's verbosity

    Args:
        verbosity (int): Set verbosity level of libsox.

            * ``1`` failure messages
            * ``2`` warnings
            * ``3`` details of processing
            * ``4``-``6`` increasing levels of debug messages

    See Also:
        http://sox.sourceforge.net/sox.html
    N)r   set_verbosity)r   s    r	   r   r      s     )$r
   buffer_sizec                 .    t         j                  |        y)zSet buffer size for sox effect chain

    Args:
        buffer_size (int): Set the size in bytes of the buffers used for processing audio.

    See Also:
        http://sox.sourceforge.net/sox.html
    N)r   set_buffer_size)r   s    r	   r   r   )   s     K(r
   use_threadsc                 .    t         j                  |        y)a>  Set multithread option for sox effect chain

    Args:
        use_threads (bool): When ``True``, enables ``libsox``'s parallel effects channels processing.
            To use mutlithread, the underlying ``libsox`` has to be compiled with OpenMP support.

    See Also:
        http://sox.sourceforge.net/sox.html
    N)r   set_use_threads)r   s    r	   r   r   5   s     K(r
   returnc                  <    t        t        j                               S )zxList the available sox effect names

    Returns:
        Dict[str, str]: Mapping from ``effect name`` to ``usage``
    )dictr   list_effects r
   r	   r   r   B   s     $$&''r
   c                  *    t         j                         S )zoList the supported audio formats for read

    Returns:
        List[str]: List of supported audio formats
    )r   list_read_formatsr   r
   r	   r   r   K   s     $$&&r
   c                  *    t         j                         S )zpList the supported audio formats for write

    Returns:
        List[str]: List of supported audio formats
    )r   list_write_formatsr   r
   r	   r   r   T   s     %%''r
   c                  *    t         j                         S )zxGet buffer size for sox effect chain

    Returns:
        int: size in bytes of buffers used for processing audio.
    )r   get_buffer_sizer   r
   r	   r   r   ]   s     ""$$r
   )__doc__typingr   r   
torchaudio
_extensionlazy_import_sox_extr   intr   r   r   boolr   strr   r   r   r   r   r
   r	   <module>r'      s     



3
3
5	3 	%S %"	) 	)
) 
)(d38n ('49 '(DI (% %r
   