X-Git-Url: http://git.xonotic.org/?a=blobdiff_plain;f=snd_win.c;h=06aed2bbe03dcb4f358b4aa67d50853aa6302bb1;hb=aa2d8a45047185f5501e62b75b7839cc2bff2bb0;hp=1bed6c3d5c5aa1d820bf129de39d9c948536283b;hpb=2df77fd4ec15782a38c4ed2f94c3654bbb6e48cc;p=xonotic%2Fdarkplaces.git diff --git a/snd_win.c b/snd_win.c index 1bed6c3d..06aed2bb 100644 --- a/snd_win.c +++ b/snd_win.c @@ -88,7 +88,9 @@ HRESULT (WINAPI *pDirectSoundCreate)(GUID FAR *lpGUID, LPDIRECTSOUND FAR *lplpDS static unsigned int wav_buffer_size; // DirectSound output: 64KB in 1 buffer -#define SECONDARY_BUFFER_SIZE(fmt_ptr) ((fmt_ptr)->width * (fmt_ptr)->channels * (fmt_ptr)->speed / 2) +//#define SECONDARY_BUFFER_SIZE(fmt_ptr) ((fmt_ptr)->width * (fmt_ptr)->channels * (fmt_ptr)->speed / 2) +// LordHavoc: changed this to be a multiple of 32768 +#define SECONDARY_BUFFER_SIZE(fmt_ptr) ((fmt_ptr)->channels * 32768) typedef enum sndinitstat_e {SIS_SUCCESS, SIS_FAILURE, SIS_NOTAVAIL} sndinitstat; @@ -150,10 +152,14 @@ static qboolean SndSys_BuildWaveFormat (const snd_format_t* requested, WAVEFORMA pfmtex->nBlockAlign = pfmtex->nChannels * pfmtex->wBitsPerSample / 8; pfmtex->nAvgBytesPerSec = pfmtex->nSamplesPerSec * pfmtex->nBlockAlign; + // LordHavoc: disabled this WAVE_FORMAT_EXTENSIBLE support because it does not seem to be working +#if 0 if (requested->channels <= 2) { +#endif pfmtex->wFormatTag = WAVE_FORMAT_PCM; pfmtex->cbSize = 0; +#if 0 } else { @@ -181,6 +187,7 @@ static qboolean SndSys_BuildWaveFormat (const snd_format_t* requested, WAVEFORMA return false; } } +#endif return true; } @@ -319,7 +326,7 @@ static sndinitstat SndSys_InitDirectSound (const snd_format_t* requested) requested->speed != format.Format.nSamplesPerSec) { Con_Printf("DS:CreateSoundBuffer Failed (%d): channels=%u, width=%u, speed=%u\n", - result, format.Format.nChannels, format.Format.wBitsPerSample / 8, format.Format.nSamplesPerSec); + (int)result, (unsigned)format.Format.nChannels, (unsigned)format.Format.wBitsPerSample / 8, (unsigned)format.Format.nSamplesPerSec); SndSys_Shutdown (); return SIS_FAILURE; } @@ -701,10 +708,7 @@ unsigned int SndSys_GetSoundTime (void) unsigned int diff; IDirectSoundBuffer_GetCurrentPosition(pDSBuf, &dwTime, NULL); - if (dwTime > dwStartTime) - diff = dwTime - dwStartTime; - else - diff = gSndBufSize - dwStartTime + dwTime; + diff = (unsigned int)(dwTime - dwStartTime) % (unsigned int)gSndBufSize; dwStartTime = dwTime; dsound_time += diff / factor;