Skip to content

Commit c0c4fdd

Browse files
committed
Added ability to disable DirectSound
1 parent 1aa8c1f commit c0c4fdd

File tree

1 file changed

+19
-14
lines changed

1 file changed

+19
-14
lines changed

MUSHclient.cpp

Lines changed: 19 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -596,21 +596,24 @@ BOOL CMUSHclientApp::InitInstance()
596596
// check direct sound available
597597
FARPROC pDirectSoundCreate = NULL;
598598

599-
HMODULE hDLL = LoadLibrary ("dsound");
600-
if (hDLL)
601-
pDirectSoundCreate = GetProcAddress(hDLL, "DirectSoundCreate");
602-
603-
if (pDirectSoundCreate)
599+
if (strstr (m_lpCmdLine, "/nodirectsound") == NULL)
604600
{
605-
// try to set up for DirectSound
606-
if (FAILED (DirectSoundCreate (NULL, &m_pDirectSoundObject, NULL)))
607-
m_pDirectSoundObject = NULL;
608-
609-
// set sound cooperation level
610-
if (m_pDirectSoundObject)
611-
if (FAILED (m_pDirectSoundObject->SetCooperativeLevel (pMainFrame->m_hWnd, DSSCL_NORMAL)))
612-
m_pDirectSoundObject = NULL; // no DirectSound
613-
}
601+
HMODULE hDLL = LoadLibrary ("dsound");
602+
if (hDLL)
603+
pDirectSoundCreate = GetProcAddress(hDLL, "DirectSoundCreate");
604+
605+
if (pDirectSoundCreate)
606+
{
607+
// try to set up for DirectSound
608+
if (FAILED (DirectSoundCreate (NULL, &m_pDirectSoundObject, NULL)))
609+
m_pDirectSoundObject = NULL;
610+
611+
// set sound cooperation level
612+
if (m_pDirectSoundObject)
613+
if (FAILED (m_pDirectSoundObject->SetCooperativeLevel (pMainFrame->m_hWnd, DSSCL_NORMAL)))
614+
m_pDirectSoundObject = NULL; // no DirectSound
615+
}
616+
} // if DirectSound wanted
614617

615618
if (m_pDirectSoundObject)
616619
{
@@ -687,6 +690,8 @@ BOOL CMUSHclientApp::InitInstance()
687690
{ } // do nothing else, checked further up
688691
else if (strTemp == "/noregister")
689692
{ } // do nothing else, checked further up
693+
else if (strTemp == "/nodirectsound")
694+
{ } // do nothing else, checked further up
690695
else if (strstr (strTemp, ".mcl"))
691696
// open an existing document
692697
OpenDocumentFile(m_lpCmdLine);

0 commit comments

Comments
 (0)