simple_client.py 文件源码

python
阅读 23 收藏 0 点赞 0 评论 0

项目:pulseviz 作者: pckbls 项目源码 文件源码
def write(self, data):
        """Writes samples of the given SampleSpec to the PulseAudio server."""

        self._fail_if_not_connected()

        # TODO: Use self.create_data_array...
        if self._sample_format == SampleFormat.PA_SAMPLE_U8:
            size = len(data)
            c_data = (ctypes.c_uint8 * size)(*data)
        elif self._sample_format == SampleFormat.PA_SAMPLE_S16LE:
            raise Exception('Not implemented yet.')
        elif self._sample_format == SampleFormat.PA_SAMPLE_FLOAT32LE:
            raise Exception('Not implemented yet.')

        error = ctypes.c_int(0)
        result = _libpulse_simple.pa_simple_write(self._client, c_data, size, error)
        if result < 0:
            raise PulseAudioException('Could not write data.', error.value)
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号