11Python wrapper for PortAudio's ring buffer
22==========================================
33
4- The ring buffer functionality is typically not included in binary distributions
5- of PortAudio _, therefore most Python wrappers don't include it, either.
4+ The `ring buffer functionality `_ is typically not included in binary
5+ distributions of PortAudio _, therefore most Python wrappers don't include it,
6+ either.
67
7- This module can be compiled and used on any Python version where CFFI _ is
8- available.
8+ The ``pa_ringbuffer `` module provides only a Python wrapper, the actual
9+ PortAudio ring buffer code has to be compiled separately, see Usage _.
10+ It can be used on any Python version where CFFI _ is available.
911
10- This module is designed to be used together with the sounddevice _ module
11- (it might work with other modules, too) for non-blocking transfer of data from
12- the main Python program to an audio callback function which is implemented in C
12+ This module is designed to be used together with the sounddevice _ module (it
13+ might work with other modules, too) for non-blocking transfer of data between
14+ the main Python program and an audio callback function which is implemented in C
1315or some other compiled language.
1416
1517.. _PortAudio : http://portaudio.com/
18+ .. _ring buffer functionality : http://portaudio.com/docs/v19-doxydocs-dev/
19+ pa__ringbuffer_8h.html
1620.. _sounddevice : http://python-sounddevice.readthedocs.io/
1721.. _CFFI : http://cffi.readthedocs.io/
1822
19- Installation
20- ------------
21-
22- Use this if you want to install it locally in a development environment::
23-
24- python3 setup.py develop --user
25-
26- or ::
27-
28- python3 -m pip install -e . --user
29-
3023Usage
3124-----
3225
3326This module is not meant to be used on its own, it is only useful in cooperation
3427with another Python module using CFFI.
3528
36- You can get the Python code from PyPI (Note: not yet available!),
37- for example in your ``setup.py `` file:
29+ You can get the Python code from PyPI _, for example in your ``setup.py `` file:
3830
3931.. code :: python
4032
@@ -50,6 +42,8 @@ for example in your ``setup.py`` file:
5042 ... ,
5143 )
5244
45+ .. _PyPI : https://pypi.python.org/pypi/pa-ringbuffer
46+
5347Alternatively, you can just copy the file ``src/pa_ringbuffer.py `` to your own
5448source directory and import it from there.
5549
@@ -97,3 +91,25 @@ use something like this to get access to the ``RingBuffer`` class:
9791 from _mycffimodule import ffi, lib
9892
9993 RingBuffer = pa_ringbuffer.init(ffi, lib)
94+
95+ API Reference
96+ -------------
97+
98+ There are only two functions:
99+
100+ ``pa_ringbuffer.cdef() ``
101+ ^^^^^^^^^^^^^^^^^^^^^^^^
102+
103+ This function returns a string containing C declarations from the file
104+ ``pa_ringbuffer.h ``, which can be used as argument to CFFI's `cdef() `_ function
105+ (see Usage _ above). Note that the returned declarations are slightly different
106+ when called on a macOS/Darwin system.
107+
108+ .. _cdef() : http://cffi.readthedocs.io/en/latest/
109+ cdef.html#ffi-ffibuilder-cdef-declaring-types-and-functions
110+
111+ ``pa_ringbuffer.init(ffi, lib) ``
112+ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
113+
114+ This function returns the ``RingBuffer `` class which is associated with the CFFI
115+ instance given by ``ffi `` and ``lib ``.
0 commit comments