Skip to content
Open
Show file tree
Hide file tree
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
6 changes: 6 additions & 0 deletions live/classes/set.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@
from .scene import Scene
from .device import Device
from .parameter import Parameter
from .view import View
from ..query import Query
from ..constants import CLIP_STATUS_STOPPED
from ..exceptions import LiveIOError, LiveConnectionError
Expand Down Expand Up @@ -57,6 +58,11 @@ def __init__(self, scan: bool = False):
Args:
scan: If True, automatically scans the contents of the set.
"""
# --------------------------------------------------------------------------
# Class used to query AbletonOSCs view endpoints.
# --------------------------------------------------------------------------
self.view = View()

# --------------------------------------------------------------------------
# Indicates whether the set has been synchronised with Live
# --------------------------------------------------------------------------
Expand Down
62 changes: 62 additions & 0 deletions live/classes/view.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,62 @@
import logging
from live.query import Query


def make_getter(prop):
def fn(self):
return self.live.query(f"/live/view/get/{prop}")[0]

return fn


def make_setter(prop):
def fn(self, value):
self.live.cmd(f"/live/view/set/{prop}", (value,))

return fn


class View:

@property
def live(self):
return Query()

def __init__(self):
self.name = "view"
self.logger = logging.getLogger(__name__)

def __str__(self):
return self.name

def __getstate__(self):
return {
"name": self.name,
}

def __setstate__(self, d: dict):
self.name = d["name"]

selected_scene = property(
fget=make_getter("selected_scene"),
fset=make_setter("selected_scene"),
doc="current selected scene"
)

selected_track = property(
fget=make_getter("selected_track"),
fset=make_setter("selected_track"),
doc="current selected track"
)

selected_clip = property(
fget=make_getter("selected_clip"),
fset=make_setter("selected_clip"),
doc="current selected clip"
)

selected_device = property(
fget=make_getter("selected_device"),
fset=make_setter("selected_device"),
doc="current selected device"
)