+
     h2  c                   s   R t RtRtRt^ RIt^ RIt ^ RIHt ]P                  t]P                  t]P                  t]P                  t]P                  t]P                   t]P"                  t]P$                  t]P&                  t]P(                  t]P*                  t]P,                  t]P.                  t]P0                  t]P2                  t]P4                  t]P6                  t]P8                  t]P:                  t]P<                  t]P>                  t]P@                  t ]PB                  t!]PD                  t"]PF                  t#]PH                  t$]PJ                  t%]PL                  t&]PN                  t']PP                  t(]PR                  t)]PT                  t*]PV                  t+]PX                  t,]PZ                  t-]P\                  t.]P^                  t/]P`                  t0]Pb                  t1]Pd                  t2]Pf                  t3]Ph                  t4]Pj                  t5]Pl                  t6]Pn                  t7]Pp                  t8]Pr                  t9]Pt                  t:]Pv                  t;]Px                  t<]Pz                  t=]P|                  t>]P~                  t?]P                  t@]P                  tA]P                  tB]P                  tC]P                  tD]P                  tER tFRR ltGR tHR	 tI ! R
 R4      tJ]K! ]R4      '       d    ! R R]P                  4      tM ! R R]JP                  4      tNR#   ]	 d    ]
! R4       h i ; i)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.13zrestructuredtext enNz;Could not import the PyAudio C module 'pyaudio._portaudio'.c                s.    \         P                  ! V 4      # )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)format   &7/usr/lib64/python3.14/site-packages/pyaudio/__init__.pyr   r      s     f%%    c                s    V ^8X  d   V'       d   \         # \        # V ^8X  d   \        # V ^8X  d   \        # V ^8X  d   \        # \        RV  24      h)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unsigned   &&r   get_format_from_widthr      sO     zNzzz
ug.
//r   c                 ,    \         P                  ! 4       # )z(Returns portaudio version.

:rtype: int
)r   Zget_version r   r   get_portaudio_versionr      s    
 >>r   c                 r   )z<Returns PortAudio version as a text string.

:rtype: string
)r   Zget_version_textr   r   r   get_portaudio_version_textr      s    
   r   c                   s   a  ] tR t^t o Rt ! R R4      tR tR tR tRR lt	R t
R	 tR
 tR tR tR tR tR tR tR tRR ltR tR tR tR tRtV tR# )PyAudioa7  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            	       s   a  ] tR tRt o RtRRRR]P                  RRRR3	R ltR tR t	R	 t
R
 tR tR tR tR tR tRR ltRR ltR tR tRtV tR# )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                s   V'       g   V'       g   \        R4      hWn        WPn        W`n        Wn        W n        W0n        W@n        Wn        RVRVRVRVRVRVRVRV	/pV'       d   VVR	&   V'       d   VVR
&   V'       d   WR&   \        P                  ! R/ VB V n        V P                  P                  V n        V P                  P                  V n        V P                  '       d#   \        P                   ! V P                  4       R# R# )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.
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_callbackNz'Must specify an input or output stream.r   )r   _parent	_is_input
_is_output_is_running_rate	_channels_format_frames_per_bufferr   open_streaminputLatency_input_latencyoutputLatency_output_latencystart_stream)selfZ
PA_managerr   r   r   r   r   r   r   r   Zstartr   r   r    Z	argumentss   &&&&&&&&&&&&&& r   __init__ZPyAudio.Stream.__init__)  s
   V V !OPP%L"N$O$J%N!L&7# H&&$&8%':#%6	I 3 8 9 4 9 : />+, 77/Y/DL"&,,";";D#'<<#=#=D -  r   c                s    \         P                  ! V P                  4       RV n        V P                  P                  V 4       R# )zCloses the stream.FN)r   closer*   r$   r!   _remove_streamr0   r   r   r2   ZPyAudio.Stream.close  s,    HHT\\"$DLL''-r   c                .    V P                   P                  # )z*Returns the input latency.

:rtype: float
)r*   r+   r4   r   r   get_input_latencyZ PyAudio.Stream.get_input_latency  s    
 <<,,,r   c                r5   )z+Returns the output latency.

:rtype: float
)r*   r-   r4   r   r   get_output_latencyZ!PyAudio.Stream.get_output_latency  s    
 <<---r   c                B    \         P                  ! V P                  4      # )z$Returns stream time.

