Audaspace: Update From Upstream (For API Docs)
No functional changes: - Cleanup Spelling, Line Length - Use proper class method styling for py docs - Fix Broken Links Differential Revision: https://developer.blender.org/D7276 Fixes T75191
This commit is contained in:
128
extern/audaspace/bindings/doc/tutorials.rst
vendored
128
extern/audaspace/bindings/doc/tutorials.rst
vendored
@@ -4,35 +4,51 @@ Tutorials
|
||||
Introduction
|
||||
------------
|
||||
|
||||
The C and Python binding for audaspace were designed with simplicity in mind. This means however that to use the full capabilities of audaspace, there is no way around the C++ library.
|
||||
The C and Python binding for audaspace were designed with simplicity in mind.
|
||||
This means however that to use the full capabilities of audaspace,
|
||||
there is no way around the C++ library.
|
||||
|
||||
Simple Demo
|
||||
-----------
|
||||
|
||||
The **simple.py** example program contains all the basic building blocks for an application using audaspace. These building blocks are basically the classes :class:`aud.Device`, :class:`aud.Sound` and :class:`aud.Handle`.
|
||||
The **simple.py** example program contains all the basic
|
||||
building blocks for an application using audaspace.
|
||||
These building blocks are basically the classes :class:`aud.Device`,
|
||||
:class:`aud.Sound` and :class:`aud.Handle`.
|
||||
|
||||
We start with importing :mod:`aud` and :mod:`time` as the modules we need for our simple example.
|
||||
We start with importing :mod:`aud` and :mod:`time`
|
||||
as the modules we need for our simple example.
|
||||
|
||||
.. code-block:: python
|
||||
|
||||
#!/usr/bin/python
|
||||
import aud, time
|
||||
|
||||
The first step now is to open an output device and this can simply be done by allocating a :class:`aud.Device` object.
|
||||
The first step now is to open an output device and this
|
||||
can simply be done by allocating a :class:`aud.Device` object.
|
||||
|
||||
.. code-block:: python
|
||||
|
||||
device = aud.Device()
|
||||
|
||||
To create a sound we can choose to load one from a :func:`aud.Sound.file`, or we use one of our signal generators. We decide to do the latter and create a :func:`aud.Sound.sine` signal with a frequency of 440 Hz.
|
||||
To create a sound we can choose to load one from a :func:`aud.Sound.file`,
|
||||
or we use one of our signal generators. We decide to do the latter
|
||||
and create a :func:`aud.Sound.sine` signal with a frequency of 440 Hz.
|
||||
|
||||
.. code-block:: python
|
||||
|
||||
sine = aud.Sound.sine(440)
|
||||
|
||||
.. note:: At this point nothing is playing back yet, :class:`aud.Sound` objects are just descriptions of sounds.
|
||||
.. note:: At this point nothing is playing back yet,
|
||||
:class:`aud.Sound` objects are just descriptions of sounds.
|
||||
|
||||
However instead of a sine wave, we would like to have a square wave to produce a more retro gaming sound. We could of course use the :func:`aud.Sound.square` generator instead of sine, but we want to show how to apply effects, so we apply a :func:`aud.Sound.threshold` which makes a square wave out of our sine too, even if less efficient than directly generating the square wave.
|
||||
However instead of a sine wave, we would like to have a square wave
|
||||
to produce a more retro gaming sound. We could of course use the
|
||||
:func:`aud.Sound.square` generator instead of sine,
|
||||
but we want to show how to apply effects,
|
||||
so we apply a :func:`aud.Sound.threshold`
|
||||
which makes a square wave out of our sine too,
|
||||
even if less efficient than directly generating the square wave.
|
||||
|
||||
.. code-block:: python
|
||||
|
||||
@@ -40,13 +56,19 @@ However instead of a sine wave, we would like to have a square wave to produce a
|
||||
|
||||
.. note:: The :class:`aud.Sound` class offers generator and effect functions.
|
||||
|
||||
The we can play our sound by calling the :func:`aud.Device.play` method of our device. This method returns a :class:`aud.Handle` which is used to control the playback of the sound.
|
||||
The we can play our sound by calling the
|
||||
:func:`aud.Device.play` method of our device.
|
||||
This method returns a :class:`aud.Handle`
|
||||
which is used to control the playback of the sound.
|
||||
|
||||
.. code-block:: python
|
||||
|
||||
handle = device.play(square)
|
||||
|
||||
Now if we do nothing else anymore the application will quit immediately, so we won't hear much of our square wave, so we decide to wait for three seconds before quitting the application by calling :func:`time.sleep`.
|
||||
Now if we do nothing else anymore the application will quit immediately,
|
||||
so we won't hear much of our square wave,
|
||||
so we decide to wait for three seconds before
|
||||
quitting the application by calling :func:`time.sleep`.
|
||||
|
||||
.. code-block:: python
|
||||
|
||||
@@ -55,29 +77,47 @@ Now if we do nothing else anymore the application will quit immediately, so we w
|
||||
Audioplayer
|
||||
-----------
|
||||
|
||||
Now that we know the basics of audaspace, we can build our own music player easily by just slightly changing the previous program. The **player.py** example does exactly that, let's have a short look at the differences:
|
||||
Now that we know the basics of audaspace,
|
||||
we can build our own music player easily
|
||||
by just slightly changing the previous program.
|
||||
The **player.py** example does exactly that,
|
||||
let's have a short look at the differences:
|
||||
|
||||
Instead of creating a sine signal and thresholding it, we in fact use the :func:`aud.Sound.file` function to load a sound from a file. The filename we pass is the first command line argument our application got.
|
||||
Instead of creating a sine signal and thresholding it,
|
||||
we in fact use the :func:`aud.Sound.file` function to load a sound from a file.
|
||||
The filename we pass is the first command line argument our application got.
|
||||
|
||||
.. code-block:: python
|
||||
|
||||
sound = aud.Sound.file(sys.argv[1])
|
||||
|
||||
When the sound gets played back we now want to wait until the whole file has been played, so we use the :data:`aud.Handle.status` property to determine whether the sound finished playing.
|
||||
When the sound gets played back we now want to wait until
|
||||
the whole file has been played, so we use the :data:`aud.Handle.status`
|
||||
property to determine whether the sound finished playing.
|
||||
|
||||
.. code-block:: python
|
||||
|
||||
while handle.status:
|
||||
time.sleep(0.1)
|
||||
|
||||
We don't make any error checks if the user actually added a command line argument. As an exercise you could extend this program to play any number of command line supplied files in sequence.
|
||||
We don't make any error checks if the user actually added a command
|
||||
line argument. As an exercise you could extend this program to play
|
||||
any number of command line supplied files in sequence.
|
||||
|
||||
Siren
|
||||
-----
|
||||
|
||||
Let's get a little bit more complex. The **siren.py** example plays a generated siren sound that circles around your head. Depending on how many speakers you have and if the output device used supports the speaker setup, you will hear this effect. With stereo speakers you should at least hear some left-right-panning.
|
||||
Let's get a little bit more complex. The **siren.py** example
|
||||
plays a generated siren sound that circles around your head.
|
||||
Depending on how many speakers you have and if the output
|
||||
device used supports the speaker setup, you will hear this effect.
|
||||
With stereo speakers you should at least hear some left-right-panning.
|
||||
|
||||
We start off again with importing the modules we need and we also define some properties of our siren sound. We want it to consist of two sine sounds with different frequencies. We define a length for the sine sounds and how long a fade in/out should take. We also know already how to open a device.
|
||||
We start off again with importing the modules we need and
|
||||
we also define some properties of our siren sound.
|
||||
We want it to consist of two sine sounds with different frequencies.
|
||||
We define a length for the sine sounds and how long a fade in/out should take.
|
||||
We also know already how to open a device.
|
||||
|
||||
.. code-block:: python
|
||||
|
||||
@@ -88,27 +128,35 @@ We start off again with importing the modules we need and we also define some pr
|
||||
|
||||
device = aud.Device()
|
||||
|
||||
The next thing to do is to define our sine waves and apply all the required effects. As each of the effect functions returns the corresponding sound, we can easily chain those calls together.
|
||||
The next thing to do is to define our sine waves and apply all the required effects.
|
||||
As each of the effect functions returns the corresponding sound,
|
||||
we can easily chain those calls together.
|
||||
|
||||
.. code-block:: python
|
||||
|
||||
high = aud.Sound.sine(880).limit(0, length).fadein(0, fadelength).fadeout(length - fadelength, length)
|
||||
low = aud.Sound.sine(700).limit(0, length).fadein(0, fadelength).fadeout(length - fadelength, length).volume(0.6)
|
||||
|
||||
The next step is to connect the two sines, which we do using the :func:`aud.Sound.join` function.
|
||||
The next step is to connect the two sines,
|
||||
which we do using the :func:`aud.Sound.join` function.
|
||||
|
||||
.. code-block:: python
|
||||
|
||||
sound = high.join(low)
|
||||
|
||||
The generated siren sound can now be played back and what we also do is to loop it. Therefore we set the :data:`aud.Handle.loop_count` to a negative value to loop forever.
|
||||
The generated siren sound can now be played back and what we also do is to loop it.
|
||||
Therefore we set the :data:`aud.Handle.loop_count` to a negative value to loop forever.
|
||||
|
||||
.. code-block:: python
|
||||
|
||||
handle = device.play(sound)
|
||||
handle.loop_count = -1
|
||||
|
||||
Now we use some timing code to make sure our demo runs for 10 seconds, but we also use the time to update the location of our playing sound, with the :data:`aud.Handle.location` property, which is a three dimensional vector. The trigonometic calculation based on the running time of the program keeps the sound on the XZ plane letting it follow a circle around us.
|
||||
Now we use some timing code to make sure our demo runs for 10 seconds,
|
||||
but we also use the time to update the location of our playing sound,
|
||||
with the :data:`aud.Handle.location` property, which is a three dimensional vector.
|
||||
The trigonometic calculation based on the running time of the program keeps
|
||||
the sound on the XZ plane letting it follow a circle around us.
|
||||
|
||||
.. code-block:: python
|
||||
|
||||
@@ -119,33 +167,54 @@ Now we use some timing code to make sure our demo runs for 10 seconds, but we al
|
||||
|
||||
handle.location = [math.sin(angle), 0, -math.cos(angle)]
|
||||
|
||||
As an exercise you could try to let the sound come from the far left and go to the far right and a little bit in front of you within the 10 second runtime of the program. With this change you should be able to hear the volume of the sound change, depending on how far it is away from you. Updating the :data:`aud.Handle.velocity` property properly also enables the doppler effect. Compare your solution to the **siren2.py** demo.
|
||||
As an exercise you could try to let the sound come from the far left
|
||||
and go to the far right and a little bit in front of you within the
|
||||
10 second runtime of the program. With this change you should be able
|
||||
to hear the volume of the sound change, depending on how far it is away from you.
|
||||
Updating the :data:`aud.Handle.velocity` property properly also enables the doppler effect.
|
||||
Compare your solution to the **siren2.py** demo.
|
||||
|
||||
Tetris
|
||||
------
|
||||
|
||||
The **tetris.py** demo application shows an even more complex application which generates retro tetris music. Looking at the source code there should be nothing new here, again the functions used from audaspace are the same as in the previous examples. In the :func:`parseNote` function all single notes get joined which leads to a very long chain of sounds. If you think of :func:`aud.Sound.join` as a function that creates a binary tree with the two joined sounds as leaves then the :func:`parseNote` function creates a very unbalanced tree.
|
||||
The **tetris.py** demo application shows an even more
|
||||
complex application which generates retro tetris music.
|
||||
Looking at the source code there should be nothing new here,
|
||||
again the functions used from audaspace are the same as in the previous examples.
|
||||
In the :func:`parseNote` function all single notes get joined which leads
|
||||
to a very long chain of sounds. If you think of :func:`aud.Sound.join`
|
||||
as a function that creates a binary tree with the two joined sounds as
|
||||
leaves then the :func:`parseNote` function creates a very unbalanced tree.
|
||||
|
||||
Insted we could rewrite the code to use two other classes: :class:`aud.Sequence` and :class:`aud.SequenceEntry` to sequence the notes. The **tetris2.py** application does exactly that. Before the while loop we add a variable that stores the current position in the score and create a new :class:`aud.Sequence` object.
|
||||
Insted we could rewrite the code to use two other classes:
|
||||
:class:`aud.Sequence` and :class:`aud.SequenceEntry` to sequence the notes.
|
||||
The **tetris2.py** application does exactly that.
|
||||
Before the while loop we add a variable that stores the current position
|
||||
in the score and create a new :class:`aud.Sequence` object.
|
||||
|
||||
.. code-block:: python
|
||||
|
||||
position = 0
|
||||
sequence = aud.Sequence()
|
||||
|
||||
Then in the loop we can create the note simply by chaining the :func:`aud.Sound.square` generator and :func:`aud.Sound.fadein` and :func:`aud.Sound.fadeout` effects.
|
||||
Then in the loop we can create the note simply by chaining the
|
||||
:func:`aud.Sound.square` generator and :func:`aud.Sound.fadein`
|
||||
and :func:`aud.Sound.fadeout` effects.
|
||||
|
||||
.. code-block:: python
|
||||
|
||||
note = aud.Sound.square(freq, rate).fadein(0, fadelength).fadeout(length - fadelength, fadelength)
|
||||
|
||||
Now instead of using :func:`aud.Sound.limit` and :func:`aud.Sound.join` we simply add the sound to the sequence.
|
||||
Now instead of using :func:`aud.Sound.limit` and :func:`aud.Sound.join`
|
||||
we simply add the sound to the sequence.
|
||||
|
||||
.. code-block:: python
|
||||
|
||||
entry = sequence.add(note, position, position + length, 0)
|
||||
|
||||
The entry returned from the :func:`aud.Sequence.add` function is an object of the :class:`aud.SequenceEntry` class. We can use this entry to mute the note in case it's actually a pause.
|
||||
The entry returned from the :func:`aud.Sequence.add`
|
||||
function is an object of the :class:`aud.SequenceEntry` class.
|
||||
We can use this entry to mute the note in case it's actually a pause.
|
||||
|
||||
.. code-block:: python
|
||||
|
||||
@@ -158,9 +227,14 @@ Lastly we have to update our position variable.
|
||||
|
||||
position += length
|
||||
|
||||
Now in **tetris2.py** we used the :data:`aud.SequenceEntry.muted` property to show how the :class:`aud.SequenceEntry` class can be used, but it would actually be smarter to not even create a note for pauses and just skip them. You can try to implement this as an exercise and then check out the solution in **tetris3.py**.
|
||||
Now in **tetris2.py** we used the :data:`aud.SequenceEntry.muted`
|
||||
property to show how the :class:`aud.SequenceEntry` class can be used,
|
||||
but it would actually be smarter to not even create a note for pauses and just skip them.
|
||||
You can try to implement this as an exercise and then check out the solution in **tetris3.py**.
|
||||
|
||||
Conclusion
|
||||
----------
|
||||
|
||||
We introduced all five currently available classes in the audaspace Python API. Of course all classes offer a lot more functions than have been used in these demo applications, check out the specific class documentation for more details.
|
||||
We introduced all five currently available classes in the audaspace Python API.
|
||||
Of course all classes offer a lot more functions than have been used in these demo applications,
|
||||
check out the specific class documentation for more details.
|
||||
|
24
extern/audaspace/bindings/python/PyDevice.cpp
vendored
24
extern/audaspace/bindings/python/PyDevice.cpp
vendored
@@ -124,14 +124,16 @@ Device_new(PyTypeObject* type, PyObject* args, PyObject* kwds)
|
||||
}
|
||||
|
||||
PyDoc_STRVAR(M_aud_Device_lock_doc,
|
||||
"lock()\n\n"
|
||||
"Locks the device so that it's guaranteed, that no samples are "
|
||||
".. classmethod:: lock()\n\n"
|
||||
" Locks the device so that it's guaranteed, that no samples are\n"
|
||||
" read from the streams until :meth:`unlock` is called.\n"
|
||||
"This is useful if you want to do start/stop/pause/resume some "
|
||||
" This is useful if you want to do start/stop/pause/resume some\n"
|
||||
" sounds at the same time.\n\n"
|
||||
".. note:: The device has to be unlocked as often as locked to be "
|
||||
" .. note::\n\n"
|
||||
" The device has to be unlocked as often as locked to be\n"
|
||||
" able to continue playback.\n\n"
|
||||
".. warning:: Make sure the time between locking and unlocking is "
|
||||
" .. warning::\n\n"
|
||||
" Make sure the time between locking and unlocking is\n"
|
||||
" as short as possible to avoid clicks.");
|
||||
|
||||
static PyObject *
|
||||
@@ -150,13 +152,13 @@ Device_lock(Device* self)
|
||||
}
|
||||
|
||||
PyDoc_STRVAR(M_aud_Device_play_doc,
|
||||
"play(sound, keep=False)\n\n"
|
||||
".. classmethod:: play(sound, keep=False)\n\n"
|
||||
" Plays a sound.\n\n"
|
||||
" :arg sound: The sound to play.\n"
|
||||
" :type sound: :class:`Sound`\n"
|
||||
" :arg keep: See :attr:`Handle.keep`.\n"
|
||||
" :type keep: bool\n"
|
||||
":return: The playback handle with which playback can be "
|
||||
" :return: The playback handle with which playback can be\n"
|
||||
" controlled with.\n"
|
||||
" :rtype: :class:`Handle`");
|
||||
|
||||
@@ -210,7 +212,7 @@ Device_play(Device* self, PyObject* args, PyObject* kwds)
|
||||
}
|
||||
|
||||
PyDoc_STRVAR(M_aud_Device_stopAll_doc,
|
||||
"stopAll()\n\n"
|
||||
".. classmethod:: stopAll()\n\n"
|
||||
" Stops all playing and paused sounds.");
|
||||
|
||||
static PyObject *
|
||||
@@ -229,8 +231,8 @@ Device_stopAll(Device* self)
|
||||
}
|
||||
|
||||
PyDoc_STRVAR(M_aud_Device_unlock_doc,
|
||||
"unlock()\n\n"
|
||||
"Unlocks the device after a lock call, see :meth:`lock` for "
|
||||
".. classmethod:: unlock()\n\n"
|
||||
" Unlocks the device after a lock call, see :meth:`lock` for\n"
|
||||
" details.");
|
||||
|
||||
static PyObject *
|
||||
@@ -284,7 +286,7 @@ Device_get_channels(Device* self, void* nothing)
|
||||
|
||||
PyDoc_STRVAR(M_aud_Device_distance_model_doc,
|
||||
"The distance model of the device.\n\n"
|
||||
".. seealso:: http://connect.creativelabs.com/openal/Documentation/OpenAL%201.1%20Specification.htm#_Toc199835864");
|
||||
".. seealso:: `OpenAL Documentation <https://www.openal.org/documentation/>`__");
|
||||
|
||||
static PyObject *
|
||||
Device_get_distance_model(Device* self, void* nothing)
|
||||
|
@@ -60,7 +60,7 @@ DynamicMusic_dealloc(DynamicMusicP* self)
|
||||
}
|
||||
|
||||
PyDoc_STRVAR(M_aud_DynamicMusic_addScene_doc,
|
||||
"addScene(scene)\n\n"
|
||||
".. classmethod:: addScene(scene)\n\n"
|
||||
" Adds a new scene.\n\n"
|
||||
" :arg scene: The scene sound.\n"
|
||||
" :type scene: :class:`Sound`\n"
|
||||
@@ -90,7 +90,7 @@ DynamicMusic_addScene(DynamicMusicP* self, PyObject* args)
|
||||
}
|
||||
|
||||
PyDoc_STRVAR(M_aud_DynamicMusic_addTransition_doc,
|
||||
"addTransition(ini, end, transition)\n\n"
|
||||
".. classmethod:: addTransition(ini, end, transition)\n\n"
|
||||
" Adds a new scene.\n\n"
|
||||
" :arg ini: the initial scene foor the transition.\n"
|
||||
" :type ini: int\n"
|
||||
@@ -125,7 +125,7 @@ DynamicMusic_addTransition(DynamicMusicP* self, PyObject* args)
|
||||
}
|
||||
|
||||
PyDoc_STRVAR(M_aud_DynamicMusic_resume_doc,
|
||||
"resume()\n\n"
|
||||
".. classmethod:: resume()\n\n"
|
||||
" Resumes playback of the scene.\n\n"
|
||||
" :return: Whether the action succeeded.\n"
|
||||
" :rtype: bool");
|
||||
@@ -145,7 +145,7 @@ DynamicMusic_resume(DynamicMusicP* self)
|
||||
}
|
||||
|
||||
PyDoc_STRVAR(M_aud_DynamicMusic_pause_doc,
|
||||
"pause()\n\n"
|
||||
".. classmethod:: pause()\n\n"
|
||||
" Pauses playback of the scene.\n\n"
|
||||
" :return: Whether the action succeeded.\n"
|
||||
" :rtype: bool");
|
||||
@@ -165,7 +165,7 @@ DynamicMusic_pause(DynamicMusicP* self)
|
||||
}
|
||||
|
||||
PyDoc_STRVAR(M_aud_DynamicMusic_stop_doc,
|
||||
"stop()\n\n"
|
||||
".. classmethod:: stop()\n\n"
|
||||
" Stops playback of the scene.\n\n"
|
||||
" :return: Whether the action succeeded.\n"
|
||||
" :rtype: bool\n\n");
|
||||
|
6
extern/audaspace/bindings/python/PyHRTF.cpp
vendored
6
extern/audaspace/bindings/python/PyHRTF.cpp
vendored
@@ -54,7 +54,7 @@ HRTF_dealloc(HRTFP* self)
|
||||
}
|
||||
|
||||
PyDoc_STRVAR(M_aud_HRTF_addImpulseResponse_doc,
|
||||
"addImpulseResponseFromSound(sound, azimuth, elevation)\n\n"
|
||||
".. classmethod:: addImpulseResponseFromSound(sound, azimuth, elevation)\n\n"
|
||||
" Adds a new hrtf to the HRTF object\n\n"
|
||||
" :arg sound: The sound that contains the hrtf.\n"
|
||||
" :type sound: :class:`Sound`\n"
|
||||
@@ -90,7 +90,7 @@ HRTF_addImpulseResponseFromSound(HRTFP* self, PyObject* args)
|
||||
}
|
||||
|
||||
PyDoc_STRVAR(M_aud_HRTF_loadLeftHrtfSet_doc,
|
||||
"loadLeftHrtfSet(extension, directory)\n\n"
|
||||
".. classmethod:: loadLeftHrtfSet(extension, directory)\n\n"
|
||||
" Loads all HRTFs from a directory.\n\n"
|
||||
" :arg extension: The file extension of the hrtfs.\n"
|
||||
" :type extension: string\n"
|
||||
@@ -125,7 +125,7 @@ HRTF_loadLeftHrtfSet(PyTypeObject* type, PyObject* args)
|
||||
}
|
||||
|
||||
PyDoc_STRVAR(M_aud_HRTF_loadRightHrtfSet_doc,
|
||||
"loadLeftHrtfSet(extension, directory)\n\n"
|
||||
".. classmethod:: loadLeftHrtfSet(extension, directory)\n\n"
|
||||
" Loads all HRTFs from a directory.\n\n"
|
||||
" :arg extension: The file extension of the hrtfs.\n"
|
||||
" :type extension: string\n"
|
||||
|
@@ -38,7 +38,7 @@ Handle_dealloc(Handle* self)
|
||||
}
|
||||
|
||||
PyDoc_STRVAR(M_aud_Handle_pause_doc,
|
||||
"pause()\n\n"
|
||||
".. classmethod:: pause()\n\n"
|
||||
" Pauses playback.\n\n"
|
||||
" :return: Whether the action succeeded.\n"
|
||||
" :rtype: bool");
|
||||
@@ -58,7 +58,7 @@ Handle_pause(Handle* self)
|
||||
}
|
||||
|
||||
PyDoc_STRVAR(M_aud_Handle_resume_doc,
|
||||
"resume()\n\n"
|
||||
".. classmethod:: resume()\n\n"
|
||||
" Resumes playback.\n\n"
|
||||
" :return: Whether the action succeeded.\n"
|
||||
" :rtype: bool");
|
||||
@@ -78,7 +78,7 @@ Handle_resume(Handle* self)
|
||||
}
|
||||
|
||||
PyDoc_STRVAR(M_aud_Handle_stop_doc,
|
||||
"stop()\n\n"
|
||||
".. classmethod:: stop()\n\n"
|
||||
" Stops playback.\n\n"
|
||||
" :return: Whether the action succeeded.\n"
|
||||
" :rtype: bool\n\n"
|
||||
@@ -1122,5 +1122,3 @@ void addHandleToModule(PyObject* module)
|
||||
Py_INCREF(&HandleType);
|
||||
PyModule_AddObject(module, "Handle", (PyObject *)&HandleType);
|
||||
}
|
||||
|
||||
|
||||
|
@@ -60,11 +60,12 @@ PlaybackManager_dealloc(PlaybackManagerP* self)
|
||||
}
|
||||
|
||||
PyDoc_STRVAR(M_aud_PlaybackManager_play_doc,
|
||||
"setVolume(sound, catKey)\n\n"
|
||||
".. classmethod:: setVolume(sound, catKey)\n\n"
|
||||
" Plays a sound through the playback manager and assigns it to a category.\n\n"
|
||||
" :arg sound: The sound to play.\n"
|
||||
" :type sound: :class:`Sound`\n"
|
||||
":arg catKey: the key of the category in which the sound will be added, if it doesn't exist, a new one will be created.\n"
|
||||
" :arg catKey: the key of the category in which the sound will be added,\n"
|
||||
" if it doesn't exist, a new one will be created.\n"
|
||||
" :type catKey: int\n"
|
||||
" :return: The playback handle with which playback can be controlled with.\n"
|
||||
" :rtype: :class:`Handle`");
|
||||
@@ -103,7 +104,7 @@ PlaybackManager_play(PlaybackManagerP* self, PyObject* args)
|
||||
}
|
||||
|
||||
PyDoc_STRVAR(M_aud_PlaybackManager_resume_doc,
|
||||
"resume(catKey)\n\n"
|
||||
".. classmethod:: resume(catKey)\n\n"
|
||||
" Resumes playback of the catgory.\n\n"
|
||||
" :arg catKey: the key of the category.\n"
|
||||
" :type catKey: int\n"
|
||||
@@ -130,7 +131,7 @@ PlaybackManager_resume(PlaybackManagerP* self, PyObject* args)
|
||||
}
|
||||
|
||||
PyDoc_STRVAR(M_aud_PlaybackManager_pause_doc,
|
||||
"pause(catKey)\n\n"
|
||||
".. classmethod:: pause(catKey)\n\n"
|
||||
" Pauses playback of the category.\n\n"
|
||||
" :arg catKey: the key of the category.\n"
|
||||
" :type catKey: int\n"
|
||||
@@ -157,7 +158,7 @@ PlaybackManager_pause(PlaybackManagerP* self, PyObject* args)
|
||||
}
|
||||
|
||||
PyDoc_STRVAR(M_aud_PlaybackManager_add_category_doc,
|
||||
"addCategory(volume)\n\n"
|
||||
".. classmethod:: addCategory(volume)\n\n"
|
||||
" Adds a category with a custom volume.\n\n"
|
||||
" :arg volume: The volume for ther new category.\n"
|
||||
" :type volume: float\n"
|
||||
@@ -184,7 +185,7 @@ PlaybackManager_add_category(PlaybackManagerP* self, PyObject* args)
|
||||
}
|
||||
|
||||
PyDoc_STRVAR(M_aud_PlaybackManager_get_volume_doc,
|
||||
"getVolume(catKey)\n\n"
|
||||
".. classmethod:: getVolume(catKey)\n\n"
|
||||
" Retrieves the volume of a category.\n\n"
|
||||
" :arg catKey: the key of the category.\n"
|
||||
" :type catKey: int\n"
|
||||
@@ -211,7 +212,7 @@ PlaybackManager_get_volume(PlaybackManagerP* self, PyObject* args)
|
||||
}
|
||||
|
||||
PyDoc_STRVAR(M_aud_PlaybackManager_set_volume_doc,
|
||||
"setVolume(volume, catKey)\n\n"
|
||||
".. classmethod:: setVolume(volume, catKey)\n\n"
|
||||
" Changes the volume of a category.\n\n"
|
||||
" :arg volume: the new volume value.\n"
|
||||
" :type volume: float\n"
|
||||
@@ -241,7 +242,7 @@ PlaybackManager_set_volume(PlaybackManagerP* self, PyObject* args)
|
||||
}
|
||||
|
||||
PyDoc_STRVAR(M_aud_PlaybackManager_stop_doc,
|
||||
"stop(catKey)\n\n"
|
||||
".. classmethod:: stop(catKey)\n\n"
|
||||
" Stops playback of the category.\n\n"
|
||||
" :arg catKey: the key of the category.\n"
|
||||
" :type catKey: int\n"
|
||||
@@ -268,7 +269,7 @@ PlaybackManager_stop(PlaybackManagerP* self, PyObject* args)
|
||||
}
|
||||
|
||||
PyDoc_STRVAR(M_aud_PlaybackManager_clean_doc,
|
||||
"clean()\n\n"
|
||||
".. classmethod:: clean()\n\n"
|
||||
" Cleans all the invalid and finished sound from the playback manager.\n\n");
|
||||
|
||||
static PyObject *
|
||||
|
@@ -99,7 +99,7 @@ Sequence_new(PyTypeObject* type, PyObject* args, PyObject* kwds)
|
||||
}
|
||||
|
||||
PyDoc_STRVAR(M_aud_Sequence_add_doc,
|
||||
"add()\n\n"
|
||||
".. classmethod:: add()\n\n"
|
||||
" Adds a new entry to the sequence.\n\n"
|
||||
" :arg sound: The sound this entry should play.\n"
|
||||
" :type sound: :class:`Sound`\n"
|
||||
@@ -151,7 +151,7 @@ Sequence_add(Sequence* self, PyObject* args, PyObject* kwds)
|
||||
}
|
||||
|
||||
PyDoc_STRVAR(M_aud_Sequence_remove_doc,
|
||||
"remove()\n\n"
|
||||
".. classmethod:: remove()\n\n"
|
||||
" Removes an entry from the sequence.\n\n"
|
||||
" :arg entry: The entry to remove.\n"
|
||||
" :type entry: :class:`SequenceEntry`\n");
|
||||
@@ -183,7 +183,7 @@ Sequence_remove(Sequence* self, PyObject* args)
|
||||
}
|
||||
|
||||
PyDoc_STRVAR(M_aud_Sequence_setAnimationData_doc,
|
||||
"setAnimationData()\n\n"
|
||||
".. classmethod:: setAnimationData()\n\n"
|
||||
" Writes animation data to a sequence.\n\n"
|
||||
" :arg type: The type of animation data.\n"
|
||||
" :type type: int\n"
|
||||
@@ -325,7 +325,7 @@ Sequence_set_channels(Sequence* self, PyObject* args, void* nothing)
|
||||
|
||||
PyDoc_STRVAR(M_aud_Sequence_distance_model_doc,
|
||||
"The distance model of the sequence.\n\n"
|
||||
".. seealso:: http://connect.creativelabs.com/openal/Documentation/OpenAL%201.1%20Specification.htm#_Toc199835864");
|
||||
".. seealso:: `OpenAL Documentation <https://www.openal.org/documentation/>`__");
|
||||
|
||||
static PyObject *
|
||||
Sequence_get_distance_model(Sequence* self, void* nothing)
|
||||
|
@@ -43,7 +43,7 @@ SequenceEntry_dealloc(SequenceEntry* self)
|
||||
}
|
||||
|
||||
PyDoc_STRVAR(M_aud_SequenceEntry_move_doc,
|
||||
"move()\n\n"
|
||||
".. classmethod:: move()\n\n"
|
||||
" Moves the entry.\n\n"
|
||||
" :arg begin: The new start time.\n"
|
||||
" :type begin: float\n"
|
||||
@@ -73,7 +73,7 @@ SequenceEntry_move(SequenceEntry* self, PyObject* args)
|
||||
}
|
||||
|
||||
PyDoc_STRVAR(M_aud_SequenceEntry_setAnimationData_doc,
|
||||
"setAnimationData()\n\n"
|
||||
".. classmethod:: setAnimationData()\n\n"
|
||||
" Writes animation data to a sequenced entry.\n\n"
|
||||
" :arg type: The type of animation data.\n"
|
||||
" :type type: int\n"
|
||||
|
189
extern/audaspace/bindings/python/PySound.cpp
vendored
189
extern/audaspace/bindings/python/PySound.cpp
vendored
@@ -114,7 +114,7 @@ Sound_new(PyTypeObject* type, PyObject* args, PyObject* kwds)
|
||||
}
|
||||
|
||||
PyDoc_STRVAR(M_aud_Sound_data_doc,
|
||||
"data()\n\n"
|
||||
".. classmethod:: data()\n\n"
|
||||
" Retrieves the data of the sound as numpy array.\n\n"
|
||||
" :return: A two dimensional numpy float array.\n"
|
||||
" :rtype: :class:`numpy.ndarray`\n\n"
|
||||
@@ -145,7 +145,7 @@ Sound_data(Sound* self)
|
||||
}
|
||||
|
||||
PyDoc_STRVAR(M_aud_Sound_write_doc,
|
||||
"write(filename, rate, channels, format, container, codec, bitrate, buffersize)\n\n"
|
||||
".. classmethod:: write(filename, rate, channels, format, container, codec, bitrate, buffersize)\n\n"
|
||||
" Writes the sound to a file.\n\n"
|
||||
" :arg filename: The path to write to.\n"
|
||||
" :type filename: string\n"
|
||||
@@ -162,7 +162,7 @@ PyDoc_STRVAR(M_aud_Sound_write_doc,
|
||||
" :arg bitrate: The bitrate to write with.\n"
|
||||
" :type bitrate: int\n"
|
||||
" :arg buffersize: The size of the writing buffer.\n"
|
||||
":type buffersize: int\n");
|
||||
" :type buffersize: int");
|
||||
|
||||
static PyObject *
|
||||
Sound_write(Sound* self, PyObject* args, PyObject* kwds)
|
||||
@@ -286,7 +286,7 @@ Sound_write(Sound* self, PyObject* args, PyObject* kwds)
|
||||
}
|
||||
|
||||
PyDoc_STRVAR(M_aud_Sound_buffer_doc,
|
||||
"buffer(data, rate)\n\n"
|
||||
".. classmethod:: buffer(data, rate)\n\n"
|
||||
" Creates a sound from a data buffer.\n\n"
|
||||
" :arg data: The data as two dimensional numpy array.\n"
|
||||
" :type data: numpy.ndarray\n"
|
||||
@@ -356,15 +356,16 @@ Sound_buffer(PyTypeObject* type, PyObject* args)
|
||||
}
|
||||
|
||||
PyDoc_STRVAR(M_aud_Sound_cache_doc,
|
||||
"cache()\n\n"
|
||||
"Caches a sound into RAM.\n"
|
||||
"This saves CPU usage needed for decoding and file access if the "
|
||||
"underlying sound reads from a file on the harddisk, but it "
|
||||
"consumes a lot of memory.\n\n"
|
||||
".. classmethod:: cache()\n\n"
|
||||
" Caches a sound into RAM.\n\n"
|
||||
" This saves CPU usage needed for decoding and file access if the\n"
|
||||
" underlying sound reads from a file on the harddisk,\n"
|
||||
" but it consumes a lot of memory.\n\n"
|
||||
" :return: The created :class:`Sound` object.\n"
|
||||
" :rtype: :class:`Sound`\n\n"
|
||||
" .. note:: Only known-length factories can be buffered.\n\n"
|
||||
".. warning:: Raw PCM data needs a lot of space, only buffer "
|
||||
" .. warning::\n\n"
|
||||
" Raw PCM data needs a lot of space, only buffer\n"
|
||||
" short factories.");
|
||||
|
||||
static PyObject *
|
||||
@@ -391,15 +392,16 @@ Sound_cache(Sound* self)
|
||||
}
|
||||
|
||||
PyDoc_STRVAR(M_aud_Sound_file_doc,
|
||||
"file(filename)\n\n"
|
||||
".. classmethod:: file(filename)\n\n"
|
||||
" Creates a sound object of a sound file.\n\n"
|
||||
" :arg filename: Path of the file.\n"
|
||||
" :type filename: string\n"
|
||||
" :return: The created :class:`Sound` object.\n"
|
||||
" :rtype: :class:`Sound`\n\n"
|
||||
".. warning:: If the file doesn't exist or can't be read you will "
|
||||
"not get an exception immediately, but when you try to start "
|
||||
"playback of that sound.");
|
||||
" .. warning::\n\n"
|
||||
" If the file doesn't exist or can't be read you will\n"
|
||||
" not get an exception immediately, but when you try to start\n"
|
||||
" playback of that sound.\n");
|
||||
|
||||
static PyObject *
|
||||
Sound_file(PyTypeObject* type, PyObject* args)
|
||||
@@ -430,11 +432,11 @@ Sound_file(PyTypeObject* type, PyObject* args)
|
||||
}
|
||||
|
||||
PyDoc_STRVAR(M_aud_Sound_sawtooth_doc,
|
||||
"sawtooth(frequency, rate=48000)\n\n"
|
||||
".. classmethod:: sawtooth(frequency, rate=48000)\n\n"
|
||||
" Creates a sawtooth sound which plays a sawtooth wave.\n\n"
|
||||
" :arg frequency: The frequency of the sawtooth wave in Hz.\n"
|
||||
" :type frequency: float\n"
|
||||
":arg rate: The sampling rate in Hz. It's recommended to set this "
|
||||
" :arg rate: The sampling rate in Hz. It's recommended to set this\n"
|
||||
" value to the playback device's samling rate to avoid resamping.\n"
|
||||
" :type rate: int\n"
|
||||
" :return: The created :class:`Sound` object.\n"
|
||||
@@ -470,9 +472,9 @@ Sound_sawtooth(PyTypeObject* type, PyObject* args)
|
||||
}
|
||||
|
||||
PyDoc_STRVAR(M_aud_Sound_silence_doc,
|
||||
"silence(rate=48000)\n\n"
|
||||
".. classmethod:: silence(rate=48000)\n\n"
|
||||
" Creates a silence sound which plays simple silence.\n\n"
|
||||
":arg rate: The sampling rate in Hz. It's recommended to set this "
|
||||
" :arg rate: The sampling rate in Hz. It's recommended to set this\n"
|
||||
" value to the playback device's samling rate to avoid resamping.\n"
|
||||
" :type rate: int\n"
|
||||
" :return: The created :class:`Sound` object.\n"
|
||||
@@ -507,11 +509,11 @@ Sound_silence(PyTypeObject* type, PyObject* args)
|
||||
}
|
||||
|
||||
PyDoc_STRVAR(M_aud_Sound_sine_doc,
|
||||
"sine(frequency, rate=48000)\n\n"
|
||||
".. classmethod:: sine(frequency, rate=48000)\n\n"
|
||||
" Creates a sine sound which plays a sine wave.\n\n"
|
||||
" :arg frequency: The frequency of the sine wave in Hz.\n"
|
||||
" :type frequency: float\n"
|
||||
":arg rate: The sampling rate in Hz. It's recommended to set this "
|
||||
" :arg rate: The sampling rate in Hz. It's recommended to set this\n"
|
||||
" value to the playback device's samling rate to avoid resamping.\n"
|
||||
" :type rate: int\n"
|
||||
" :return: The created :class:`Sound` object.\n"
|
||||
@@ -547,11 +549,11 @@ Sound_sine(PyTypeObject* type, PyObject* args)
|
||||
}
|
||||
|
||||
PyDoc_STRVAR(M_aud_Sound_square_doc,
|
||||
"square(frequency, rate=48000)\n\n"
|
||||
".. classmethod:: square(frequency, rate=48000)\n\n"
|
||||
" Creates a square sound which plays a square wave.\n\n"
|
||||
" :arg frequency: The frequency of the square wave in Hz.\n"
|
||||
" :type frequency: float\n"
|
||||
":arg rate: The sampling rate in Hz. It's recommended to set this "
|
||||
" :arg rate: The sampling rate in Hz. It's recommended to set this\n"
|
||||
" value to the playback device's samling rate to avoid resamping.\n"
|
||||
" :type rate: int\n"
|
||||
" :return: The created :class:`Sound` object.\n"
|
||||
@@ -587,11 +589,11 @@ Sound_square(PyTypeObject* type, PyObject* args)
|
||||
}
|
||||
|
||||
PyDoc_STRVAR(M_aud_Sound_triangle_doc,
|
||||
"triangle(frequency, rate=48000)\n\n"
|
||||
".. classmethod:: triangle(frequency, rate=48000)\n\n"
|
||||
" Creates a triangle sound which plays a triangle wave.\n\n"
|
||||
" :arg frequency: The frequency of the triangle wave in Hz.\n"
|
||||
" :type frequency: float\n"
|
||||
":arg rate: The sampling rate in Hz. It's recommended to set this "
|
||||
" :arg rate: The sampling rate in Hz. It's recommended to set this\n"
|
||||
" value to the playback device's samling rate to avoid resamping.\n"
|
||||
" :type rate: int\n"
|
||||
" :return: The created :class:`Sound` object.\n"
|
||||
@@ -627,9 +629,11 @@ Sound_triangle(PyTypeObject* type, PyObject* args)
|
||||
}
|
||||
|
||||
PyDoc_STRVAR(M_aud_Sound_accumulate_doc,
|
||||
"accumulate(additive=False)\n\n"
|
||||
"Accumulates a sound by summing over positive input differences thus generating a monotonic sigal. "
|
||||
"If additivity is set to true negative input differences get added too, but positive ones with a factor of two. "
|
||||
".. classmethod:: accumulate(additive=False)\n\n"
|
||||
" Accumulates a sound by summing over positive input\n"
|
||||
" differences thus generating a monotonic sigal.\n"
|
||||
" If additivity is set to true negative input differences get added too,\n"
|
||||
" but positive ones with a factor of two.\n\n"
|
||||
" Note that with additivity the signal is not monotonic anymore.\n\n"
|
||||
" :arg additive: Whether the accumulation should be additive or not.\n"
|
||||
" :type time: bool\n"
|
||||
@@ -677,8 +681,8 @@ Sound_accumulate(Sound* self, PyObject* args)
|
||||
}
|
||||
|
||||
PyDoc_STRVAR(M_aud_Sound_ADSR_doc,
|
||||
"ADSR(attack,decay,sustain,release)\n\n"
|
||||
"Attack-Decay-Sustain-Release envelopes the volume of a sound. "
|
||||
".. classmethod:: ADSR(attack, decay, sustain, release)\n\n"
|
||||
" Attack-Decay-Sustain-Release envelopes the volume of a sound.\n"
|
||||
" Note: there is currently no way to trigger the release with this API.\n\n"
|
||||
" :arg attack: The attack time in seconds.\n"
|
||||
" :type attack: float\n"
|
||||
@@ -720,11 +724,9 @@ Sound_ADSR(Sound* self, PyObject* args)
|
||||
}
|
||||
|
||||
PyDoc_STRVAR(M_aud_Sound_delay_doc,
|
||||
"delay(time)\n\n"
|
||||
"Delays by playing adding silence in front of the other sound's "
|
||||
"data.\n\n"
|
||||
":arg time: How many seconds of silence should be added before "
|
||||
"the sound.\n"
|
||||
".. classmethod:: delay(time)\n\n"
|
||||
" Delays by playing adding silence in front of the other sound's data.\n\n"
|
||||
" :arg time: How many seconds of silence should be added before the sound.\n"
|
||||
" :type time: float\n"
|
||||
" :return: The created :class:`Sound` object.\n"
|
||||
" :rtype: :class:`Sound`");
|
||||
@@ -758,9 +760,8 @@ Sound_delay(Sound* self, PyObject* args)
|
||||
}
|
||||
|
||||
PyDoc_STRVAR(M_aud_Sound_envelope_doc,
|
||||
"envelope(attack, release, threshold, arthreshold)\n\n"
|
||||
"Delays by playing adding silence in front of the other sound's "
|
||||
"data.\n\n"
|
||||
".. classmethod:: envelope(attack, release, threshold, arthreshold)\n\n"
|
||||
" Delays by playing adding silence in front of the other sound's data.\n\n"
|
||||
" :arg attack: The attack factor.\n"
|
||||
" :type attack: float\n"
|
||||
" :arg release: The release factor.\n"
|
||||
@@ -801,8 +802,8 @@ Sound_envelope(Sound* self, PyObject* args)
|
||||
}
|
||||
|
||||
PyDoc_STRVAR(M_aud_Sound_fadein_doc,
|
||||
"fadein(start, length)\n\n"
|
||||
"Fades a sound in by raising the volume linearly in the given "
|
||||
".. classmethod:: fadein(start, length)\n\n"
|
||||
" Fades a sound in by raising the volume linearly in the given\n"
|
||||
" time interval.\n\n"
|
||||
" :arg start: Time in seconds when the fading should start.\n"
|
||||
" :type start: float\n"
|
||||
@@ -841,8 +842,8 @@ Sound_fadein(Sound* self, PyObject* args)
|
||||
}
|
||||
|
||||
PyDoc_STRVAR(M_aud_Sound_fadeout_doc,
|
||||
"fadeout(start, length)\n\n"
|
||||
"Fades a sound in by lowering the volume linearly in the given "
|
||||
".. classmethod:: fadeout(start, length)\n\n"
|
||||
" Fades a sound in by lowering the volume linearly in the given\n"
|
||||
" time interval.\n\n"
|
||||
" :arg start: Time in seconds when the fading should start.\n"
|
||||
" :type start: float\n"
|
||||
@@ -850,7 +851,8 @@ PyDoc_STRVAR(M_aud_Sound_fadeout_doc,
|
||||
" :type length: float\n"
|
||||
" :return: The created :class:`Sound` object.\n"
|
||||
" :rtype: :class:`Sound`\n\n"
|
||||
".. note:: After the fade this sound plays silence, so that "
|
||||
" .. note::\n\n"
|
||||
" After the fade this sound plays silence, so that\n"
|
||||
" the length of the sound is not altered.");
|
||||
|
||||
static PyObject *
|
||||
@@ -882,13 +884,13 @@ Sound_fadeout(Sound* self, PyObject* args)
|
||||
}
|
||||
|
||||
PyDoc_STRVAR(M_aud_Sound_filter_doc,
|
||||
"filter(b, a = (1))\n\n"
|
||||
".. classmethod:: filter(b, a = (1))\n\n"
|
||||
" Filters a sound with the supplied IIR filter coefficients.\n"
|
||||
"Without the second parameter you'll get a FIR filter.\n"
|
||||
"If the first value of the a sequence is 0 it will be set to 1 "
|
||||
"automatically.\n"
|
||||
"If the first value of the a sequence is neither 0 nor 1, all "
|
||||
"filter coefficients will be scaled by this value so that it is 1 "
|
||||
" Without the second parameter you'll get a FIR filter.\n\n"
|
||||
" If the first value of the a sequence is 0,\n"
|
||||
" it will be set to 1 automatically.\n"
|
||||
" If the first value of the a sequence is neither 0 nor 1, all\n"
|
||||
" filter coefficients will be scaled by this value so that it is 1\n"
|
||||
" in the end, you don't have to scale yourself.\n\n"
|
||||
" :arg b: The nominator filter coefficients.\n"
|
||||
" :type b: sequence of float\n"
|
||||
@@ -982,9 +984,9 @@ Sound_filter(Sound* self, PyObject* args)
|
||||
}
|
||||
|
||||
PyDoc_STRVAR(M_aud_Sound_highpass_doc,
|
||||
"highpass(frequency, Q=0.5)\n\n"
|
||||
"Creates a second order highpass filter based on the transfer "
|
||||
"function H(s) = s^2 / (s^2 + s/Q + 1)\n\n"
|
||||
".. classmethod:: highpass(frequency, Q=0.5)\n\n"
|
||||
" Creates a second order highpass filter based on the transfer\n"
|
||||
" function :math:`H(s) = s^2 / (s^2 + s/Q + 1)`\n\n"
|
||||
" :arg frequency: The cut off trequency of the highpass.\n"
|
||||
" :type frequency: float\n"
|
||||
" :arg Q: Q factor of the lowpass.\n"
|
||||
@@ -1022,7 +1024,7 @@ Sound_highpass(Sound* self, PyObject* args)
|
||||
}
|
||||
|
||||
PyDoc_STRVAR(M_aud_Sound_limit_doc,
|
||||
"limit(start, end)\n\n"
|
||||
".. classmethod:: limit(start, end)\n\n"
|
||||
" Limits a sound within a specific start and end time.\n\n"
|
||||
" :arg start: Start time in seconds.\n"
|
||||
" :type start: float\n"
|
||||
@@ -1060,14 +1062,15 @@ Sound_limit(Sound* self, PyObject* args)
|
||||
}
|
||||
|
||||
PyDoc_STRVAR(M_aud_Sound_loop_doc,
|
||||
"loop(count)\n\n"
|
||||
".. classmethod:: loop(count)\n\n"
|
||||
" Loops a sound.\n\n"
|
||||
":arg count: How often the sound should be looped. "
|
||||
" :arg count: How often the sound should be looped.\n"
|
||||
" Negative values mean endlessly.\n"
|
||||
" :type count: integer\n"
|
||||
" :return: The created :class:`Sound` object.\n"
|
||||
" :rtype: :class:`Sound`\n\n"
|
||||
".. note:: This is a filter function, you might consider using "
|
||||
" .. note::\n\n"
|
||||
" This is a filter function, you might consider using\n"
|
||||
" :attr:`Handle.loop_count` instead.");
|
||||
|
||||
static PyObject *
|
||||
@@ -1099,9 +1102,9 @@ Sound_loop(Sound* self, PyObject* args)
|
||||
}
|
||||
|
||||
PyDoc_STRVAR(M_aud_Sound_lowpass_doc,
|
||||
"lowpass(frequency, Q=0.5)\n\n"
|
||||
".. classmethod:: lowpass(frequency, Q=0.5)\n\n"
|
||||
" Creates a second order lowpass filter based on the transfer "
|
||||
"function H(s) = 1 / (s^2 + s/Q + 1)\n\n"
|
||||
" function :math:`H(s) = 1 / (s^2 + s/Q + 1)`\n\n"
|
||||
" :arg frequency: The cut off trequency of the lowpass.\n"
|
||||
" :type frequency: float\n"
|
||||
" :arg Q: Q factor of the lowpass.\n"
|
||||
@@ -1139,13 +1142,14 @@ Sound_lowpass(Sound* self, PyObject* args)
|
||||
}
|
||||
|
||||
PyDoc_STRVAR(M_aud_Sound_modulate_doc,
|
||||
"modulate(sound)\n\n"
|
||||
".. classmethod:: modulate(sound)\n\n"
|
||||
" Modulates two factories.\n\n"
|
||||
" :arg sound: The sound to modulate over the other.\n"
|
||||
" :type sound: :class:`Sound`\n"
|
||||
" :return: The created :class:`Sound` object.\n"
|
||||
" :rtype: :class:`Sound`\n\n"
|
||||
".. note:: The two factories have to have the same specifications "
|
||||
" .. note::\n\n"
|
||||
" The two factories have to have the same specifications\n"
|
||||
" (channels and samplerate).");
|
||||
|
||||
static PyObject *
|
||||
@@ -1180,16 +1184,18 @@ Sound_modulate(Sound* self, PyObject* object)
|
||||
}
|
||||
|
||||
PyDoc_STRVAR(M_aud_Sound_pitch_doc,
|
||||
"pitch(factor)\n\n"
|
||||
".. classmethod:: pitch(factor)\n\n"
|
||||
" Changes the pitch of a sound with a specific factor.\n\n"
|
||||
" :arg factor: The factor to change the pitch with.\n"
|
||||
" :type factor: float\n"
|
||||
" :return: The created :class:`Sound` object.\n"
|
||||
" :rtype: :class:`Sound`\n\n"
|
||||
".. note:: This is done by changing the sample rate of the "
|
||||
"underlying sound, which has to be an integer, so the factor "
|
||||
" .. note::\n\n"
|
||||
" This is done by changing the sample rate of the\n"
|
||||
" underlying sound, which has to be an integer, so the factor\n"
|
||||
" value rounded and the factor may not be 100 % accurate.\n\n"
|
||||
".. note:: This is a filter function, you might consider using "
|
||||
" .. note::\n\n"
|
||||
" This is a filter function, you might consider using\n"
|
||||
" :attr:`Handle.pitch` instead.");
|
||||
|
||||
static PyObject *
|
||||
@@ -1221,7 +1227,7 @@ Sound_pitch(Sound* self, PyObject* args)
|
||||
}
|
||||
|
||||
PyDoc_STRVAR(M_aud_Sound_rechannel_doc,
|
||||
"rechannel(channels)\n\n"
|
||||
".. classmethod:: rechannel(channels)\n\n"
|
||||
" Rechannels the sound.\n\n"
|
||||
" :arg channels: The new channel configuration.\n"
|
||||
" :type channels: int\n"
|
||||
@@ -1261,7 +1267,7 @@ Sound_rechannel(Sound* self, PyObject* args)
|
||||
}
|
||||
|
||||
PyDoc_STRVAR(M_aud_Sound_resample_doc,
|
||||
"resample(rate, high_quality)\n\n"
|
||||
".. classmethod:: resample(rate, high_quality)\n\n"
|
||||
" Resamples the sound.\n\n"
|
||||
" :arg rate: The new sample rate.\n"
|
||||
" :type rate: double\n"
|
||||
@@ -1316,16 +1322,18 @@ Sound_resample(Sound* self, PyObject* args)
|
||||
}
|
||||
|
||||
PyDoc_STRVAR(M_aud_Sound_reverse_doc,
|
||||
"reverse()\n\n"
|
||||
".. classmethod:: reverse()\n\n"
|
||||
" Plays a sound reversed.\n\n"
|
||||
" :return: The created :class:`Sound` object.\n"
|
||||
" :rtype: :class:`Sound`\n\n"
|
||||
".. note:: The sound has to have a finite length and has to be "
|
||||
"seekable. It's recommended to use this only with factories with "
|
||||
"fast and accurate seeking, which is not true for encoded audio "
|
||||
"files, such ones should be buffered using :meth:`cache` before "
|
||||
" .. note::\n\n"
|
||||
" The sound has to have a finite length and has to be seekable.\n"
|
||||
" It's recommended to use this only with factories with\n"
|
||||
" fast and accurate seeking, which is not true for encoded audio\n"
|
||||
" files, such ones should be buffered using :meth:`cache` before\n"
|
||||
" being played reversed.\n\n"
|
||||
".. warning:: If seeking is not accurate in the underlying sound "
|
||||
" .. warning::\n\n"
|
||||
" If seeking is not accurate in the underlying sound\n"
|
||||
" you'll likely hear skips/jumps/cracks.");
|
||||
|
||||
static PyObject *
|
||||
@@ -1352,7 +1360,7 @@ Sound_reverse(Sound* self)
|
||||
}
|
||||
|
||||
PyDoc_STRVAR(M_aud_Sound_sum_doc,
|
||||
"sum()\n\n"
|
||||
".. classmethod:: sum()\n\n"
|
||||
" Sums the samples of a sound.\n\n"
|
||||
" :return: The created :class:`Sound` object.\n"
|
||||
" :rtype: :class:`Sound`");
|
||||
@@ -1381,11 +1389,11 @@ Sound_sum(Sound* self)
|
||||
}
|
||||
|
||||
PyDoc_STRVAR(M_aud_Sound_threshold_doc,
|
||||
"threshold(threshold = 0)\n\n"
|
||||
"Makes a threshold wave out of an audio wave by setting all samples "
|
||||
"with a amplitude >= threshold to 1, all <= -threshold to -1 and "
|
||||
".. classmethod:: threshold(threshold = 0)\n\n"
|
||||
" Makes a threshold wave out of an audio wave by setting all samples\n"
|
||||
" with a amplitude >= threshold to 1, all <= -threshold to -1 and\n"
|
||||
" all between to 0.\n\n"
|
||||
":arg threshold: Threshold value over which an amplitude counts "
|
||||
" :arg threshold: Threshold value over which an amplitude counts\n"
|
||||
" non-zero.\n"
|
||||
":type threshold: float\n"
|
||||
":return: The created :class:`Sound` object.\n"
|
||||
@@ -1420,14 +1428,15 @@ Sound_threshold(Sound* self, PyObject* args)
|
||||
}
|
||||
|
||||
PyDoc_STRVAR(M_aud_Sound_volume_doc,
|
||||
"volume(volume)\n\n"
|
||||
".. classmethod:: volume(volume)\n\n"
|
||||
" Changes the volume of a sound.\n\n"
|
||||
" :arg volume: The new volume..\n"
|
||||
" :type volume: float\n"
|
||||
" :return: The created :class:`Sound` object.\n"
|
||||
" :rtype: :class:`Sound`\n\n"
|
||||
" .. note:: Should be in the range [0, 1] to avoid clipping.\n\n"
|
||||
".. note:: This is a filter function, you might consider using "
|
||||
" .. note::\n\n"
|
||||
" This is a filter function, you might consider using\n"
|
||||
" :attr:`Handle.volume` instead.");
|
||||
|
||||
static PyObject *
|
||||
@@ -1459,13 +1468,14 @@ Sound_volume(Sound* self, PyObject* args)
|
||||
}
|
||||
|
||||
PyDoc_STRVAR(M_aud_Sound_join_doc,
|
||||
"join(sound)\n\n"
|
||||
".. classmethod:: join(sound)\n\n"
|
||||
" Plays two factories in sequence.\n\n"
|
||||
" :arg sound: The sound to play second.\n"
|
||||
" :type sound: :class:`Sound`\n"
|
||||
" :return: The created :class:`Sound` object.\n"
|
||||
" :rtype: :class:`Sound`\n\n"
|
||||
".. note:: The two factories have to have the same specifications "
|
||||
" .. note::\n\n"
|
||||
" The two factories have to have the same specifications\n"
|
||||
" (channels and samplerate).");
|
||||
|
||||
static PyObject *
|
||||
@@ -1501,13 +1511,14 @@ Sound_join(Sound* self, PyObject* object)
|
||||
}
|
||||
|
||||
PyDoc_STRVAR(M_aud_Sound_mix_doc,
|
||||
"mix(sound)\n\n"
|
||||
".. classmethod:: mix(sound)\n\n"
|
||||
" Mixes two factories.\n\n"
|
||||
" :arg sound: The sound to mix over the other.\n"
|
||||
" :type sound: :class:`Sound`\n"
|
||||
" :return: The created :class:`Sound` object.\n"
|
||||
" :rtype: :class:`Sound`\n\n"
|
||||
".. note:: The two factories have to have the same specifications "
|
||||
" .. note::\n\n"
|
||||
" The two factories have to have the same specifications\n"
|
||||
" (channels and samplerate).");
|
||||
|
||||
static PyObject *
|
||||
@@ -1542,7 +1553,7 @@ Sound_mix(Sound* self, PyObject* object)
|
||||
}
|
||||
|
||||
PyDoc_STRVAR(M_aud_Sound_pingpong_doc,
|
||||
"pingpong()\n\n"
|
||||
".. classmethod:: pingpong()\n\n"
|
||||
" Plays a sound forward and then backward.\n"
|
||||
" This is like joining a sound with its reverse.\n\n"
|
||||
" :return: The created :class:`Sound` object.\n"
|
||||
@@ -1572,9 +1583,9 @@ Sound_pingpong(Sound* self)
|
||||
}
|
||||
|
||||
PyDoc_STRVAR(M_aud_Sound_list_doc,
|
||||
"list()\n\n"
|
||||
".. classmethod:: list()\n\n"
|
||||
" Creates an empty sound list that can contain several sounds.\n\n"
|
||||
":arg random: wether the playback will be random or not.\n"
|
||||
" :arg random: whether the playback will be random or not.\n"
|
||||
" :type random: int\n"
|
||||
" :return: The created :class:`Sound` object.\n"
|
||||
" :rtype: :class:`Sound`");
|
||||
@@ -1608,7 +1619,7 @@ Sound_list(PyTypeObject* type, PyObject* args)
|
||||
}
|
||||
|
||||
PyDoc_STRVAR(M_aud_Sound_mutable_doc,
|
||||
"mutable()\n\n"
|
||||
".. classmethod:: mutable()\n\n"
|
||||
" Creates a sound that will be restarted when sought backwards.\n"
|
||||
" If the original sound is a sound list, the playing sound can change.\n\n"
|
||||
" :return: The created :class:`Sound` object.\n"
|
||||
@@ -1638,7 +1649,7 @@ Sound_mutable(Sound* self)
|
||||
}
|
||||
|
||||
PyDoc_STRVAR(M_aud_Sound_list_addSound_doc,
|
||||
"addSound(sound)\n\n"
|
||||
".. classmethod:: addSound(sound)\n\n"
|
||||
" Adds a new sound to a sound list.\n\n"
|
||||
" :arg sound: The sound that will be added to the list.\n"
|
||||
" :type sound: :class:`Sound`\n\n"
|
||||
@@ -1671,7 +1682,7 @@ Sound_list_addSound(Sound* self, PyObject* object)
|
||||
#ifdef WITH_CONVOLUTION
|
||||
|
||||
PyDoc_STRVAR(M_aud_Sound_convolver_doc,
|
||||
"convolver()\n\n"
|
||||
".. classmethod:: convolver()\n\n"
|
||||
" Creates a sound that will apply convolution to another sound.\n\n"
|
||||
" :arg impulseResponse: The filter with which convolve the sound.\n"
|
||||
" :type impulseResponse: :class:`ImpulseResponse`\n"
|
||||
@@ -1720,7 +1731,7 @@ Sound_convolver(Sound* self, PyObject* args)
|
||||
}
|
||||
|
||||
PyDoc_STRVAR(M_aud_Sound_binaural_doc,
|
||||
"convolver()\n\n"
|
||||
".. classmethod:: convolver()\n\n"
|
||||
" Creates a binaural sound using another sound as source. The original sound must be mono\n\n"
|
||||
" :arg hrtfs: An HRTF set.\n"
|
||||
" :type hrtf: :class:`HRTF`\n"
|
||||
|
Reference in New Issue
Block a user