Commit 8fb1e3eb authored by Jörg Höhle's avatar Jörg Höhle Committed by Alexandre Julliard

winmm: Support MCI_SOUND.

parent 95a9bc04
......@@ -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);
......
......@@ -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;
}
......
......@@ -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 */
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment