Exemplo n.º 1
0
class WavPackValidator():

    def __init__(self, sample_data):
        self._validator = Kunquat()
        self._sample_data = sample_data
        self._validation_error = None

    def is_data_valid(self):
        if self._validation_error:
            return False

        transaction = {
            'au_00/p_manifest.json'                   : {},
            'au_00/proc_00/p_manifest.json'           : { 'type': 'sample' },
            'au_00/proc_00/p_signal_type.json'        : 'voice',
            'au_00/proc_00/c/smp_000/p_sh_sample.json': {
                    'format': 'WavPack', 'freq' : 48000, },
            'au_00/proc_00/c/smp_000/p_sample.wv'     : self._sample_data,
        }

        for key, value in transaction.items():
            self._validator.set_data(key, value)

        try:
            self._validator.validate()
        except KunquatFormatError as e:
            self._validation_error = e['message']
            return False

        return True

    def get_validation_error(self):
        return self._validation_error
Exemplo n.º 2
0
class WavPackValidator():

    def __init__(self, sample_data):
        self._validator = Kunquat()
        self._sample_data = sample_data
        self._validation_error = None

    def is_data_valid(self):
        if self._validation_error:
            return False

        transaction = {
            'au_00/p_manifest.json'                   : {},
            'au_00/proc_00/p_manifest.json'           : { 'type': 'sample' },
            'au_00/proc_00/p_signal_type.json'        : 'voice',
            'au_00/proc_00/c/smp_000/p_sh_sample.json': {
                    'format': 'WavPack', 'freq' : 48000, },
            'au_00/proc_00/c/smp_000/p_sample.wv'     : self._sample_data,
        }

        for key, value in transaction.items():
            self._validator.set_data(key, value)

        try:
            self._validator.validate()
        except KunquatFormatError as e:
            self._validation_error = e['message']
            return False

        return True

    def get_validation_error(self):
        return self._validation_error
Exemplo n.º 3
0
class KqtiValidator():
    def __init__(self, contents):
        self._validator = Kunquat()
        self._contents = contents
        self._validation_error = None

    def get_validation_steps(self):
        target_prefix = 'au_00'
        for (au_key, value) in self._contents.items():
            yield
            key = '/'.join((target_prefix, au_key))
            self._validator.set_data(key, value)

    def is_valid(self):
        if self._validation_error:
            return False

        try:
            self._validator.validate()
        except KunquatFormatError as e:
            self._validation_error = e['message']
            return False
        return True

    def get_validation_error(self):
        return self._validation_error
Exemplo n.º 4
0
class KqtiValidator():

    def __init__(self, contents):
        self._validator = Kunquat()
        self._contents = contents
        self._validation_error = None

    def get_validation_steps(self):
        target_prefix = 'au_00'
        for (au_key, value) in self._contents.items():
            yield
            key = '/'.join((target_prefix, au_key))
            self._validator.set_data(key, value)

    def is_valid(self):
        if self._validation_error:
            return False

        try:
            self._validator.validate()
        except KunquatFormatError as e:
            self._validation_error = e['message']
            return False
        return True

    def get_validation_error(self):
        return self._validation_error
Exemplo n.º 5
0
 def __init__(self, contents, data_converters):
     self._validator = Kunquat()
     self._validator.set_loader_thread_count(
         cmdline.get_default_thread_count())
     self._contents = contents
     self._data_converters = data_converters
     self._validation_error = None
     self._progress = 0
Exemplo n.º 6
0
def create_audio_engine():
    latency = cmdline.get_audio_latency() * 0.001
    rendering_engine = Kunquat(audio_rate=cmdline.get_audio_rate())
    rendering_engine.thread_count = cmdline.get_thread_count()
    audio_rate = rendering_engine.audio_rate
    chunk_size = max(1, int(latency * audio_rate * 0.5))
    audio_engine = AudioEngine(chunk_size)
    audio_output = Pushaudio(audio_rate, latency)
    audio_output.set_audio_source(audio_engine)
    audio_output.start()
    audio_engine.set_rendering_engine(rendering_engine)
    audio_engine.set_audio_output(audio_output)
    return audio_engine
