# Path: bl/debug.py
# DEBUG = _Debug()


from functools import partial
from twisted.python import log
from bl.debug import DEBUG

    def detach(self):
        self._led_schedule.stopLater(0)
        self._refresh_ui_schedule.stopLater(0)
        self._multifader.detach()
        self._multitoggle.detach()

    def updateLEDs(self):
        ss = self.stepSequencer
        on = ss.step + 1
        off = on - 1
        off = off or ss.beats
        self.send(self.ledAddressPattern % (self.page, on), 1.0)
        self.send(self.ledAddressPattern % (self.page, off), 0.0)
        # really only want this for udp, but alas
        self.send(self.ledAddressPattern % (self.page, on), 1.0)
        self.send(self.ledAddressPattern % (self.page, off), 0.0)

    def setVelocity(self, idx, v):
        nv = int(v * 127)
        self.stepSequencer.setVelocity(idx, nv)

    def refreshUI(self):
        ss = self.stepSequencer
        col = ss.on_off[self._refresh_col]
        for (index, on_off) in enumerate(col):
            self.send(MultiToggle.addressPattern %
                      (self.page, index + 1, self._refresh_col + 1), on_off)
        for beat in range(ss.beats):
            self.send(MultiFader.addressPattern % (self.page, beat + 1),

# Path: bl/debug.py
# DEBUG = _Debug()


# Path: bl/osc/touchosc.py
from functools import partial
from twisted.python import log
from bl.debug import DEBUG


    def detach(self):
        self._led_schedule.stopLater(0)
        self._refresh_ui_schedule.stopLater(0)
        self._multifader.detach()
        self._multitoggle.detach()

    def updateLEDs(self):
        ss = self.stepSequencer
        on = ss.step + 1
        off = on - 1
        off = off or ss.beats
        self.send(self.ledAddressPattern % (self.page, on), 1.0)
        self.send(self.ledAddressPattern % (self.page, off), 0.0)
        # really only want this for udp, but alas
        self.send(self.ledAddressPattern % (self.page, on), 1.0)
        self.send(self.ledAddressPattern % (self.page, off), 0.0)

    def setVelocity(self, idx, v):
        nv = int(v * 127)
        self.stepSequencer.setVelocity(idx, nv)

    def refreshUI(self):
        ss = self.stepSequencer
        col = ss.on_off[self._refresh_col]
        for (index, on_off) in enumerate(col):
            self.send(MultiToggle.addressPattern %
                      (self.page, index + 1, self._refresh_col + 1), on_off)
        for beat in range(ss.beats):
            self.send(MultiFader.addressPattern % (self.page, beat + 1),

                      ss.velocity[beat] / 127.)