
    τi2                     r   d Z dZdZdZddlZddlZ	 ddlmZ ej                  Zej                  Zej                  Zej                  Zej                  Zej                   Zej"                  Zej$                  Zej&                  Zej(                  Zej*                  Zej,                  Zej.                  Zej0                  Zej2                  Zej4                  Zej6                  Zej8                  Zej:                  Zej<                  Zej>                  Zej@                  Z ejB                  Z!ejD                  Z"ejF                  Z#ejH                  Z$ejJ                  Z%ejL                  Z&ejN                  Z'ejP                  Z(ejR                  Z)ejT                  Z*ejV                  Z+ejX                  Z,ejZ                  Z-ej\                  Z.ej^                  Z/ej`                  Z0ejb                  Z1ejd                  Z2ejf                  Z3ejh                  Z4ejj                  Z5ejl                  Z6ejn                  Z7ejp                  Z8ejr                  Z9ejt                  Z:ejv                  Z;ejx                  Z<ejz                  Z=ej|                  Z>ej~                  Z?ej                  Z@ej                  ZAej                  ZBej                  ZCej                  ZDej                  ZEd ZFddZGd	 ZHd
 ZI G d d      ZJ eKed      r G d dej                        ZM G d deJj                        ZNy# e	$ r
  e
d        w xY w)aZ  
PyAudio provides Python bindings for PortAudio, the cross-platform
audio I/O library. With PyAudio, you can easily use Python to play and
record audio on a variety of platforms.

.. include:: ../sphinx/examples.rst

Overview
--------

**Classes**
  :py:class:`PyAudio`, :py:class:`PyAudio.Stream`

.. only:: pamac

   **Host Specific Classes**
     :py:class:`PaMacCoreStreamInfo`

**Stream Conversion Convenience Functions**
  :py:func:`get_sample_size`, :py:func:`get_format_from_width`

**PortAudio version**
  :py:func:`get_portaudio_version`, :py:func:`get_portaudio_version_text`

.. |PaSampleFormat| replace:: :ref:`PortAudio Sample Format <PaSampleFormat>`
.. _PaSampleFormat:

**Portaudio Sample Formats**
  :py:data:`paFloat32`, :py:data:`paInt32`, :py:data:`paInt24`,
  :py:data:`paInt16`, :py:data:`paInt8`, :py:data:`paUInt8`,
  :py:data:`paCustomFormat`

.. |PaHostAPI| replace:: :ref:`PortAudio Host API <PaHostAPI>`
.. _PaHostAPI:

**PortAudio Host APIs**
  :py:data:`paInDevelopment`, :py:data:`paDirectSound`, :py:data:`paMME`,
  :py:data:`paASIO`, :py:data:`paSoundManager`, :py:data:`paCoreAudio`,
  :py:data:`paOSS`, :py:data:`paALSA`, :py:data:`paAL`, :py:data:`paBeOS`,
  :py:data:`paWDMKS`, :py:data:`paJACK`, :py:data:`paWASAPI`,
  :py:data:`paNoDevice`

.. |PaErrorCode| replace:: :ref:`PortAudio Error Code <PaErrorCode>`
.. _PaErrorCode:

**PortAudio Error Codes**
  :py:data:`paNoError`, :py:data:`paNotInitialized`,
  :py:data:`paUnanticipatedHostError`, :py:data:`paInvalidChannelCount`,
  :py:data:`paInvalidSampleRate`, :py:data:`paInvalidDevice`,
  :py:data:`paInvalidFlag`, :py:data:`paSampleFormatNotSupported`,
  :py:data:`paBadIODeviceCombination`, :py:data:`paInsufficientMemory`,
  :py:data:`paBufferTooBig`, :py:data:`paBufferTooSmall`,
  :py:data:`paNullCallback`, :py:data:`paBadStreamPtr`,
  :py:data:`paTimedOut`, :py:data:`paInternalError`,
  :py:data:`paDeviceUnavailable`,
  :py:data:`paIncompatibleHostApiSpecificStreamInfo`,
  :py:data:`paStreamIsStopped`, :py:data:`paStreamIsNotStopped`,
  :py:data:`paInputOverflowed`, :py:data:`paOutputUnderflowed`,
  :py:data:`paHostApiNotFound`, :py:data:`paInvalidHostApi`,
  :py:data:`paCanNotReadFromACallbackStream`,
  :py:data:`paCanNotWriteToACallbackStream`,
  :py:data:`paCanNotReadFromAnOutputOnlyStream`,
  :py:data:`paCanNotWriteToAnInputOnlyStream`,
  :py:data:`paIncompatibleStreamHostApi`

