Added support for getting the wave device name.
This commit is contained in:
parent
f1598b9792
commit
be4281522d
|
@ -494,6 +494,21 @@ UINT MMDRV_PhysicalFeatures(LPWINE_MLD mld, UINT uMsg, DWORD dwParam1,
|
|||
case DRV_QUERYMAPPABLE:
|
||||
return (lpDrv->bIsMapper) ? 2 : 0;
|
||||
|
||||
case DRVM_MAPPER_PREFERRED_GET:
|
||||
/* FIXME: get from registry someday */
|
||||
if (bFrom32) {
|
||||
*((LPDWORD)dwParam1) = -1; /* No preferred device */
|
||||
break;
|
||||
}
|
||||
return MMSYSERR_INVALPARAM;
|
||||
|
||||
case DRV_QUERYDEVICEINTERFACE:
|
||||
case DRV_QUERYDEVICEINTERFACESIZE:
|
||||
if (bFrom32)
|
||||
return MMDRV_Message(mld, uMsg, dwParam1, dwParam2, TRUE);
|
||||
|
||||
return MMSYSERR_INVALPARAM;
|
||||
|
||||
case DRV_QUERYDSOUNDIFACE: /* Wine-specific: Retrieve DirectSound interface */
|
||||
case DRV_QUERYDSOUNDDESC: /* Wine-specific: Retrieve DirectSound driver description*/
|
||||
case DRV_QUERYDSOUNDGUID: /* Wine-specific: Retrieve DirectSound driver GUID */
|
||||
|
|
|
@ -26,7 +26,9 @@
|
|||
#include "wine/test.h"
|
||||
#include "windef.h"
|
||||
#include "winbase.h"
|
||||
#include "winnls.h"
|
||||
#include "mmsystem.h"
|
||||
#include "mmddk.h"
|
||||
|
||||
/*
|
||||
* Note that in most of this test we may get MMSYSERR_BADDEVICEID errors
|
||||
|
@ -254,6 +256,9 @@ static void wave_out_tests()
|
|||
HWAVEOUT wout;
|
||||
MMRESULT rc;
|
||||
UINT ndev,d,f;
|
||||
WCHAR * wname;
|
||||
CHAR * name=NULL;
|
||||
DWORD size;
|
||||
|
||||
ndev=waveOutGetNumDevs();
|
||||
trace("found %d WaveOut devices\n",ndev);
|
||||
|
@ -280,8 +285,20 @@ static void wave_out_tests()
|
|||
if (rc==MMSYSERR_BADDEVICEID)
|
||||
continue;
|
||||
|
||||
trace(" %d: \"%s\" %d.%d (%d:%d): channels=%d formats=%05lx support=%04lx\n",
|
||||
d,caps.szPname,caps.vDriverVersion >> 8,
|
||||
rc=waveOutMessage((HWAVEOUT)d, DRV_QUERYDEVICEINTERFACESIZE, (DWORD_PTR)&size, 0);
|
||||
ok(rc==MMSYSERR_NOERROR, "waveOutMessage: failed to get interface size for device: %d rc=%d\n",d,rc);
|
||||
if (rc==MMSYSERR_NOERROR) {
|
||||
wname = (WCHAR *)malloc(size);
|
||||
rc=waveOutMessage((HWAVEOUT)d, DRV_QUERYDEVICEINTERFACE, (DWORD_PTR)wname, size);
|
||||
ok(rc==MMSYSERR_NOERROR,"waveOutMessage: failed to get interface name for device:: %d rc=%d\n",d,rc);
|
||||
if (rc==MMSYSERR_NOERROR) {
|
||||
name = malloc(size/sizeof(WCHAR));
|
||||
WideCharToMultiByte(CP_ACP, 0, wname, size/sizeof(WCHAR), name, size/sizeof(WCHAR), NULL, NULL);
|
||||
}
|
||||
}
|
||||
|
||||
trace(" %d: \"%s\" (%s) %d.%d (%d:%d): channels=%d formats=%05lx support=%04lx\n",
|
||||
d,caps.szPname,name,caps.vDriverVersion >> 8,
|
||||
caps.vDriverVersion & 0xff,
|
||||
caps.wMid,caps.wPid,
|
||||
caps.wChannels,caps.dwFormats,caps.dwSupport);
|
||||
|
@ -425,6 +442,9 @@ static void wave_in_tests()
|
|||
HWAVEIN win;
|
||||
MMRESULT rc;
|
||||
UINT ndev,d,f;
|
||||
WCHAR * wname;
|
||||
CHAR * name=NULL;
|
||||
DWORD size;
|
||||
|
||||
ndev=waveInGetNumDevs();
|
||||
trace("found %d WaveIn devices\n",ndev);
|
||||
|
@ -451,8 +471,20 @@ static void wave_in_tests()
|
|||
if (rc==MMSYSERR_BADDEVICEID)
|
||||
continue;
|
||||
|
||||
trace(" %d: \"%s\" %d.%d (%d:%d): channels=%d formats=%05lx\n",
|
||||
d,caps.szPname,caps.vDriverVersion >> 8,
|
||||
rc=waveInMessage((HWAVEIN)d, DRV_QUERYDEVICEINTERFACESIZE, (DWORD_PTR)&size, 0);
|
||||
ok(rc==MMSYSERR_NOERROR, "waveInMessage: failed to get interface size for device: %d rc=%d\n",d,rc);
|
||||
if (rc==MMSYSERR_NOERROR) {
|
||||
wname = (WCHAR *)malloc(size);
|
||||
rc=waveInMessage((HWAVEIN)d, DRV_QUERYDEVICEINTERFACE, (DWORD_PTR)wname, size);
|
||||
ok(rc==MMSYSERR_NOERROR,"waveInMessage: failed to get interface name for device:: %d rc=%d\n",d,rc);
|
||||
if (rc==MMSYSERR_NOERROR) {
|
||||
name = malloc(size/sizeof(WCHAR));
|
||||
WideCharToMultiByte(CP_ACP, 0, wname, size/sizeof(WCHAR), name, size/sizeof(WCHAR), NULL, NULL);
|
||||
}
|
||||
}
|
||||
|
||||
trace(" %d: \"%s\" (%s) %d.%d (%d:%d): channels=%d formats=%05lx\n",
|
||||
d,caps.szPname,name,caps.vDriverVersion >> 8,
|
||||
caps.vDriverVersion & 0xff,
|
||||
caps.wMid,caps.wPid,
|
||||
caps.wChannels,caps.dwFormats);
|
||||
|
|
|
@ -45,6 +45,7 @@
|
|||
#include "wingdi.h"
|
||||
#include "winerror.h"
|
||||
#include "winuser.h"
|
||||
#include "winnls.h"
|
||||
#include "mmddk.h"
|
||||
#include "dsound.h"
|
||||
#include "dsdriver.h"
|
||||
|
@ -55,8 +56,6 @@
|
|||
WINE_DEFAULT_DEBUG_CHANNEL(wave);
|
||||
|
||||
|
||||
#define FAKE_CHARPTR(s) ((char *)(unsigned long)(s))
|
||||
|
||||
#if defined(HAVE_ALSA) && ((SND_LIB_MAJOR == 0 && SND_LIB_MINOR >= 9) || SND_LIB_MAJOR >= 1)
|
||||
|
||||
/* internal ALSALIB functions */
|
||||
|
@ -124,7 +123,7 @@ typedef struct {
|
|||
WAVEOUTCAPSA caps;
|
||||
|
||||
/* ALSA information (ALSA 0.9/1.x uses two different devices for playback/capture) */
|
||||
char * device;
|
||||
char device[32];
|
||||
snd_pcm_t* p_handle; /* handle to ALSA playback device */
|
||||
snd_pcm_t* c_handle; /* handle to ALSA capture device */
|
||||
snd_pcm_hw_params_t * hw_params; /* ALSA Hw params */
|
||||
|
@ -414,7 +413,7 @@ LONG ALSA_WaveInit(void)
|
|||
wwo = &WOutDev[0];
|
||||
|
||||
/* FIXME: use better values */
|
||||
wwo->device = FAKE_CHARPTR("hw");
|
||||
strcpy(wwo->device, "hw");
|
||||
wwo->caps.wMid = 0x0002;
|
||||
wwo->caps.wPid = 0x0104;
|
||||
strcpy(wwo->caps.szPname, "SB16 Wave Out");
|
||||
|
@ -1595,6 +1594,32 @@ static DWORD wodGetNumDevs(void)
|
|||
return ALSA_WodNumDevs;
|
||||
}
|
||||
|
||||
/**************************************************************************
|
||||
* wodDevInterfaceSize [internal]
|
||||
*/
|
||||
static DWORD wodDevInterfaceSize(UINT wDevID, LPDWORD dwParam1)
|
||||
{
|
||||
TRACE("(%u, %p)\n", wDevID, dwParam1);
|
||||
|
||||
*dwParam1 = MultiByteToWideChar(CP_ACP, 0, WOutDev[wDevID].device, -1,
|
||||
NULL, 0 ) * sizeof(WCHAR);
|
||||
return MMSYSERR_NOERROR;
|
||||
}
|
||||
|
||||
/**************************************************************************
|
||||
* wodDevInterface [internal]
|
||||
*/
|
||||
static DWORD wodDevInterface(UINT wDevID, PWCHAR dwParam1, DWORD dwParam2)
|
||||
{
|
||||
if (dwParam2 >= MultiByteToWideChar(CP_ACP, 0, WOutDev[wDevID].device, -1,
|
||||
NULL, 0 ) * sizeof(WCHAR))
|
||||
{
|
||||
MultiByteToWideChar(CP_ACP, 0, WOutDev[wDevID].device, -1,
|
||||
dwParam1, dwParam2 / sizeof(WCHAR));
|
||||
return MMSYSERR_NOERROR;
|
||||
}
|
||||
return MMSYSERR_INVALPARAM;
|
||||
}
|
||||
|
||||
/**************************************************************************
|
||||
* wodMessage (WINEALSA.@)
|
||||
|
@ -1630,6 +1655,8 @@ DWORD WINAPI ALSA_wodMessage(UINT wDevID, UINT wMsg, DWORD dwUser,
|
|||
case WODM_SETVOLUME: return wodSetVolume (wDevID, dwParam1);
|
||||
case WODM_RESTART: return wodRestart (wDevID);
|
||||
case WODM_RESET: return wodReset (wDevID);
|
||||
case DRV_QUERYDEVICEINTERFACESIZE: return wodDevInterfaceSize (wDevID, (LPDWORD)dwParam1);
|
||||
case DRV_QUERYDEVICEINTERFACE: return wodDevInterface (wDevID, (PWCHAR)dwParam1, dwParam2);
|
||||
case DRV_QUERYDSOUNDIFACE: return wodDsCreate (wDevID, (PIDSDRIVER*)dwParam1);
|
||||
case DRV_QUERYDSOUNDDESC: return wodDsDesc (wDevID, (PDSDRIVERDESC)dwParam1);
|
||||
case DRV_QUERYDSOUNDGUID: return wodDsGuid (wDevID, (LPGUID)dwParam1);
|
||||
|
|
|
@ -257,6 +257,28 @@ static int getEnables(OSS_DEVICE *ossdev)
|
|||
(ossdev->bInputEnabled ? PCM_ENABLE_INPUT : 0) );
|
||||
}
|
||||
|
||||
static DWORD wdDevInterfaceSize(UINT wDevID, LPDWORD dwParam1)
|
||||
{
|
||||
TRACE("(%u, %p)\n", wDevID, dwParam1);
|
||||
|
||||
*dwParam1 = MultiByteToWideChar(CP_ACP, 0, OSS_Devices[wDevID].dev_name, -1,
|
||||
NULL, 0 ) * sizeof(WCHAR);
|
||||
return MMSYSERR_NOERROR;
|
||||
}
|
||||
|
||||
static DWORD wdDevInterface(UINT wDevID, PWCHAR dwParam1, DWORD dwParam2)
|
||||
{
|
||||
if (dwParam2 >= MultiByteToWideChar(CP_ACP, 0, OSS_Devices[wDevID].dev_name, -1,
|
||||
NULL, 0 ) * sizeof(WCHAR))
|
||||
{
|
||||
MultiByteToWideChar(CP_ACP, 0, OSS_Devices[wDevID].dev_name, -1,
|
||||
dwParam1, dwParam2 / sizeof(WCHAR));
|
||||
return MMSYSERR_NOERROR;
|
||||
}
|
||||
|
||||
return MMSYSERR_INVALPARAM;
|
||||
}
|
||||
|
||||
/*======================================================================*
|
||||
* Low level WAVE implementation *
|
||||
*======================================================================*/
|
||||
|
@ -1947,6 +1969,8 @@ DWORD WINAPI OSS_wodMessage(UINT wDevID, UINT wMsg, DWORD dwUser,
|
|||
case WODM_RESTART: return wodRestart (wDevID);
|
||||
case WODM_RESET: return wodReset (wDevID);
|
||||
|
||||
case DRV_QUERYDEVICEINTERFACESIZE: return wdDevInterfaceSize (wDevID, (LPDWORD)dwParam1);
|
||||
case DRV_QUERYDEVICEINTERFACE: return wdDevInterface (wDevID, (PWCHAR)dwParam1, dwParam2);
|
||||
case DRV_QUERYDSOUNDIFACE: return wodDsCreate (wDevID, (PIDSDRIVER*)dwParam1);
|
||||
case DRV_QUERYDSOUNDDESC: return wodDsDesc (wDevID, (PDSDRIVERDESC)dwParam1);
|
||||
case DRV_QUERYDSOUNDGUID: return wodDsGuid (wDevID, (LPGUID)dwParam1);
|
||||
|
@ -3143,6 +3167,8 @@ DWORD WINAPI OSS_widMessage(WORD wDevID, WORD wMsg, DWORD dwUser,
|
|||
case WIDM_RESET: return widReset (wDevID);
|
||||
case WIDM_START: return widStart (wDevID);
|
||||
case WIDM_STOP: return widStop (wDevID);
|
||||
case DRV_QUERYDEVICEINTERFACESIZE: return wdDevInterfaceSize (wDevID, (LPDWORD)dwParam1);
|
||||
case DRV_QUERYDEVICEINTERFACE: return wdDevInterface (wDevID, (PWCHAR)dwParam1, dwParam2);
|
||||
case DRV_QUERYDSOUNDIFACE: return widDsCreate (wDevID, (PIDSCDRIVER*)dwParam1);
|
||||
case DRV_QUERYDSOUNDDESC: return widDsDesc (wDevID, (PDSDRIVERDESC)dwParam1);
|
||||
case DRV_QUERYDSOUNDGUID: return widDsGuid (wDevID, (LPGUID)dwParam1);
|
||||
|
|
Loading…
Reference in New Issue