aboutsummaryrefslogtreecommitdiffstats
path: root/Alc
diff options
context:
space:
mode:
authorChris Robinson <[email protected]>2008-02-12 19:24:08 -0800
committerChris Robinson <[email protected]>2008-02-12 19:24:08 -0800
commitfbc869eed7cee13c12c1bfef47749b9f60e492d4 (patch)
treed4c40f5a08ba6eaa3f212ca89dc5c799dcfbff34 /Alc
parente3e4dbbccfc352ec124f9b4e96083ed4db264ac8 (diff)
Pretend DSound buffer fragment size is 1/4th the total buffer size
Diffstat (limited to 'Alc')
-rw-r--r--Alc/dsound.c9
1 files changed, 7 insertions, 2 deletions
diff --git a/Alc/dsound.c b/Alc/dsound.c
index 5313b039..98c50e83 100644
--- a/Alc/dsound.c
+++ b/Alc/dsound.c
@@ -40,6 +40,9 @@
DEFINE_GUID(KSDATAFORMAT_SUBTYPE_PCM, 0x00000001, 0x0000, 0x0010, 0x80, 0x00, 0x00, 0xaa, 0x00, 0x38, 0x9b, 0x71);
+// Since DSound doesn't report the fragment size, just assume 4 fragments
+#define DS_FRAGS 4
+
typedef struct {
// DirectSound Playback Device
LPDIRECTSOUND lpDS;
@@ -70,7 +73,7 @@ static ALuint DSoundProc(ALvoid *ptr)
DWORD avail;
HRESULT err;
- BufferSize = pDevice->UpdateFreq*pDevice->FrameSize;
+ BufferSize = pDevice->UpdateFreq*DS_FRAGS*pDevice->FrameSize;
while(!pData->killNow)
{
@@ -234,6 +237,8 @@ static ALCboolean DSoundOpenPlayback(ALCdevice *device, const ALCchar *deviceNam
OutputType.Format.nSamplesPerSec = device->Frequency;
OutputType.Format.nAvgBytesPerSec = OutputType.Format.nSamplesPerSec*OutputType.Format.nBlockAlign;
OutputType.Format.cbSize = 0;
+
+ device->UpdateFreq /= DS_FRAGS;
}
if(OutputType.Format.nChannels > 2)
@@ -261,7 +266,7 @@ static ALCboolean DSoundOpenPlayback(ALCdevice *device, const ALCchar *deviceNam
memset(&DSBDescription,0,sizeof(DSBUFFERDESC));
DSBDescription.dwSize=sizeof(DSBUFFERDESC);
DSBDescription.dwFlags=DSBCAPS_GLOBALFOCUS|DSBCAPS_GETCURRENTPOSITION2;
- DSBDescription.dwBufferBytes=device->UpdateFreq * device->FrameSize;
+ DSBDescription.dwBufferBytes=device->UpdateFreq * DS_FRAGS * device->FrameSize;
DSBDescription.lpwfxFormat=&OutputType.Format;
hr = IDirectSound_CreateSoundBuffer(pData->lpDS, &DSBDescription, &pData->DSsbuffer, NULL);
}