winmm: Support MCI_SOUND.

oldstable
Jörg Höhle 2010-03-28 21:54:50 +02:00 committed by Alexandre Julliard
parent 95a9bc043e
commit 8fb1e3eba2
3 changed files with 22 additions and 11 deletions

View File

@ -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);

View File

@ -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;
DWORD dwRet;
if (lpParms == NULL) return MCIERR_NULL_PARAMETER_BLOCK;
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 (dwFlags & MCI_SOUND_NAME)
dwRet = sndPlaySoundW(lpParms->lpstrSoundName, SND_SYNC) ? MMSYSERR_NOERROR : MMSYSERR_ERROR;
else
dwRet = MMSYSERR_ERROR; /* what should be done ??? */
if (MMSYSERR_NOERROR==dwRet && (dwFlags & MCI_NOTIFY))
if (!dwRet && lpParms && (dwFlags & MCI_NOTIFY))
mciDriverNotify((HWND)lpParms->dwCallback, wDevID, MCI_NOTIFY_SUCCESSFUL);
return dwRet;
}

View File

@ -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 */