Skip to content

Commit

Permalink
fix: U16TupleEvent, closes #68
Browse files Browse the repository at this point in the history
  • Loading branch information
demberto committed Sep 29, 2022
1 parent 863fa9e commit 99d45a3
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 2 deletions.
2 changes: 2 additions & 0 deletions CHANGELOG.md
Expand Up @@ -29,6 +29,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0

- String are decoded as UTF16 when version is 11.5+ now [#65].
- `Insert.stereo_separation` docstring for maximum, minimum value.
- `U16TupleEvent.value` [#68].

### Removed

Expand All @@ -41,6 +42,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
[#58]: https://github.com/demberto/PyFLP/issues/58
[#65]: https://github.com/demberto/PyFLP/issues/65
[#66]: https://github.com/demberto/PyFLP/issues/66
[#68]: https://github.com/demberto/PyFLP/issues/68

## 2.0.0a1 - 2022-09-21

Expand Down
6 changes: 4 additions & 2 deletions pyflp/_events.py
Expand Up @@ -21,6 +21,7 @@

import abc
import enum
import struct
import sys
import warnings
from collections.abc import Hashable, Sized
Expand Down Expand Up @@ -65,6 +66,7 @@

T = TypeVar("T")
T_co = TypeVar("T_co", covariant=True)
UShortTuple = struct.Struct("HH")


# ! MRO erros when deriving from SupportsBytes on Python 3.7
Expand Down Expand Up @@ -303,11 +305,11 @@ class U16TupleEvent(DWordEventBase[Tuple[int, int]]):

@property
def value(self) -> tuple[int, int]:
return UInt.unpack(self._raw)
return UShortTuple.unpack(self._raw)

@value.setter
def value(self, value: tuple[int, int]):
self._raw = UInt.pack(*value)
self._raw = UShortTuple.pack(*value)


class ColorEvent(DWordEventBase[colour.Color]):
Expand Down

0 comments on commit 99d45a3

Please sign in to comment.