Skip to content

Commit

Permalink
DOC: restore viewcode highlighting, disable unwanted highlighting
Browse files Browse the repository at this point in the history
  • Loading branch information
mgeier committed Oct 8, 2024
1 parent 00ef17c commit f930b10
Show file tree
Hide file tree
Showing 15 changed files with 39 additions and 36 deletions.
12 changes: 6 additions & 6 deletions CONTRIBUTING.rst
Original file line number Diff line number Diff line change
Expand Up @@ -17,13 +17,13 @@ please make sure to provide as much useful information as possible.
You can use Markdown formatting to show Python code, e.g. ::

I have created a script named `my_script.py`:

```python
import sounddevice as sd

fs = 48000
duration = 1.5

data = sd.rec(int(duration * fs), channels=99)
sd.wait()
print(data.shape)
Expand All @@ -37,7 +37,7 @@ including all ``import`` statements.
You should of course also show what happens when you run your code, e.g. ::

Running my script, I got this error:

```
$ python my_script.py
Expression 'parameters->channelCount <= maxChans' failed in 'src/hostapi/alsa/pa_linux_alsa.c', line: 1514
Expand Down Expand Up @@ -71,7 +71,7 @@ If you don't want to clutter the issue description with a huge load of gibberish
you can use the ``<details>`` HTML tag to show some content only on demand::

<details>

```
$ python -m sounddevice
0 Built-in Line Input, Core Audio (2 in, 0 out)
Expand All @@ -80,7 +80,7 @@ you can use the ``<details>`` HTML tag to show some content only on demand::
3 Built-in Line Output, Core Audio (0 in, 2 out)
4 Built-in Digital Output, Core Audio (0 in, 2 out)
```

</details>


Expand Down
1 change: 0 additions & 1 deletion doc/CONTRIBUTING.rst

This file was deleted.

2 changes: 1 addition & 1 deletion doc/api/checking-hardware.rst
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ Checking Available Hardware

.. autosummary::
:nosignatures:

query_devices
DeviceList
query_hostapis
Expand Down
2 changes: 1 addition & 1 deletion doc/api/convenience-functions.rst
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ Convenience Functions using NumPy Arrays

.. autosummary::
:nosignatures:

play
rec
playrec
Expand Down
2 changes: 1 addition & 1 deletion doc/api/expert-mode.rst
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ Expert Mode

.. autosummary::
:nosignatures:

_initialize
_terminate
_split
Expand Down
2 changes: 1 addition & 1 deletion doc/api/misc.rst
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ Miscellaneous

.. autosummary::
:nosignatures:

sleep
get_portaudio_version
CallbackFlags
Expand Down
2 changes: 1 addition & 1 deletion doc/api/platform-specific-settings.rst
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ Platform-specific Settings

.. autosummary::
:nosignatures:

AsioSettings
CoreAudioSettings
WasapiSettings
Expand Down
2 changes: 1 addition & 1 deletion doc/api/raw-streams.rst
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ Raw Streams

.. autosummary::
:nosignatures:

RawStream
RawInputStream
RawOutputStream
Expand Down
3 changes: 1 addition & 2 deletions doc/api/streams.rst
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ Streams using NumPy Arrays

.. autosummary::
:nosignatures:

Stream
InputStream
OutputStream
Expand All @@ -20,4 +20,3 @@ Streams using NumPy Arrays
.. autoclass:: InputStream

.. autoclass:: OutputStream

1 change: 0 additions & 1 deletion doc/conf.py
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,6 @@
today = '<unknown date>'

default_role = 'any'
highlight_language = 'none'

nitpicky = True

Expand Down
3 changes: 3 additions & 0 deletions doc/contributing.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
.. highlight:: none

.. include:: ../CONTRIBUTING.rst
11 changes: 0 additions & 11 deletions doc/examples.rst
Original file line number Diff line number Diff line change
Expand Up @@ -6,84 +6,73 @@ Play a Sound File
:gh-example:`play_file.py`

.. literalinclude:: ../examples/play_file.py
:language: python

Play a Very Long Sound File
---------------------------

:gh-example:`play_long_file.py`

.. literalinclude:: ../examples/play_long_file.py
:language: python

Play a Very Long Sound File without Using NumPy
-----------------------------------------------

:gh-example:`play_long_file_raw.py`

.. literalinclude:: ../examples/play_long_file_raw.py
:language: python

Play a Web Stream
-----------------

:gh-example:`play_stream.py`

.. literalinclude:: ../examples/play_stream.py
:language: python

