Skip to content

Commit

Permalink
Read correct bit for IT signed flag
Browse files Browse the repository at this point in the history
  • Loading branch information
dbrookman committed Oct 13, 2020
1 parent fa75bb3 commit 405d7df
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions trackrip/tracker.py
Original file line number Diff line number Diff line change
Expand Up @@ -267,7 +267,7 @@ def __init__(self, file):
else:
sample["data"] = self.decompress_it_sample(sample_data)
# HACK: don't know why 8-bit samples are signed while 16-bit samples are unsigned
if sample["width"] == 1 or not sample["signed"]:
if sample["width"] == 1 or sample["signed"]:
sample["data"] = pcm.signed_to_unsigned(sample["data"])

@staticmethod
Expand Down Expand Up @@ -304,7 +304,7 @@ def decode_sample_header(header_bytes) -> dict:
# skip default pan

convert = int.from_bytes(header_bytes[46:47], "big")
sample["signed"] = bool(convert & 1)
sample["signed"] = bool(convert & 0)

# length of sample is stored in no. of samples NOT no. of bytes
sample["length"] = int.from_bytes(header_bytes[48:52], "little") * sample["width"]
Expand Down

0 comments on commit 405d7df

Please sign in to comment.