Source code for rv.modules.base.spectravoice

# -- DO NOT EDIT THIS FILE DIRECTLY --
"""
Base class for SpectraVoice
This file was auto-generated by genrv.
"""
from enum import IntEnum

from rv.chunks import ArrayChunk
from rv.controller import Controller


class BaseSpectraVoice:
    name = "SpectraVoice"
    mtype = "SpectraVoice"
    mgroup = "Synth"
    flags = 73

    class Mode(IntEnum):
        hq = 0
        hq_mono = 1
        lq = 2
        lq_mono = 3
        hq_spline = 4

    class HarmonicType(IntEnum):
        hsin = 0
        rect = 1
        org1 = 2
        org2 = 3
        org3 = 4
        org4 = 5
        sin = 6
        random = 7
        triangle1 = 8
        triangle2 = 9
        overtones1 = 10
        overtones2 = 11
        overtones3 = 12
        overtones4 = 13
        overtones1_plus = 14
        overtones2_plus = 15
        overtones3_plus = 16
        overtones4_plus = 17
        metal = 18

    volume = Controller((0, 256), 128)
    panning = Controller((-128, 128), 0)
    attack = Controller((0, 512), 10)
    release = Controller((0, 512), 512)
    polyphony_ch = Controller((1, 32), 8)
    mode = Controller(Mode, Mode.hq_spline)
    sustain = Controller(bool, True)
    spectrum_resolution = Controller((0, 5), 1)
    harmonic = Controller((0, 15), 0)
    h_freq_hz = Controller((0, 22050), 1098)
    h_volume = Controller((0, 255), 255)
    h_width = Controller((0, 255), 3)
    h_type = Controller(HarmonicType, HarmonicType.hsin)

    class harmonic_freqs_chunk(ArrayChunk):
        chnm = 0
        length = 16
        type = "H"
        element_size = 2
        min_value = 0
        max_value = 32768
        default = [1098, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0]

    class harmonic_volumes_chunk(ArrayChunk):
        chnm = 1
        length = 16
        type = "B"
        element_size = 1
        min_value = 0
        max_value = 255
        default = [255, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0]

    class harmonic_widths_chunk(ArrayChunk):
        chnm = 2
        length = 16
        type = "B"
        element_size = 1
        min_value = 0
        max_value = 255
        default = [3, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0]

    class harmonic_types_chunk(ArrayChunk):
        chnm = 3
        length = 16
        type = "B"
        element_size = 1

        @property
        def default(self):
            return [
                BaseSpectraVoice.HarmonicType.hsin,
                BaseSpectraVoice.HarmonicType.hsin,
                BaseSpectraVoice.HarmonicType.hsin,
                BaseSpectraVoice.HarmonicType.hsin,
                BaseSpectraVoice.HarmonicType.hsin,
                BaseSpectraVoice.HarmonicType.hsin,
                BaseSpectraVoice.HarmonicType.hsin,
                BaseSpectraVoice.HarmonicType.hsin,
                BaseSpectraVoice.HarmonicType.hsin,
                BaseSpectraVoice.HarmonicType.hsin,
                BaseSpectraVoice.HarmonicType.hsin,
                BaseSpectraVoice.HarmonicType.hsin,
                BaseSpectraVoice.HarmonicType.hsin,
                BaseSpectraVoice.HarmonicType.hsin,
                BaseSpectraVoice.HarmonicType.hsin,
                BaseSpectraVoice.HarmonicType.hsin,
            ]

        @property
        def encoded_values(self):
            return [x.value for x in self.values]

        @property
        def python_type(self):
            return BaseSpectraVoice.HarmonicType