comparison libao2/ao_dsound.c @ 35469:539bfa51eb72

ao_dsound: Add a hack that avoid cutting of audio, even when the drivers do not report status correctly.
author reimar
date Sun, 02 Dec 2012 21:39:29 +0000
parents ed1000201cd0
children 116dbb38eac0
comparison
equal deleted inserted replaced
35468:047fc4746236 35469:539bfa51eb72
566 { 566 {
567 if(immed)reset(); 567 if(immed)reset();
568 else{ 568 else{
569 DWORD status; 569 DWORD status;
570 IDirectSoundBuffer_Play(hdsbuf, 0, 0, 0); 570 IDirectSoundBuffer_Play(hdsbuf, 0, 0, 0);
571 // This should not be necessary, but a lot of drivers
572 // do not correctly report the status here, causing
573 // audio to be discarded. So we sleep approximately
574 // the right amount of time first.
575 usec_sleep(get_delay() * 1000 * 1000);
571 while(!IDirectSoundBuffer_GetStatus(hdsbuf,&status) && (status&DSBSTATUS_PLAYING)) 576 while(!IDirectSoundBuffer_GetStatus(hdsbuf,&status) && (status&DSBSTATUS_PLAYING))
572 usec_sleep(20000); 577 usec_sleep(20000);
573 } 578 }
574 DestroyBuffer(); 579 DestroyBuffer();
575 UninitDirectSound(); 580 UninitDirectSound();