Jörg Höhle : winmm: Support MCI_SOUND.
Alexandre Julliard
julliard at winehq.org
Thu Sep 16 14:09:05 CDT 2010
Module: wine
Branch: master
Commit: 8fb1e3eba200d446e65aa46769a3cb0b8523157e
URL: http://source.winehq.org/git/wine.git/?a=commit;h=8fb1e3eba200d446e65aa46769a3cb0b8523157e
Author: Jörg Höhle <hoehle at users.sourceforge.net>
Date: Sun Mar 28 21:54:50 2010 +0200
winmm: Support MCI_SOUND.
---
dlls/mmsystem.dll16/mci16.c | 1 +
dlls/winmm/mci.c | 29 +++++++++++++++++++----------
dlls/winmm/tests/mci.c | 7 ++++---
3 files changed, 24 insertions(+), 13 deletions(-)
diff --git a/dlls/mmsystem.dll16/mci16.c b/dlls/mmsystem.dll16/mci16.c
index 914636d..d9bf7bb 100644
--- a/dlls/mmsystem.dll16/mci16.c
+++ b/dlls/mmsystem.dll16/mci16.c
@@ -87,6 +87,7 @@ static const char* MCI_MessageToString(UINT wMsg)
CASE(MCI_SAVE);
CASE(MCI_SEEK);
CASE(MCI_SET);
+ CASE(MCI_SOUND);
CASE(MCI_SPIN);
CASE(MCI_STATUS);
CASE(MCI_STEP);
diff --git a/dlls/winmm/mci.c b/dlls/winmm/mci.c
index c7e8165..485f436 100644
--- a/dlls/winmm/mci.c
+++ b/dlls/winmm/mci.c
@@ -178,6 +178,7 @@ static const char* MCI_MessageToString(UINT wMsg)
CASE(MCI_SAVE);
CASE(MCI_SEEK);
CASE(MCI_SET);
+ CASE(MCI_SOUND);
CASE(MCI_SPIN);
CASE(MCI_STATUS);
CASE(MCI_STEP);
@@ -1438,6 +1439,12 @@ DWORD WINAPI mciSendStringW(LPCWSTR lpstrCommand, LPWSTR lpstrRet,
}
}
break;
+ case MCI_SOUND:
+ /* FIXME: name is optional, "sound" is a valid command.
+ * FIXME: Parse "sound notify" as flag, not as name. */
+ ((LPMCI_SOUND_PARMSW)data)->lpstrSoundName = dev;
+ dwFlags |= MCI_SOUND_NAME;
+ break;
}
TRACE("[%d, %s, %08x, %08lx %08lx %08lx %08lx %08lx %08lx %08lx %08lx %08lx %08lx]\n",
@@ -1942,16 +1949,18 @@ static DWORD MCI_Break(UINT wDevID, DWORD dwFlags, LPMCI_BREAK_PARMS lpParms)
*/
static DWORD MCI_Sound(UINT wDevID, DWORD dwFlags, LPMCI_SOUND_PARMSW lpParms)
{
- DWORD dwRet = 0;
-
- if (lpParms == NULL) return MCIERR_NULL_PARAMETER_BLOCK;
+ DWORD dwRet;
- if (dwFlags & MCI_SOUND_NAME)
- dwRet = sndPlaySoundW(lpParms->lpstrSoundName, SND_SYNC) ? MMSYSERR_NOERROR : MMSYSERR_ERROR;
- else
- dwRet = MMSYSERR_ERROR; /* what should be done ??? */
+ if (dwFlags & MCI_SOUND_NAME) {
+ if (lpParms == NULL) return MCIERR_NULL_PARAMETER_BLOCK;
+ else dwRet = PlaySoundW(lpParms->lpstrSoundName, NULL,
+ SND_ALIAS | (dwFlags & MCI_WAIT ? SND_SYNC : SND_ASYNC))
+ ? 0 : MCIERR_HARDWARE;
+ } else dwRet = PlaySoundW((LPCWSTR)SND_ALIAS_SYSTEMDEFAULT, NULL,
+ SND_ALIAS_ID | (dwFlags & MCI_WAIT ? SND_SYNC : SND_ASYNC))
+ ? 0 : MCIERR_HARDWARE;
- if (MMSYSERR_NOERROR==dwRet && (dwFlags & MCI_NOTIFY))
+ if (!dwRet && lpParms && (dwFlags & MCI_NOTIFY))
mciDriverNotify((HWND)lpParms->dwCallback, wDevID, MCI_NOTIFY_SUCCESSFUL);
return dwRet;
}
diff --git a/dlls/winmm/tests/mci.c b/dlls/winmm/tests/mci.c
index f47d4f6..1803c0c 100644
--- a/dlls/winmm/tests/mci.c
+++ b/dlls/winmm/tests/mci.c
@@ -1057,12 +1057,13 @@ static void test_AutoOpenWAVE(HWND hwnd)
ok(!err,"mci sysinfo waveaudio quantity open returned %s\n", dbg_mcierr(err));
if(!err) ok(!strcmp(buf,"0"), "sysinfo quantity open expected 0, got: %s, some more tests will fail.\n", buf);
- /* Who knows why some machines pass all tests but return MCIERR_HARDWARE here? */
+ /* Who knows why some MS machines pass all tests but return MCIERR_HARDWARE here? */
+ /* Wine returns MCIERR_HARDWARE when no default sound is found in win.ini or the registry. */
err = mciSendString("sound NoSuchSoundDefined wait", NULL, 0, NULL);
- todo_wine ok(err==ok_snd || broken(err==MCIERR_HARDWARE),"mci sound NoSuchSoundDefined returned %s\n", dbg_mcierr(err));
+ ok(err==ok_snd || err==MCIERR_HARDWARE, "mci sound NoSuchSoundDefined returned %s\n", dbg_mcierr(err));
err = mciSendString("sound SystemExclamation notify wait", NULL, 0, hwnd);
- todo_wine ok(err==ok_snd || broken(err==MCIERR_HARDWARE),"mci sound SystemExclamation returned %s\n", dbg_mcierr(err));
+ ok(err==ok_snd || err==MCIERR_HARDWARE, "mci sound SystemExclamation returned %s\n", dbg_mcierr(err));
test_notification(hwnd, "sound notify", err ? 0 : MCI_NOTIFY_SUCCESSFUL);
Sleep(16); /* time to auto-close makes sysinfo below return expected error */
More information about the wine-cvs
mailing list