.. |PaCallbackReturnCodes| replace:: :ref:`PortAudio Callback Return Code <PaCallbackReturnCodes>`
.. _PaCallbackReturnCodes:

**PortAudio Callback Return Codes**
  :py:data:`paContinue`, :py:data:`paComplete`, :py:data:`paAbort`

.. |PaCallbackFlags| replace:: :ref:`PortAutio Callback Flag <PaCallbackFlags>`
.. _PaCallbackFlags:

**PortAudio Callback Flags**
  :py:data:`paInputUnderflow`, :py:data:`paInputOverflow`,
  :py:data:`paOutputUnderflow`, :py:data:`paOutputOverflow`,
  :py:data:`paPrimingOutput`
zHubert Phamz0.2.14zrestructuredtext en    Nz;Could not import the PyAudio C module 'pyaudio._portaudio'.c                 ,    t        j                  |       S )zReturns the size (in bytes) for the specified sample *format*.

    :param format: A |PaSampleFormat| constant.
    :raises ValueError: on invalid specified `format`.
    :rtype: integer
    paget_sample_size)formats    Z/home/obispo/Crisostomo_bridge/mision_env/lib/python3.12/site-packages/pyaudio/__init__.pyr   r      s     f%%    c                     | dk(  r|rt         S t        S | dk(  rt        S | dk(  rt        S | dk(  rt        S t        d|        )a*  Returns a PortAudio format constant for the specified *width*.

    :param width: The desired sample width in bytes (1, 2, 3, or 4)
    :param unsigned: For 1 byte width, specifies signed or unsigned format.

    :raises ValueError: when invalid *width*
    :rtype: A |PaSampleFormat| constant
                zInvalid width: )paUInt8paInt8paInt16paInt24	paFloat32
ValueError)widthunsigneds     r   get_format_from_widthr      sO     zNzzz
ug.
//r	   c                  *    t        j                         S )z0Returns portaudio version.

    :rtype: int
    )r   get_version r	   r   get_portaudio_versionr      s    
 >>r	   c                  *    t        j                         S )zDReturns PortAudio version as a text string.

    :rtype: string
    )r   get_version_textr   r	   r   get_portaudio_version_textr      s    
   r	   c                       e Zd ZdZ G d d      Zd Zd Zd ZddZd Z	d	 Z
d
 Zd Zd Zd Zd Zd Zd Zd Z	 	 	 	 	 	 ddZd Zd Zd Zd Zy)PyAudioa  Python interface to PortAudio.

    Provides methods to:
     - initialize and terminate PortAudio
     - open and close streams
     - query and inspect the available PortAudio Host APIs
     - query and inspect the available PortAudio audio devices.

    **Stream Management**
      :py:func:`open`, :py:func:`close`

    **Host API**
      :py:func:`get_host_api_count`, :py:func:`get_default_host_api_info`,
      :py:func:`get_host_api_info_by_type`,
      :py:func:`get_host_api_info_by_index`,
      :py:func:`get_device_info_by_host_api_device_index`

    **Device API**
      :py:func:`get_device_count`, :py:func:`is_format_supported`,
      :py:func:`get_default_input_device_info`,
      :py:func:`get_default_output_device_info`,
      :py:func:`get_device_info_by_index`

    **Stream Format Conversion**
      :py:func:`get_sample_size`, :py:func:`get_format_from_width`

    **Details**
    c            	           e Zd ZdZddddej
                  ddddf	dZd Zd Zd Z	d	 Z
d
 Zd Zd Zd Zd ZddZddZd Zd Zy)PyAudio.StreamaU  PortAudio Stream Wrapper. Use :py:func:`PyAudio.open` to instantiate.

        **Opening and Closing**
          :py:func:`__init__`, :py:func:`close`

        **Stream Info**
          :py:func:`get_input_latency`, :py:func:`get_output_latency`,
          :py:func:`get_time`, :py:func:`get_cpu_load`

        **Stream Management**
          :py:func:`start_stream`, :py:func:`stop_stream`, :py:func:`is_active`,
          :py:func:`is_stopped`

        **Input Output**
          :py:func:`write`, :py:func:`read`, :py:func:`get_read_available`,
          :py:func:`get_write_available`
        FNTc           	         |s|st        d      || _        || _        || _        |
