Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Tidy up changing instrument #7

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 3 additions & 5 deletions musicbox.py
Original file line number Diff line number Diff line change
Expand Up @@ -195,12 +195,10 @@ def set_volume():
instrument = 0
def set_instrument():
global instrument
number_of_instruments = len(fonts)-1
number_of_pot_steps = 1024
current_pot_value = pot1.raw_value
max_instrument = len(fonts)-1

new_instrument = int(round(number_of_instruments*(current_pot_value / number_of_pot_steps)))
#print("Number of instruments: {} / Current pot: {} / New instrument: {} / Number of pot steps: {}".format(number_of_instruments, current_pot_value, new_instrument, number_of_pot_steps))
new_instrument = int(pot1.value * max_instrument)
#print("Max instrument: {} / Current pot: {} / New instrument: {}".format(max_instrument, pot1.value, new_instrument))

if new_instrument != instrument:
print("Instrument being set to {}".format(new_instrument))
Expand Down