Skip to content

Commit

Permalink
Safer use of save and reset through HMI
Browse files Browse the repository at this point in the history
Signed-off-by: falkTX <falktx@falktx.com>
  • Loading branch information
falkTX committed Feb 4, 2021
1 parent 600d6ee commit facb3cc
Showing 1 changed file with 8 additions and 4 deletions.
12 changes: 8 additions & 4 deletions mod/host.py
Original file line number Diff line number Diff line change
Expand Up @@ -5178,6 +5178,10 @@ def hmi_next_control_page_real(self, hw_id, props, callback):
logging.exception(e)

def hmi_save_current_pedalboard(self, callback):
if not self.pedalboard_path:
callback(True)
return

def host_callback(ok):
os.sync()
callback(True)
Expand Down Expand Up @@ -5224,15 +5228,15 @@ def hmi_reset_current_pedalboard_real(self, callback):

# if bypassed, do it now
if diffBypass and bypassed:
#self.msg_callback("param_set %s :bypass 1.0" % (instance,))
self.msg_callback("param_set %s :bypass 1.0" % (instance,))
try:
yield gen.Task(self.bypass, instance, True)
except Exception as e:
logging.exception(e)

if p['preset'] and pluginData['preset'] != p['preset']:
pluginData['preset'] = p['preset']
#self.msg_callback("preset %s %s" % (instance, p['preset']))
self.msg_callback("preset %s %s" % (instance, p['preset']))
try:
yield gen.Task(self.send_notmodified, "preset_load %d %s" % (instance_id, p['preset']))
except Exception as e:
Expand All @@ -5252,7 +5256,7 @@ def hmi_reset_current_pedalboard_real(self, callback):
continue

pluginData['ports'][symbol] = value
#self.msg_callback("param_set %s %s %f" % (instance, symbol, value))
self.msg_callback("param_set %s %s %f" % (instance, symbol, value))
try:
yield gen.Task(self.send_notmodified, "param_set %d %s %f" % (instance_id, symbol, value))
except Exception as e:
Expand All @@ -5266,7 +5270,7 @@ def hmi_reset_current_pedalboard_real(self, callback):

# if not bypassed (enabled), do it at the end
if diffBypass and not bypassed:
#self.msg_callback("param_set %s :bypass 0.0" % (instance,))
self.msg_callback("param_set %s :bypass 0.0" % (instance,))
try:
yield gen.Task(self.bypass, instance, False)
except Exception as e:
Expand Down

0 comments on commit facb3cc

Please sign in to comment.