stufisher / LiveOSC2

New version of LiveOSC for Live 9
99 stars 31 forks source link

Is Live playing #11

Closed burkholderm closed 6 years ago

burkholderm commented 7 years ago

Is there a listener or something that can tell us if Live is playing or stopped? In LO2TransportComponent.py, I see this:

@subject_slot('is_playing') def _on_playing_changed(self): self.send('/live/play', self.song().is_playing)

But I am not getting any message from it.

ccerrillos commented 7 years ago

UPDATED It'll work if you add the line at the end in def __init__

        s = self.song()
        self._on_metronome_changed.subject = s
        self._on_signature_numerator_changed.subject = s
        self._on_signature_denominator_changed.subject = s
        self._on_tempo_changed.subject = s
        self._on_playing_changed.subject = s

I think the API needs to be reworked a bit. For example, what if I want to manually fetch the is_playing status? If you add that line, the status is pushed when it changes under /live/play but this is a conflict with actually calling /live/play which is akin to hitting the play button. It'll easily cause confusion when two operations share the same call path. There should be some /live/play/status or /live/status/[play, record, etc] calls instead to avoid confusion.

I'm open to input on how the API should be reorganized, but I'm not sure if @stufisher will accept it in the end.

stufisher commented 7 years ago

This should probably live in TransportComponent, where the listener is :) I am reading, just not had a lot of time to respond yet, sorry!

stufisher commented 7 years ago

Urgh the subject slot is not assigned a target. TransportComponet needs: self. _on_playing_changed.subject = s at the top

ccerrillos commented 7 years ago

Ah, so that's how it works!

I've updated my comment, thanks!