Пример #1
0
 def delete(self):
     self.worker.stop()
     with self.lock:
         alc.alcMakeContextCurrent(None)
         alc.alcDestroyContext(self._context)
         alc.alcCloseDevice(self._device)
         self._device = None
Пример #2
0
    def __init__(self, device_name=None):
        super(OpenALDriver, self).__init__()

        # TODO devices must be enumerated on Windows, otherwise 1.0 context is
        # returned.

        self._device = alc.alcOpenDevice(device_name)
        if not self._device:
            raise Exception('No OpenAL device.')

        self._context = alc.alcCreateContext(self._device, None)
        alc.alcMakeContextCurrent(self._context)

        self.have_1_1 = self.have_version(1, 1) and False

        self.lock = threading.Lock()

        self._listener = OpenALListener(self)

        # Start worker thread
        self.worker = OpenALWorker()
        self.worker.start()