mirror of https://github.com/McSinyx/palace
Fix incorrect multivalue return type
This fixes GH-107 and supersedes and closes GH-108.
This commit is contained in:
parent
c24df3143b
commit
c216f307ef
|
@ -1444,7 +1444,7 @@ cdef class Source:
|
||||||
@property
|
@property
|
||||||
def position(self) -> Vector3:
|
def position(self) -> Vector3:
|
||||||
"""3D position of the source."""
|
"""3D position of the source."""
|
||||||
return from_vector3(self.impl.get_position())
|
return tuple(from_vector3(self.impl.get_position()))
|
||||||
|
|
||||||
@position.setter
|
@position.setter
|
||||||
def position(self, value: Vector3) -> None:
|
def position(self, value: Vector3) -> None:
|
||||||
|
@ -1458,7 +1458,7 @@ cdef class Source:
|
||||||
position, and instead just alters the pitch as determined
|
position, and instead just alters the pitch as determined
|
||||||
by the doppler effect.
|
by the doppler effect.
|
||||||
"""
|
"""
|
||||||
return from_vector3(self.impl.get_velocity())
|
return tuple(from_vector3(self.impl.get_velocity()))
|
||||||
|
|
||||||
@velocity.setter
|
@velocity.setter
|
||||||
def velocity(self, value: Vector3) -> None:
|
def velocity(self, value: Vector3) -> None:
|
||||||
|
@ -1481,7 +1481,7 @@ cdef class Source:
|
||||||
comes from, this also affects the facing direction.
|
comes from, this also affects the facing direction.
|
||||||
"""
|
"""
|
||||||
cdef pair[alure.Vector3, alure.Vector3] o = self.impl.get_orientation()
|
cdef pair[alure.Vector3, alure.Vector3] o = self.impl.get_orientation()
|
||||||
return from_vector3(o.first), from_vector3(o.second)
|
return tuple(from_vector3(o.first)), tuple(from_vector3(o.second))
|
||||||
|
|
||||||
@orientation.setter
|
@orientation.setter
|
||||||
def orientation(self, value: Tuple[Vector3, Vector3]) -> None:
|
def orientation(self, value: Tuple[Vector3, Vector3]) -> None:
|
||||||
|
@ -2234,7 +2234,7 @@ cdef class ReverbEffect(BaseEffect):
|
||||||
@property
|
@property
|
||||||
def reflections_pan(self) -> Vector3:
|
def reflections_pan(self) -> Vector3:
|
||||||
"""Reflections as 3D vector of magnitude between 0 and 1."""
|
"""Reflections as 3D vector of magnitude between 0 and 1."""
|
||||||
return self.properties.reflections_pan
|
return tuple(self.properties.reflections_pan)
|
||||||
|
|
||||||
@reflections_pan.setter
|
@reflections_pan.setter
|
||||||
def reflections_pan(self, value: Vector3) -> None:
|
def reflections_pan(self, value: Vector3) -> None:
|
||||||
|
@ -2277,7 +2277,7 @@ cdef class ReverbEffect(BaseEffect):
|
||||||
@property
|
@property
|
||||||
def late_reverb_pan(self) -> Vector3:
|
def late_reverb_pan(self) -> Vector3:
|
||||||
"""Late reverb as 3D vector of magnitude between 0 and 1."""
|
"""Late reverb as 3D vector of magnitude between 0 and 1."""
|
||||||
return self.properties.late_reverb_pan
|
return tuple(self.properties.late_reverb_pan)
|
||||||
|
|
||||||
@late_reverb_pan.setter
|
@late_reverb_pan.setter
|
||||||
def late_reverb_pan(self, value: Vector3) -> None:
|
def late_reverb_pan(self, value: Vector3) -> None:
|
||||||
|
|
|
@ -22,7 +22,7 @@ for single-precision floating-point numbers.
|
||||||
__all__ = ['FLT_MAX', 'allclose', 'isclose']
|
__all__ = ['FLT_MAX', 'allclose', 'isclose']
|
||||||
|
|
||||||
from math import isclose as _isclose
|
from math import isclose as _isclose
|
||||||
from typing import Sequence
|
from typing import Any, Callable, Sequence
|
||||||
|
|
||||||
FLT_EPSILON: float = 2.0 ** -23
|
FLT_EPSILON: float = 2.0 ** -23
|
||||||
FLT_MAX: float = 2.0**128 - 2.0**104
|
FLT_MAX: float = 2.0**128 - 2.0**104
|
||||||
|
@ -42,7 +42,8 @@ def isclose(a: float, b: float) -> bool:
|
||||||
return _isclose(a, b, rel_tol=FLT_EPSILON)
|
return _isclose(a, b, rel_tol=FLT_EPSILON)
|
||||||
|
|
||||||
|
|
||||||
def allclose(a: Sequence[float], b: Sequence[float]) -> bool:
|
def allclose(a: Sequence[float], b: Sequence[float],
|
||||||
|
close: Callable[[Any, Any], bool] = isclose) -> bool:
|
||||||
"""Determine whether two sequences of single-precision
|
"""Determine whether two sequences of single-precision
|
||||||
floating-point numbers are close in value.
|
floating-point numbers are close in value.
|
||||||
|
|
||||||
|
@ -53,4 +54,4 @@ def allclose(a: Sequence[float], b: Sequence[float]) -> bool:
|
||||||
That is, NaN is not close to anything, even itself.
|
That is, NaN is not close to anything, even itself.
|
||||||
inf and -inf are only close to themselves.
|
inf and -inf are only close to themselves.
|
||||||
"""
|
"""
|
||||||
return all(map(isclose, a, b))
|
return type(a) is type(b) and all(map(close, a, b))
|
||||||
|
|
|
@ -200,9 +200,9 @@ def test_velocity(context):
|
||||||
def test_orientation(context):
|
def test_orientation(context):
|
||||||
"""Test read-write property orientation."""
|
"""Test read-write property orientation."""
|
||||||
with Source(context) as source:
|
with Source(context) as source:
|
||||||
assert all(map(allclose, source.orientation, ((0, 0, -1), (0, 1, 0))))
|
assert allclose(source.orientation, ((0, 0, -1), (0, 1, 0)), allclose)
|
||||||
source.orientation = (1, 1, -2), (3, -5, 8)
|
source.orientation = (1, 1, -2), (3, -5, 8)
|
||||||
assert all(map(allclose, source.orientation, ((1, 1, -2), (3, -5, 8))))
|
assert allclose(source.orientation, ((1, 1, -2), (3, -5, 8)), allclose)
|
||||||
|
|
||||||
|
|
||||||
def test_cone_angles(context):
|
def test_cone_angles(context):
|
||||||
|
|
Loading…
Reference in New Issue