<commit_before># -*- coding: utf-8 -*-

'''Opus decoder.'''

from __future__ import unicode_literals, absolute_import

__all__ = [
        'OpusDecoder',
        ]

from . import base
from . import llinterface
from . import utils


class OpusDecoder(base.OpusCodec):
    '''Opus decoder.'''

    def __init__(self, frequency, channels):
        # basic sanity check
        utils.check_freq(frequency)
        utils.check_channels(channels)

        self.frequency = frequency
        self.channels = channels

        # initialize state
        super(OpusDecoder, self).__init__()

    def _get_state_size(self):
        return llinterface.decoder_get_size(self.channels)

    def _init_state(self):
        llinterface.decoder_init(self._state, self.frequency, self.channels)


# vim:set ai et ts=4 sw=4 sts=4 fenc=utf-8:
<commit_msg>implement CTL interface on OpusDecoder<commit_after># -*- coding: utf-8 -*-

'''Opus decoder.'''

from __future__ import unicode_literals, absolute_import

__all__ = [
        'OpusDecoder',
        ]

from . import base
from . import llinterface
from . import ctl
from . import utils


class OpusDecoder(base.OpusCodec):
    '''Opus decoder.'''

    def __init__(self, frequency, channels):
        # basic sanity check
        utils.check_freq(frequency)
        utils.check_channels(channels)

        self.frequency = frequency
        self.channels = channels

        # initialize state
        super(OpusDecoder, self).__init__()

    def _get_state_size(self):
        return llinterface.decoder_get_size(self.channels)

    def _init_state(self):
        llinterface.decoder_init(self._state, self.frequency, self.channels)

    def reset_state(self):
        ctl.decoder_reset_state(self._state)

    @property
    def final_range(self):
        return ctl.decoder_get_final_range(self._state)

    @property
    def pitch(self):
        return ctl.decoder_get_pitch(self._state)

    @property
    def bandwidth(self):
        return ctl.decoder_get_bandwidth(self._state)

    @property
    def gain(self):
        return ctl.decoder_get_gain(self._state)

    @gain.setter
    def gain(self, value):
        ctl.decoder_set_gain(self._state, value)


# vim:set ai et ts=4 sw=4 sts=4 fenc=utf-8:

{'fraction_non_alphanumeric': 0.10204991087344029, 'fraction_numerical': 0.004456327985739751, 'mean_word_length': 2.924825174825175, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '5349978', 'n_tokens_mistral': 726, 'n_tokens_neox': 687, 'n_words': 152}