# Path: pylsdj/vibrato.py
# class Vibrato(object):
# 
#     def __init__(self, data):
#         self._data = data
# 
#     @property
#     def type(self):
#         """ ``hf`` (for high frequency sine), ``sawtooth``,
#         ``saw`` or ``square``"""
#         return self._data.type
# 
#     @type.setter
#     def type(self, value):
#         self._data.type = value
# 
#     @property
#     def direction(self):
#         """'down' or 'up'"""
#         return self._data.direction
# 
#     @direction.setter
#     def direction(self, value):
#         self._data.direction = value
# 
#     def import_lsdinst(self, struct_data):
#         self.direction = struct_data['data']['vibrato']['direction']
#         self.type = struct_data['data']['vibrato']['type']
# 
#     def __eq__(self, other):
#         return (isinstance(other, Vibrato)
#                 and self.type == other.type
#                 and self.direction == other.direction)


from .vibrato import Vibrato

class EnvelopeMixin(object):

    @property
    def envelope(self):
        """the noise instrument's volume envelope (8-bit integer)"""
        return self.data.envelope

    @envelope.setter
    def envelope(self, value):
        self.data.envelope = value

    @staticmethod
    def import_lsdinst(obj, struct_data):
        obj.envelope = struct_data['data']['envelope']

    @staticmethod
    def equal(a, b):
        return (isinstance(a, EnvelopeMixin) and isinstance(b, EnvelopeMixin)
                and a.envelope == b.envelope)

class VibratoMixin(object):

    @property
    def vibrato(self):
        """instrument's vibrato settings"""
        return Vibrato(self.data.vibrato)

    @staticmethod
    def import_lsdinst(obj, struct_data):

# Path: pylsdj/vibrato.py
# class Vibrato(object):
# 
#     def __init__(self, data):
#         self._data = data
# 
#     @property
#     def type(self):
#         """ ``hf`` (for high frequency sine), ``sawtooth``,
#         ``saw`` or ``square``"""
#         return self._data.type
# 
#     @type.setter
#     def type(self, value):
#         self._data.type = value
# 
#     @property
#     def direction(self):
#         """'down' or 'up'"""
#         return self._data.direction
# 
#     @direction.setter
#     def direction(self, value):
#         self._data.direction = value
# 
#     def import_lsdinst(self, struct_data):
#         self.direction = struct_data['data']['vibrato']['direction']
#         self.type = struct_data['data']['vibrato']['type']
# 
#     def __eq__(self, other):
#         return (isinstance(other, Vibrato)
#                 and self.type == other.type
#                 and self.direction == other.direction)


# Path: pylsdj/instrument_mixins.py
from .vibrato import Vibrato


class EnvelopeMixin(object):

    @property
    def envelope(self):
        """the noise instrument's volume envelope (8-bit integer)"""
        return self.data.envelope

    @envelope.setter
    def envelope(self, value):
        self.data.envelope = value

    @staticmethod
    def import_lsdinst(obj, struct_data):
        obj.envelope = struct_data['data']['envelope']

    @staticmethod
    def equal(a, b):
        return (isinstance(a, EnvelopeMixin) and isinstance(b, EnvelopeMixin)
                and a.envelope == b.envelope)

class VibratoMixin(object):

    @property
    def vibrato(self):
        """instrument's vibrato settings"""
        return Vibrato(self.data.vibrato)

    @staticmethod
    def import_lsdinst(obj, struct_data):

        Vibrato(obj.data.vibrato).import_lsdinst(struct_data)