:rtype: float
)r   Zget_stream_timer*   r4   r   r   get_timeZPyAudio.Stream.get_time  s    
 %%dll33r   c                r8   )zLReturn the CPU load. Always 0.0 when using the blocking API.

:rtype: float
)r   Zget_stream_cpu_loadr*   r4   r   r   get_cpu_loadZPyAudio.Stream.get_cpu_load  s    
 ))$,,77r   c                s|    V P                   '       d   R# \        P                  ! V P                  4       RV n         R# )zStarts the stream.NT)r$   r   r/   r*   r4   r   r   r/   ZPyAudio.Stream.start_stream  s)    OODLL)#Dr   c                s|    V P                   '       g   R# \        P                  ! V P                  4       RV n         R# )zStops the stream.NF)r$   r   stop_streamr*   r4   r   r   r;   ZPyAudio.Stream.stop_stream  s)    ###NN4<<($Dr   c                r8   )z4Returns whether the stream is active.

:rtype: bool
)r   Zis_stream_activer*   r4   r   r   	is_activeZPyAudio.Stream.is_active  s    
 &&t||44r   c                r8   )z5Returns whether the stream is stopped.

:rtype: bool
)r   Zis_stream_stoppedr*   r4   r   r   
is_stoppedZPyAudio.Stream.is_stopped  s    
 ''55r   c                s   V P                   '       g   \        R\        4      hVfB   \        V P                  4      p\        \        V4      V P                  V,          ,          4      p\        P                  ! V P                  WV4       R# )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)r#   IOError paCanNotWriteToAnInputOnlyStreamr   r'   ZintZlenr&   r   Zwrite_streamr*   )r0   Zframes
num_framesZexception_on_underflowr   s   &&&& r   writeZPyAudio.Stream.write  sk    , ???1>@ @ !'5 V0F!GH
OODLL&24r   c                s    V P                   '       g   \        R\        4      h\        P                  ! V P
                  VV4      # )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"   r>   "paCanNotReadFromAnOutputOnlyStreamr   Zread_streamr*   )r0   r@   Zexception_on_overflow   &&&r   readZPyAudio.Stream.read)  s>     >>>0@B B>>$,,
"79 9r   c                r8   )zOReturn the number of frames that can be read without waiting.

:rtype: integer
)r   Zget_stream_read_availabler*   r4   r   r   get_read_availableZ!PyAudio.Stream.get_read_available=  s    
 //==r   c                r8   )zRReturn the number of frames that can be written without waiting.

:rtype: integer
)r   Zget_stream_write_availabler*   r4   r   r   get_write_availableZ"PyAudio.Stream.get_write_availableD  s    
 00>>r   )r&   r'   r(   r,   r"   r#   r$   r.   r!   r%   r*   )NFT)__name__
__module____qualname____firstlineno____doc__r   paFramesPerBufferUnspecifiedr1   r2   r6   r7   r9   r:   r/   r;   r<   r=   rA   rD   rE   rF   __static_attributes____classdictcell____classdict__   @r   Streamr     s{     	, !!(,)-')'F'F9=:>%)V	.p	.	-	.	4	8	$	%	5	6 	4D	9(	>	? 	?r   rS   c                sN    \         P                  ! 4        \        4       V n        R# )zInitialize PortAudio.N)r   Z
initializeset_streamsr4   r   r   r1   ZPyAudio.__init__M  s    
r   c                s    V P                   P                  4        F  pVP                  4        K  	  \        4       V n         \        P
                  ! 4        R# )zTerminates PortAudio.

:attention: Be sure to call this method for every instance of this
  object to release PortAudio resources.
N)rU   Zcopyr2   rT   r   	terminater0   stream   & r   rV   ZPyAudio.terminateR  s8     mm((*FLLN + 
r   c                s.    \         P                  ! V4      # )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    )r0   r   r   r   r   ZPyAudio.get_sample_size`  s     !!&))r   c                s    \        W4      # )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   )r0   r   r   rC   r   r   ZPyAudio.get_format_from_widthj  s     %U55r   c                sp    \         P                  ! V .VO5/ VB pV P                  P                  V4       V# )zOpens a new stream.

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

:returns: A new :py:class:`PyAudio.Stream`
)r   rS   rU   Zadd)r0   argskwargsrX   s   &*, r   r)   ZPyAudio.openw  s3     6t6v6&!r   c                sd    WP                   9  d   \        RV R24      hVP                  4        R# )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)rU   r   r2   rW   r   r   r2   ZPyAudio.close  s+     &wvhj9::r   c                s`    WP                   9   d   V P                   P                  V4       R# R# )zcRemoves a stream. (Internal)

