-Potential fix for the sound hardware issue

This commit is contained in:
cyberwarriorx 2007-01-17 03:19:08 +00:00
parent c9573f973d
commit f43c172cff
1 changed files with 4 additions and 13 deletions

View File

@ -1,4 +1,4 @@
/* Copyright (C) 2005-2006 Theo Berkau
/* Copyright (C) 2005-2007 Theo Berkau
This file is part of DeSmuME
@ -17,9 +17,6 @@
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
#include <dsound.h>
#ifdef __MINGW32__
// I have to do this because for some reason because the dxerr8.h header is fubared
@ -65,7 +62,6 @@ static int issoundmuted;
//////////////////////////////////////////////////////////////////////////////
int SNDDXInit(int buffersize)
{
DSBUFFERDESC dsbdesc;
@ -128,7 +124,8 @@ int SNDDXInit(int buffersize)
if ((ret = IDirectSound8_CreateSoundBuffer(lpDS8, &dsbdesc, &lpDSB2, NULL)) != DS_OK)
{
if (ret == DSERR_CONTROLUNAVAIL ||
ret == DSERR_INVALIDCALL)
ret == DSERR_INVALIDCALL ||
ret == E_FAIL)
{
// Try using a software buffer instead
dsbdesc.dwFlags = DSBCAPS_GLOBALFOCUS | DSBCAPS_STICKYFOCUS |
@ -165,7 +162,6 @@ int SNDDXInit(int buffersize)
//////////////////////////////////////////////////////////////////////////////
void SNDDXDeInit()
{
DWORD status=0;
@ -196,7 +192,6 @@ void SNDDXDeInit()
//////////////////////////////////////////////////////////////////////////////
void SNDDXUpdateAudio(s16 *buffer, u32 num_samples)
{
LPVOID buffer1;
@ -223,7 +218,6 @@ void SNDDXUpdateAudio(s16 *buffer, u32 num_samples)
//////////////////////////////////////////////////////////////////////////////
u32 SNDDXGetAudioSpace()
{
DWORD playcursor, writecursor;
@ -245,7 +239,6 @@ u32 SNDDXGetAudioSpace()
//////////////////////////////////////////////////////////////////////////////
void SNDDXMuteAudio()
{
issoundmuted = 1;
@ -254,7 +247,6 @@ void SNDDXMuteAudio()
//////////////////////////////////////////////////////////////////////////////
void SNDDXUnMuteAudio()
{
issoundmuted = 0;
@ -263,10 +255,9 @@ void SNDDXUnMuteAudio()
//////////////////////////////////////////////////////////////////////////////
void SNDDXSetVolume(int volume)
{
if (!lpDSB2) return ; /* might happen when changing sounddevice on the fly, caused a gpf */
if (!lpDSB2) return ; /* might happen when changing sounddevice on the fly, caused a gpf */
soundvolume = (((LONG)volume) - 100) * 100;
if (!issoundmuted)
IDirectSoundBuffer8_SetVolume (lpDSB2, soundvolume);