mirror of
https://github.com/jtauber/applepy.git
synced 2024-06-09 21:29:26 +00:00
Fix speaker
Float division in python3 -> force integer division with //
This commit is contained in:
parent
b717984056
commit
2d6e6f5de6
|
@ -279,7 +279,7 @@ class Speaker:
|
||||||
|
|
||||||
def toggle(self, cycle):
|
def toggle(self, cycle):
|
||||||
if self.last_toggle is not None:
|
if self.last_toggle is not None:
|
||||||
l = (cycle - self.last_toggle) / Speaker.CPU_CYCLES_PER_SAMPLE
|
l = (cycle - self.last_toggle) // Speaker.CPU_CYCLES_PER_SAMPLE
|
||||||
self.buffer.extend([0, 26000] if self.polarity else [0, -2600])
|
self.buffer.extend([0, 26000] if self.polarity else [0, -2600])
|
||||||
self.buffer.extend((l - 2) * [16384] if self.polarity else [-16384])
|
self.buffer.extend((l - 2) * [16384] if self.polarity else [-16384])
|
||||||
self.polarity = not self.polarity
|
self.polarity = not self.polarity
|
||||||
|
|
Loading…
Reference in New Issue
Block a user