예제 #1
0
    def stop(self):
        if _debug:
            print('stop')
        with context.lock:
            context.async_operation(
                pa.pa_stream_cork(self.stream, 1,
                                  pa.pa_stream_success_cb_t(0), None)
            )

        self._playing = False
예제 #2
0
    def play(self):
        if _debug:
            print('play')
        with context.lock:
            context.async_operation(
                pa.pa_stream_cork(self.stream, 0,
                                  pa.pa_stream_success_cb_t(0), None)
            )

            # If whole stream has already been written, trigger immediate
            # playback.        
            if self._underflow_is_eos:
                context.async_operation(
                    pa.pa_stream_trigger(self.stream,
                                         pa.pa_stream_success_cb_t(0), None)
                )

            if self._buffer_underflow:
                self._write_cb(self.stream, None, None)

        self._playing = True