Lines Matching refs:this

105     SDL_AudioDevice *this = (SDL_AudioDevice *) dwInstance;  in CaptureSound()  local
112 ReleaseSemaphore(this->hidden->audio_sem, 1, NULL); in CaptureSound()
121 SDL_AudioDevice *this = (SDL_AudioDevice *) dwInstance; in FillSound() local
128 ReleaseSemaphore(this->hidden->audio_sem, 1, NULL); in FillSound()
152 WaitForSingleObject(this->hidden->audio_sem, INFINITE); in WINMM_WaitDevice()
158 return (Uint8 *) (this->hidden-> in WINMM_GetDeviceBuf()
159 wavebuf[this->hidden->next_buffer].lpData); in WINMM_GetDeviceBuf()
166 waveOutWrite(this->hidden->hout, in WINMM_PlayDevice()
167 &this->hidden->wavebuf[this->hidden->next_buffer], in WINMM_PlayDevice()
168 sizeof(this->hidden->wavebuf[0])); in WINMM_PlayDevice()
169 this->hidden->next_buffer = (this->hidden->next_buffer + 1) % NUM_BUFFERS; in WINMM_PlayDevice()
175 const int nextbuf = this->hidden->next_buffer; in WINMM_CaptureFromDevice()
178 SDL_assert(buflen == this->spec.size); in WINMM_CaptureFromDevice()
181 WaitForSingleObject(this->hidden->audio_sem, INFINITE); in WINMM_CaptureFromDevice()
184 SDL_memcpy(buffer, this->hidden->wavebuf[nextbuf].lpData, this->spec.size); in WINMM_CaptureFromDevice()
187 result = waveInAddBuffer(this->hidden->hin, in WINMM_CaptureFromDevice()
188 &this->hidden->wavebuf[nextbuf], in WINMM_CaptureFromDevice()
189 sizeof (this->hidden->wavebuf[nextbuf])); in WINMM_CaptureFromDevice()
195 this->hidden->next_buffer = (nextbuf + 1) % NUM_BUFFERS; in WINMM_CaptureFromDevice()
196 return this->spec.size; in WINMM_CaptureFromDevice()
203 if (WaitForSingleObject(this->hidden->audio_sem, 0) == WAIT_OBJECT_0) { in WINMM_FlushCapture()
204 const int nextbuf = this->hidden->next_buffer; in WINMM_FlushCapture()
206 waveInAddBuffer(this->hidden->hin, in WINMM_FlushCapture()
207 &this->hidden->wavebuf[nextbuf], in WINMM_FlushCapture()
208 sizeof (this->hidden->wavebuf[nextbuf])); in WINMM_FlushCapture()
209 this->hidden->next_buffer = (nextbuf + 1) % NUM_BUFFERS; in WINMM_FlushCapture()
218 if (this->hidden->hout) { in WINMM_CloseDevice()
219 waveOutReset(this->hidden->hout); in WINMM_CloseDevice()
223 if (this->hidden->wavebuf[i].dwUser != 0xFFFF) { in WINMM_CloseDevice()
224 waveOutUnprepareHeader(this->hidden->hout, in WINMM_CloseDevice()
225 &this->hidden->wavebuf[i], in WINMM_CloseDevice()
226 sizeof (this->hidden->wavebuf[i])); in WINMM_CloseDevice()
230 waveOutClose(this->hidden->hout); in WINMM_CloseDevice()
233 if (this->hidden->hin) { in WINMM_CloseDevice()
234 waveInReset(this->hidden->hin); in WINMM_CloseDevice()
238 if (this->hidden->wavebuf[i].dwUser != 0xFFFF) { in WINMM_CloseDevice()
239 waveInUnprepareHeader(this->hidden->hin, in WINMM_CloseDevice()
240 &this->hidden->wavebuf[i], in WINMM_CloseDevice()
241 sizeof (this->hidden->wavebuf[i])); in WINMM_CloseDevice()
244 waveInClose(this->hidden->hin); in WINMM_CloseDevice()
247 if (this->hidden->audio_sem) { in WINMM_CloseDevice()
248 CloseHandle(this->hidden->audio_sem); in WINMM_CloseDevice()
251 SDL_free(this->hidden->mixbuf); in WINMM_CloseDevice()
252 SDL_free(this->hidden); in WINMM_CloseDevice()
260 if (SDL_AUDIO_ISFLOAT(this->spec.format)) { in PrepWaveFormat()
265 pfmt->wBitsPerSample = SDL_AUDIO_BITSIZE(this->spec.format); in PrepWaveFormat()
267 pfmt->nChannels = this->spec.channels; in PrepWaveFormat()
268 pfmt->nSamplesPerSec = this->spec.freq; in PrepWaveFormat()
282 SDL_AudioFormat test_format = SDL_FirstAudioFormat(this->spec.format); in WINMM_OpenDevice()
296 this->hidden = (struct SDL_PrivateAudioData *) in WINMM_OpenDevice()
297 SDL_malloc((sizeof *this->hidden)); in WINMM_OpenDevice()
298 if (this->hidden == NULL) { in WINMM_OpenDevice()
301 SDL_zerop(this->hidden); in WINMM_OpenDevice()
305 this->hidden->wavebuf[i].dwUser = 0xFFFF; in WINMM_OpenDevice()
307 if (this->spec.channels > 2) in WINMM_OpenDevice()
308 this->spec.channels = 2; /* !!! FIXME: is this right? */ in WINMM_OpenDevice()
316 this->spec.format = test_format; in WINMM_OpenDevice()
317 if (PrepWaveFormat(this, devId, &waveformat, iscapture)) { in WINMM_OpenDevice()
335 SDL_CalculateAudioSpec(&this->spec); in WINMM_OpenDevice()
339 result = waveInOpen(&this->hidden->hin, devId, &waveformat, in WINMM_OpenDevice()
340 (DWORD_PTR) CaptureSound, (DWORD_PTR) this, in WINMM_OpenDevice()
346 result = waveOutOpen(&this->hidden->hout, devId, &waveformat, in WINMM_OpenDevice()
347 (DWORD_PTR) FillSound, (DWORD_PTR) this, in WINMM_OpenDevice()
359 result = waveInGetDevCaps((UINT) this->hidden->hout, in WINMM_OpenDevice()
367 result = waveOutGetDevCaps((UINT) this->hidden->hout, in WINMM_OpenDevice()
378this->hidden->audio_sem = CreateSemaphore(NULL, iscapture ? 0 : NUM_BUFFERS - 1, NUM_BUFFERS, NULL… in WINMM_OpenDevice()
379 if (this->hidden->audio_sem == NULL) { in WINMM_OpenDevice()
384 this->hidden->mixbuf = in WINMM_OpenDevice()
385 (Uint8 *) SDL_malloc(NUM_BUFFERS * this->spec.size); in WINMM_OpenDevice()
386 if (this->hidden->mixbuf == NULL) { in WINMM_OpenDevice()
390 SDL_zeroa(this->hidden->wavebuf); in WINMM_OpenDevice()
392 this->hidden->wavebuf[i].dwBufferLength = this->spec.size; in WINMM_OpenDevice()
393 this->hidden->wavebuf[i].dwFlags = WHDR_DONE; in WINMM_OpenDevice()
394 this->hidden->wavebuf[i].lpData = in WINMM_OpenDevice()
395 (LPSTR) & this->hidden->mixbuf[i * this->spec.size]; in WINMM_OpenDevice()
398 result = waveInPrepareHeader(this->hidden->hin, in WINMM_OpenDevice()
399 &this->hidden->wavebuf[i], in WINMM_OpenDevice()
400 sizeof(this->hidden->wavebuf[i])); in WINMM_OpenDevice()
405 result = waveInAddBuffer(this->hidden->hin, in WINMM_OpenDevice()
406 &this->hidden->wavebuf[i], in WINMM_OpenDevice()
407 sizeof(this->hidden->wavebuf[i])); in WINMM_OpenDevice()
412 result = waveOutPrepareHeader(this->hidden->hout, in WINMM_OpenDevice()
413 &this->hidden->wavebuf[i], in WINMM_OpenDevice()
414 sizeof(this->hidden->wavebuf[i])); in WINMM_OpenDevice()
422 result = waveInStart(this->hidden->hin); in WINMM_OpenDevice()