Skip to content

Commit

Permalink
new function get_linear_pad_type_index in Edrumulus GUI
Browse files Browse the repository at this point in the history
  • Loading branch information
corrados committed Nov 12, 2023
1 parent 3030466 commit 9705bd1
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions tools/edrumulus_gui.py
Original file line number Diff line number Diff line change
Expand Up @@ -110,7 +110,7 @@ def process_user_input(ch):
sel_cmd -= 1
elif (ch == chr(259) or ch == "U"): # 259: up key
if cmd_names[sel_cmd] == "type": # special order for types needed, derived from dictionary
linear_idx = pad_types_dict_list.index([k for k, v in pad_types_dict.items() if v == database[sel_cmd]][0])
linear_idx = get_linear_pad_type_index(database[sel_cmd])
if linear_idx < cmd_val_rng[sel_cmd]:
linear_idx += 1
database[sel_cmd] = pad_types_dict[pad_types_dict_list[linear_idx]]
Expand All @@ -121,7 +121,7 @@ def process_user_input(ch):
send_value_to_edrumulus(cmd_val[sel_cmd], database[sel_cmd])
elif (ch == chr(258) or ch == "D"): # 258: down key
if cmd_names[sel_cmd] == "type": # special order for types needed, derived from dictionary
linear_idx = pad_types_dict_list.index([k for k, v in pad_types_dict.items() if v == database[sel_cmd]][0])
linear_idx = get_linear_pad_type_index(database[sel_cmd])
if linear_idx > 0:
linear_idx -= 1
database[sel_cmd] = pad_types_dict[pad_types_dict_list[linear_idx]]
Expand All @@ -137,6 +137,9 @@ def process_user_input(ch):
elif (ch == "v" or ch == "V") and not use_rtmidi: # kit volume (only for jack audio mode)
ecasound_kit_volume(ch == "v")

def get_linear_pad_type_index(d):
return pad_types_dict_list.index([k for k, v in pad_types_dict.items() if v == d][0])

def parse_cmd_param(cmd):
# check for "pad type" and "curve type" special cases, otherwise convert integer in string
return pad_types[database[cmd]] if cmd == 0 else curve_types[database[cmd]] if cmd == 7 else str(database[cmd])
Expand Down

0 comments on commit 9705bd1

Please sign in to comment.