# Path: mididings/units/base.py
# class _Filter(_Unit, _Selector):
#     """
#     Wrapper class for all filters.
#     """
#     def __init__(self, unit):
#         _Unit.__init__(self, unit)
# 
#     def __invert__(self):
#         """
#         Invert the filter (still act on the same event types, unary
#         operator ~).
#         """
#         return self.invert()
# 
#     def __neg__(self):
#         """
#         Negate the filter (ignoring event types, unary operator -)
#         """
#         return self.negate()
# 
#     def invert(self):
#         return _InvertedFilter(self, False)
# 
#     def negate(self):
#         return _InvertedFilter(self, True)
# 
#     def build(self):
#         return self
# 
#     def build_negated(self):
#         return self.negate()


import _mididings
import mididings.util as _util
import mididings.overload as _overload
import mididings.arguments as _arguments
import mididings.unitrepr as _unitrepr
import functools as _functools
from mididings.units.base import _Filter
@_unitrepr.accept(_util.velocity_limit, _util.velocity_limit)
def VelocityFilter(lower, upper):
    return _Filter(_mididings.VelocityFilter(lower, upper))


@_unitrepr.accept(_arguments.flatten(_util.ctrl_number), add_varargs=True)
def CtrlFilter(ctrls):
    """
    CtrlFilter(ctrls, ...)

    Filter control change events by controller number. The *ctrls* argument
    can be a single controller or a list of multiple controller numbers.
    All other events are discarded.
    """
    return _Filter(_mididings.CtrlFilter(ctrls))


@_overload.mark(
    """
    CtrlValueFilter(value)
    CtrlValueFilter(lower=...)
    CtrlValueFilter(upper=...)
    CtrlValueFilter(lower, upper)

    Filter control change events by controller value. All other events are
    discarded.
    """
)
@_unitrepr.accept(_util.ctrl_value)
def CtrlValueFilter(value):

# Path: mididings/units/base.py
# class _Filter(_Unit, _Selector):
#     """
#     Wrapper class for all filters.
#     """
#     def __init__(self, unit):
#         _Unit.__init__(self, unit)
# 
#     def __invert__(self):
#         """
#         Invert the filter (still act on the same event types, unary
#         operator ~).
#         """
#         return self.invert()
# 
#     def __neg__(self):
#         """
#         Negate the filter (ignoring event types, unary operator -)
#         """
#         return self.negate()
# 
#     def invert(self):
#         return _InvertedFilter(self, False)
# 
#     def negate(self):
#         return _InvertedFilter(self, True)
# 
#     def build(self):
#         return self
# 
#     def build_negated(self):
#         return self.negate()


# Path: mididings/units/filters.py
import _mididings
import mididings.util as _util
import mididings.overload as _overload
import mididings.arguments as _arguments
import mididings.unitrepr as _unitrepr
import functools as _functools
from mididings.units.base import _Filter

@_unitrepr.accept(_util.velocity_limit, _util.velocity_limit)
def VelocityFilter(lower, upper):
    return _Filter(_mididings.VelocityFilter(lower, upper))


@_unitrepr.accept(_arguments.flatten(_util.ctrl_number), add_varargs=True)
def CtrlFilter(ctrls):
    """
    CtrlFilter(ctrls, ...)

    Filter control change events by controller number. The *ctrls* argument
    can be a single controller or a list of multiple controller numbers.
    All other events are discarded.
    """
    return _Filter(_mididings.CtrlFilter(ctrls))


@_overload.mark(
    """
    CtrlValueFilter(value)
    CtrlValueFilter(lower=...)
    CtrlValueFilter(upper=...)
    CtrlValueFilter(lower, upper)

    Filter control change events by controller value. All other events are
    discarded.
    """
)
@_unitrepr.accept(_util.ctrl_value)
def CtrlValueFilter(value):

    return _Filter(_mididings.CtrlValueFilter(value, value + 1))