
    h2                        S r SrSrSrSSKrSSKr SSKJr  \R                  r\R                  r\R                  r\R                  r\R                  r\R                   r\R"                  r\R$                  r\R&                  r\R(                  r\R*                  r\R,                  r\R.                  r\R0                  r\R2                  r\R4                  r\R6                  r\R8                  r\R:                  r\R<                  r\R>                  r\R@                  r \RB                  r!\RD                  r"\RF                  r#\RH                  r$\RJ                  r%\RL                  r&\RN                  r'\RP                  r(\RR                  r)\RT                  r*\RV                  r+\RX                  r,\RZ                  r-\R\                  r.\R^                  r/\R`                  r0\Rb                  r1\Rd                  r2\Rf                  r3\Rh                  r4\Rj                  r5\Rl                  r6\Rn                  r7\Rp                  r8\Rr                  r9\Rt                  r:\Rv                  r;\Rx                  r<\Rz                  r=\R|                  r>\R~                  r?\R                  r@\R                  rA\R                  rB\R                  rC\R                  rD\R                  rES rFSS jrGS	 rHS
 rI " S S5      rJ\K" \S5      (       a   " S S\R                  5      rM " S S\JR                  5      rNg! \	 a
    \
" S5        e f = f)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                 .    [         R                  " U 5      $ )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    Y/home/james-whalen/eden_hybrid_phi/.venv/lib/python3.13/site-packages/pyaudio/__init__.pyr   r      s     f%%    c                     U S:X  a  U(       a  [         $ [        $ U S:X  a  [        $ U S:X  a  [        $ U S:X  a  [        $ [        SU  35      e)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                  ,    [         R                  " 5       $ )z(Returns portaudio version.

:rtype: int
)r   get_version r	   r   get_portaudio_versionr      s    
 >>r	   c                  ,    [         R                  " 5       $ )z<Returns PortAudio version as a text string.

:rtype: string
)r   get_version_textr   r	   r   get_portaudio_version_textr      s    
   r	   c                       \ rS rSrSr " S S5      rS rS rS rSS jr	S	 r
S
 rS rS rS rS rS rS rS rS r      SS jrS rS rS rS rSrg)PyAudio   a7  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            	           \ rS rSrSrSSSS\R                  SSSS4	S jrS rS r	S	 r
S
 rS rS rS rS rS rSS jrSS jrS rS rSrg)PyAudio.Streami  a  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           	         U(       d  U(       d  [        S5      eXl        XPl        X`l        Xl        X l        X0l        X@l        Xl        UUUUUUUU	S.nU(       a  UUS'   U(       a  UUS'   U(       a  XS'   [        R                  " S0 UD6U l        U R                  R                  U l        U R                  R                  U l        U R                  (       a!  [        R                   " U R                  5        gg)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__PyAudio.Stream.__init__)  s    V V !OPP%L"N$O$J%N!L&7# $  &8':%6	I 3 8 9 4 9 : />+, 77/Y/DL"&,,";";D#'<<#=#=D -  r	   c                     [         R                  " U R                  5        SU l        U R                  R                  U 5        g)zCloses the stream.FN)r   closer8   r2   r/   _remove_streamr>   s    r   rE   PyAudio.Stream.close  s,    HHT\\"$DLL''-r	   c                 .    U R                   R                  $ )z*Returns the input latency.

:rtype: float
)r8   r9   rG   s    r   get_input_latency PyAudio.Stream.get_input_latency  s    
 <<,,,r	   c                 .    U R                   R                  $ )z+Returns the output latency.

:rtype: float
)r8   r;   rG   s    r   get_output_latency!PyAudio.Stream.get_output_latency  s    
 <<---r	   c                 B    [         R                  " U R                  5      $ )z$Returns stream time.

:rtype: float
)r   get_stream_timer8   rG   s    r   get_timePyAudio.Stream.get_time  s    
 %%dll33r	   c                 B    [         R                  " U R                  5      $ )zLReturn the CPU load. Always 0.0 when using the blocking API.

:rtype: float
)r   get_stream_cpu_loadr8   rG   s    r   get_cpu_loadPyAudio.Stream.get_cpu_load  s    
 ))$,,77r	   c                 v    U R                   (       a  g[        R                  " U R                  5        SU l         g)zStarts the stream.NT)r2   r   r=   r8   rG   s    r   r=   PyAudio.Stream.start_stream  s&    OODLL)#Dr	   c                 v    U R                   (       d  g[        R                  " U R                  5        SU l         g)zStops the stream.NF)r2   r   stop_streamr8   rG   s    r   rZ   PyAudio.Stream.stop_stream  s&    ##NN4<<($Dr	   c                 B    [         R                  " U R                  5      $ )z4Returns whether the stream is active.

:rtype: bool
)r   is_stream_activer8   rG   s    r   	is_activePyAudio.Stream.is_active  s    
 &&t||44r	   c                 B    [         R                  " U R                  5      $ )z5Returns whether the stream is stopped.

:rtype: bool
)r   is_stream_stoppedr8   rG   s    r   
is_stoppedPyAudio.Stream.is_stopped  s    
 ''55r	   c                    U R                   (       d  [        S[        5      eUc9  [        U R                  5      n[        [        U5      U R                  U-  -  5      n[        R                  " U R                  XU5        g)aN  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)r1   IOError paCanNotWriteToAnInputOnlyStreamr   r5   intlenr4   r   write_streamr8   )r>   frames
num_framesexception_on_underflowr   s        r   writePyAudio.Stream.write  si    , ??1>@ @ !'5 V0F!GH
OODLL&24r	   c                     U R                   (       d  [        S[        5      e[        R                  " U R
                  UU5      $ )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)r0   re   "paCanNotReadFromAnOutputOnlyStreamr   read_streamr8   )r>   rk   exception_on_overflows      r   readPyAudio.Stream.read)  s<     >>0@B B>>$,,
"79 9r	   c                 B    [         R                  " U R                  5      $ )zOReturn the number of frames that can be read without waiting.

:rtype: integer
)r   get_stream_read_availabler8   rG   s    r   get_read_available!PyAudio.Stream.get_read_available=  s    
 //==r	   c                 B    [         R                  " U R                  5      $ )zRReturn the number of frames that can be written without waiting.

:rtype: integer
)r   get_stream_write_availabler8   rG   s    r   get_write_available"PyAudio.Stream.get_write_availableD  s    
 00>>r	   )r4   r5   r6   r:   r0   r1   r2   r<   r/   r3   r8   )NFT)__name__
__module____qualname____firstlineno____doc__r   paFramesPerBufferUnspecifiedrB   rE   rJ   rM   rQ   rU   r=   rZ   r^   rb   rm   rs   rw   r{   __static_attributes__r   r	   r   Streamr#     ss    	, !!(,)-')'F'F9=:>%)V	.p	.	-	.	4	8	$	%	5	6 	4D	9(	>	?r	   r   c                 L    [         R                  " 5         [        5       U l        g)zInitialize PortAudio.N)r   
initializeset_streamsrG   s    r   rB   PyAudio.__init__M  s    
r	   c                     U R                   R                  5        H  nUR                  5         M     [        5       U l         [        R
                  " 5         g)zTerminates PortAudio.

:attention: Be sure to call this method for every instance of this
  object to release PortAudio resources.
N)r   copyrE   r   r   	terminater>   streams     r   r   PyAudio.terminateR  s8     mm((*FLLN + 
r	   c                 .    [         R                  " U5      $ )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   PyAudio.get_sample_size`  s     !!&))r	   c                     [        X5      $ )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   PyAudio.get_format_from_widthj  s     %U55r	   c                 p    [         R                  " U /UQ70 UD6nU R                  R                  U5        U$ )zOpens a new stream.

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

:returns: A new :py:class:`PyAudio.Stream`
)r    r   r   add)r>   argskwargsr   s       r   r7   PyAudio.openw  s3     6t6v6&!r	   c                 `    XR                   ;  a  [        SU S35      eUR                  5         g)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)r   r   rE   r   s     r   rE   PyAudio.close  s+     &wvhj9::r	   c                 Z    XR                   ;   a  U R                   R                  U5        gg)zcRemoves a stream. (Internal)

:param stream: An instance of the :py:class:`PyAudio.Stream` object.
N)r   remover   s     r   rF   PyAudio._remove_stream  s%    
 ]]"MM  ( #r	   c                 ,    [         R                  " 5       $ )zFReturns the number of available PortAudio Host APIs.

:rtype: integer
)r   get_host_api_countrG   s    r   r   PyAudio.get_host_api_count  s    
 $$&&r	   c                 N    [         R                  " 5       nU R                  U5      $ )zReturns 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_info!PyAudio.get_default_host_api_info  s%     "$!8!8!:../EFFr	   c                 P    [         R                  " U5      nU R                  U5      $ )a2  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_type!PyAudio.get_host_api_info_by_type  s%     55mD..u55r	   c                 N    U R                  U[        R                  " U5      5      $ )a0  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   "PyAudio.get_host_api_info_by_index  s(     --  02 	2r	   c                 T    [         R                  nU" X5      nU R                  U5      $ )aY  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_index0PyAudio.get_device_info_by_host_api_device_index  s+     CC'N,,\::r	   c                     UUR                   UR                  UR                  UR                  UR                  UR
                  S.$ )zOCreates 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   !PyAudio._make_host_api_dictionary  sG     ,::#((#((*66"1"D"D#2#F#F
 	
r	   c                 ,    [         R                  " 5       $ )z<Returns the number of PortAudio Host APIs.

:rtype: integer
)r   get_device_countrG   s    r   r   PyAudio.get_device_count  s    
 ""$$r	   Nc                     Uc  Uc  [        S[        5      e0 nUb  X(S'   X8S'   XHS'   Ub  XXS'   XhS'   XxS'   [        R                  " U40 UD6$ )au  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   PyAudio.is_format_supported  s~    F M$9G! ! #%1>"'5#$%1>"$&3?#(7$%&3?#%%d5f55r	   c                 N    [         R                  " 5       nU R                  U5      $ )zReturns 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_info%PyAudio.get_default_input_device_info#  s#     224,,\::r	   c                 N    [         R                  " 5       nU R                  U5      $ )zReturns 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_info&PyAudio.get_default_output_device_info/  s#     335,,\::r	   c                 N    U R                  U[        R                  " U5      5      $ )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    PyAudio.get_device_info_by_index;  s(     00|,. 	.r	   c                 \   UR                   n[        R                  " SS9nUS4 H  n UR                  U5      n  O   UUR                  UUR
                  UR                  UR                  UR                  UR                  UR                  UR                  UR                  S.$ !    M  = f)zPCreates 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   $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+)r   r}   )NNNNNN)r~   r   r   r   r   r   rB   r   r   r   r7   rE   rF   r   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                   J  ^  \ rS rSrSr\R                  r\R                  r\R                  r\R                  r	\R                  r
\R                  r\R                  r\R                  r\R                  r\R                  r\R                   rSU 4S jjrS rS rS rSrU =r$ )	PaMacCoreStreamInfoin  az  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                 F   > 0 nUb  XS'   Ub  X#S'   [         TU ]  " S0 UD6  g)a  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   )superrB   )r>   r   r   r   	__class__s       r   rB   PaMacCoreStreamInfo.__init__  s5     F "'w&(3}%G&v&r	   c                 N    [         R                  " S[        SS9  U R                  $ )zReturns 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   rG   s    r   	get_flagsPaMacCoreStreamInfo.get_flags  s'     MM$"	
 ::r	   c                 N    [         R                  " S[        SS9  U R                  $ )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   rG   s    r   get_channel_map#PaMacCoreStreamInfo.get_channel_map  s)     MM0"	
 ###r	   c                 :    [         R                  " S[        SS9  U $ )zZReturns 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   rG   s    r   _get_host_api_stream_object/PaMacCoreStreamInfo._get_host_api_stream_object  s#     MM@"	
 Kr	   r   )NN)r~   r   r   r   r   r   paMacCoreChangeDeviceParameters!paMacCoreFailIfConversionRequiredpaMacCoreConversionQualityMin paMacCoreConversionQualityMediumpaMacCoreConversionQualityLowpaMacCoreConversionQualityHighpaMacCoreConversionQualityMaxpaMacCorePlayNicepaMacCorePropaMacCoreMinimizeCPUButPlayNicepaMacCoreMinimizeCPUrB   r   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                   ,   ^  \ rS rSrSrU 4S jrSrU =r$ )r   i  zReserved. Do not instantiate.c                 Z   > [         R                  " S[        SS9  [        TU ]  " U0 UD6  g )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   rB   )r>   r   r   r   s      r   rB   Stream.__init__  s0    % 	 	$)&)r	   r   )r~   r   r   r   r   rB   r   r  r  s   @r   r   r     s    '* *r	   r   r}   )Or   
__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paCanNotWriteToACallbackStreamrp   rf   paIncompatibleStreamHostApi
paContinue
paCompletepaAbortpaInputUnderflowpaInputOverflowpaOutputUnderflowpaOutputOverflowpaPrimingOutputr   r   r   r   r   r    hasattrr   r   r   r   r	   r   <module>rQ     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- -L=