Retouch docstrings for multi-value properties

This fixes GH-64.  Moreover switch back to flake8 since pytest-flake8
is not as configurable.
This commit is contained in:
Nguyễn Gia Phong 2020-05-09 21:51:55 +07:00
parent 24192360f8
commit 83315de9c8
4 changed files with 55 additions and 41 deletions

View File

@ -1,6 +1,6 @@
[metadata] [metadata]
name = palace name = palace
version = 0.2.0 version = 0.2.1
url = https://github.com/McSinyx/palace url = https://github.com/McSinyx/palace
author = Nguyễn Gia Phong author = Nguyễn Gia Phong
author_email = mcsinyx@disroot.org author_email = mcsinyx@disroot.org

View File

@ -106,10 +106,10 @@ cdef extern from 'alure2.h' nogil:
float hf_reference 'flHFReference' float hf_reference 'flHFReference'
float lf_reference 'flLFReference' float lf_reference 'flLFReference'
float room_rolloff_factor 'flRoomRolloffFactor' float room_rolloff_factor 'flRoomRolloffFactor'
int decay_hf_limit 'iDecayHFLimit' bint decay_hf_limit 'iDecayHFLimit'
cdef cppclass EFXCHORUSPROPERTIES: cdef cppclass EFXCHORUSPROPERTIES:
int waveform 'iWaveform' bint waveform 'iWaveform'
int phase 'iPhase' int phase 'iPhase'
float rate 'flRate' float rate 'flRate'
float depth 'flDepth' float depth 'flDepth'

View File