Play a Sine Signal
------------------

:gh-example:`play_sine.py`

.. literalinclude:: ../examples/play_sine.py
:language: python

Input to Output Pass-Through
----------------------------

:gh-example:`wire.py`

.. literalinclude:: ../examples/wire.py
:language: python

Plot Microphone Signal(s) in Real-Time
--------------------------------------

:gh-example:`plot_input.py`

.. literalinclude:: ../examples/plot_input.py
:language: python

Real-Time Text-Mode Spectrogram
-------------------------------

:gh-example:`spectrogram.py`

.. literalinclude:: ../examples/spectrogram.py
:language: python

Recording with Arbitrary Duration
---------------------------------

:gh-example:`rec_unlimited.py`

.. literalinclude:: ../examples/rec_unlimited.py
:language: python

Using a stream in an `asyncio` coroutine
----------------------------------------

:gh-example:`asyncio_coroutines.py`

.. literalinclude:: ../examples/asyncio_coroutines.py
:language: python

Creating an `asyncio` generator for audio blocks
------------------------------------------------

:gh-example:`asyncio_generators.py`

.. literalinclude:: ../examples/asyncio_generators.py
:language: python
2 changes: 1 addition & 1 deletion doc/index.rst
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
installation
usage
examples
CONTRIBUTING
contributing
api/index
version-history

Expand Down
2 changes: 1 addition & 1 deletion doc/installation.rst
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ To un-install, use::
python -m pip uninstall sounddevice

If you want to try the very latest development version of the ``sounddevice`` module,
have a look at the section about :doc:`CONTRIBUTING`.
have a look at the section about :doc:`contributing`.

If you install the ``sounddevice`` module with ``pip`` on macOS or Windows,
the PortAudio_ library will be installed automagically.
Expand Down
28 changes: 21 additions & 7 deletions sounddevice.py
Original file line number Diff line number Diff line change
Expand Up @@ -1187,7 +1187,9 @@ def __init__(self, samplerate=None, blocksize=None,
callback : callable
User-supplied function to consume audio data in response to
requests from an active stream.
The callback must have this signature::
The callback must have this signature:
.. code-block:: text
callback(indata: buffer, frames: int,
time: CData, status: CallbackFlags) -> None
Expand Down Expand Up @@ -1271,7 +1273,9 @@ def __init__(self, samplerate=None, blocksize=None,
callback : callable
User-supplied function to generate audio data in response to
requests from an active stream.
The callback must have this signature::
The callback must have this signature:
.. code-block:: text
callback(outdata: buffer, frames: int,
time: CData, status: CallbackFlags) -> None
Expand Down Expand Up @@ -1378,7 +1382,9 @@ def __init__(self, samplerate=None, blocksize=None,
callback : callable
User-supplied function to consume, process or generate audio
data in response to requests from an active stream.
The callback must have this signature::
The callback must have this signature:
.. code-block:: text
callback(indata: buffer, outdata: buffer, frames: int,
time: CData, status: CallbackFlags) -> None
Expand Down Expand Up @@ -1416,7 +1422,9 @@ def __init__(self, samplerate=None, blocksize=None,
callback : callable
User-supplied function to consume audio in response to
requests from an active stream.
The callback must have this signature::
The callback must have this signature:
.. code-block:: text
callback(indata: numpy.ndarray, frames: int,
time: CData, status: CallbackFlags) -> None
Expand Down Expand Up @@ -1489,7 +1497,9 @@ def __init__(self, samplerate=None, blocksize=None,
callback : callable
User-supplied function to generate audio data in response to
requests from an active stream.
The callback must have this signature::
The callback must have this signature:
.. code-block:: text
callback(outdata: numpy.ndarray, frames: int,
time: CData, status: CallbackFlags) -> None
Expand Down Expand Up @@ -1691,7 +1701,9 @@ def __init__(self, samplerate=None, blocksize=None,
read or written without blocking is returned by
`read_available` and `write_available`, respectively.
The callback must have this signature::
The callback must have this signature:
.. code-block:: text
callback(indata: ndarray, outdata: ndarray, frames: int,
time: CData, status: CallbackFlags) -> None
Expand Down Expand Up @@ -1794,7 +1806,9 @@ def __init__(self, samplerate=None, blocksize=None,
raises `CallbackStop`, or `stop()` is called, the stream
finished callback will not be called until all generated
sample data has been played. The callback must have this
signature::
signature:
.. code-block:: text
finished_callback() -> None
Expand Down

0 comments on commit f930b10

Please sign in to comment.