| _        || _        || _        || _        |	| _        ||||||||	d}|r||d<   |r||d<   |r||d<   t        j                  di || _        | j                  j                  | _        | j                  j                  | _        | j                  r t        j                   | j                         yy)a  Initialize an audio stream.

            Do not call directly. Use :py:func:`PyAudio.open`.

            A stream can either be input, output, or both.

            :param PA_manager: A reference to the managing :py:class:`PyAudio`
                instance
            :param rate: Sampling rate
            :param channels: Number of channels
            :param format: Sampling size and format. See |PaSampleFormat|.
            :param input: Specifies whether this is an input stream.
                Defaults to ``False``.
            :param output: Specifies whether this is an output stream.
                Defaults to ``False``.
            :param input_device_index: Index of Input Device to use.
                Unspecified (or ``None``) uses default device.
                Ignored if `input` is ``False``.
            :param output_device_index:
                Index of Output Device to use.
                Unspecified (or ``None``) uses the default device.
                Ignored if `output` is ``False``.
            :param frames_per_buffer: Specifies the number of frames per buffer.
            :param start: Start the stream running immediately.
                Defaults to ``True``. In general, there is no reason to set
                this to ``False``.
            :param input_host_api_specific_stream_info: Specifies a host API
                specific stream information data structure for input.

                .. only:: pamac

                   See :py:class:`PaMacCoreStreamInfo`.

            :param output_host_api_specific_stream_info: Specifies a host API
                specific stream information data structure for output.

                .. only:: pamac

                   See :py:class:`PaMacCoreStreamInfo`.

            :param stream_callback: Specifies a callback function for
                *non-blocking* (callback) operation.  Default is
                ``None``, which indicates *blocking* operation (i.e.,
                :py:func:`PyAudio.Stream.read` and
                :py:func:`PyAudio.Stream.write`).  To use non-blocking
                operation, specify a callback that conforms to the following
                signature:

                .. code-block:: python

                   callback(in_data,      # input data if input=True; else None
                            frame_count,  # number of frames
                            time_info,    # dictionary
                            status_flags) # PaCallbackFlags

                ``time_info`` is a dictionary with the following keys:
                ``input_buffer_adc_time``, ``current_time``, and
                ``output_buffer_dac_time``; see the PortAudio
                documentation for their meanings.  ``status_flags`` is one
                of |PaCallbackFlags|.

                The callback must return a tuple:

                .. code-block:: python

                    (out_data, flag)

                ``out_data`` is a byte array whose length should be the
                (``frame_count * channels * bytes-per-channel``) if
                ``output=True`` or ``None`` if ``output=False``.  ``flag``
                must be either :py:data:`paContinue`, :py:data:`paComplete` or
                :py:data:`paAbort` (one of |PaCallbackReturnCodes|).
                When ``output=True`` and ``out_data`` does not contain at
                least ``frame_count`` frames, :py:data:`paComplete` is
                assumed for ``flag``.

                **Note:** ``stream_callback`` is called in a separate
                thread (from the main thread).  Exceptions that occur in
                the ``stream_callback`` will:

                1. print a traceback on standard error to aid debugging,
                2. queue the exception to be thrown (at some point) in
                   the main thread, and
                3. return `paAbort` to PortAudio to stop the stream.

                **Note:** Do not call :py:func:`PyAudio.Stream.read` or
                :py:func:`PyAudio.Stream.write` if using non-blocking operation.

                **See:** PortAudio's callback signature for additional
                details: http://portaudio.com/docs/v19-doxydocs/portaudio_8h.html#a8a60fb2a5ec9cbade3f54a9c978e2710

            :raise ValueError: Neither input nor output are set True.
            z'Must specify an input or output stream.)ratechannelsr   inputoutputinput_device_indexoutput_device_indexframes_per_buffer#input_host_api_specific_stream_info$output_host_api_specific_stream_infostream_callbackNr   )r   _parent	_is_input
