wineoss: Move AUXDM_GETNUMDEVS to the unixlib.

Signed-off-by: Huw Davies <huw@codeweavers.com>
Signed-off-by: Andrew Eikum <aeikum@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
This commit is contained in:
Huw Davies 2022-05-03 07:42:29 +01:00 committed by Alexandre Julliard
parent f278194caf
commit b1f550651c
3 changed files with 93 additions and 40 deletions

View File

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

View File

@ -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,
};

View File

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