Refactored OpenALListener class for clarity and correctness.
@@ -371,17 +371,29 @@ OpenALOrientation = namedtuple("OpenALOrientation", ['at', 'up'])
class OpenALListener(OpenALObject):
- def _float_source_property(attribute):
- return property(lambda self: self._get_float(attribute),
- lambda self, value: self._set_float(attribute, value))
+ @property
+ def position(self):
+ return self._get_3floats(al.AL_POSITION)
- def _3floats_source_property(attribute):
- return property(lambda self: self._get_3floats(attribute),
- lambda self, value: self._set_3floats(attribute, value))
+ @position.setter
+ def position(self, values):
+ self._set_3floats(al.AL_POSITION, values)
- position = _3floats_source_property(al.AL_POSITION)
- velocity = _3floats_source_property(al.AL_VELOCITY)
- gain = _float_source_property(al.AL_GAIN)
+ @property
+ def velocity(self):
+ return self._get_3floats(al.AL_VELOCITY)
+
+ @velocity.setter
+ def velocity(self, values):
+ self._set_3floats(al.AL_VELOCITY, values)
+
+ @property
+ def gain(self):
+ return self._get_float(al.AL_GAIN)
+
+ @gain.setter
+ def gain(self, value):
+ self._set_float(al.AL_GAIN, value)
@property
def orientation(self):
