wineoss: Move AUXDM_GETDEVCAPS 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:
parent
b1f550651c
commit
d088c3a119
|
@ -33,9 +33,9 @@
|
|||
#include "winbase.h"
|
||||
#include "mmddk.h"
|
||||
#include "audioclient.h"
|
||||
#include "winternl.h"
|
||||
|
||||
#include "wine/debug.h"
|
||||
#include "wine/unicode.h"
|
||||
#include "wine/unixlib.h"
|
||||
|
||||
#include "unixlib.h"
|
||||
|
@ -46,44 +46,6 @@ WINE_DEFAULT_DEBUG_CHANNEL(mmaux);
|
|||
|
||||
/*-----------------------------------------------------------------------*/
|
||||
|
||||
DWORD WINAPI OSS_auxMessage(UINT wDevID, UINT wMsg, DWORD_PTR dwUser,
|
||||
DWORD_PTR dwParam1, DWORD_PTR dwParam2);
|
||||
|
||||
/**************************************************************************
|
||||
* AUX_GetDevCaps [internal]
|
||||
*/
|
||||
static DWORD AUX_GetDevCaps(WORD wDevID, LPAUXCAPSW lpCaps, DWORD dwSize)
|
||||
{
|
||||
int mixer, volume;
|
||||
static const WCHAR ini[] = {'O','S','S',' ','A','u','x',' ','#','0',0};
|
||||
unsigned int num_aux = OSS_auxMessage(0, AUXDM_GETNUMDEVS, 0, 0, 0);
|
||||
|
||||
TRACE("(%04X, %p, %u);\n", wDevID, lpCaps, dwSize);
|
||||
if (lpCaps == NULL) return MMSYSERR_NOTENABLED;
|
||||
if (wDevID >= num_aux) return MMSYSERR_BADDEVICEID;
|
||||
if ((mixer = open(MIXER_DEV, O_RDWR)) < 0) {
|
||||
WARN("mixer device not available !\n");
|
||||
return MMSYSERR_NOTENABLED;
|
||||
}
|
||||
if (ioctl(mixer, SOUND_MIXER_READ_LINE, &volume) == -1) {
|
||||
close(mixer);
|
||||
WARN("unable to read mixer !\n");
|
||||
return MMSYSERR_NOTENABLED;
|
||||
}
|
||||
close(mixer);
|
||||
lpCaps->wMid = 0xAA;
|
||||
lpCaps->wPid = 0x55 + wDevID;
|
||||
lpCaps->vDriverVersion = 0x0100;
|
||||
strcpyW(lpCaps->szPname, ini);
|
||||
lpCaps->szPname[9] = '0' + wDevID; /* 6 at max */
|
||||
lpCaps->wTechnology = wDevID == 2 ? AUXCAPS_CDAUDIO : AUXCAPS_AUXIN;
|
||||
lpCaps->wReserved1 = 0;
|
||||
lpCaps->dwSupport = AUXCAPS_VOLUME | AUXCAPS_LRVOLUME;
|
||||
|
||||
return MMSYSERR_NOERROR;
|
||||
}
|
||||
|
||||
|
||||
/**************************************************************************
|
||||
* AUX_GetVolume [internal]
|
||||
*/
|
||||
|
@ -212,8 +174,6 @@ DWORD WINAPI OSS_auxMessage(UINT wDevID, UINT wMsg, DWORD_PTR dwUser,
|
|||
wDevID, wMsg, dwUser, dwParam1, dwParam2);
|
||||
|
||||
switch (wMsg) {
|
||||
case AUXDM_GETDEVCAPS:
|
||||
return AUX_GetDevCaps(wDevID, (LPAUXCAPSW)dwParam1, dwParam2);
|
||||
case AUXDM_GETVOLUME:
|
||||
return AUX_GetVolume(wDevID, (LPDWORD)dwParam1);
|
||||
case AUXDM_SETVOLUME:
|
||||
|
|
|
@ -1412,6 +1412,38 @@ static UINT aux_exit(void)
|
|||
return 0;
|
||||
}
|
||||
|
||||
static UINT aux_get_devcaps(WORD dev_id, AUXCAPSW *caps, UINT size)
|
||||
{
|
||||
int mixer, volume;
|
||||
static const WCHAR ini[] = {'O','S','S',' ','A','u','x',' ','#','0',0};
|
||||
|
||||
TRACE("(%04X, %p, %u);\n", dev_id, caps, size);
|
||||
if (caps == NULL) return MMSYSERR_NOTENABLED;
|
||||
if (dev_id >= num_aux) return MMSYSERR_BADDEVICEID;
|
||||
if ((mixer = open(MIXER_DEV, O_RDWR)) < 0)
|
||||
{
|
||||
WARN("mixer device not available !\n");
|
||||
return MMSYSERR_NOTENABLED;
|
||||
}
|
||||
if (ioctl(mixer, SOUND_MIXER_READ_LINE, &volume) == -1)
|
||||
{
|
||||
close(mixer);
|
||||
WARN("unable to read mixer !\n");
|
||||
return MMSYSERR_NOTENABLED;
|
||||
}
|
||||
close(mixer);
|
||||
caps->wMid = 0xAA;
|
||||
caps->wPid = 0x55 + dev_id;
|
||||
caps->vDriverVersion = 0x0100;
|
||||
memcpy(caps->szPname, ini, sizeof(ini));
|
||||
caps->szPname[9] = '0' + dev_id; /* 6 at max */
|
||||
caps->wTechnology = (dev_id == 2) ? AUXCAPS_CDAUDIO : AUXCAPS_AUXIN;
|
||||
caps->wReserved1 = 0;
|
||||
caps->dwSupport = AUXCAPS_VOLUME | AUXCAPS_LRVOLUME;
|
||||
|
||||
return MMSYSERR_NOERROR;
|
||||
}
|
||||
|
||||
static NTSTATUS aux_message(void *args)
|
||||
{
|
||||
struct aux_message_params *params = args;
|
||||
|
@ -1429,6 +1461,9 @@ static NTSTATUS aux_message(void *args)
|
|||
/* FIXME: Pretend this is supported */
|
||||
*params->err = 0;
|
||||
break;
|
||||
case AUXDM_GETDEVCAPS:
|
||||
*params->err = aux_get_devcaps(params->dev_id, (AUXCAPSW *)params->param_1, params->param_2);
|
||||
break;
|
||||
case AUXDM_GETNUMDEVS:
|
||||
TRACE("return %d;\n", num_aux);
|
||||
*params->err = num_aux;
|
||||
|
|
Loading…
Reference in New Issue