snd_win.c 15 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728
  1. /*
  2. Copyright (C) 1996-1997 Id Software, Inc.
  3. This program is free software; you can redistribute it and/or
  4. modify it under the terms of the GNU General Public License
  5. as published by the Free Software Foundation; either version 2
  6. of the License, or (at your option) any later version.
  7. This program is distributed in the hope that it will be useful,
  8. but WITHOUT ANY WARRANTY; without even the implied warranty of
  9. MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
  10. See the GNU General Public License for more details.
  11. You should have received a copy of the GNU General Public License
  12. along with this program; if not, write to the Free Software
  13. Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
  14. */
  15. #include "quakedef.h"
  16. #include "winquake.h"
  17. #define iDirectSoundCreate(a,b,c) pDirectSoundCreate(a,b,c)
  18. HRESULT (WINAPI *pDirectSoundCreate)(GUID FAR *lpGUID, LPDIRECTSOUND FAR *lplpDS, IUnknown FAR *pUnkOuter);
  19. // 64K is > 1 second at 16-bit, 22050 Hz
  20. #define WAV_BUFFERS 64
  21. #define WAV_MASK 0x3F
  22. #define WAV_BUFFER_SIZE 0x0400
  23. #define SECONDARY_BUFFER_SIZE 0x10000
  24. typedef enum {SIS_SUCCESS, SIS_FAILURE, SIS_NOTAVAIL} sndinitstat;
  25. static qboolean wavonly;
  26. static qboolean dsound_init;
  27. static qboolean wav_init;
  28. static qboolean snd_firsttime = true, snd_isdirect, snd_iswave;
  29. static qboolean primary_format_set;
  30. static int sample16;
  31. static int snd_sent, snd_completed;
  32. /*
  33. * Global variables. Must be visible to window-procedure function
  34. * so it can unlock and free the data block after it has been played.
  35. */
  36. HANDLE hData;
  37. HPSTR lpData, lpData2;
  38. HGLOBAL hWaveHdr;
  39. LPWAVEHDR lpWaveHdr;
  40. HWAVEOUT hWaveOut;
  41. WAVEOUTCAPS wavecaps;
  42. DWORD gSndBufSize;
  43. MMTIME mmstarttime;
  44. LPDIRECTSOUND pDS;
  45. LPDIRECTSOUNDBUFFER pDSBuf, pDSPBuf;
  46. HINSTANCE hInstDS;
  47. qboolean SNDDMA_InitDirect (void);
  48. qboolean SNDDMA_InitWav (void);
  49. /*
  50. ==================
  51. S_BlockSound
  52. ==================
  53. */
  54. void S_BlockSound (void)
  55. {
  56. // DirectSound takes care of blocking itself
  57. if (snd_iswave)
  58. {
  59. snd_blocked++;
  60. if (snd_blocked == 1)
  61. waveOutReset (hWaveOut);
  62. }
  63. }
  64. /*
  65. ==================
  66. S_UnblockSound
  67. ==================
  68. */
  69. void S_UnblockSound (void)
  70. {
  71. // DirectSound takes care of blocking itself
  72. if (snd_iswave)
  73. {
  74. snd_blocked--;
  75. }
  76. }
  77. /*
  78. ==================
  79. FreeSound
  80. ==================
  81. */
  82. void FreeSound (void)
  83. {
  84. int i;
  85. if (pDSBuf)
  86. {
  87. pDSBuf->lpVtbl->Stop(pDSBuf);
  88. pDSBuf->lpVtbl->Release(pDSBuf);
  89. }
  90. // only release primary buffer if it's not also the mixing buffer we just released
  91. if (pDSPBuf && (pDSBuf != pDSPBuf))
  92. {
  93. pDSPBuf->lpVtbl->Release(pDSPBuf);
  94. }
  95. if (pDS)
  96. {
  97. pDS->lpVtbl->SetCooperativeLevel (pDS, mainwindow, DSSCL_NORMAL);
  98. pDS->lpVtbl->Release(pDS);
  99. }
  100. if (hWaveOut)
  101. {
  102. waveOutReset (hWaveOut);
  103. if (lpWaveHdr)
  104. {
  105. for (i=0 ; i< WAV_BUFFERS ; i++)
  106. waveOutUnprepareHeader (hWaveOut, lpWaveHdr+i, sizeof(WAVEHDR));
  107. }
  108. waveOutClose (hWaveOut);
  109. if (hWaveHdr)
  110. {
  111. GlobalUnlock(hWaveHdr);
  112. GlobalFree(hWaveHdr);
  113. }
  114. if (hData)
  115. {
  116. GlobalUnlock(hData);
  117. GlobalFree(hData);
  118. }
  119. }
  120. pDS = NULL;
  121. pDSBuf = NULL;
  122. pDSPBuf = NULL;
  123. hWaveOut = 0;
  124. hData = 0;
  125. hWaveHdr = 0;
  126. lpData = NULL;
  127. lpWaveHdr = NULL;
  128. dsound_init = false;
  129. wav_init = false;
  130. }
  131. /*
  132. ==================
  133. SNDDMA_InitDirect
  134. Direct-Sound support
  135. ==================
  136. */
  137. sndinitstat SNDDMA_InitDirect (void)
  138. {
  139. DSBUFFERDESC dsbuf;
  140. DSBCAPS dsbcaps;
  141. DWORD dwSize, dwWrite;
  142. DSCAPS dscaps;
  143. WAVEFORMATEX format, pformat;
  144. HRESULT hresult;
  145. int reps;
  146. memset ((void *)&sn, 0, sizeof (sn));
  147. shm = &sn;
  148. shm->channels = 2;
  149. shm->samplebits = 16;
  150. shm->speed = 11025;
  151. memset (&format, 0, sizeof(format));
  152. format.wFormatTag = WAVE_FORMAT_PCM;
  153. format.nChannels = shm->channels;
  154. format.wBitsPerSample = shm->samplebits;
  155. format.nSamplesPerSec = shm->speed;
  156. format.nBlockAlign = format.nChannels
  157. *format.wBitsPerSample / 8;
  158. format.cbSize = 0;
  159. format.nAvgBytesPerSec = format.nSamplesPerSec
  160. *format.nBlockAlign;
  161. if (!hInstDS)
  162. {
  163. hInstDS = LoadLibrary("dsound.dll");
  164. if (hInstDS == NULL)
  165. {
  166. Con_SafePrintf ("Couldn't load dsound.dll\n");
  167. return SIS_FAILURE;
  168. }
  169. pDirectSoundCreate = (void *)GetProcAddress(hInstDS,"DirectSoundCreate");
  170. if (!pDirectSoundCreate)
  171. {
  172. Con_SafePrintf ("Couldn't get DS proc addr\n");
  173. return SIS_FAILURE;
  174. }
  175. }
  176. while ((hresult = iDirectSoundCreate(NULL, &pDS, NULL)) != DS_OK)
  177. {
  178. if (hresult != DSERR_ALLOCATED)
  179. {
  180. Con_SafePrintf ("DirectSound create failed\n");
  181. return SIS_FAILURE;
  182. }
  183. if (MessageBox (NULL,
  184. "The sound hardware is in use by another app.\n\n"
  185. "Select Retry to try to start sound again or Cancel to run Quake with no sound.",
  186. "Sound not available",
  187. MB_RETRYCANCEL | MB_SETFOREGROUND | MB_ICONEXCLAMATION) != IDRETRY)
  188. {
  189. Con_SafePrintf ("DirectSoundCreate failure\n"
  190. " hardware already in use\n");
  191. return SIS_NOTAVAIL;
  192. }
  193. }
  194. dscaps.dwSize = sizeof(dscaps);
  195. if (DS_OK != pDS->lpVtbl->GetCaps (pDS, &dscaps))
  196. {
  197. Con_SafePrintf ("Couldn't get DS caps\n");
  198. }
  199. if (dscaps.dwFlags & DSCAPS_EMULDRIVER)
  200. {
  201. Con_SafePrintf ("No DirectSound driver installed\n");
  202. FreeSound ();
  203. return SIS_FAILURE;
  204. }
  205. if (DS_OK != pDS->lpVtbl->SetCooperativeLevel (pDS, mainwindow, DSSCL_EXCLUSIVE))
  206. {
  207. Con_SafePrintf ("Set coop level failed\n");
  208. FreeSound ();
  209. return SIS_FAILURE;
  210. }
  211. // get access to the primary buffer, if possible, so we can set the
  212. // sound hardware format
  213. memset (&dsbuf, 0, sizeof(dsbuf));
  214. dsbuf.dwSize = sizeof(DSBUFFERDESC);
  215. dsbuf.dwFlags = DSBCAPS_PRIMARYBUFFER;
  216. dsbuf.dwBufferBytes = 0;
  217. dsbuf.lpwfxFormat = NULL;
  218. memset(&dsbcaps, 0, sizeof(dsbcaps));
  219. dsbcaps.dwSize = sizeof(dsbcaps);
  220. primary_format_set = false;
  221. if (!COM_CheckParm ("-snoforceformat"))
  222. {
  223. if (DS_OK == pDS->lpVtbl->CreateSoundBuffer(pDS, &dsbuf, &pDSPBuf, NULL))
  224. {
  225. pformat = format;
  226. if (DS_OK != pDSPBuf->lpVtbl->SetFormat (pDSPBuf, &pformat))
  227. {
  228. // if (snd_firsttime)
  229. // Con_SafePrintf ("Set primary sound buffer format: no\n");
  230. }
  231. else
  232. // {
  233. // if (snd_firsttime)
  234. // Con_SafePrintf ("Set primary sound buffer format: yes\n");
  235. primary_format_set = true;
  236. // }
  237. }
  238. }
  239. if (!primary_format_set || !COM_CheckParm ("-primarysound"))
  240. {
  241. // create the secondary buffer we'll actually work with
  242. memset (&dsbuf, 0, sizeof(dsbuf));
  243. dsbuf.dwSize = sizeof(DSBUFFERDESC);
  244. dsbuf.dwFlags = DSBCAPS_CTRLFREQUENCY | DSBCAPS_LOCSOFTWARE;
  245. dsbuf.dwBufferBytes = SECONDARY_BUFFER_SIZE;
  246. dsbuf.lpwfxFormat = &format;
  247. memset(&dsbcaps, 0, sizeof(dsbcaps));
  248. dsbcaps.dwSize = sizeof(dsbcaps);
  249. if (DS_OK != pDS->lpVtbl->CreateSoundBuffer(pDS, &dsbuf, &pDSBuf, NULL))
  250. {
  251. Con_SafePrintf ("DS:CreateSoundBuffer Failed");
  252. FreeSound ();
  253. return SIS_FAILURE;
  254. }
  255. shm->channels = format.nChannels;
  256. shm->samplebits = format.wBitsPerSample;
  257. shm->speed = format.nSamplesPerSec;
  258. if (DS_OK != pDSBuf->lpVtbl->GetCaps (pDSBuf, &dsbcaps))
  259. {
  260. Con_SafePrintf ("DS:GetCaps failed\n");
  261. FreeSound ();
  262. return SIS_FAILURE;
  263. }
  264. // if (snd_firsttime)
  265. // Con_SafePrintf ("Using secondary sound buffer\n");
  266. }
  267. else
  268. {
  269. if (DS_OK != pDS->lpVtbl->SetCooperativeLevel (pDS, mainwindow, DSSCL_WRITEPRIMARY))
  270. {
  271. Con_SafePrintf ("Set coop level failed\n");
  272. FreeSound ();
  273. return SIS_FAILURE;
  274. }
  275. if (DS_OK != pDSPBuf->lpVtbl->GetCaps (pDSPBuf, &dsbcaps))
  276. {
  277. Con_Printf ("DS:GetCaps failed\n");
  278. return SIS_FAILURE;
  279. }
  280. pDSBuf = pDSPBuf;
  281. // Con_SafePrintf ("Using primary sound buffer\n");
  282. }
  283. // Make sure mixer is active
  284. pDSBuf->lpVtbl->Play(pDSBuf, 0, 0, DSBPLAY_LOOPING);
  285. /* if (snd_firsttime)
  286. Con_SafePrintf(" %d channel(s)\n"
  287. " %d bits/sample\n"
  288. " %d bytes/sec\n",
  289. shm->channels, shm->samplebits, shm->speed);*/
  290. gSndBufSize = dsbcaps.dwBufferBytes;
  291. // initialize the buffer
  292. reps = 0;
  293. while ((hresult = pDSBuf->lpVtbl->Lock(pDSBuf, 0, gSndBufSize, &lpData, &dwSize, NULL, NULL, 0)) != DS_OK)
  294. {
  295. if (hresult != DSERR_BUFFERLOST)
  296. {
  297. Con_SafePrintf ("SNDDMA_InitDirect: DS::Lock Sound Buffer Failed\n");
  298. FreeSound ();
  299. return SIS_FAILURE;
  300. }
  301. if (++reps > 10000)
  302. {
  303. Con_SafePrintf ("SNDDMA_InitDirect: DS: couldn't restore buffer\n");
  304. FreeSound ();
  305. return SIS_FAILURE;
  306. }
  307. }
  308. memset(lpData, 0, dwSize);
  309. // lpData[4] = lpData[5] = 0x7f; // force a pop for debugging
  310. pDSBuf->lpVtbl->Unlock(pDSBuf, lpData, dwSize, NULL, 0);
  311. /* we don't want anyone to access the buffer directly w/o locking it first. */
  312. lpData = NULL;
  313. pDSBuf->lpVtbl->Stop(pDSBuf);
  314. pDSBuf->lpVtbl->GetCurrentPosition(pDSBuf, &mmstarttime.u.sample, &dwWrite);
  315. pDSBuf->lpVtbl->Play(pDSBuf, 0, 0, DSBPLAY_LOOPING);
  316. shm->soundalive = true;
  317. shm->splitbuffer = false;
  318. shm->samples = gSndBufSize/(shm->samplebits/8);
  319. shm->samplepos = 0;
  320. shm->submission_chunk = 1;
  321. shm->buffer = (unsigned char *) lpData;
  322. sample16 = (shm->samplebits/8) - 1;
  323. dsound_init = true;
  324. return SIS_SUCCESS;
  325. }
  326. /*
  327. ==================
  328. SNDDM_InitWav
  329. Crappy windows multimedia base
  330. ==================
  331. */
  332. qboolean SNDDMA_InitWav (void)
  333. {
  334. WAVEFORMATEX format;
  335. int i;
  336. HRESULT hr;
  337. snd_sent = 0;
  338. snd_completed = 0;
  339. shm = &sn;
  340. shm->channels = 2;
  341. shm->samplebits = 16;
  342. shm->speed = 11025;
  343. memset (&format, 0, sizeof(format));
  344. format.wFormatTag = WAVE_FORMAT_PCM;
  345. format.nChannels = shm->channels;
  346. format.wBitsPerSample = shm->samplebits;
  347. format.nSamplesPerSec = shm->speed;
  348. format.nBlockAlign = format.nChannels
  349. *format.wBitsPerSample / 8;
  350. format.cbSize = 0;
  351. format.nAvgBytesPerSec = format.nSamplesPerSec
  352. *format.nBlockAlign;
  353. /* Open a waveform device for output using window callback. */
  354. while ((hr = waveOutOpen((LPHWAVEOUT)&hWaveOut, WAVE_MAPPER,
  355. &format,
  356. 0, 0L, CALLBACK_NULL)) != MMSYSERR_NOERROR)
  357. {
  358. if (hr != MMSYSERR_ALLOCATED)
  359. {
  360. Con_SafePrintf ("waveOutOpen failed\n");
  361. return false;
  362. }
  363. if (MessageBox (NULL,
  364. "The sound hardware is in use by another app.\n\n"
  365. "Select Retry to try to start sound again or Cancel to run Quake with no sound.",
  366. "Sound not available",
  367. MB_RETRYCANCEL | MB_SETFOREGROUND | MB_ICONEXCLAMATION) != IDRETRY)
  368. {
  369. Con_SafePrintf ("waveOutOpen failure;\n"
  370. " hardware already in use\n");
  371. return false;
  372. }
  373. }
  374. /*
  375. * Allocate and lock memory for the waveform data. The memory
  376. * for waveform data must be globally allocated with
  377. * GMEM_MOVEABLE and GMEM_SHARE flags.
  378. */
  379. gSndBufSize = WAV_BUFFERS*WAV_BUFFER_SIZE;
  380. hData = GlobalAlloc(GMEM_MOVEABLE | GMEM_SHARE, gSndBufSize);
  381. if (!hData)
  382. {
  383. Con_SafePrintf ("Sound: Out of memory.\n");
  384. FreeSound ();
  385. return false;
  386. }
  387. lpData = GlobalLock(hData);
  388. if (!lpData)
  389. {
  390. Con_SafePrintf ("Sound: Failed to lock.\n");
  391. FreeSound ();
  392. return false;
  393. }
  394. memset (lpData, 0, gSndBufSize);
  395. /*
  396. * Allocate and lock memory for the header. This memory must
  397. * also be globally allocated with GMEM_MOVEABLE and
  398. * GMEM_SHARE flags.
  399. */
  400. hWaveHdr = GlobalAlloc(GMEM_MOVEABLE | GMEM_SHARE,
  401. (DWORD) sizeof(WAVEHDR) * WAV_BUFFERS);
  402. if (hWaveHdr == NULL)
  403. {
  404. Con_SafePrintf ("Sound: Failed to Alloc header.\n");
  405. FreeSound ();
  406. return false;
  407. }
  408. lpWaveHdr = (LPWAVEHDR) GlobalLock(hWaveHdr);
  409. if (lpWaveHdr == NULL)
  410. {
  411. Con_SafePrintf ("Sound: Failed to lock header.\n");
  412. FreeSound ();
  413. return false;
  414. }
  415. memset (lpWaveHdr, 0, sizeof(WAVEHDR) * WAV_BUFFERS);
  416. /* After allocation, set up and prepare headers. */
  417. for (i=0 ; i<WAV_BUFFERS ; i++)
  418. {
  419. lpWaveHdr[i].dwBufferLength = WAV_BUFFER_SIZE;
  420. lpWaveHdr[i].lpData = lpData + i*WAV_BUFFER_SIZE;
  421. if (waveOutPrepareHeader(hWaveOut, lpWaveHdr+i, sizeof(WAVEHDR)) !=
  422. MMSYSERR_NOERROR)
  423. {
  424. Con_SafePrintf ("Sound: failed to prepare wave headers\n");
  425. FreeSound ();
  426. return false;
  427. }
  428. }
  429. shm->soundalive = true;
  430. shm->splitbuffer = false;
  431. shm->samples = gSndBufSize/(shm->samplebits/8);
  432. shm->samplepos = 0;
  433. shm->submission_chunk = 1;
  434. shm->buffer = (unsigned char *) lpData;
  435. sample16 = (shm->samplebits/8) - 1;
  436. wav_init = true;
  437. return true;
  438. }
  439. /*
  440. ==================
  441. SNDDMA_Init
  442. Try to find a sound device to mix for.
  443. Returns false if nothing is found.
  444. ==================
  445. */
  446. int SNDDMA_Init(void)
  447. {
  448. sndinitstat stat;
  449. if (COM_CheckParm ("-wavonly"))
  450. wavonly = true;
  451. dsound_init = wav_init = 0;
  452. stat = SIS_FAILURE; // assume DirectSound won't initialize
  453. /* Init DirectSound */
  454. if (!wavonly)
  455. {
  456. if (snd_firsttime || snd_isdirect)
  457. {
  458. stat = SNDDMA_InitDirect ();;
  459. if (stat == SIS_SUCCESS)
  460. {
  461. snd_isdirect = true;
  462. if (snd_firsttime)
  463. Con_SafePrintf ("DirectSound initialized\n");
  464. }
  465. else
  466. {
  467. snd_isdirect = false;
  468. Con_SafePrintf ("DirectSound failed to init\n");
  469. }
  470. }
  471. }
  472. // if DirectSound didn't succeed in initializing, try to initialize
  473. // waveOut sound, unless DirectSound failed because the hardware is
  474. // already allocated (in which case the user has already chosen not
  475. // to have sound)
  476. if (!dsound_init && (stat != SIS_NOTAVAIL))
  477. {
  478. if (snd_firsttime || snd_iswave)
  479. {
  480. snd_iswave = SNDDMA_InitWav ();
  481. if (snd_iswave)
  482. {
  483. if (snd_firsttime)
  484. Con_SafePrintf ("Wave sound initialized\n");
  485. }
  486. else
  487. {
  488. Con_SafePrintf ("Wave sound failed to init\n");
  489. }
  490. }
  491. }
  492. snd_firsttime = false;
  493. if (!dsound_init && !wav_init)
  494. {
  495. if (snd_firsttime)
  496. Con_SafePrintf ("No sound device initialized\n");
  497. return 0;
  498. }
  499. return 1;
  500. }
  501. /*
  502. ==============
  503. SNDDMA_GetDMAPos
  504. return the current sample position (in mono samples read)
  505. inside the recirculating dma buffer, so the mixing code will know
  506. how many sample are required to fill it up.
  507. ===============
  508. */
  509. int SNDDMA_GetDMAPos(void)
  510. {
  511. MMTIME mmtime;
  512. int s;
  513. DWORD dwWrite;
  514. if (dsound_init)
  515. {
  516. mmtime.wType = TIME_SAMPLES;
  517. pDSBuf->lpVtbl->GetCurrentPosition(pDSBuf, &mmtime.u.sample, &dwWrite);
  518. s = mmtime.u.sample - mmstarttime.u.sample;
  519. }
  520. else if (wav_init)
  521. {
  522. s = snd_sent * WAV_BUFFER_SIZE;
  523. }
  524. s >>= sample16;
  525. s &= (shm->samples-1);
  526. return s;
  527. }
  528. /*
  529. ==============
  530. SNDDMA_Submit
  531. Send sound to device if buffer isn't really the dma buffer
  532. ===============
  533. */
  534. void SNDDMA_Submit(void)
  535. {
  536. LPWAVEHDR h;
  537. int wResult;
  538. if (!wav_init)
  539. return;
  540. //
  541. // find which sound blocks have completed
  542. //
  543. while (1)
  544. {
  545. if ( snd_completed == snd_sent )
  546. {
  547. Con_DPrintf ("Sound overrun\n");
  548. break;
  549. }
  550. if ( ! (lpWaveHdr[ snd_completed & WAV_MASK].dwFlags & WHDR_DONE) )
  551. {
  552. break;
  553. }
  554. snd_completed++; // this buffer has been played
  555. }
  556. //
  557. // submit two new sound blocks
  558. //
  559. while (((snd_sent - snd_completed) >> sample16) < 4)
  560. {
  561. h = lpWaveHdr + ( snd_sent&WAV_MASK );
  562. snd_sent++;
  563. /*
  564. * Now the data block can be sent to the output device. The
  565. * waveOutWrite function returns immediately and waveform
  566. * data is sent to the output device in the background.
  567. */
  568. wResult = waveOutWrite(hWaveOut, h, sizeof(WAVEHDR));
  569. if (wResult != MMSYSERR_NOERROR)
  570. {
  571. Con_SafePrintf ("Failed to write block to device\n");
  572. FreeSound ();
  573. return;
  574. }
  575. }
  576. }
  577. /*
  578. ==============
  579. SNDDMA_Shutdown
  580. Reset the sound device for exiting
  581. ===============
  582. */
  583. void SNDDMA_Shutdown(void)
  584. {
  585. FreeSound ();
  586. }