Skip to content

Commit

Permalink
Small tweaks to commenting. Added getter for selected_device.
Browse files Browse the repository at this point in the history
  • Loading branch information
steeltrack committed Jan 16, 2024
1 parent 02de085 commit 20c1dd4
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 2 deletions.
3 changes: 2 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -204,6 +204,7 @@ Represents the view (user interface) of live
| /live/view/get/selected_scene | | scene_index | Returns the selected scene index (first scene = 0) |
| /live/view/get/selected_track | | track_index | Returns the selected index track (first track = 0) |
| /live/view/get/selected_clip | | track_index, scene_index | Returns the track and scene index of the selected clip |
| /live/view/get/selected_device | | track_index, device_index| Get the selected device (first device = 0) |
| /live/view/set/selected_scene | scene_index | | Set the selected scene (first scene = 0) |
| /live/view/set/selected_track | track_index | | Set the selected track (first track = 0) |
| /live/view/set/selected_clip | track_index, scene_index | | Set the selected clip |
Expand Down Expand Up @@ -404,12 +405,12 @@ Represents an instrument or effect.
| /live/device/get/num_parameters | track_id, device_id | track_id, device_id, num_parameters | Get the number of parameters exposed by the device |
| /live/device/get/parameters/name | track_id, device_id | track_id, device_id, [name, ...] | Get the list of parameter names exposed by the device |
| /live/device/get/parameters/value | track_id, device_id | track_id, device_id, [value, ...] | Get the device parameter values |
| /live/device/get/parameters/value_string | track_id, device_id | track_id, device_id, [value, ...] | Get the device parameter value as a readable string ex: 2500Hz |
| /live/device/get/parameters/min | track_id, device_id | track_id, device_id, [value, ...] | Get the device parameter minimum values |
| /live/device/get/parameters/max | track_id, device_id | track_id, device_id, [value, ...] | Get the device parameter maximum values |
| /live/device/get/parameters/is_quantized | track_id, device_id | track_id, device_id, [value, ...] | Get the list of is_quantized settings (i.e., whether the parameter must be an int/bool) |
| /live/device/set/parameters/value | track_id, device_id, value, value ... | | Set the device parameter values |
| /live/device/get/parameter/value | track_id, device_id, parameter_id | track_id, device_id, parameter_id, value | Get a device parameter value |
| /live/device/get/parameter/value_string | track_id, device_id, parameter_id | track_id, device_id, parameter_id, value | Get the device parameter value as a readable string ex: 2500 Hz |
| /live/device/set/parameter/value | track_id, device_id, parameter_id, value | | Set a device parameter value |

For devices:
Expand Down
2 changes: 1 addition & 1 deletion abletonosc/device.py
Original file line number Diff line number Diff line change
Expand Up @@ -89,7 +89,7 @@ def device_get_parameter_value(device, params: Tuple[Any] = ()):
param_index = int(params[0])
return param_index, device.parameters[param_index].value

# Uses str_for_value method to return the UI-friendly version of a parameter value (ex: "2500Hz")
# Uses str_for_value method to return the UI-friendly version of a parameter value (ex: "2500 Hz")
def device_get_parameter_value_string(device, params: Tuple[Any] = ()):
param_index = int(params[0])
return param_index, device.parameters[param_index].str_for_value(device.parameters[param_index].value)
Expand Down
4 changes: 4 additions & 0 deletions abletonosc/view.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,9 @@ def get_selected_track(params: Optional[Tuple] = ()):

def get_selected_clip(params: Optional[Tuple] = ()):
return (get_selected_track()[0], get_selected_scene()[0])

def get_selected_device(params: Optional[Tuple] = ()):
return (get_selected_track()[0], list(self.song.view.selected_track.devices).index(self.song.view.selected_track.view.selected_device))

def set_selected_scene(params: Optional[Tuple] = ()):
self.song.view.selected_scene = self.song.scenes[params[0]]
Expand All @@ -35,6 +38,7 @@ def set_selected_device(params: Optional[Tuple] = ()):
self.osc_server.add_handler("/live/view/get/selected_scene", get_selected_scene)
self.osc_server.add_handler("/live/view/get/selected_track", get_selected_track)
self.osc_server.add_handler("/live/view/get/selected_clip", get_selected_clip)
self.osc_server.add_handler("/live/view/get/selected_device", get_selected_device)
self.osc_server.add_handler("/live/view/set/selected_scene", set_selected_scene)
self.osc_server.add_handler("/live/view/set/selected_track", set_selected_track)
self.osc_server.add_handler("/live/view/set/selected_clip", set_selected_clip)
Expand Down

0 comments on commit 20c1dd4

Please sign in to comment.