# Path: bl/debug.py
# def debug(message):
#     if DEBUG:
#         log.msg(message)
# 
# DEBUG = _Debug()
# 
# Path: bl/utils.py
# def getClock(clock=None):
#     if clock is None:
#         from bl.scheduler import BeatClock
#         return BeatClock.defaultClock
#     return clock
# 
# def exhaustCall(v):
#     """
#     Get an uncallable value at the end of a call chain or `v` itself
#     if `v` is not callable.
#     """
#     while callable(v):
#         v = v()
#     return v


import random
from itertools import cycle
from pprint import pformat
from zope.interface import Interface, Attribute, implements
from twisted.python import log
from bl.debug import debug, DEBUG
from bl.utils import getClock, exhaustCall
        Make a triple paradiddle: RLRLRLRR LRLRLRLL
        """
        return [r, l, r, l, r, l, r, r, l, r, l, r, l, r, l, l]


class ParadiddleDiddle(Paradiddle):

    def makeParadiddle(self, r, l):
        """
        Make a paradiddle diddle
        """
        return [r, l, r, r, l, l] * 2 + [l, r, l, l, r, r] * 2


class OctaveArp(ArpSwitcher):

    def __init__(self, arp, values=None, octaves=3, direction=1,
                 oscillate=False):
        ArpSwitcher.__init__(self, arp, values)
        self.octaves = octaves
        self.currentOctave = 0
        self.index = 0
        if direction == -1:
            self.currentOctave = octaves
        self.direction = direction
        self.oscillate = oscillate

    def __call__(self):
        if not self.count:
            return

# Path: bl/debug.py
# def debug(message):
#     if DEBUG:
#         log.msg(message)
# 
# DEBUG = _Debug()
# 
# Path: bl/utils.py
# def getClock(clock=None):
#     if clock is None:
#         from bl.scheduler import BeatClock
#         return BeatClock.defaultClock
#     return clock
# 
# def exhaustCall(v):
#     """
#     Get an uncallable value at the end of a call chain or `v` itself
#     if `v` is not callable.
#     """
#     while callable(v):
#         v = v()
#     return v


# Path: bl/arp.py
import random
from itertools import cycle
from pprint import pformat
from zope.interface import Interface, Attribute, implements
from twisted.python import log
from bl.debug import debug, DEBUG
from bl.utils import getClock, exhaustCall

        Make a triple paradiddle: RLRLRLRR LRLRLRLL
        """
        return [r, l, r, l, r, l, r, r, l, r, l, r, l, r, l, l]


class ParadiddleDiddle(Paradiddle):

    def makeParadiddle(self, r, l):
        """
        Make a paradiddle diddle
        """
        return [r, l, r, r, l, l] * 2 + [l, r, l, l, r, r] * 2


class OctaveArp(ArpSwitcher):

    def __init__(self, arp, values=None, octaves=3, direction=1,
                 oscillate=False):
        ArpSwitcher.__init__(self, arp, values)
        self.octaves = octaves
        self.currentOctave = 0
        self.index = 0
        if direction == -1:
            self.currentOctave = octaves
        self.direction = direction
        self.oscillate = oscillate

    def __call__(self):
        if not self.count:
            return

        v = exhaustCall(self.arp())