# Path: mididings/units/base.py
# class _Unit(object):
#     """
#     Wrapper class for all units.
#     """
#     def __init__(self, unit):
#         self.unit = unit
# 
#     def __rshift__(self, other):
#         """
#         Connect units in series (operator >>).
#         """
#         if not isinstance(other, _UNIT_TYPES):
#             return NotImplemented
#         return _join_units(_Chain, self, other)
# 
#     def __rrshift__(self, other):
#         """
#         Connect units in series (operator >>).
#         """
#         if not isinstance(other, _UNIT_TYPES):
#             return NotImplemented
#         return _join_units(_Chain, other, self)
# 
#     def __floordiv__(self, other):
#         """
#         Connect units in parallel (operator //).
#         """
#         if not isinstance(other, _UNIT_TYPES):
#             return NotImplemented
#         return _join_units(_Fork, self, other)
# 
#     def __rfloordiv__(self, other):
#         """
#         Connect units in parallel (operator //).
#         """
#         if not isinstance(other, _UNIT_TYPES):
#             return NotImplemented
#         return _join_units(_Fork, other, self)
# 
#     def __pos__(self):
#         """
#         Apply to duplicate (unary operator +)
#         """
#         return self.add()
# 
#     def add(self):
#         return Fork([ Pass(), self ])
# 
#     def __repr__(self):
#         return _unitrepr.unit_to_string(self)
# 
# @_unitrepr.accept(_arguments.reduce_bitmask([_constants._EventType]),
#                   add_varargs=True)
# def Filter(types):
#     """
#     Filter(types, ...)
# 
#     Filter by event type. Multiple types can be given as bitmasks, lists, or
#     separate parameters.
#     """
#     return _Filter(_mididings.TypeFilter(types))
# 
# @_arguments.accept({
#     _arguments.nullable(_arguments.reduce_bitmask([_constants._EventType])):
#         _UNIT_TYPES
# })
# def Split(mapping):
#     """
#     Split(mapping)
# 
#     Split by event type.
#     """
#     return _Split(mapping)
# 
# @_unitrepr.store
# def Pass():
#     """
#     Do nothing. This is sometimes useful/necessary as a placeholder, much like
#     the ``pass`` statement in Python.
#     """
#     return _Unit(_mididings.Pass(True))
# 
# Path: mididings/units/splits.py
# @_overload.mark(
#     """
#     VelocitySplit(threshold, patch_lower, patch_upper)
#     VelocitySplit(mapping)
# 
#     Split events by note-on velocity. Non-note events are sent to all patches.
# 
#     The first version splits at a single threshold. The second version allows
#     an arbitrary number of (possibly overlapping) value ranges, with
#     *mapping* being a dictionary of the form ``{(lower, upper): patch, ...}``.
#     """
# )
# @_arguments.accept(_util.velocity_limit, _UNIT_TYPES, _UNIT_TYPES)
# def VelocitySplit(threshold, patch_lower, patch_upper):
#     return _make_threshold(VelocityFilter(0, threshold),
#                            patch_lower, patch_upper)
# 
# Path: mididings/units/generators.py
# @_overload.partial((_constants.EVENT_PORT, _constants.EVENT_CHANNEL))
# @_unitrepr.accept(_util.port_number_ref, _util.channel_number_ref,
#                   _util.note_number_ref, _util.velocity_value_ref)
# def NoteOn(port, channel, note, velocity):
#     """
#     NoteOn(note, velocity)
#     NoteOn(port, channel, note, velocity)
# 
#     Create a note-on event, replacing the incoming event.
#     """
#     return _Unit(_mididings.Generator(
#         _constants.NOTEON,
#         _util.actual_ref(port),
#         _util.actual_ref(channel),
#         note,
#         velocity
#     ))
# 
# @_overload.partial((_constants.EVENT_PORT, _constants.EVENT_CHANNEL))
# @_unitrepr.accept(_util.port_number_ref, _util.channel_number_ref,
#                   _util.note_number_ref, _util.velocity_value_ref)
# def NoteOff(port, channel, note, velocity=0):
#     """
#     NoteOff(note, velocity=0)
#     NoteOff(port, channel, note, velocity=0)
# 
#     Create a note-off event, replacing the incoming event.
#     """
#     return _Unit(_mididings.Generator(
#         _constants.NOTEOFF,
#         _util.actual_ref(port),
#         _util.actual_ref(channel),
#         note,
#         velocity
#     ))
# 
# @_overload.partial((_constants.EVENT_PORT, _constants.EVENT_CHANNEL))
# @_unitrepr.accept(_util.port_number_ref, _util.channel_number_ref,
#                   _util.note_number_ref, int)
# def PolyAftertouch(port, channel, note, value):
#     """
#     PolyAftertouch(note, value)
#     PolyAftertouch(port, channel, note, value)
# 
#     Create a polyphonic aftertouch event, replacing the incoming event.
#     """
#     return _Unit(_mididings.Generator(
#         _constants.POLY_AFTERTOUCH,
#         _util.actual_ref(port),
#         _util.actual_ref(channel),
#         note,
#         value
#     ))