_is_output_is_running_rate	_channels_format_frames_per_bufferr   open_streaminputLatency_input_latencyoutputLatency_output_latencystart_stream)self
PA_managerr$   r%   r   r&   r'   r(   r)   r*   startr+   r,   r-   	argumentss                  r   __init__zPyAudio.Stream.__init__)  s   V V !OPP%DL"DN$DO$DDJ%DN!DL&7D# $  &8':%6	I 3 8 9 4 9 : />	+, 77/Y/DL"&,,";";D#'<<#=#=D -  r	   c                     t        j                  | j                         d| _        | j                  j                  |        y)zCloses the stream.FN)r   closer7   r1   r.   _remove_streamr=   s    r   rC   zPyAudio.Stream.close  s,    HHT\\"$DLL''-r	   c                 .    | j                   j                  S )zBReturns the input latency.

            :rtype: float
            )r7   r8   rE   s    r   get_input_latencyz PyAudio.Stream.get_input_latency  s    
 <<,,,r	   c                 .    | j                   j                  S )zCReturns the output latency.

            :rtype: float
            )r7   r:   rE   s    r   get_output_latencyz!PyAudio.Stream.get_output_latency  s    
 <<---r	   c                 @    t        j                  | j                        S )z<Returns stream time.

            :rtype: float
            )r   get_stream_timer7   rE   s    r   get_timezPyAudio.Stream.get_time  s    
 %%dll33r	   c                 @    t        j                  | j                        S )zdReturn the CPU load. Always 0.0 when using the blocking API.

            :rtype: float
            )r   get_stream_cpu_loadr7   rE   s    r   get_cpu_loadzPyAudio.Stream.get_cpu_load  s    
 ))$,,77r	   c                 j    | j                   ryt        j                  | j                         d| _         y)zStarts the stream.NT)r1   r   r<   r7   rE   s    r   r<   zPyAudio.Stream.start_stream  s&    OODLL)#Dr	   c                 j    | j                   syt        j                  | j                         d| _         y)zStops the stream.NF)r1   r   stop_streamr7   rE   s    r   rR   zPyAudio.Stream.stop_stream  s&    ##NN4<<($Dr	   c                 @    t        j                  | j                        S )zLReturns whether the stream is active.

            :rtype: bool
            )r   is_stream_activer7   rE   s    r   	is_activezPyAudio.Stream.is_active  s    
 &&t||44r	   c                 @    t        j                  | j                        S )zMReturns whether the stream is stopped.

            :rtype: bool
            )r   is_stream_stoppedr7   rE   s    r   
is_stoppedzPyAudio.Stream.is_stopped  s    
 ''55r	   c                     | j                   st        dt              |9t        | j                        }t        t        |      | j                  |z  z        }t        j                  | j                  |||       y)a  Write samples to the stream for playback.

            Do not call when using non-blocking mode.

            :param frames:
               The frames of data.
            :param num_frames:
               The number of frames to write.
               Defaults to None, in which this value will be
               automatically computed.
            :param exception_on_underflow:
               Specifies whether an IOError exception should be thrown
               (or silently ignored) on buffer underflow. Defaults
               to False for improved performance, especially on
               slower platforms.

            :raises IOError: if the stream is not an output stream
               or if the write operation was unsuccessful.

            :rtype: `None`
            zNot output streamN)r0   IOError paCanNotWriteToAnInputOnlyStreamr   r4   intlenr3   r   write_streamr7   )r=   frames
num_framesexception_on_underflowr   s        r   writezPyAudio.Stream.write  sk    , ??1>@ @ !'5 V0F!GH
OODLL&*24r	   c                 |    | j                   st        dt              t        j                  | j
                  ||      S )a  Read samples from the stream.

            Do not call when using non-blocking mode.

            :param num_frames: The number of frames to read.
            :param exception_on_overflow:
               Specifies whether an IOError exception should be thrown
               (or silently ignored) on input buffer overflow. Defaults
               to True.
            :raises IOError: if stream is not an input stream
              or if the read operation was unsuccessful.
            :rtype: bytes
            zNot input stream)r/   rZ   "paCanNotReadFromAnOutputOnlyStreamr   read_streamr7   )r=   r`   exception_on_overflows      r   readzPyAudio.Stream.read)  s<     >>0@B B>>$,,