Exemplo n.º 7
0
def create_audio_engine():
    latency = cmdline.get_audio_latency() * 0.001
    rendering_engine = Kunquat()
    rendering_engine.thread_count = cmdline.get_thread_count()
    audio_rate = rendering_engine.audio_rate
    chunk_size = max(1, int(latency * audio_rate * 0.5))
    audio_engine = AudioEngine(chunk_size)
    audio_output = Pushaudio(latency)
    audio_output.set_audio_source(audio_engine)
    audio_output.start()
    audio_engine.set_rendering_engine(rendering_engine)
    audio_engine.set_audio_output(audio_output)
    return audio_engine
Exemplo n.º 8
0
 def __init__(self, contents, data_converters):
     self._validator = Kunquat()
     self._validator.set_loader_thread_count(cmdline.get_default_thread_count())
     self._contents = contents
     self._data_converters = data_converters
     self._validation_error = None
     self._progress = 0
Exemplo n.º 9
0
class KqtiValidator():
    def __init__(self, contents, data_converters):
        self._validator = Kunquat()
        self._contents = contents
        self._data_converters = data_converters
        self._validation_error = None
        self._progress = 0

    def get_progress(self):
        return self._progress

    def get_validation_steps(self):
        target_prefix = 'au_00'
        step_count = len(self._contents.items())
        for i, (au_key, value) in enumerate(self._contents.items()):
            yield
            key = '/'.join((target_prefix, au_key))

            try:
                self._data_converters.convert_key_and_data(key, value)
            except UnsupportedVersionError as e:
                version_data = self._contents.get('m_editor_version.json')
                self._validation_error = e.get_message('audio unit',
                                                       version_data)
                break
            except VersionError as e:
                self._validation_error = e.args[0]
                break

            self._validator.set_data(key, value)
            self._progress = i / step_count

    def is_valid(self):
        if self._validation_error:
            return False

        try:
            self._validator.validate()
        except KunquatFormatError as e:
            self._validation_error = e['message']
            return False
        return True

    def get_validation_error(self):
        return self._validation_error
Exemplo n.º 10
0
class KqtiValidator():

    def __init__(self, contents, data_converters):
        self._validator = Kunquat()
        self._validator.set_loader_thread_count(cmdline.get_default_thread_count())
        self._contents = contents
        self._data_converters = data_converters
        self._validation_error = None
        self._progress = 0

    def get_progress(self):
        return self._progress

    def get_validation_steps(self):
        target_prefix = 'au_00'
        step_count = len(self._contents.items())
        for i, (au_key, value) in enumerate(self._contents.items()):
            yield
            key = '/'.join((target_prefix, au_key))

            try:
                self._data_converters.convert_key_and_data(key, value)
            except UnsupportedVersionError as e:
                version_data = self._contents.get('m_editor_version.json')
                self._validation_error = e.get_message('audio unit', version_data)
                break
            except VersionError as e:
                self._validation_error = e.args[0]
                break

            self._validator.set_data(key, value)
            self._progress = i / step_count

    def is_valid(self):
        if self._validation_error:
            return False

        try:
            self._validator.validate()
        except KunquatFormatError as e:
            self._validation_error = e['message']
            return False
        return True

    def get_validation_error(self):
        return self._validation_error
Exemplo n.º 11
0
 def __init__(self, contents, data_converters):
     self._validator = Kunquat()
     self._contents = contents
     self._data_converters = data_converters
     self._validation_error = None
     self._progress = 0
Exemplo n.º 12
0
 def __init__(self, sample_data):
     self._validator = Kunquat()
     self._sample_data = sample_data
     self._validation_error = None
Exemplo n.º 13
0
 def __init__(self, sample_data):
     self._validator = Kunquat()
     self._sample_data = sample_data
     self._validation_error = None
Exemplo n.º 14
0
 def __init__(self, sample_data, data_converters):
     self._validator = Kunquat()
     self._sample_data = sample_data
     self._data_converters = data_converters
     self._validation_error = None
Exemplo n.º 15
0
 def __init__(self, contents):
     self._validator = Kunquat()
     self._contents = contents
     self._validation_error = None
Exemplo n.º 16
0
 def __init__(self, contents):
     self._validator = Kunquat()
     self._contents = contents
     self._validation_error = None