Huw Davies : wineoss: Move AUXDM_GETNUMDEVS to the unixlib.

Alexandre Julliard julliard at winehq.org
Tue May 3 15:39:23 CDT 2022


Module: wine
Branch: master
Commit: b1f550651ca9ef171f26ef7f7d720b86de2d874a
URL:    https://source.winehq.org/git/wine.git/?a=commit;h=b1f550651ca9ef171f26ef7f7d720b86de2d874a

Author: Huw Davies <huw at codeweavers.com>
Date:   Tue May  3 07:42:29 2022 +0100

wineoss: Move AUXDM_GETNUMDEVS to the unixlib.

Signed-off-by: Huw Davies <huw at codeweavers.com>
Signed-off-by: Andrew Eikum <aeikum at codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard at winehq.org>

---

 dlls/wineoss.drv/mmaux.c   | 59 ++++++++++++++-----------------------------
 dlls/wineoss.drv/oss.c     | 63 ++++++++++++++++++++++++++++++++++++++++++++++
 dlls/wineoss.drv/unixlib.h | 11 ++++++++
 3 files changed, 93 insertions(+), 40 deletions(-)

diff --git a/dlls/wineoss.drv/mmaux.c b/dlls/wineoss.drv/mmaux.c
index 02ef912bd34..9fb1eeb7cd7 100644
--- a/dlls/wineoss.drv/mmaux.c
+++ b/dlls/wineoss.drv/mmaux.c
@@ -32,40 +32,20 @@
 #include "windef.h"
 #include "winbase.h"
 #include "mmddk.h"
-#include "wine/unicode.h"
+#include "audioclient.h"
+
 #include "wine/debug.h"
+#include "wine/unicode.h"
+#include "wine/unixlib.h"
+
+#include "unixlib.h"
 
 WINE_DEFAULT_DEBUG_CHANNEL(mmaux);
 
 #define MIXER_DEV "/dev/mixer"
 
-static int	NumDev = 6;
-
-/*-----------------------------------------------------------------------*/
-
-static LRESULT OSS_AuxInit(void)
-{
-    int	mixer;
-    TRACE("()\n");
-
-    if ((mixer = open(MIXER_DEV, O_RDWR)) < 0) {
-	WARN("mixer device not available !\n");
-	NumDev = 0;
-    } else {
-	close(mixer);
-	NumDev = 6;
-    }
-    return 0;
-}
-
 /*-----------------------------------------------------------------------*/
 
-static LRESULT OSS_AuxExit(void)
-{
-    TRACE("()\n");
-    return 0;
-}
-
 DWORD WINAPI OSS_auxMessage(UINT wDevID, UINT wMsg, DWORD_PTR dwUser,
 			    DWORD_PTR dwParam1, DWORD_PTR dwParam2);
 
@@ -225,29 +205,28 @@ static DWORD AUX_SetVolume(WORD wDevID, DWORD dwParam)
 DWORD WINAPI OSS_auxMessage(UINT wDevID, UINT wMsg, DWORD_PTR dwUser,
 			    DWORD_PTR dwParam1, DWORD_PTR dwParam2)
 {
+    struct aux_message_params params;
+    UINT err;
+
     TRACE("(%04X, %04X, %08lX, %08lX, %08lX);\n",
 	  wDevID, wMsg, dwUser, dwParam1, dwParam2);
 
     switch (wMsg) {
-    case DRVM_INIT:
-        return OSS_AuxInit();
-    case DRVM_EXIT:
-        return OSS_AuxExit();
-    case DRVM_ENABLE:
-    case DRVM_DISABLE:
-	/* FIXME: Pretend this is supported */
-	return 0;
     case AUXDM_GETDEVCAPS:
 	return AUX_GetDevCaps(wDevID, (LPAUXCAPSW)dwParam1, dwParam2);
-    case AUXDM_GETNUMDEVS:
-	TRACE("return %d;\n", NumDev);
-	return NumDev;
     case AUXDM_GETVOLUME:
 	return AUX_GetVolume(wDevID, (LPDWORD)dwParam1);
     case AUXDM_SETVOLUME:
 	return AUX_SetVolume(wDevID, dwParam1);
-    default:
-	WARN("unknown message !\n");
     }
-    return MMSYSERR_NOTSUPPORTED;
+
+    params.dev_id = wDevID;
+    params.msg = wMsg;
+    params.user = dwUser;
+    params.param_1 = dwParam1;
+    params.param_2 = dwParam2;
+    params.err = &err;
+    OSS_CALL(aux_message, &params);
+
+    return err;
 }