"79 9r	   c                 @    t        j                  | j                        S )zgReturn the number of frames that can be read without waiting.

            :rtype: integer
            )r   get_stream_read_availabler7   rE   s    r   get_read_availablez!PyAudio.Stream.get_read_available=  s    
 //==r	   c                 @    t        j                  | j                        S )zjReturn the number of frames that can be written without waiting.

            :rtype: integer
            )r   get_stream_write_availabler7   rE   s    r   get_write_availablez"PyAudio.Stream.get_write_availableD  s    
 00>>r	   )NFT)__name__
__module____qualname____doc__r   paFramesPerBufferUnspecifiedrA   rC   rG   rI   rL   rO   r<   rR   rU   rX   rb   rg   rj   rm   r   r	   r   Streamr"     ss    	, !!(,)-')'F'F9=:>%)V	.p	.	-	.	4	8	$	%	5	6 	4D	9(	>	?r	   rt   c                 J    t        j                          t               | _        y)zInitialize PortAudio.N)r   
initializeset_streamsrE   s    r   rA   zPyAudio.__init__M  s    
r	   c                     | j                   j                         D ]  }|j                           t               | _         t	        j
                          y)zTerminates PortAudio.

        :attention: Be sure to call this method for every instance of this
          object to release PortAudio resources.
        N)rx   copyrC   rw   r   	terminater=   streams     r   r{   zPyAudio.terminateR  s=     mm((* 	FLLN	 
r	   c                 ,    t        j                  |      S )zReturns the size (in bytes) for the specified sample `format`
        (a |PaSampleFormat| constant).

        :param format: A |PaSampleFormat| constant.
        :raises ValueError: Invalid specified `format`.
        :rtype: integer
        r   )r=   r   s     r   r   zPyAudio.get_sample_size`  s     !!&))r	   c                     t        ||      S )a>  Returns a PortAudio format constant for the specified `width`.

        :param width: The desired sample width in bytes (1, 2, 3, or 4)
        :param unsigned: For 1 byte width, specifies signed or unsigned format.

        :raises ValueError: for invalid `width`
        :rtype: A |PaSampleFormat| constant.
        )r   )r=   r   r   s      r   r   zPyAudio.get_format_from_widthj  s     %UH55r	   c                 n    t        j                  | g|i |}| j                  j                  |       |S )zOpens a new stream.

        See constructor for :py:func:`PyAudio.Stream.__init__` for parameter
        details.

        :returns: A new :py:class:`PyAudio.Stream`
        )r    rt   rx   add)r=   argskwargsr}   s       r   r6   zPyAudio.openw  s3     6t6v6&!r	   c                 ^    || j                   vrt        d| d      |j                          y)zCloses a stream. Use :py:func:`PyAudio.Stream.close` instead.

        :param stream: An instance of the :py:class:`PyAudio.Stream` object.
        :raises ValueError: if stream does not exist.
        zStream z
 not foundN)rx   r   rC   r|   s     r   rC   zPyAudio.close  s-     &wvhj9::r	   c                 X    || j                   v r| j                   j                  |       yy)zsRemoves a stream. (Internal)

        :param stream: An instance of the :py:class:`PyAudio.Stream` object.
        N)rx   remover|   s     r   rD   zPyAudio._remove_stream  s'    
 T]]"MM  ( #r	   c                 *    t        j                         S )zVReturns the number of available PortAudio Host APIs.

        :rtype: integer
        )r   get_host_api_countrE   s    r   r   zPyAudio.get_host_api_count  s    
 $$&&r	   c                 L    t        j                         }| j                  |      S )a  Returns a dictionary containing the default Host API parameters.

        The keys of the dictionary mirror the data fields of PortAudio's
        ``PaHostApiInfo`` structure.

        :raises IOError: if no default input device is available
        :rtype: dict
        )r   get_default_host_apiget_host_api_info_by_index)r=   default_host_api_indexs     r   get_default_host_api_infoz!PyAudio.get_default_host_api_info  s%     "$!8!8!:../EFFr	   c                 N    t        j                  |      }| j                  |      S )aj  Returns a dictionary containing the Host API parameters for the
        host API specified by the `host_api_type`. The keys of the
        dictionary mirror the data fields of PortAudio's ``PaHostApiInfo``
        structure.

        :param host_api_type: The desired |PaHostAPI|
        :raises IOError: for invalid `host_api_type`
        :rtype: dict
        )r   "host_api_type_id_to_host_api_indexr   )r=   host_api_typeindexs      r   get_host_api_info_by_typez!PyAudio.get_host_api_info_by_type  s%     55mD..u55r	   c                 L    | j                  |t        j                  |            S )ah  Returns a dictionary containing the Host API parameters for the
        host API specified by the `host_api_index`. The keys of the
        dictionary mirror the data fields of PortAudio's ``PaHostApiInfo``
        structure.

        :param host_api_index: The host api index
        :raises IOError: for invalid `host_api_index`
        :rtype: dict
        )_make_host_api_dictionaryr   get_host_api_info)r=   host_api_indexs     r   r   z"PyAudio.get_host_api_info_by_index  s(     --  02 	2r	   c                 V    t         j                  } |||      }| j                  |      S )a  Returns a dictionary containing the Device parameters for a
        given Host API's n'th device. The keys of the dictionary
        mirror the data fields of PortAudio's ``PaDeviceInfo`` structure.

        :param host_api_index: The Host API index number
        :param host_api_device_index: The n'th device of the host API
        :raises IOError: for invalid indices
        :rtype: dict
        )r   %host_api_device_index_to_device_indexget_device_info_by_index)r=   r   host_api_device_indexlong_method_namedevice_indexs        r   (get_device_info_by_host_api_device_indexz0PyAudio.get_device_info_by_host_api_device_index  s.     CC'8MN,,\::r	   c                     ||j                   |j                  |j                  |j                  |j                  |j
                  dS )z_Creates dictionary like PortAudio's ``PaHostApiInfo`` structure.

        :rtype: dict
        )r   structVersiontypenamedeviceCountdefaultInputDevicedefaultOutputDevice)r   r   r   r   r   r   )r=   r   host_api_structs      r   r   z!PyAudio._make_host_api_dictionary  sG     ,::#((#((*66"1"D"D#2#F#F
 	
r	   c                 *    t        j                         S )zLReturns the number of PortAudio Host APIs.

        :rtype: integer
        )r   get_device_countrE   s    r   r   zPyAudio.get_device_count  s    
 ""$$r	   Nc                     ||t        dt              i }|||d<   ||d<   ||d<   |||d<   ||d<   ||d<   t        j                  |fi |S )a5  Checks if specified device configuration is supported.

        Returns True if the configuration is supported; raises ValueError
        otherwise.

        :param rate:
           Specifies the desired rate (in Hz)
        :param input_device:
           The input device index. Specify ``None`` (default) for
           half-duplex output-only streams.
        :param input_channels:
           The desired number of input channels. Ignored if
           `input_device` is not specified (or ``None``).
        :param input_format:
           PortAudio sample format constant defined
           in this module
        :param output_device:
           The output device index. Specify ``None`` (default) for
           half-duplex input-only streams.
        :param output_channels:
           The desired number of output channels. Ignored if
           `input_device` is not specified (or ``None``).
        :param output_format:
           |PaSampleFormat| constant.

        :rtype: bool
        :raises ValueError: tuple containing (error string, |PaErrorCode|).
        z5Must specify stream format for input, output, or bothinput_deviceinput_channelsinput_formatoutput_deviceoutput_channelsoutput_format)r   paInvalidDevicer   is_format_supported)	r=   r$   r   r   r   r   r   r   r   s	            r   r   zPyAudio.is_format_supported  s    F M$9G! ! #%1F>"'5F#$%1F>"$&3F?#(7F$%&3F?#%%d5f55r	   c                 L    t        j                         }| j                  |      S )a  Returns the default input device parameters as a dictionary.

        The keys of the dictionary mirror the data fields of PortAudio's
        ``PaDeviceInfo`` structure.

        :raises IOError: No default input device available.
        :rtype: dict
        )r   get_default_input_devicer   r=   r   s     r   get_default_input_device_infoz%PyAudio.get_default_input_device_info#  s#     224,,\::r	   c                 L    t        j                         }| j                  |      S )a  Returns the default output device parameters as a dictionary.

        The keys of the dictionary mirror the data fields of PortAudio's
        ``PaDeviceInfo`` structure.

        :raises IOError: No default output device available.
        :rtype: dict
        )r   get_default_output_devicer   r   s     r   get_default_output_device_infoz&PyAudio.get_default_output_device_info/  s#     335,,\::r	   c                 L    | j                  |t        j                  |            S )a@  Returns the device parameters for device specified in `device_index`
        as a dictionary. The keys of the dictionary mirror the data fields of
        PortAudio's ``PaDeviceInfo`` structure.

        :param device_index: The device index
        :raises IOError: Invalid `device_index`.
        :rtype: dict
        )_make_device_info_dictionaryr   get_device_infor   s     r   r   z PyAudio.get_device_info_by_index;  s(     00|,. 	.r	   c                 \   |j                   }t        j                  d      }|dfD ]  }	 |j                  |      } n ||j                  ||j
                  |j                  |j                  |j                  |j                  |j                  |j                  |j                  dS #  Y xY w)z`Creates a dictionary like PortAudio's ``PaDeviceInfo`` structure.

        :rtype: dict
        F)do_setlocalezutf-8)r   r   r   hostApimaxInputChannelsmaxOutputChannelsdefaultLowInputLatencydefaultLowOutputLatencydefaultHighInputLatencydefaultHighOutputLatencydefaultSampleRate)r   localegetpreferredencodingdecoder   r   r   r   r   r   r   r   r   )r=   r   device_infodevice_nameos_encodingcodecs         r   r   z$PyAudio._make_device_info_dictionaryH  s    
 "&& 11uE!7+ 	E)007	 !,!:!:#&..$/$@$@%0%B%B22333344--/ 	/s   B''B+rn   )NNNNNN)ro   rp   rq   rr   rt   rA   r{   r   r   r6   rC   rD   r   r   r   r   r   r   r   r   r   r   r   r   r   r	   r   r    r       s    :r? r?l	

