Skip to content

Commit f085245

Browse files
committed
DOC: more documentation
1 parent 576e784 commit f085245

File tree

4 files changed

+67
-21
lines changed

4 files changed

+67
-21
lines changed

CONTRIBUTING.rst

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
Contributing
2+
------------
3+
4+
If you find bugs, errors, omissions or other things that need improvement,
5+
please create an issue or a pull request at
6+
https://github.com/spatialaudio/python-pa-ringbuffer/.
7+
Contributions are always welcome!
8+
9+
Instead of pip-installing the latest release from PyPI_, you should get the
10+
newest development version with Git::
11+
12+
git clone https://github.com/spatialaudio/python-pa-ringbuffer.git
13+
cd python-sounddevice
14+
python3 setup.py develop --user
15+
16+
.. _PyPI: https://pypi.python.org/pypi/pa-ringbuffer
17+
18+
This way, your installation always stays up-to-date, even if you pull new
19+
changes from the Github repository and if you switch between branches.
20+
21+
If you prefer, you can also replace the last command with::
22+
23+
python3 -m pip install --user -e .
24+
25+
... where ``-e`` stands for ``--editable``.
26+
27+
In both cases you can drop the ``--user`` flag if you want a system-wide
28+
installation (assuming you have the necessary rights).

README.rst

Lines changed: 36 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -1,40 +1,32 @@
11
Python 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
1315
or 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-
3023
Usage
3124
-----
3225

3326
This module is not meant to be used on its own, it is only useful in cooperation
3427
with 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+
5347
Alternatively, you can just copy the file ``src/pa_ringbuffer.py`` to your own
5448
source 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``.

setup.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@
1919
long_description=open('README.rst').read(),
2020
license='MIT',
2121
keywords='sound audio PortAudio ringbuffer lock-free'.split(),
22-
#url='',
22+
url='https://github.com/spatialaudio/python-pa-ringbuffer',
2323
platforms='any',
2424
classifiers=[
2525
'License :: OSI Approved :: MIT License',

src/pa_ringbuffer.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -59,6 +59,8 @@ class _RingBufferBase(object):
5959
def __init__(self, elementsize, size):
6060
"""Create an instance of PortAudio's ring buffer.
6161
62+
http://portaudio.com/docs/v19-doxydocs-dev/pa__ringbuffer_8h.html
63+
6264
Parameters
6365
----------
6466
elementsize : int

0 commit comments

Comments
 (0)