belangeo / pyo

Python DSP module
GNU Lesser General Public License v3.0
1.28k stars 130 forks source link

Small Bug with Virtual Keyboard (Hold mode) and Polyphony #230

Closed Bibiko closed 2 years ago

Bibiko commented 2 years ago

Hi, I've found a small bug in the Keyboard class. To reproduce it, you can use e.g. Zyne with server settings MIDI interface = Virtual Keyboard, Polyphony = 3, and Hold mode. Start audio and press/click 3 keys and then try to deselect all pressed keys. You still hear sound and the console shows an exception for no declared var voice. A suggestion to fix the bug look at the functions MouseDown and KeyDown in file pyo.lib._wxwidgets.py; when deleting a dict key from self.blackSelected or self.whiteSelected, one should decrement total by one; otherwise self.outFunction(note) would not called with note (pit, 0) to switch off the key correctly.

Thus, adding after these lines: 3668 3680 3790 3807 a new line with: total -= 1 should fix it.

PS Brilliant work!

belangeo commented 2 years ago

Fixed in pyo's sources:

db2bf816007476c6f3b53b341ad98294e8b6f322

Thanks for the report!