:param stream: An instance of the :py:class:`PyAudio.Stream` object.
N)rU   ZremoverW   r   r   r3   ZPyAudio._remove_stream  s%    
 ]]"MM  ( #r   c                r   )zFReturns the number of available PortAudio Host APIs.

:rtype: integer
)r   get_host_api_countr4   r   r   r\   ZPyAudio.get_host_api_count  s    
 $$&&r   c                N    \         P                  ! 4       pV P                  V4      # )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   Zget_default_host_apiget_host_api_info_by_index)r0   Zdefault_host_api_indexrY   r   get_default_host_api_infoZ!PyAudio.get_default_host_api_info  s%     "$!8!8!:../EFFr   c                sP    \         P                  ! V4      pV P                  V4      # )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   Z"host_api_type_id_to_host_api_indexr^   )r0   Z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                N    V P                  V\        P                  ! V4      4      # )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   Zget_host_api_info)r0   host_api_indexr   r   r^   Z"PyAudio.get_host_api_info_by_index  s(     --  02 	2r   c                sT    \         P                  pV! W4      pV P                  V4      # )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   Z%host_api_device_index_to_device_indexget_device_info_by_index)r0   rd   Zhost_api_device_indexZ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'N,,\::r   c                s    RVRVP                   RVP                  RVP                  RVP                  RVP                  RVP
                  /# )zOCreates dictionary like PortAudio's ``PaHostApiInfo`` structure.

