summaryrefslogtreecommitdiff
path: root/apps/plugins/sdl/progs/quake/snd_dma.c
diff options
context:
space:
mode:
Diffstat (limited to 'apps/plugins/sdl/progs/quake/snd_dma.c')
-rw-r--r--apps/plugins/sdl/progs/quake/snd_dma.c72
1 files changed, 1 insertions, 71 deletions
diff --git a/apps/plugins/sdl/progs/quake/snd_dma.c b/apps/plugins/sdl/progs/quake/snd_dma.c
index 4c42f32d49..3789381552 100644
--- a/apps/plugins/sdl/progs/quake/snd_dma.c
+++ b/apps/plugins/sdl/progs/quake/snd_dma.c
@@ -21,10 +21,6 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
21 21
22#include "quakedef.h" 22#include "quakedef.h"
23 23
24#ifdef _WIN32
25#include "winquake.h"
26#endif
27
28void S_Play(void); 24void S_Play(void);
29void S_PlayVol(void); 25void S_PlayVol(void);
30void S_SoundList(void); 26void S_SoundList(void);
@@ -148,9 +144,7 @@ void S_Startup (void)
148 144
149 if (!rc) 145 if (!rc)
150 { 146 {
151#ifndef _WIN32
152 Con_Printf("S_Startup: SNDDMA_Init failed.\n"); 147 Con_Printf("S_Startup: SNDDMA_Init failed.\n");
153#endif
154 sound_started = 0; 148 sound_started = 0;
155 return; 149 return;
156 } 150 }
@@ -561,11 +555,7 @@ void S_ClearBuffer (void)
561{ 555{
562 int clear; 556 int clear;
563 557
564#ifdef _WIN32
565 if (!sound_started || !shm || (!shm->buffer && !pDSBuf))
566#else
567 if (!sound_started || !shm || !shm->buffer) 558 if (!sound_started || !shm || !shm->buffer)
568#endif
569 return; 559 return;
570 560
571 if (shm->samplebits == 8) 561 if (shm->samplebits == 8)
@@ -573,43 +563,7 @@ void S_ClearBuffer (void)
573 else 563 else
574 clear = 0; 564 clear = 0;
575 565
576#ifdef _WIN32 566 Q_memset(shm->buffer, clear, shm->samples * shm->samplebits/8);
577 if (pDSBuf)
578 {
579 DWORD dwSize;
580 DWORD *pData;
581 int reps;
582 HRESULT hresult;
583
584 reps = 0;
585
586 while ((hresult = pDSBuf->lpVtbl->Lock(pDSBuf, 0, gSndBufSize, &pData, &dwSize, NULL, NULL, 0)) != DS_OK)
587 {
588 if (hresult != DSERR_BUFFERLOST)
589 {
590 Con_Printf ("S_ClearBuffer: DS::Lock Sound Buffer Failed\n");
591 S_Shutdown ();
592 return;
593 }
594
595 if (++reps > 10000)
596 {
597 Con_Printf ("S_ClearBuffer: DS: couldn't restore buffer\n");
598 S_Shutdown ();
599 return;
600 }
601 }
602
603 Q_memset(pData, clear, shm->samples * shm->samplebits/8);
604
605 pDSBuf->lpVtbl->Unlock(pDSBuf, pData, dwSize, NULL, 0);
606
607 }
608 else
609#endif
610 {
611 Q_memset(shm->buffer, clear, shm->samples * shm->samplebits/8);
612 }
613} 567}
614 568
615 569
@@ -844,11 +798,6 @@ void GetSoundtime(void)
844 798
845void S_ExtraUpdate (void) 799void S_ExtraUpdate (void)
846{ 800{
847
848#ifdef _WIN32
849 IN_Accumulate ();
850#endif
851
852 if (snd_noextraupdate.value) 801 if (snd_noextraupdate.value)
853 return; // don't pollute timings 802 return; // don't pollute timings
854 S_Update_(); 803 S_Update_();
@@ -880,25 +829,6 @@ void S_Update_(void)
880 if (endtime - soundtime > samps) 829 if (endtime - soundtime > samps)
881 endtime = soundtime + samps; 830 endtime = soundtime + samps;
882 831
883#ifdef _WIN32
884// if the buffer was lost or stopped, restore it and/or restart it
885 {
886 DWORD dwStatus;
887
888 if (pDSBuf)
889 {
890 if (pDSBuf->lpVtbl->GetStatus (pDSBuf, &dwStatus) != DD_OK)
891 Con_Printf ("Couldn't get sound buffer status\n");
892
893 if (dwStatus & DSBSTATUS_BUFFERLOST)
894 pDSBuf->lpVtbl->Restore (pDSBuf);
895
896 if (!(dwStatus & DSBSTATUS_PLAYING))
897 pDSBuf->lpVtbl->Play(pDSBuf, 0, 0, DSBPLAY_LOOPING);
898 }
899 }
900#endif
901
902 S_PaintChannels (endtime); 832 S_PaintChannels (endtime);
903 833
904 SNDDMA_Submit (); 834 SNDDMA_Submit ();