1
0
mirror of https://github.com/jonathanhogg/scopething synced 2025-07-14 03:02:09 +01:00

New hi/lo model; improved timeout logic; new generator low/high logic; fixed scaling of samples

This commit is contained in:
Jonathan Hogg
2017-07-14 17:29:59 +01:00
parent 000862abef
commit 44194ab63e
2 changed files with 50 additions and 43 deletions

4
vm.py
View File

@ -339,10 +339,10 @@ class VirtualMachine:
if sample_width == 2:
data = await self._reader.readexactly(2 * n)
data = struct.unpack(f'>{n}h', data)
return [value/65536 + 0.5 for value in data]
return [(value+32768)/65535 for value in data]
elif sample_width == 1:
data = await self._reader.readexactly(n)
return [value/256 for value in data]
return [value/255 for value in data]
else:
raise ValueError(f"Bad sample width: {sample_width}")