- }
- else
-#endif
- {
- pbuf = (DWORD *)shm->buffer;
- }
-
- while (lpaintedtime < endtime)
- {
- // handle recirculating buffer issues
- lpos = lpaintedtime & ((shm->samples>>1)-1);
-
- snd_out = (short *) pbuf + (lpos<<1);
-
- snd_linear_count = (shm->samples>>1) - lpos;
- if (lpaintedtime + snd_linear_count > endtime)
- snd_linear_count = endtime - lpaintedtime;
-
- snd_linear_count <<= 1;
-
- // write a linear blast of samples
- Snd_WriteLinearBlastStereo16 ();
-
- snd_p += snd_linear_count;
- lpaintedtime += (snd_linear_count>>1);
- }
-
-#ifdef _WIN32
- if (pDSBuf)
- pDSBuf->lpVtbl->Unlock(pDSBuf, pbuf, dwSize, NULL, 0);
-#endif
-}
-
-void S_TransferPaintBuffer(int endtime)
-{
- int out_idx;
- int count;
- int out_mask;
- int *p;
- int step;
- int val;
- int snd_vol;
- DWORD *pbuf;
-#ifdef _WIN32
- int reps;
- DWORD dwSize,dwSize2;
- DWORD *pbuf2;
- HRESULT hresult;
-#endif
-
- if (shm->samplebits == 16 && shm->channels == 2)
- {
- S_TransferStereo16 (endtime);
- return;
- }
-
- p = (int *) paintbuffer;
- count = (endtime - paintedtime) * shm->channels;
- out_mask = shm->samples - 1;
- out_idx = paintedtime * shm->channels & out_mask;
- step = 3 - shm->channels;
- snd_vol = volume.value*256;
-
-#ifdef _WIN32
- if (pDSBuf)
- {
- reps = 0;
-
- while ((hresult = pDSBuf->lpVtbl->Lock(pDSBuf, 0, gSndBufSize, &pbuf, &dwSize, &pbuf2,&dwSize2, 0)) != DS_OK)