# 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)
# 
# Path: mididings/setup.py
# def get_config(var):
#     return _config[var]


import _mididings
import mididings.event as _event
import mididings.overload as _overload
import mididings.unitrepr as _unitrepr
import mididings.misc as _misc
import sys as _sys
    import _thread
    import thread as _thread
import subprocess as _subprocess
import types as _types
import copy as _copy
import collections as _collections
import inspect as _inspect
from mididings.units.base import _Unit
from mididings.setup import get_config as _get_config

    Process the incoming MIDI event using a Python function, then continue
    executing the mididings patch with the events returned from that
    function.

    :param function:
        a function, or any other callable object, that will be called with
        a :class:`~.MidiEvent` object as its first argument.

        The function's return value can be:
          - a single :class:`~.MidiEvent` object.
          - a list of :class:`~.MidiEvent` objects.
          - ``None`` (or an empty list).

        Instead of ``return``\ ing :class:`~.MidiEvent` objects, *function*
        may also be a generator that ``yield``\ s :class:`~.MidiEvent`
        objects.

    :param \*args:
        optional positional arguments that will be passed to *function*.

    :param \*\*kwargs:
        optional keyword arguments that will be passed to *function*.


    Any other MIDI processing will be stalled until *function* returns,
    so this should only be used with functions that don't block.
    Use :func:`Call()` for tasks that may take longer and/or don't require
    returning any MIDI events.
    """

# 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)
# 
# Path: mididings/setup.py
# def get_config(var):
#     return _config[var]


# Path: mididings/units/call.py
import _mididings
import mididings.event as _event
import mididings.overload as _overload
import mididings.unitrepr as _unitrepr
import mididings.misc as _misc
import sys as _sys
    import _thread
    import thread as _thread
import subprocess as _subprocess
import types as _types
import copy as _copy
import collections as _collections
import inspect as _inspect
from mididings.units.base import _Unit
from mididings.setup import get_config as _get_config


    Process the incoming MIDI event using a Python function, then continue
    executing the mididings patch with the events returned from that
    function.

    :param function:
        a function, or any other callable object, that will be called with
        a :class:`~.MidiEvent` object as its first argument.

        The function's return value can be:
          - a single :class:`~.MidiEvent` object.
          - a list of :class:`~.MidiEvent` objects.
          - ``None`` (or an empty list).

        Instead of ``return``\ ing :class:`~.MidiEvent` objects, *function*
        may also be a generator that ``yield``\ s :class:`~.MidiEvent`
        objects.

    :param \*args:
        optional positional arguments that will be passed to *function*.

    :param \*\*kwargs:
        optional keyword arguments that will be passed to *function*.


    Any other MIDI processing will be stalled until *function* returns,
    so this should only be used with functions that don't block.
    Use :func:`Call()` for tasks that may take longer and/or don't require
    returning any MIDI events.
    """

    if _get_config('backend') == 'jack-rt' and not _get_config('silent'):