Lines Matching refs:this
193 result = IDirectSoundBuffer_GetCurrentPosition(this->hidden->mixbuf, in DSOUND_WaitDevice()
197 IDirectSoundBuffer_Restore(this->hidden->mixbuf); in DSOUND_WaitDevice()
205 while ((cursor / this->spec.size) == this->hidden->lastchunk) { in DSOUND_WaitDevice()
210 IDirectSoundBuffer_GetStatus(this->hidden->mixbuf, &status); in DSOUND_WaitDevice()
212 IDirectSoundBuffer_Restore(this->hidden->mixbuf); in DSOUND_WaitDevice()
213 IDirectSoundBuffer_GetStatus(this->hidden->mixbuf, &status); in DSOUND_WaitDevice()
219 result = IDirectSoundBuffer_Play(this->hidden->mixbuf, 0, 0, in DSOUND_WaitDevice()
231 result = IDirectSoundBuffer_GetCurrentPosition(this->hidden->mixbuf, in DSOUND_WaitDevice()
244 if (this->hidden->locked_buf) { in DSOUND_PlayDevice()
245 IDirectSoundBuffer_Unlock(this->hidden->mixbuf, in DSOUND_PlayDevice()
246 this->hidden->locked_buf, in DSOUND_PlayDevice()
247 this->spec.size, NULL, 0); in DSOUND_PlayDevice()
260 this->hidden->locked_buf = NULL; in DSOUND_GetDeviceBuf()
261 result = IDirectSoundBuffer_GetCurrentPosition(this->hidden->mixbuf, in DSOUND_GetDeviceBuf()
264 IDirectSoundBuffer_Restore(this->hidden->mixbuf); in DSOUND_GetDeviceBuf()
265 result = IDirectSoundBuffer_GetCurrentPosition(this->hidden->mixbuf, in DSOUND_GetDeviceBuf()
272 cursor /= this->spec.size; in DSOUND_GetDeviceBuf()
277 if (spot < this->hidden->lastchunk) { in DSOUND_GetDeviceBuf()
278 spot += this->hidden->num_buffers; in DSOUND_GetDeviceBuf()
280 if (spot > this->hidden->lastchunk + 1) { in DSOUND_GetDeviceBuf()
282 (spot - (this->hidden->lastchunk + 1))); in DSOUND_GetDeviceBuf()
286 this->hidden->lastchunk = cursor; in DSOUND_GetDeviceBuf()
287 cursor = (cursor + 1) % this->hidden->num_buffers; in DSOUND_GetDeviceBuf()
288 cursor *= this->spec.size; in DSOUND_GetDeviceBuf()
291 result = IDirectSoundBuffer_Lock(this->hidden->mixbuf, cursor, in DSOUND_GetDeviceBuf()
292 this->spec.size, in DSOUND_GetDeviceBuf()
293 (LPVOID *) & this->hidden->locked_buf, in DSOUND_GetDeviceBuf()
296 IDirectSoundBuffer_Restore(this->hidden->mixbuf); in DSOUND_GetDeviceBuf()
297 result = IDirectSoundBuffer_Lock(this->hidden->mixbuf, cursor, in DSOUND_GetDeviceBuf()
298 this->spec.size, in DSOUND_GetDeviceBuf()
299 (LPVOID *) & this-> in DSOUND_GetDeviceBuf()
307 return (this->hidden->locked_buf); in DSOUND_GetDeviceBuf()
313 struct SDL_PrivateAudioData *h = this->hidden; in DSOUND_CaptureFromDevice()
317 SDL_assert(buflen == this->spec.size); in DSOUND_CaptureFromDevice()
320 if (SDL_AtomicGet(&this->shutdown)) { /* in case the buffer froze... */ in DSOUND_CaptureFromDevice()
321 SDL_memset(buffer, this->spec.silence, buflen); in DSOUND_CaptureFromDevice()
328 if ((cursor / this->spec.size) == h->lastchunk) { in DSOUND_CaptureFromDevice()
335 …if (IDirectSoundCaptureBuffer_Lock(h->capturebuf, h->lastchunk * this->spec.size, this->spec.size,… in DSOUND_CaptureFromDevice()
339 SDL_assert(ptr1len == this->spec.size); in DSOUND_CaptureFromDevice()
357 struct SDL_PrivateAudioData *h = this->hidden; in DSOUND_FlushCapture()
360 h->lastchunk = cursor / this->spec.size; in DSOUND_FlushCapture()
367 if (this->hidden->mixbuf != NULL) { in DSOUND_CloseDevice()
368 IDirectSoundBuffer_Stop(this->hidden->mixbuf); in DSOUND_CloseDevice()
369 IDirectSoundBuffer_Release(this->hidden->mixbuf); in DSOUND_CloseDevice()
371 if (this->hidden->sound != NULL) { in DSOUND_CloseDevice()
372 IDirectSound_Release(this->hidden->sound); in DSOUND_CloseDevice()
374 if (this->hidden->capturebuf != NULL) { in DSOUND_CloseDevice()
375 IDirectSoundCaptureBuffer_Stop(this->hidden->capturebuf); in DSOUND_CloseDevice()
376 IDirectSoundCaptureBuffer_Release(this->hidden->capturebuf); in DSOUND_CloseDevice()
378 if (this->hidden->capture != NULL) { in DSOUND_CloseDevice()
379 IDirectSoundCapture_Release(this->hidden->capture); in DSOUND_CloseDevice()
381 SDL_free(this->hidden); in DSOUND_CloseDevice()
391 LPDIRECTSOUND sndObj = this->hidden->sound; in CreateSecondary()
392 LPDIRECTSOUNDBUFFER *sndbuf = &this->hidden->mixbuf; in CreateSecondary()
417 SDL_memset(pvAudioPtr1, this->spec.silence, dwAudioBytes1); in CreateSecondary()
434 LPDIRECTSOUNDCAPTURE capture = this->hidden->capture; in CreateCaptureBuffer()
435 LPDIRECTSOUNDCAPTUREBUFFER *capturebuf = &this->hidden->capturebuf; in CreateCaptureBuffer()
465 this->hidden->lastchunk = cursor / this->spec.size; in CreateCaptureBuffer()
478 SDL_AudioFormat test_format = SDL_FirstAudioFormat(this->spec.format); in DSOUND_OpenDevice()
483 this->hidden = (struct SDL_PrivateAudioData *) in DSOUND_OpenDevice()
484 SDL_malloc((sizeof *this->hidden)); in DSOUND_OpenDevice()
485 if (this->hidden == NULL) { in DSOUND_OpenDevice()
488 SDL_zerop(this->hidden); in DSOUND_OpenDevice()
492 result = pDirectSoundCaptureCreate8(guid, &this->hidden->capture, NULL); in DSOUND_OpenDevice()
497 result = pDirectSoundCreate8(guid, &this->hidden->sound, NULL); in DSOUND_OpenDevice()
501 result = IDirectSound_SetCooperativeLevel(this->hidden->sound, in DSOUND_OpenDevice()
517 this->spec.format = test_format; in DSOUND_OpenDevice()
520 SDL_CalculateAudioSpec(&this->spec); in DSOUND_OpenDevice()
522 bufsize = numchunks * this->spec.size; in DSOUND_OpenDevice()
531 if (SDL_AUDIO_ISFLOAT(this->spec.format)) { in DSOUND_OpenDevice()
537 wfmt.wBitsPerSample = SDL_AUDIO_BITSIZE(this->spec.format); in DSOUND_OpenDevice()
538 wfmt.nChannels = this->spec.channels; in DSOUND_OpenDevice()
539 wfmt.nSamplesPerSec = this->spec.freq; in DSOUND_OpenDevice()
543 …rc = iscapture ? CreateCaptureBuffer(this, bufsize, &wfmt) : CreateSecondary(this, bufsize, &wfmt); in DSOUND_OpenDevice()
545 this->hidden->num_buffers = numchunks; in DSOUND_OpenDevice()