:rtype: dict
r`   structVersiontypenamedeviceCountdefaultInputDevicedefaultOutputDevice)rh   ri   rj   rk   rl   rm   )r0   r`   Zhost_api_structrC   r   rc   Z!PyAudio._make_host_api_dictionary  sU     U_::O((O((?66 /"D"D!?#F#F
 	
r   c                r   )z<Returns the number of PortAudio Host APIs.

:rtype: integer
)r   get_device_countr4   r   r   rn   ZPyAudio.get_device_count  s    
 ""$$r   Nc                s    Vf   Vf   \        R\        4      h/ pVe   W(R&   W8R&   WHR&   Ve   WXR&   WhR&   WxR&   \        P                  ! V3/ VB # )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)	r0   r   ro   rp   rq   rr   rs   rt   r[   s	   &&&&&&&& r   rv   ZPyAudio.is_format_supported  s~    F M$9G! ! #%1>"'5#$%1>"$&3?#(7$%&3?#%%d5f55r   c                r]   )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   Zget_default_input_devicere   r0   rf   rY   r   get_default_input_device_infoZ%PyAudio.get_default_input_device_info#  s#     224,,\::r   c                r]   )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   Zget_default_output_devicere   rw   rY   r   get_default_output_device_infoZ&PyAudio.get_default_output_device_info/  s#     335,,\::r   c                rb   )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   Zget_device_inforw   r   r   re   Z PyAudio.get_device_info_by_index;  s(     00|,. 	.r   c                sv   VP                   p\        P                  ! RR7      pVR3 F  p VP                  V4      p M	  RVRVP                  RVRVP
                  RVP                  R	VP                  R
VP                  RVP                  RVP                  RVP                  RVP                  /#     K  ; i)zPCreates a dictionary like PortAudio's ``PaDeviceInfo`` structure.

:rtype: dict
F)Zdo_setlocalezutf-8r`   rh   rj   hostApimaxInputChannelsmaxOutputChannelsdefaultLowInputLatencydefaultLowOutputLatencydefaultHighInputLatencydefaultHighOutputLatencydefaultSampleRate)rj   localeZgetpreferredencodingZdecoderh   r{   r|   r}   r~   r   r   r   r   )r0   r`   Zdevice_infoZdevice_nameZos_encodingZcodecs   &&&   r   rz   Z$PyAudio._make_device_info_dictionaryH  s    
 "&& 11uE!7+E)007 , !:!:;.."K$@$@#[%B%B(22)33)33*44#--/ 	/s   B33B8)rU   rG   )NNNNNN)rH   rI   rJ   rK   rL   rS   r1   rV   r   r   r)   r2   r3   r\   r_   ra   r^   rg   rc   rn   rv   rx   ry   re   rz   rN   rO   rP   rR   r   r   r      s}     :r? r?l	

*	6
	)'
G62; 
"%36j
;
;. /  /r   r   paMacCoreStreamInfoc                   sT  a a ] tR tRt oRt]P                  t]P                  t]P                  t]P                  t	]P                  t
]P                  t]P                  t]P                  t]P                  t]P                  t]P                   tRV 3R lltR tR tR tRtVtV ;t# )	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                sL   < / pVe   WR&   Ve   W#R&   \         SV `  ! R/ VB  R# )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   )superr1   )r0   r   r   r[   	__class__s   &&& r   r1   ZPaMacCoreStreamInfo.__init__  s5     F "'w&(3}%G&v&r   c                T    \         P                  ! R\        ^R7       V P                  # )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.Z
stacklevel)warningswarnDeprecationWarningr   r4   r   r   	get_flagsZPaMacCoreStreamInfo.get_flags  s'     MM$"	
 ::r   c                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   r4   r   r   get_channel_mapZ#PaMacCoreStreamInfo.get_channel_map  s)     MM0"	
 ###r   c                s@    \         P                  ! R\        ^R7       V # )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   r4   r   r   _get_host_api_stream_objectZ/PaMacCoreStreamInfo._get_host_api_stream_object  s#     MM@"	
 Kr   r   )NN)rH   rI   rJ   rK   rL   r   ZpaMacCoreChangeDeviceParametersZ!paMacCoreFailIfConversionRequiredZpaMacCoreConversionQualityMinZ paMacCoreConversionQualityMediumZpaMacCoreConversionQualityLowZpaMacCoreConversionQualityHighZpaMacCoreConversionQualityMaxZpaMacCorePlayNiceZpaMacCoreProZpaMacCoreMinimizeCPUButPlayNiceZpaMacCoreMinimizeCPUr1   r   r   r   rN   rO   __classcell__r   rQ      @@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                   s6   a a ] tR tRt oRtV 3R ltRtVtV ;t# )rS   i  zReserved. Do not instantiate.c                sb   < \         P                  ! R \        ^R7       \        SV `  ! V/ VB  R# )zDo not instantiate pyaudio.Stream directly. Use pyaudio.PyAudio.open() instead. pyaudio.Stream may change or be removed in the future.r   N)r   r   r   r   r1   )r0   rZ   r[   r   s   &*,r   r1   ZStream.__init__  s0    % 	 	$)&)r   r   )	rH   rI   rJ   rK   rL   r1   rN   rO   r   r   r   r   rS   rS     s     '* *r   rS   rG   )OrL   Z
__author__Z__version__Z__docformat__r   r   Zpyaudio._portaudioZ
_portaudior   ZImportErrorZprintr   ZpaInt32r
   r	   r   r   ZpaCustomFormatZpaInDevelopmentZpaDirectSoundZpaMMEZpaASIOZpaSoundManagerZpaCoreAudioZpaOSSZpaALSAZpaALZpaBeOSZpaWDMKSZpaJACKZpaWASAPIZ
paNoDeviceZ	paNoErrorZpaNotInitializedZpaUnanticipatedHostErrorZpaInvalidChannelCountZpaInvalidSampleRateru   ZpaInvalidFlagZpaSampleFormatNotSupportedZpaBadIODeviceCombinationZpaInsufficientMemoryZpaBufferTooBigZpaBufferTooSmallZpaNullCallbackZpaBadStreamPtrZ
paTimedOutZpaInternalErrorZpaDeviceUnavailableZ'paIncompatibleHostApiSpecificStreamInfoZpaStreamIsStoppedZpaStreamIsNotStoppedZpaInputOverflowedZpaOutputUnderflowedZpaHostApiNotFoundZpaInvalidHostApiZpaCanNotReadFromACallbackStreamZpaCanNotWriteToACallbackStreamrB   r?   ZpaIncompatibleStreamHostApiZ
paContinueZ
paCompleteZpaAbortZpaInputUnderflowZpaInputOverflowZpaOutputUnderflowZpaOutputOverflowZpaPrimingOutputrM   r   r   r   r   r   Zhasattrr   r   rS   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/ /M 