import _mididings
import mididings.util as _util
import mididings.misc as _misc
import mididings.overload as _overload
import mididings.constants as _constants
import mididings.arguments as _arguments
import mididings.unitrepr as _unitrepr
from mididings.units.base import _Unit, Filter, Split, Pass
from mididings.units.splits import VelocitySplit
from mididings.units.generators import NoteOn, NoteOff, PolyAftertouch
# -*- coding: utf-8 -*-
#
# mididings
#
# Copyright (C) 2008-2014  Dominic Sacré  <dominic.sacre@gmx.de>
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 2 of the License, or
# (at your option) any later version.
#





@_unitrepr.accept(_util.port_number)
def Port(port):
    """
    Port(port)

    Change the event's port number.
    """

# Path: mididings/units/base.py
# class _Unit(object):
#     """
#     Wrapper class for all units.
#     """
#     def __init__(self, unit):
#         self.unit = unit
# 
#     def __rshift__(self, other):
#         """
#         Connect units in series (operator >>).
#         """
#         if not isinstance(other, _UNIT_TYPES):
#             return NotImplemented
#         return _join_units(_Chain, self, other)
# 
#     def __rrshift__(self, other):
#         """
#         Connect units in series (operator >>).
#         """
#         if not isinstance(other, _UNIT_TYPES):
#             return NotImplemented
#         return _join_units(_Chain, other, self)
# 
#     def __floordiv__(self, other):
#         """
#         Connect units in parallel (operator //).
#         """
#         if not isinstance(other, _UNIT_TYPES):
#             return NotImplemented
#         return _join_units(_Fork, self, other)
# 
#     def __rfloordiv__(self, other):
#         """
#         Connect units in parallel (operator //).
#         """
#         if not isinstance(other, _UNIT_TYPES):
#             return NotImplemented
#         return _join_units(_Fork, other, self)
# 
#     def __pos__(self):
#         """
#         Apply to duplicate (unary operator +)
#         """
#         return self.add()
# 
#     def add(self):
#         return Fork([ Pass(), self ])
# 
#     def __repr__(self):
#         return _unitrepr.unit_to_string(self)
# 
# @_unitrepr.accept(_arguments.reduce_bitmask([_constants._EventType]),
#                   add_varargs=True)
# def Filter(types):
#     """
#     Filter(types, ...)
# 
#     Filter by event type. Multiple types can be given as bitmasks, lists, or
#     separate parameters.
#     """
#     return _Filter(_mididings.TypeFilter(types))
# 
# @_arguments.accept({
#     _arguments.nullable(_arguments.reduce_bitmask([_constants._EventType])):
#         _UNIT_TYPES
# })
# def Split(mapping):
#     """
#     Split(mapping)
# 
#     Split by event type.
#     """
#     return _Split(mapping)
# 
# @_unitrepr.store
# def Pass():
#     """
#     Do nothing. This is sometimes useful/necessary as a placeholder, much like
#     the ``pass`` statement in Python.
#     """
#     return _Unit(_mididings.Pass(True))
# 
# Path: mididings/units/splits.py
# @_overload.mark(
#     """
#     VelocitySplit(threshold, patch_lower, patch_upper)
#     VelocitySplit(mapping)
# 
#     Split events by note-on velocity. Non-note events are sent to all patches.
# 
#     The first version splits at a single threshold. The second version allows
#     an arbitrary number of (possibly overlapping) value ranges, with
#     *mapping* being a dictionary of the form ``{(lower, upper): patch, ...}``.
#     """
# )
# @_arguments.accept(_util.velocity_limit, _UNIT_TYPES, _UNIT_TYPES)
# def VelocitySplit(threshold, patch_lower, patch_upper):
#     return _make_threshold(VelocityFilter(0, threshold),
#                            patch_lower, patch_upper)
# 
# Path: mididings/units/generators.py
# @_overload.partial((_constants.EVENT_PORT, _constants.EVENT_CHANNEL))
# @_unitrepr.accept(_util.port_number_ref, _util.channel_number_ref,
#                   _util.note_number_ref, _util.velocity_value_ref)
# def NoteOn(port, channel, note, velocity):
#     """
#     NoteOn(note, velocity)
#     NoteOn(port, channel, note, velocity)
# 
#     Create a note-on event, replacing the incoming event.
#     """
#     return _Unit(_mididings.Generator(
#         _constants.NOTEON,
#         _util.actual_ref(port),
#         _util.actual_ref(channel),
#         note,
#         velocity
#     ))
# 
# @_overload.partial((_constants.EVENT_PORT, _constants.EVENT_CHANNEL))
# @_unitrepr.accept(_util.port_number_ref, _util.channel_number_ref,
#                   _util.note_number_ref, _util.velocity_value_ref)
# def NoteOff(port, channel, note, velocity=0):
#     """
#     NoteOff(note, velocity=0)
#     NoteOff(port, channel, note, velocity=0)
# 
#     Create a note-off event, replacing the incoming event.
#     """
#     return _Unit(_mididings.Generator(
#         _constants.NOTEOFF,
#         _util.actual_ref(port),
#         _util.actual_ref(channel),
#         note,
#         velocity
#     ))
# 
# @_overload.partial((_constants.EVENT_PORT, _constants.EVENT_CHANNEL))
# @_unitrepr.accept(_util.port_number_ref, _util.channel_number_ref,
#                   _util.note_number_ref, int)
# def PolyAftertouch(port, channel, note, value):
#     """
#     PolyAftertouch(note, value)
#     PolyAftertouch(port, channel, note, value)
# 
#     Create a polyphonic aftertouch event, replacing the incoming event.
#     """
#     return _Unit(_mididings.Generator(
#         _constants.POLY_AFTERTOUCH,
#         _util.actual_ref(port),
#         _util.actual_ref(channel),
#         note,
#         value
#     ))


# Path: mididings/units/modifiers.py
import _mididings
import mididings.util as _util
import mididings.misc as _misc
import mididings.overload as _overload
import mididings.constants as _constants
import mididings.arguments as _arguments
import mididings.unitrepr as _unitrepr
from mididings.units.base import _Unit, Filter, Split, Pass
from mididings.units.splits import VelocitySplit
from mididings.units.generators import NoteOn, NoteOff, PolyAftertouch

# -*- coding: utf-8 -*-
#
# mididings
#
# Copyright (C) 2008-2014  Dominic Sacré  <dominic.sacre@gmx.de>
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 2 of the License, or
# (at your option) any later version.
#





@_unitrepr.accept(_util.port_number)
def Port(port):
    """
    Port(port)

    Change the event's port number.
    """

    return _Unit(_mididings.Port(_util.actual(port)))