@ -925,7 +925,7 @@ cdef class Listener:
def orientation(self, value: Tuple[Vector3, Vector3]) -> None: def orientation(self, value: Tuple[Vector3, Vector3]) -> None:
"""3D orientation of the listener. """3D orientation of the listener.
Parameters Attributes
---------- ----------
at : Tuple[float, float, float] at : Tuple[float, float, float]
Relative position. Relative position.
@ -1110,7 +1110,7 @@ cdef class Buffer:
current context, `start = 0` and `end = length` respectively. current context, `start = 0` and `end = length` respectively.
Otherwise, `start < end <= length`. Otherwise, `start < end <= length`.
Parameters Attributes
---------- ----------
start : int start : int
Starting point, in sample frames (inclusive). Starting point, in sample frames (inclusive).
@ -1382,7 +1382,7 @@ cdef class Source:
This is used after distance and cone attenuation are applied This is used after distance and cone attenuation are applied
to the gain base and before the adjustments of the filter gain. to the gain base and before the adjustments of the filter gain.
Parameters Attributes
---------- ----------
mingain : float mingain : float
Minimum gain, default to 0. Minimum gain, default to 0.
@ -1410,7 +1410,7 @@ cdef class Source:
distance is clamped to the specified range before applying distance is clamped to the specified range before applying
distance-related attenuation. distance-related attenuation.
Parameters Attributes
---------- ----------
refdist : float refdist : float
The distance at which the source's volume will not have The distance at which the source's volume will not have
@ -1461,7 +1461,7 @@ cdef class Source:
def orientation(self) -> Tuple[Vector3, Vector3]: def orientation(self) -> Tuple[Vector3, Vector3]:
"""3D orientation of the source. """3D orientation of the source.
Parameters Attributes
---------- ----------
at : Tuple[float, float, float] at : Tuple[float, float, float]
Relative position. Relative position.
@ -1486,7 +1486,7 @@ cdef class Source:
def cone_angles(self) -> Tuple[float, float]: def cone_angles(self) -> Tuple[float, float]:
"""Cone inner and outer angles in degrees. """Cone inner and outer angles in degrees.
Parameters Attributes
---------- ----------
inner : float inner : float
The area within which the listener will hear the source The area within which the listener will hear the source
@ -1518,7 +1518,7 @@ cdef class Source:
def outer_cone_gains(self) -> Tuple[float, float]: def outer_cone_gains(self) -> Tuple[float, float]:
"""Gain when listener is out of the source's outer cone area. """Gain when listener is out of the source's outer cone area.
Parameters Attributes
---------- ----------
gain : float gain : float
Linear gain applying to all frequencies, default to 1. Linear gain applying to all frequencies, default to 1.
@ -1542,22 +1542,25 @@ cdef class Source:
@property @property
def rolloff_factors(self) -> Tuple[float, float]: def rolloff_factors(self) -> Tuple[float, float]:
"""Rolloff factor and room factor for the direct and send paths. """Rolloff factors for the direct and send paths.
This is effectively a distance scaling relative to This is effectively a distance scaling relative to
the reference distance. the reference distance.
Attributes
----------
factor : float
Rolloff factor.
room_factor : float
Room rolloff factor, default to 0 which disables
distance attenuation for send paths. This is because
the reverb engine will, by default, apply a more realistic
room decay based on the reverb decay time and distance.
Raises Raises
------ ------
ValueError ValueError
If either of rolloff factors is set to a negative value. If either of rolloff factors is set to a negative value.
Notes
-----
To disable distance attenuation for send paths,
set room factor to 0. The reverb engine will, by default,
apply a more realistic room decay based on the reverb decay
time and distance.
""" """
return self.impl.get_rolloff_factors() return self.impl.get_rolloff_factors()
@ -1689,9 +1692,14 @@ cdef class Source:
def gain_auto(self) -> Tuple[bool, bool, bool]: def gain_auto(self) -> Tuple[bool, bool, bool]:
"""Whether automatically adjust gains. """Whether automatically adjust gains.
Respectively for direct path's high frequency gain, Attributes
send paths' gain and send paths' high-frequency gain are ----------
automatically adjusted. The default is `True` for all. direct_hf : bool
Direct path's high frequency gain, default to `True`.
send : bool
Send paths' gain, default to `True`.
send_hf : bool
Send paths' high-frequency, default to `True`.
""" """
return (self.impl.get_direct_gain_hf_auto(), return (self.impl.get_direct_gain_hf_auto(),
self.impl.get_send_gain_auto(), self.impl.get_send_gain_auto(),
@ -1699,8 +1707,8 @@ cdef class Source:
@gain_auto.setter @gain_auto.setter
def gain_auto(self, value: Tuple[bool, bool, bool]) -> None: def gain_auto(self, value: Tuple[bool, bool, bool]) -> None:
directhf, send, sendhf = value direct_hf, send, send_hf = value
self.impl.set_gain_auto(directhf, send, sendhf) self.impl.set_gain_auto(direct_hf, send, send_hf)
@getter @getter
def sends(self) -> AuxiliarySends: def sends(self) -> AuxiliarySends:
@ -1964,7 +1972,7 @@ cdef class BaseEffect:
See Also See Also
-------- --------
ReverbEffect : EAXReverb effect ReverbEffect : Environmental reverberation effect
ChorusEffect : Chorus effect ChorusEffect : Chorus effect
""" """
cdef alure.AuxiliaryEffectSlot slot cdef alure.AuxiliaryEffectSlot slot
@ -2048,10 +2056,7 @@ cdef class BaseEffect:
cdef class ReverbEffect(BaseEffect): cdef class ReverbEffect(BaseEffect):
"""EAXReverb effect. """Environmental reverberation effect.
It will automatically downgrade to the Standard Reverb effect
if EAXReverb effect is not supported.
Parameters Parameters
---------- ----------
@ -2336,7 +2341,8 @@ cdef class ReverbEffect(BaseEffect):
@air_absorption_gain_hf.setter @air_absorption_gain_hf.setter
def air_absorption_gain_hf(self, value: float) -> None: def air_absorption_gain_hf(self, value: float) -> None:
if value < 0.892 or value > 1.0: if value < 0.892 or value > 1.0:
raise ValueError(f'invalid high frequency air absorption gain: {value}') raise ValueError(
f'invalid high frequency air absorption gain: {value}')
self.properties.air_absorption_gain_hf = value self.properties.air_absorption_gain_hf = value
self.impl.set_reverb_properties(self.properties) self.impl.set_reverb_properties(self.properties)
self.slot.apply_effect(self.impl) self.slot.apply_effect(self.impl)
@ -2382,12 +2388,12 @@ cdef class ReverbEffect(BaseEffect):
@property @property
def decay_hf_limit(self) -> bool: def decay_hf_limit(self) -> bool:
"""High frequency decay limit.""" """Whether to limit high frequency decay."""
return bool(self.properties.decay_hf_limit) return self.properties.decay_hf_limit
@decay_hf_limit.setter @decay_hf_limit.setter
def decay_hf_limit(self, value: bool) -> None: def decay_hf_limit(self, value: bool) -> None:
self.properties.decay_hf_limit = bool(value) self.properties.decay_hf_limit = value
self.impl.set_reverb_properties(self.properties) self.impl.set_reverb_properties(self.properties)
self.slot.apply_effect(self.impl) self.slot.apply_effect(self.impl)
@ -2395,6 +2401,12 @@ cdef class ReverbEffect(BaseEffect):
cdef class ChorusEffect(BaseEffect): cdef class ChorusEffect(BaseEffect):
"""Chorus effect. """Chorus effect.
The chorus effect essentially replays the input audio accompanied
by another slightly delayed version of the signal, creating
a "doubling" effect. This was originally intended to emulate
the effect of several musicians playing the same notes
simultaneously, to create a thicker, more satisfying sound.
Parameters Parameters
---------- ----------
waveform : str waveform : str
@ -2439,9 +2451,9 @@ cdef class ChorusEffect(BaseEffect):
@waveform.setter @waveform.setter
def waveform(self, value: str) -> None: def waveform(self, value: str) -> None:
if value == 'triangle': if value == 'triangle':
self.properties.waveform = 1 self.properties.waveform = True
elif value == 'sine': elif value == 'sine':
self.properties.waveform = 0 self.properties.waveform = False
else: else:
raise ValueError(f'invalid waveform: {value}') raise ValueError(f'invalid waveform: {value}')
self.impl.set_chorus_properties(self.properties) self.impl.set_chorus_properties(self.properties)
@ -2583,8 +2595,8 @@ cdef class Decoder:
def loop_points(self) -> Tuple[int, int]: def loop_points(self) -> Tuple[int, int]:
"""Loop points in sample frames. """Loop points in sample frames.
Parameters Returns
---------- -------
start : int start : int
Inclusive starting loop point. Inclusive starting loop point.
end : int end : int
@ -2707,8 +2719,8 @@ class BaseDecoder(_BaseDecoder, metaclass=ABCMeta):
def loop_points(self) -> Tuple[int, int]: def loop_points(self) -> Tuple[int, int]:
"""Loop points in sample frames. """Loop points in sample frames.
Parameters Returns
---------- -------
start : int start : int
Inclusive starting loop point. Inclusive starting loop point.
end : int end : int

View File

@ -7,9 +7,11 @@ isolated_build = true
deps = deps =
Cython Cython
scipy scipy
pytest-flake8 flake8
pytest-cov pytest-cov
commands = pytest commands =
flake8
pytest
setenv = CYTHON_TRACE = 1 setenv = CYTHON_TRACE = 1
passenv = TRAVIS passenv = TRAVIS
@ -22,7 +24,7 @@ per-file-ignores = *.pxd:E501,E999
;max-doc-length = 72 ;max-doc-length = 72
[pytest] [pytest]
addopts = --flake8 --cov=palace addopts = --cov=palace
[coverage:run] [coverage:run]
plugins = Cython.Coverage plugins = Cython.Coverage