Eric Pouech : winmm: Added support for SND_ALIAS_ID in winmm.PlaySound[AW].

Alexandre Julliard julliard at winehq.org
Mon Mar 30 12:08:41 CDT 2009


Module: wine
Branch: master
Commit: 2dbc7d5c41e03d0456feb83c731a51754e13a812
URL:    http://source.winehq.org/git/wine.git/?a=commit;h=2dbc7d5c41e03d0456feb83c731a51754e13a812

Author: Eric Pouech <eric.pouech at orange.fr>
Date:   Sun Mar 29 17:22:43 2009 +0200

winmm: Added support for SND_ALIAS_ID in winmm.PlaySound[AW].

---

 dlls/winmm/playsound.c |   40 +++++++++++++++++++++++++++++++++-------
 include/mmsystem.h     |   13 +++++++++++++
 2 files changed, 46 insertions(+), 7 deletions(-)

diff --git a/dlls/winmm/playsound.c b/dlls/winmm/playsound.c
index a4d21ce..143f4a9 100644
--- a/dlls/winmm/playsound.c
+++ b/dlls/winmm/playsound.c
@@ -193,11 +193,12 @@ static BOOL PlaySound_IsString(DWORD fdwSound, const void* psz)
     /* SND_RESOURCE is 0x40004 while
      * SND_MEMORY is 0x00004
      */
-    switch (fdwSound & (SND_RESOURCE|SND_ALIAS|SND_FILENAME))
+    switch (fdwSound & (SND_RESOURCE|SND_ALIAS_ID|SND_FILENAME))
     {
     case SND_RESOURCE:  return HIWORD(psz) != 0; /* by name or by ID ? */
+    case SND_ALIAS_ID:
     case SND_MEMORY:    return FALSE;
-    case SND_ALIAS:     /* what about ALIAS_ID ??? */
+    case SND_ALIAS:
     case SND_FILENAME:
     case 0:             return TRUE;
     default:            FIXME("WTF\n"); return FALSE;
@@ -309,6 +310,36 @@ static DWORD WINAPI proc_PlaySound(LPVOID arg)
     }
     else if (wps->fdwSound & SND_ALIAS)
     {
+        if (wps->fdwSound & SND_ALIAS_ID)
+        {
+            static const WCHAR  wszSystemAsterisk[] = {'S','y','s','t','e','m','A','s','t','e','r','i','s','k',0};
+            static const WCHAR  wszSystemDefault[] = {'S','y','s','t','e','m','D','e','f','a','u','l','t',0};
+            static const WCHAR  wszSystemExclamation[] = {'S','y','s','t','e','m','E','x','c','l','a','m','a','t','i','o','n',0};
+            static const WCHAR  wszSystemExit[] = {'S','y','s','t','e','m','E','x','i','t',0};
+            static const WCHAR  wszSystemHand[] = {'S','y','s','t','e','m','H','a','n','d',0};
+            static const WCHAR  wszSystemQuestion[] = {'S','y','s','t','e','m','Q','u','e','s','t','i','o','n',0};
+            static const WCHAR  wszSystemStart[] = {'S','y','s','t','e','m','S','t','a','r','t',0};
+            static const WCHAR  wszSystemWelcome[] = {'S','y','s','t','e','m','W','e','l','c','o','m','e',0};
+
+            wps->fdwSound &= ~(SND_ALIAS_ID ^ SND_ALIAS);
+            if (wps->pszSound == (LPCWSTR)SND_ALIAS_SYSTEMASTERISK)
+                wps->pszSound = wszSystemAsterisk;
+            else if (wps->pszSound == (LPCWSTR)SND_ALIAS_SYSTEMDEFAULT)
+                wps->pszSound = wszSystemDefault;
+            else if (wps->pszSound == (LPCWSTR)SND_ALIAS_SYSTEMEXCLAMATION)
+                wps->pszSound = wszSystemExclamation;
+            else if (wps->pszSound == (LPCWSTR)SND_ALIAS_SYSTEMEXIT)
+                wps->pszSound = wszSystemExit;
+            else if (wps->pszSound == (LPCWSTR)SND_ALIAS_SYSTEMHAND)
+                wps->pszSound = wszSystemHand;
+            else if (wps->pszSound == (LPCWSTR)SND_ALIAS_SYSTEMQUESTION)
+                wps->pszSound = wszSystemQuestion;
+            else if (wps->pszSound == (LPCWSTR)SND_ALIAS_SYSTEMSTART)
+                wps->pszSound = wszSystemStart;
+            else if (wps->pszSound == (LPCWSTR)SND_ALIAS_SYSTEMWELCOME)
+                wps->pszSound = wszSystemWelcome;
+            else return FALSE;
+        }
         hmmio = get_mmioFromProfile(wps->fdwSound, wps->pszSound);
     }
     else if (wps->fdwSound & SND_FILENAME)
@@ -446,11 +477,6 @@ static BOOL MULTIMEDIA_PlaySound(const void* pszSound, HMODULE hmod, DWORD fdwSo
     if ((fdwSound & (SND_NOWAIT | SND_NOSTOP)) && PlaySoundList != NULL)
 	return FALSE;
 
-    if ((fdwSound & SND_ALIAS_ID) == SND_ALIAS_ID) {
-        FIXME("SND_ALIAS_ID not supported\n");
-        return FALSE;
-    }
-
     /* alloc internal structure, if we need to play something */
     if (pszSound && !(fdwSound & SND_PURGE))
     {
diff --git a/include/mmsystem.h b/include/mmsystem.h
index abed551..39f70a1 100644
--- a/include/mmsystem.h
+++ b/include/mmsystem.h
@@ -285,6 +285,19 @@ BOOL 		WINAPI 	PlaySoundW(LPCWSTR pszSound, HMODULE hmod, DWORD fdwSound);
 #define SND_PURGE		0x00000040L /* purge all sounds */
 #define SND_APPLICATION     	0x00000080L /* look for application specific association */
 
+#define SND_ALIAS_START         0
+
+#define sndAlias(ch0, ch1)              (SND_ALIAS_START + ((DWORD)(BYTE)(ch0) | ((DWORD)(BYTE)(ch1) << 8)))
+
+#define SND_ALIAS_SYSTEMASTERISK        sndAlias('S', '*')
+#define SND_ALIAS_SYSTEMQUESTION        sndAlias('S', '?')
+#define SND_ALIAS_SYSTEMHAND            sndAlias('S', 'H')
+#define SND_ALIAS_SYSTEMEXIT            sndAlias('S', 'E')
+#define SND_ALIAS_SYSTEMSTART           sndAlias('S', 'S')
+#define SND_ALIAS_SYSTEMWELCOME         sndAlias('S', 'W')
+#define SND_ALIAS_SYSTEMEXCLAMATION     sndAlias('S', '!')
+#define SND_ALIAS_SYSTEMDEFAULT         sndAlias('S', 'D')
+
 /* waveform audio error return values */
 #define WAVERR_BADFORMAT      (WAVERR_BASE + 0)    /* unsupported wave format */
 #define WAVERR_STILLPLAYING   (WAVERR_BASE + 1)    /* still something playing */




More information about the wine-cvs mailing list