Skip to content

Commit

Permalink
Add message to reset controller values
Browse files Browse the repository at this point in the history
  • Loading branch information
segfault16 committed May 29, 2020
1 parent adcb683 commit 9ed3b84
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 2 deletions.
4 changes: 4 additions & 0 deletions audioled/project.py
Original file line number Diff line number Diff line change
Expand Up @@ -458,6 +458,10 @@ def __setstate__(self, state):
def setResetControllerModulation(self, newValue):
self._resetControllerModulation = newValue

def resetControllerModulation(self):
for fg in self._activeFiltergraphs():
fg.resetControllerModulations()

def setDevice(self, device: audioled.devices.MultiOutputWrapper):
logging.debug("setting device")
if not isinstance(device, audioled.devices.MultiOutputWrapper):
Expand Down
10 changes: 8 additions & 2 deletions audioled_controller/midi_full.py
Original file line number Diff line number Diff line change
Expand Up @@ -291,15 +291,21 @@ def _handleSysex(self, data, serverconfig: serverconfiguration.ServerConfigurati
self._sendMidiCallback(self._createScenesMetadataMsg(metadata))
elif data[0] == 0x01 and data[1] == 0x30:
# Get enabled controllers for active scene
logger.info("MIDI-BLE REQ Get controller for active scene")
logger.info("MIDI-BLE REQ Get controller enabled for active scene")
proj = serverconfig.getActiveProjectOrDefault()
if self._sendMidiCallback is not None:
self._sendMidiCallback(self._createEnabledControllersMsg(proj))
elif data[0] == 0x01 and data[1] == 0x40:
# Request controller values for active project
logger.info("MIDI-BLE REQ Get controller for active scene")
logger.info("MIDI-BLE REQ Get controller values for active scene")
proj = serverconfig.getActiveProjectOrDefault()
self._sendControllerStatus(proj)
elif data[0] == 0x01 and data[1] == 0x50:
# Reset controller values for active project
logger.info("MIDI-BLE REQ Reset controller for active scene")
proj = serverconfig.getActiveProjectOrDefault()
proj.resetControllerModulation()
self._sendControllerStatus(proj)
elif data[0] == 0x02 and data[1] == 0x00:
# Get server configuration
logger.info("MIDI-BLE REQ Get server configuration")
Expand Down
1 change: 1 addition & 0 deletions docs/midi_sysex.md
Original file line number Diff line number Diff line change
Expand Up @@ -81,6 +81,7 @@ followed by `0xf7` for Midi Sysex End.
| REQ | Get enabled controller for active scene | `0x01`, `0x30` | | |
| RESP | Get enabled controller for active scene | `0x01`, `0x30` | Binary data encode of utf8 json dict controller -> True/False | |
| REQ | Request controller values for active scene | `0x01`, `0x40` | | Response on corresponding CC |
| REQ | Reset controller values for active scene | `0x01`, `0x50` | | Response on corresponding CC |
| REQ | Get server configuration | `0x02`, `0x00` | | |
| RESP | Get server configuration | `0x02`, `0x00` | Binary data encode of utf8 server config json compressed with zlib | |
| REQ | Update server configuration | `0x02`, `0x10` | Binary data encode of utf8 server config json compressed with zlib | |
Expand Down

0 comments on commit 9ed3b84

Please sign in to comment.