# -*- encoding: utf-8 -*-
from supriya.tools.bindingtools.BindingTarget import BindingTarget


class SynthControl(BindingTarget):

    ### CLASS VARIABLES ###

    __documentation_section__ = 'Server Internals'

    __slots__ = (
        '_binding_sources',
        '_calculation_rate',
        '_client',
        '_index',
        '_default_value',
        '_last_unmapped_value',
        '_name',
        '_range',
        '_unit',
        '_value',
        )

    ### INITIALIZER ###

    def __init__(
        self,
        client=None,
        index=None,
        name=None,
        range_=None,
        calculation_rate=None,
        unit=None,
        value=None,
        ):
        from supriya.tools import servertools
        from supriya.tools import synthdeftools
        BindingTarget.__init__(self)
        self._client = client
        self._name = str(name)
        if isinstance(range_, synthdeftools.Range):
            self._range = range_
        else:
            self._range = None
        self._calculation_rate = synthdeftools.CalculationRate.from_expr(calculation_rate)
        self._unit = unit
        self._value = value
        self._default_value = value
        if not isinstance(value, servertools.Bus):
            self._last_unmapped_value = self._value
        else:
            self._last_unmapped_value = self._default_value