static void WinMMCloseCapture(ALCdevice *Device) { WinMMData *data = (WinMMData*)Device->ExtraData; void *buffer = NULL; int i; /* Tell the processing thread to quit and wait for it to do so. */ data->killNow = AL_TRUE; PostThreadMessage(data->thread, WM_QUIT, 0, 0); althrd_join(data->thread, &i); /* Make sure capture is stopped and all pending buffers are flushed. */ waveInReset(data->WaveHandle.In); // Release the wave buffers for(i = 0; i < 4; i++) { waveInUnprepareHeader(data->WaveHandle.In, &data->WaveBuffer[i], sizeof(WAVEHDR)); if(i == 0) buffer = data->WaveBuffer[i].lpData; data->WaveBuffer[i].lpData = NULL; } free(buffer); DestroyRingBuffer(data->Ring); data->Ring = NULL; // Close the Wave device waveInClose(data->WaveHandle.In); data->WaveHandle.In = 0; free(data); Device->ExtraData = NULL; }
static void ALCwinmmCapture_Destruct(ALCwinmmCapture *self) { void *buffer = NULL; int i; /* Tell the processing thread to quit and wait for it to do so. */ if(!ATOMIC_EXCHANGE(&self->killNow, AL_TRUE, almemory_order_acq_rel)) { PostThreadMessage(self->thread, WM_QUIT, 0, 0); althrd_join(self->thread, &i); /* Make sure capture is stopped and all pending buffers are flushed. */ waveInReset(self->InHdl); // Release the wave buffers for(i = 0;i < 4;i++) { waveInUnprepareHeader(self->InHdl, &self->WaveBuffer[i], sizeof(WAVEHDR)); if(i == 0) buffer = self->WaveBuffer[i].lpData; self->WaveBuffer[i].lpData = NULL; } free(buffer); } ll_ringbuffer_free(self->Ring); self->Ring = NULL; // Close the Wave device if(self->InHdl) waveInClose(self->InHdl); self->InHdl = 0; ALCbackend_Destruct(STATIC_CAST(ALCbackend, self)); }
static void ALCnullBackend_stop(ALCnullBackend *self) { int res; if(ATOMIC_EXCHANGE(&self->killNow, AL_TRUE, almemory_order_acq_rel)) return; althrd_join(self->thread, &res); }
static void qsa_stop_playback(ALCdevice* device) { qsa_data *data = (qsa_data*)device->ExtraData; int res; if(data->killNow) return; data->killNow = 1; althrd_join(data->thread, &res); }
static void ALCsolarisBackend_stop(ALCsolarisBackend *self) { int res; if(ATOMIC_EXCHANGE_SEQ(&self->killNow, AL_TRUE)) return; althrd_join(self->thread, &res); if(ioctl(self->fd, AUDIO_DRAIN) < 0) ERR("Error draining device: %s\n", strerror(errno)); }
static void sndio_stop_playback(ALCdevice *device) { sndio_data *data = device->ExtraData; int res; if(data->killNow) return; data->killNow = 1; althrd_join(data->thread, &res); if(!sio_stop(data->sndHandle)) ERR("Error stopping device\n"); free(data->mix_data); data->mix_data = NULL; }
static void ALCwinmmPlayback_stop(ALCwinmmPlayback *self) { void *buffer = NULL; int i; if(ATOMIC_EXCHANGE(&self->killNow, AL_TRUE, almemory_order_acq_rel)) return; althrd_join(self->thread, &i); // Release the wave buffers for(i = 0;i < 4;i++) { waveOutUnprepareHeader(self->OutHdl, &self->WaveBuffer[i], sizeof(WAVEHDR)); if(i == 0) buffer = self->WaveBuffer[i].lpData; self->WaveBuffer[i].lpData = NULL; } free(buffer); }
static void WinMMStopPlayback(ALCdevice *device) { WinMMData *data = (WinMMData*)device->ExtraData; void *buffer = NULL; int i; if(data->killNow) return; // Set flag to stop processing headers data->killNow = AL_TRUE; althrd_join(data->thread, &i); // Release the wave buffers for(i = 0; i < 4; i++) { waveOutUnprepareHeader(data->WaveHandle.Out, &data->WaveBuffer[i], sizeof(WAVEHDR)); if(i == 0) buffer = data->WaveBuffer[i].lpData; data->WaveBuffer[i].lpData = NULL; } free(buffer); }