diff --git a/dlls/wineoss.drv/oss.c b/dlls/wineoss.drv/oss.c
index a5aea9ee724..d469bbebb4e 100644
--- a/dlls/wineoss.drv/oss.c
+++ b/dlls/wineoss.drv/oss.c
@@ -38,6 +38,7 @@
 #include "winternl.h"
 #include "initguid.h"
 #include "audioclient.h"
+#include "mmddk.h"
 
 #include "wine/debug.h"
 #include "wine/unixlib.h"
@@ -1380,6 +1381,67 @@ static NTSTATUS is_started(void *args)
     return oss_unlock_result(stream, &params->result, stream->playing ? S_OK : S_FALSE);
 }
 
+/* Aux driver */
+
+static unsigned int num_aux;
+
+#define MIXER_DEV "/dev/mixer"
+
+static UINT aux_init(void)
+{
+    int mixer;
+
+    TRACE("()\n");
+
+    if ((mixer = open(MIXER_DEV, O_RDWR)) < 0)
+    {
+        WARN("mixer device not available !\n");
+        num_aux = 0;
+    }
+    else
+    {
+        close(mixer);
+        num_aux = 6;
+    }
+    return 0;
+}
+
+static UINT aux_exit(void)
+{
+    TRACE("()\n");
+    return 0;
+}
+
+static NTSTATUS aux_message(void *args)
+{
+    struct aux_message_params *params = args;
+
+    switch (params->msg)
+    {
+    case DRVM_INIT:
+        *params->err = aux_init();
+        break;
+    case DRVM_EXIT:
+        *params->err = aux_exit();
+        break;
+    case DRVM_ENABLE:
+    case DRVM_DISABLE:
+        /* FIXME: Pretend this is supported */
+        *params->err = 0;
+        break;
+    case AUXDM_GETNUMDEVS:
+        TRACE("return %d;\n", num_aux);
+        *params->err = num_aux;
+        break;
+    default:
+        WARN("unknown message !\n");
+        *params->err = MMSYSERR_NOTSUPPORTED;
+        break;
+    }
+
+    return STATUS_SUCCESS;
+}
+
 unixlib_entry_t __wine_unix_call_funcs[] =
 {
     test_connect,
@@ -1409,4 +1471,5 @@ unixlib_entry_t __wine_unix_call_funcs[] =
     midi_out_message,
     midi_in_message,
     midi_notify_wait,
+    aux_message,
 };
diff --git a/dlls/wineoss.drv/unixlib.h b/dlls/wineoss.drv/unixlib.h
index 6a7dc9288d9..25e9a7007b3 100644
--- a/dlls/wineoss.drv/unixlib.h
+++ b/dlls/wineoss.drv/unixlib.h
@@ -250,6 +250,16 @@ struct midi_notify_wait_params
     struct notify_context *notify;
 };
 
+struct aux_message_params
+{
+    UINT dev_id;
+    UINT msg;
+    UINT_PTR user;
+    UINT_PTR param_1;
+    UINT_PTR param_2;
+    UINT *err;
+};
+
 enum oss_funcs
 {
     oss_test_connect,
@@ -279,6 +289,7 @@ enum oss_funcs
     oss_midi_out_message,
     oss_midi_in_message,
     oss_midi_notify_wait,
+    oss_aux_message,
 };
 
 NTSTATUS midi_release(void *args) DECLSPEC_HIDDEN;




More information about the wine-cvs mailing list