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


import sys
import math
import warnings
from collections import namedtuple
from twisted.python import log
from twisted.python.failure import Failure
from twisted.internet.selectreactor import SelectReactor
from twisted.internet.task import LoopingCall
from bl.debug import DEBUG
            from twisted.internet import reactor
            from bl.instrument import fsynth
            else:
                try:
                    self.synthChannels = int(self.synthChannels)
                except ValueError:
                    raise ValueError(
                        'synthChannels should be one of mono, '
                        'stereo, quad or an integer')
                synths = dict(
                    (n, fsynth.Synth) for n in range(self.synthChannels))
                pool = fsynth.NConnectionPool(synths)
            fsynth.suggestDefaultPool(pool)
        except ImportError:
            log.msg('fluidsynth will not be available at runtime')
            pass

    def startTicking(self):
        """
        Called by run - do not call me directly. Start the LoopingCall which
        will drive the BeatClock.
        """
        self.task = LoopingCall(self.tick)
        self.on_stop = self.task.start(60. / self.tempo.tpm, True)

    def tick(self):
        """
        Advance ticks and run delayed calls.
        """
        if self.syncClock:
            ticks, ts = self.syncClock.lastTick()
            if self.ticks > (ticks + 1):

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


# Path: bl/scheduler.py
import sys
import math
import warnings
from collections import namedtuple
from twisted.python import log
from twisted.python.failure import Failure
from twisted.internet.selectreactor import SelectReactor
from twisted.internet.task import LoopingCall
from bl.debug import DEBUG
            from twisted.internet import reactor
            from bl.instrument import fsynth

            else:
                try:
                    self.synthChannels = int(self.synthChannels)
                except ValueError:
                    raise ValueError(
                        'synthChannels should be one of mono, '
                        'stereo, quad or an integer')
                synths = dict(
                    (n, fsynth.Synth) for n in range(self.synthChannels))
                pool = fsynth.NConnectionPool(synths)
            fsynth.suggestDefaultPool(pool)
        except ImportError:
            log.msg('fluidsynth will not be available at runtime')
            pass

    def startTicking(self):
        """
        Called by run - do not call me directly. Start the LoopingCall which
        will drive the BeatClock.
        """
        self.task = LoopingCall(self.tick)
        self.on_stop = self.task.start(60. / self.tempo.tpm, True)

    def tick(self):
        """
        Advance ticks and run delayed calls.
        """
        if self.syncClock:
            ticks, ts = self.syncClock.lastTick()
            if self.ticks > (ticks + 1):

                if DEBUG: