# Path: fretwork/midi/DataTypeConverters.py
# def readBew(value):
#     """
#     Reads string as big endian word, (asserts len(value) in [1,2,4])
# 
#     .. doctest::
# 
#         >>> readBew('aáâã')
#         0
#         >>> readBew('aá')
#         0
#     """
#     try:
#         return unpack('>%s' % {1:'B', 2:'H', 4:'L'}[len(value)], value)[0]
#     except KeyError:
#         return 0
# 
# Path: fretwork/midi/DataTypeConverters.py
# def toBytes(value):
#     "Turns a string into a list of byte values"
#     return unpack('%sB' % len(value), value)


from .DataTypeConverters import readBew
from .DataTypeConverters import toBytes
from .constants import *
    from MidiToText import MidiToText
            stream.channel_pressure(channel, pressure)

        elif (PITCH_BEND & 0xF0) == hi_nible:
            hibyte, lobyte = data
            value = (hibyte<<7) + lobyte
            stream.pitch_bend(channel, value)

        else:

            raise ValueError('Illegal channel message!')

    def continuous_controllers(self, channel, controller, value):
        "Dispatches channel messages"

        stream = self.outstream

        # I am not really shure if I ought to dispatch continuous controllers
        # There's so many of them that it can clutter up the OutStream
        # classes.

        # So I just trigger the default event handler
        stream.continuous_controller(channel, controller, value)

    def system_commons(self, common_type, common_data):
        "Dispatches system common messages"

        stream = self.outstream

        # MTC Midi time code Quarter value
        if common_type == MTC:

# Path: fretwork/midi/DataTypeConverters.py
# def readBew(value):
#     """
#     Reads string as big endian word, (asserts len(value) in [1,2,4])
# 
#     .. doctest::
# 
#         >>> readBew('aáâã')
#         0
#         >>> readBew('aá')
#         0
#     """
#     try:
#         return unpack('>%s' % {1:'B', 2:'H', 4:'L'}[len(value)], value)[0]
#     except KeyError:
#         return 0
# 
# Path: fretwork/midi/DataTypeConverters.py
# def toBytes(value):
#     "Turns a string into a list of byte values"
#     return unpack('%sB' % len(value), value)


# Path: fretwork/midi/EventDispatcher.py
from .DataTypeConverters import readBew
from .DataTypeConverters import toBytes
from .constants import *
    from MidiToText import MidiToText

            stream.channel_pressure(channel, pressure)

        elif (PITCH_BEND & 0xF0) == hi_nible:
            hibyte, lobyte = data
            value = (hibyte<<7) + lobyte
            stream.pitch_bend(channel, value)

        else:

            raise ValueError('Illegal channel message!')

    def continuous_controllers(self, channel, controller, value):
        "Dispatches channel messages"

        stream = self.outstream

        # I am not really shure if I ought to dispatch continuous controllers
        # There's so many of them that it can clutter up the OutStream
        # classes.

        # So I just trigger the default event handler
        stream.continuous_controller(channel, controller, value)

    def system_commons(self, common_type, common_data):
        "Dispatches system common messages"

        stream = self.outstream

        # MTC Midi time code Quarter value
        if common_type == MTC:

            data = readBew(common_data)