*	6
	)'
G62; 
"% *.+/)-*.,0*.36j
;
;. /r	   r    paMacCoreStreamInfoc                   >    e Zd ZdZej
                  Zej                  Zej                  Zej                  Zej                  Z	ej                  Z
ej                  Zej                  Zej                  Zej                  Zej                  Zd fd	Zd Zd Zd Z xZS )PaMacCoreStreamInfoaR  PortAudio Host API Specific Stream Info for macOS-specific settings.

        To configure macOS-specific settings, instantiate this class and pass
        it as the argument in :py:func:`PyAudio.open` to parameters
        ``input_host_api_specific_stream_info`` or
        ``output_host_api_specific_stream_info``.  (See
        :py:func:`PyAudio.Stream.__init__`.)

        :note: macOS-only.

        .. |PaMacCoreFlags| replace:: :ref:`PortAudio Mac Core Flags <PaMacCoreFlags>`
        .. _PaMacCoreFlags:

        **PortAudio Mac Core Flags**
          :py:data:`paMacCoreChangeDeviceParameters`,
          :py:data:`paMacCoreFailIfConversionRequired`,
          :py:data:`paMacCoreConversionQualityMin`,
          :py:data:`paMacCoreConversionQualityMedium`,
          :py:data:`paMacCoreConversionQualityLow`,
          :py:data:`paMacCoreConversionQualityHigh`,
          :py:data:`paMacCoreConversionQualityMax`,
          :py:data:`paMacCorePlayNice`,
          :py:data:`paMacCorePro`,
          :py:data:`paMacCoreMinimizeCPUButPlayNice`,
          :py:data:`paMacCoreMinimizeCPU`

        .. attribute:: flags

           The flags specified to the constructor.

           :type: |PaMacCoreFlags|

        .. attribute:: channel_map

           The channel_map specified to the constructor

           :type: tuple or None if unspecified
        c                 D    i }|||d<   |||d<   t        |   di | y)aL  Initialize with macOS setting flags and channel_map.

            See PortAudio documentation for more details on these parameters.

            :param flags: |PaMacCoreFlags| OR'ed together.
            :param channel_map: An array describing the channel mapping.
                See PortAudio documentation for usage.
            Nflagschannel_mapr   )superrA   )r=   r   r   r   	__class__s       r   rA   zPaMacCoreStreamInfo.__init__  s9     F "'w&(3}%G&v&r	   c                 R    t        j                  dt        d       | j                  S )zReturns the flags set at instantiation. Deprecated.

            :rtype: integer

            .. deprecated:: 0.2.13
               Use :py:attr:`flags` property.
            zLPaMacCoreStreamInfo.get_flags is deprecated. Use the flags property instead.r   
stacklevel)warningswarnDeprecationWarningr   rE   s    r   	get_flagszPaMacCoreStreamInfo.get_flags  s'     MM$"	
 ::r	   c                 R    t        j                  dt        d       | j                  S )zReturns the channel map set at instantiation. Deprecated.

            :rtype: tuple or None

            .. deprecated:: 0.2.13
               Use :py:attr:`channel_map` property.
            zXPaMacCoreStreamInfo.get_channel_map is deprecated. Use the channel_map property instead.r   r   )r   r   r   r   rE   s    r   get_channel_mapz#PaMacCoreStreamInfo.get_channel_map  s)     MM0"	
 ###r	   c                 >    t        j                  dt        d       | S )z~Returns the underyling stream info.

            .. :deprecated:: 0.2.13
               Use stream_info property.
            z`PaMacCoreStreamInfo._get_host_api_stream_object is deprecated. Use this object instance instead.r   r   )r   r   r   rE   s    r   _get_host_api_stream_objectz/PaMacCoreStreamInfo._get_host_api_stream_object  s#     MM@"	
 Kr	   )NN)ro   rp   rq   rr   r   paMacCoreChangeDeviceParameters!paMacCoreFailIfConversionRequiredpaMacCoreConversionQualityMin paMacCoreConversionQualityMediumpaMacCoreConversionQualityLowpaMacCoreConversionQualityHighpaMacCoreConversionQualityMaxpaMacCorePlayNicepaMacCorePropaMacCoreMinimizeCPUButPlayNicepaMacCoreMinimizeCPUrA   r   r   r   __classcell__r   s   @r   r   r   n  s    %	L +-*L*L',.,P,P)(*(H(H%+-+N+N((*(H(H%)+)J)J&(*(H(H%00*,*L*L'!66	'$		$	r	   r   c                   "     e Zd ZdZ fdZ xZS )rt   zReserved. Do not instantiate.c                 \    t        j                  dt        d       t        |   |i | y )NzDo not instantiate pyaudio.Stream directly. Use pyaudio.PyAudio.open() instead. pyaudio.Stream may change or be removed in the future.r   r   )r   r   r   r   rA   )r=   r   r   r   s      r   rA   zStream.__init__  s0    % 	 	$)&)r	   )ro   rp   rq   rr   rA   r   r   s   @r   rt   rt     s    '* *r	   rt   rn   )Orr   
__author____version____docformat__r   r   pyaudio._portaudio
_portaudior   ImportErrorprintr   paInt32r   r   r   r   paCustomFormatpaInDevelopmentpaDirectSoundpaMMEpaASIOpaSoundManagerpaCoreAudiopaOSSpaALSApaALpaBeOSpaWDMKSpaJACKpaWASAPI
paNoDevice	paNoErrorpaNotInitializedpaUnanticipatedHostErrorpaInvalidChannelCountpaInvalidSampleRater   paInvalidFlagpaSampleFormatNotSupportedpaBadIODeviceCombinationpaInsufficientMemorypaBufferTooBigpaBufferTooSmallpaNullCallbackpaBadStreamPtr
paTimedOutpaInternalErrorpaDeviceUnavailable'paIncompatibleHostApiSpecificStreamInfopaStreamIsStoppedpaStreamIsNotStoppedpaInputOverflowedpaOutputUnderflowedpaHostApiNotFoundpaInvalidHostApipaCanNotReadFromACallbackStreampaCanNotWriteToACallbackStreamrd   r[   paIncompatibleStreamHostApi
paContinue
paCompletepaAbortpaInputUnderflowpaInputOverflowpaOutputUnderflowpaOutputOverflowpaPrimingOutputrs   r   r   r   r   r    hasattrr   r   rt   r   r	   r   <module>r(     s   .N` 
%  
# LL	
**
**
**	
**"" $$  
	""nn
		ww	
**	;;]]
 LL	&& 66 00 ,, $$  :: 66 .. ""&& """"]]
$$,, .. ((( .. (( ,, (( && "$"D"D !#!B!B %'%J%J "#%#F#F   <<  ]]
]]

** && $$(( && $$  ">> 
&02!o	/ o	/h 2$%nb44 np*W^^ *m  
	
GH	
s   L' 'L6