Commit b4e49557 authored by Alexandre Julliard's avatar Alexandre Julliard

Authors: Eric Pouech <pouech-eric@wanadoo.fr>, Filip Navara <xnavara@volny.cz>

32 bit low level drivers now use a Unicode interface (used to be ANSI): - Send the *_GETDEVCAPS messages in unicode format from the *GetDevCapsW function and call the *GetDevCapsW from their respective Ansi versions. - Modify all low level drivers to correctly process the *_GETDEVCAPS messages as unicode. - *_GETDEVCAPS messages are now mapped from/to unicode for 16 bit code. - Removed all SoundBlaster naming oldies. Better use of some unicode functions (instead of Ansi) in winmm.
parent 294835a8
......@@ -137,9 +137,9 @@ UINT WINAPI joyGetNumDevs(void)
}
/**************************************************************************
* joyGetDevCapsA [WINMM.@]
* joyGetDevCapsW [WINMM.@]
*/
MMRESULT WINAPI joyGetDevCapsA(UINT_PTR wID, LPJOYCAPSA lpCaps, UINT wSize)
MMRESULT WINAPI joyGetDevCapsW(UINT_PTR wID, LPJOYCAPSW lpCaps, UINT wSize)
{
if (wID >= MAXJOYSTICK) return JOYERR_PARMS;
if (!JOY_LoadDriver(wID)) return MMSYSERR_NODRIVER;
......@@ -151,43 +151,49 @@ MMRESULT WINAPI joyGetDevCapsA(UINT_PTR wID, LPJOYCAPSA lpCaps, UINT wSize)
}
/**************************************************************************
* joyGetDevCapsW [WINMM.@]
* joyGetDevCapsA [WINMM.@]
*/
MMRESULT WINAPI joyGetDevCapsW(UINT_PTR wID, LPJOYCAPSW lpCaps, UINT wSize)
MMRESULT WINAPI joyGetDevCapsA(UINT_PTR wID, LPJOYCAPSA lpCaps, UINT wSize)
{
JOYCAPSA jca;
MMRESULT ret = joyGetDevCapsA(wID, &jca, sizeof(jca));
if (ret != JOYERR_NOERROR) return ret;
lpCaps->wMid = jca.wMid;
lpCaps->wPid = jca.wPid;
MultiByteToWideChar( CP_ACP, 0, jca.szPname, -1, lpCaps->szPname,
sizeof(lpCaps->szPname)/sizeof(WCHAR) );
lpCaps->wXmin = jca.wXmin;
lpCaps->wXmax = jca.wXmax;
lpCaps->wYmin = jca.wYmin;
lpCaps->wYmax = jca.wYmax;
lpCaps->wZmin = jca.wZmin;
lpCaps->wZmax = jca.wZmax;
lpCaps->wNumButtons = jca.wNumButtons;
lpCaps->wPeriodMin = jca.wPeriodMin;
lpCaps->wPeriodMax = jca.wPeriodMax;
if (wSize >= sizeof(JOYCAPSW)) { /* Win95 extensions ? */
lpCaps->wRmin = jca.wRmin;
lpCaps->wRmax = jca.wRmax;
lpCaps->wUmin = jca.wUmin;
lpCaps->wUmax = jca.wUmax;
lpCaps->wVmin = jca.wVmin;
lpCaps->wVmax = jca.wVmax;
lpCaps->wCaps = jca.wCaps;
lpCaps->wMaxAxes = jca.wMaxAxes;
lpCaps->wNumAxes = jca.wNumAxes;
lpCaps->wMaxButtons = jca.wMaxButtons;
MultiByteToWideChar( CP_ACP, 0, jca.szRegKey, -1, lpCaps->szRegKey,
sizeof(lpCaps->szRegKey)/sizeof(WCHAR) );
MultiByteToWideChar( CP_ACP, 0, jca.szOEMVxD, -1, lpCaps->szOEMVxD,
sizeof(lpCaps->szOEMVxD)/sizeof(WCHAR) );
JOYCAPSW jcw;
MMRESULT ret;
if (lpCaps == NULL) return MMSYSERR_INVALPARAM;
ret = joyGetDevCapsW(wID, &jcw, sizeof(jcw));
if (ret == JOYERR_NOERROR)
{
lpCaps->wMid = jcw.wMid;
lpCaps->wPid = jcw.wPid;
WideCharToMultiByte( CP_ACP, 0, jcw.szPname, -1, lpCaps->szPname,
sizeof(lpCaps->szPname), NULL, NULL );
lpCaps->wXmin = jcw.wXmin;
lpCaps->wXmax = jcw.wXmax;
lpCaps->wYmin = jcw.wYmin;
lpCaps->wYmax = jcw.wYmax;
lpCaps->wZmin = jcw.wZmin;
lpCaps->wZmax = jcw.wZmax;
lpCaps->wNumButtons = jcw.wNumButtons;
lpCaps->wPeriodMin = jcw.wPeriodMin;
lpCaps->wPeriodMax = jcw.wPeriodMax;
if (wSize >= sizeof(JOYCAPSA)) { /* Win95 extensions ? */
lpCaps->wRmin = jcw.wRmin;
lpCaps->wRmax = jcw.wRmax;
lpCaps->wUmin = jcw.wUmin;
lpCaps->wUmax = jcw.wUmax;
lpCaps->wVmin = jcw.wVmin;
lpCaps->wVmax = jcw.wVmax;
lpCaps->wCaps = jcw.wCaps;
lpCaps->wMaxAxes = jcw.wMaxAxes;
lpCaps->wNumAxes = jcw.wNumAxes;
lpCaps->wMaxButtons = jcw.wMaxButtons;
WideCharToMultiByte( CP_ACP, 0, jcw.szRegKey, -1, lpCaps->szRegKey,
sizeof(lpCaps->szRegKey), NULL, NULL );
WideCharToMultiByte( CP_ACP, 0, jcw.szOEMVxD, -1, lpCaps->szOEMVxD,
sizeof(lpCaps->szOEMVxD), NULL, NULL );
}
}
return ret;
......
......@@ -3,7 +3,7 @@ TOPOBJDIR = ../../..
SRCDIR = @srcdir@
VPATH = @srcdir@
MODULE = joystick.drv
IMPORTS = winmm user32
IMPORTS = winmm user32 kernel32
C_SRCS = \
joystick.c
......
/* -*- tab-width: 8; c-basic-offset: 4 -*- */
/*
* joystick functions
*
......@@ -22,14 +21,18 @@
*
* NOTES:
*
* nearly all joystick functions can be regarded as obsolete,
* as Linux (2.1.x) now supports extended joysticks
* with a completely new joystick driver interface
* new driver's docu says:
* "For backward compatibility the old interface is still included,
* but will be dropped in the future."
* Thus we should implement the new interface and at most keep the old
* routines for backward compatibility.
* - nearly all joystick functions can be regarded as obsolete,
* as Linux (2.1.x) now supports extended joysticks with a completely
* new joystick driver interface
* New driver's docu says:
* "For backward compatibility the old interface is still included,
* but will be dropped in the future."
* Thus we should implement the new interface and at most keep the old
* routines for backward compatibility.
* - better support of enhanced joysticks (Linux 2.2 interface is available)
* - support more joystick drivers (like the XInput extension)
* - should load joystick DLL as any other driver (instead of hardcoding)
* the driver's name, and load it as any low lever driver.
*/
#include "config.h"
......@@ -60,6 +63,7 @@
#include "winbase.h"
#include "wingdi.h"
#include "winuser.h"
#include "winnls.h"
#include "mmddk.h"
#include "wine/debug.h"
......@@ -168,10 +172,11 @@ static int JSTCK_OpenDevice(WINE_JSTCK* jstick)
return (jstick->dev = open(buf, flags));
}
/**************************************************************************
* JoyGetDevCaps [MMSYSTEM.102]
*/
static LONG JSTCK_GetDevCaps(DWORD dwDevID, LPJOYCAPSA lpCaps, DWORD dwSize)
static LONG JSTCK_GetDevCaps(DWORD dwDevID, LPJOYCAPSW lpCaps, DWORD dwSize)
{
WINE_JSTCK* jstck;
#ifdef HAVE_LINUX_22_JOYSTICK_API
......@@ -180,6 +185,8 @@ static LONG JSTCK_GetDevCaps(DWORD dwDevID, LPJOYCAPSA lpCaps, DWORD dwSize)
char nrOfButtons;
char identString[MAXPNAMELEN];
int driverVersion;
#else
static const WCHAR ini[] = {'W','i','n','e',' ','J','o','y','s','t','i','c','k',' ','D','r','i','v','e','r',0};
#endif
if ((jstck = JSTCK_drvGet(dwDevID)) == NULL)
......@@ -195,7 +202,7 @@ static LONG JSTCK_GetDevCaps(DWORD dwDevID, LPJOYCAPSA lpCaps, DWORD dwSize)
driverVersion, identString, nrOfAxes, nrOfButtons);
lpCaps->wMid = MM_MICROSOFT;
lpCaps->wPid = MM_PC_JOYSTICK;
strncpy(lpCaps->szPname, identString, MAXPNAMELEN);
MultiByteToWideChar(CP_ACP, 0, identString, -1, lpCaps->szPname, MAXPNAMELEN);
lpCaps->szPname[MAXPNAMELEN-1] = '\0';
lpCaps->wXmin = 0;
lpCaps->wXmax = 0xFFFF;
......@@ -216,7 +223,7 @@ static LONG JSTCK_GetDevCaps(DWORD dwDevID, LPJOYCAPSA lpCaps, DWORD dwSize)
#else
lpCaps->wNumButtons = nrOfButtons;
#endif
if (dwSize == sizeof(JOYCAPSA)) {
if (dwSize == sizeof(JOYCAPSW)) {
/* since we suppose ntOfAxes <= 6 in the following code, do it explicitly */
if (nrOfAxes > 6) nrOfAxes = 6;
/* complete 95 structure */
......@@ -229,8 +236,8 @@ static LONG JSTCK_GetDevCaps(DWORD dwDevID, LPJOYCAPSA lpCaps, DWORD dwSize)
lpCaps->wMaxAxes = 6; /* same as MS Joystick Driver */
lpCaps->wNumAxes = nrOfAxes; /* nr of axes in use */
lpCaps->wMaxButtons = 32; /* same as MS Joystick Driver */
strcpy(lpCaps->szRegKey, "");
strcpy(lpCaps->szOEMVxD, "");
lpCaps->szRegKey[0] = 0;
lpCaps->szOEMVxD[0] = 0;
lpCaps->wCaps = 0;
switch(nrOfAxes) {
case 6: lpCaps->wCaps |= JOYCAPS_HASV;
......@@ -244,7 +251,7 @@ static LONG JSTCK_GetDevCaps(DWORD dwDevID, LPJOYCAPSA lpCaps, DWORD dwSize)
#else
lpCaps->wMid = MM_MICROSOFT;
lpCaps->wPid = MM_PC_JOYSTICK;
strcpy(lpCaps->szPname, "WineJoy"); /* joystick product name */
strcpyW(lpCaps->szPname, ini); /* joystick product name */
lpCaps->wXmin = 0;
lpCaps->wXmax = 0xFFFF;
lpCaps->wYmin = 0;
......@@ -252,7 +259,7 @@ static LONG JSTCK_GetDevCaps(DWORD dwDevID, LPJOYCAPSA lpCaps, DWORD dwSize)
lpCaps->wZmin = 0;
lpCaps->wZmax = 0;
lpCaps->wNumButtons = 2;
if (dwSize == sizeof(JOYCAPSA)) {
if (dwSize == sizeof(JOYCAPSW)) {
/* complete 95 structure */
lpCaps->wRmin = 0;
lpCaps->wRmax = 0;
......@@ -264,8 +271,8 @@ static LONG JSTCK_GetDevCaps(DWORD dwDevID, LPJOYCAPSA lpCaps, DWORD dwSize)
lpCaps->wMaxAxes = 2;
lpCaps->wNumAxes = 2;
lpCaps->wMaxButtons = 4;
strcpy(lpCaps->szRegKey,"");
strcpy(lpCaps->szOEMVxD,"");
lpCaps->szRegKey[0] = 0;
lpCaps->szOEMVxD[0] = 0;
}
#endif
......@@ -439,7 +446,7 @@ LONG CALLBACK JSTCK_DriverProc(DWORD dwDevID, HDRVR hDriv, DWORD wMsg,
case DRV_REMOVE: return DRVCNF_RESTART;
case JDD_GETNUMDEVS: return 1;
case JDD_GETDEVCAPS: return JSTCK_GetDevCaps(dwDevID, (LPJOYCAPSA)dwParam1, dwParam2);
case JDD_GETDEVCAPS: return JSTCK_GetDevCaps(dwDevID, (LPJOYCAPSW)dwParam1, dwParam2);
case JDD_GETPOS: return JSTCK_GetPos(dwDevID, (LPJOYINFO)dwParam1);
case JDD_SETCALIBRATION:
case JDD_CONFIGCHANGED: return JOYERR_NOCANDO;
......
/* -*- tab-width: 8; c-basic-offset: 4 -*- */
/*
* MMSYTEM MCI and low level mapping functions
* MMSYSTEM MCI and low level mapping functions
*
* Copyright 1999 Eric Pouech
*
......@@ -297,14 +297,14 @@ static WINMM_MapType MMDRV_MidiOut_Map16To32A (UINT wMsg, LPDWORD lpdwUser, LP
case MODM_GETDEVCAPS:
{
LPMIDIOUTCAPSA moc32 = HeapAlloc(GetProcessHeap(), 0, sizeof(LPMIDIOUTCAPS16) + sizeof(MIDIOUTCAPSA));
LPMIDIOUTCAPSW moc32 = HeapAlloc(GetProcessHeap(), 0, sizeof(LPMIDIOUTCAPS16) + sizeof(MIDIOUTCAPSW));
LPMIDIOUTCAPS16 moc16 = MapSL(*lpParam1);
if (moc32) {
*(LPMIDIOUTCAPS16*)moc32 = moc16;
moc32 = (LPMIDIOUTCAPSA)((LPSTR)moc32 + sizeof(LPMIDIOUTCAPS16));
moc32 = (LPMIDIOUTCAPSW)((LPSTR)moc32 + sizeof(LPMIDIOUTCAPS16));
*lpParam1 = (DWORD)moc32;
*lpParam2 = sizeof(MIDIOUTCAPSA);
*lpParam2 = sizeof(MIDIOUTCAPSW);
ret = WINMM_MAP_OKMEM;
} else {
......@@ -390,13 +390,14 @@ static WINMM_MapType MMDRV_MidiOut_UnMap16To32A(UINT wMsg, LPDWORD lpdwUser, LP
case MODM_GETDEVCAPS:
{
LPMIDIOUTCAPSA moc32 = (LPMIDIOUTCAPSA)(*lpParam1);
LPMIDIOUTCAPSW moc32 = (LPMIDIOUTCAPSW)(*lpParam1);
LPMIDIOUTCAPS16 moc16 = *(LPMIDIOUTCAPS16*)((LPSTR)moc32 - sizeof(LPMIDIOUTCAPS16));
moc16->wMid = moc32->wMid;
moc16->wPid = moc32->wPid;
moc16->vDriverVersion = moc32->vDriverVersion;
strcpy(moc16->szPname, moc32->szPname);
WideCharToMultiByte( CP_ACP, 0, moc32->szPname, -1, moc16->szPname,
sizeof(moc16->szPname), NULL, NULL );
moc16->wTechnology = moc32->wTechnology;
moc16->wVoices = moc32->wVoices;
moc16->wNotes = moc32->wNotes;
......@@ -455,16 +456,16 @@ static WINMM_MapType MMDRV_MidiOut_Map32ATo16 (UINT wMsg, LPDWORD lpdwUser, LP
break;
case MODM_GETDEVCAPS:
{
LPMIDIOUTCAPSA moc32 = (LPMIDIOUTCAPSA)*lpParam1;
LPSTR ptr = HeapAlloc( GetProcessHeap(), 0, sizeof(LPMIDIOUTCAPSA)+sizeof(MIDIOUTCAPS16));
LPMIDIOUTCAPSW moc32 = (LPMIDIOUTCAPSW)*lpParam1;
LPSTR ptr = HeapAlloc( GetProcessHeap(), 0, sizeof(LPMIDIOUTCAPSW)+sizeof(MIDIOUTCAPS16));
if (ptr) {
*(LPMIDIOUTCAPSA*)ptr = moc32;
*(LPMIDIOUTCAPSW*)ptr = moc32;
ret = WINMM_MAP_OKMEM;
} else {
ret = WINMM_MAP_NOMEM;
}
*lpParam1 = (DWORD)MapLS(ptr) + sizeof(LPMIDIOUTCAPSA);
*lpParam1 = (DWORD)MapLS(ptr) + sizeof(LPMIDIOUTCAPSW);
*lpParam2 = sizeof(MIDIOUTCAPS16);
}
break;
......@@ -596,13 +597,14 @@ static WINMM_MapType MMDRV_MidiOut_UnMap32ATo16(UINT wMsg, LPDWORD lpdwUser, LP
case MODM_GETDEVCAPS:
{
LPMIDIOUTCAPS16 moc16 = MapSL(*lpParam1);
LPSTR ptr = (LPSTR)moc16 - sizeof(LPMIDIOUTCAPSA);
LPMIDIOUTCAPSA moc32 = *(LPMIDIOUTCAPSA*)ptr;
LPSTR ptr = (LPSTR)moc16 - sizeof(LPMIDIOUTCAPSW);
LPMIDIOUTCAPSW moc32 = *(LPMIDIOUTCAPSW*)ptr;
moc32->wMid = moc16->wMid;
moc32->wPid = moc16->wPid;
moc32->vDriverVersion = moc16->vDriverVersion;
strcpy(moc32->szPname, moc16->szPname);
WideCharToMultiByte( CP_ACP, 0, moc32->szPname, -1, moc16->szPname,
sizeof(moc16->szPname), NULL, NULL );
moc32->wTechnology = moc16->wTechnology;
moc32->wVoices = moc16->wVoices;
moc32->wNotes = moc16->wNotes;
......@@ -723,14 +725,14 @@ static WINMM_MapType MMDRV_WaveIn_Map16To32A (UINT wMsg, LPDWORD lpdwUser, LPD
break;
case WIDM_GETDEVCAPS:
{
LPWAVEINCAPSA wic32 = HeapAlloc(GetProcessHeap(), 0, sizeof(LPWAVEINCAPS16) + sizeof(WAVEINCAPSA));
LPWAVEINCAPSW wic32 = HeapAlloc(GetProcessHeap(), 0, sizeof(LPWAVEINCAPS16) + sizeof(WAVEINCAPSW));
LPWAVEINCAPS16 wic16 = MapSL(*lpParam1);
if (wic32) {
*(LPWAVEINCAPS16*)wic32 = wic16;
wic32 = (LPWAVEINCAPSA)((LPSTR)wic32 + sizeof(LPWAVEINCAPS16));
wic32 = (LPWAVEINCAPSW)((LPSTR)wic32 + sizeof(LPWAVEINCAPS16));
*lpParam1 = (DWORD)wic32;
*lpParam2 = sizeof(WAVEINCAPSA);
*lpParam2 = sizeof(WAVEINCAPSW);
ret = WINMM_MAP_OKMEM;
} else {
......@@ -833,13 +835,14 @@ static WINMM_MapType MMDRV_WaveIn_UnMap16To32A(UINT wMsg, LPDWORD lpdwUser, LPD
break;
case WIDM_GETDEVCAPS:
{
LPWAVEINCAPSA wic32 = (LPWAVEINCAPSA)(*lpParam1);
LPWAVEINCAPSW wic32 = (LPWAVEINCAPSW)(*lpParam1);
LPWAVEINCAPS16 wic16 = *(LPWAVEINCAPS16*)((LPSTR)wic32 - sizeof(LPWAVEINCAPS16));
wic16->wMid = wic32->wMid;
wic16->wPid = wic32->wPid;
wic16->vDriverVersion = wic32->vDriverVersion;
strcpy(wic16->szPname, wic32->szPname);
WideCharToMultiByte( CP_ACP, 0, wic32->szPname, -1, wic16->szPname,
sizeof(wic16->szPname), NULL, NULL );
wic16->dwFormats = wic32->dwFormats;
wic16->wChannels = wic32->wChannels;
HeapFree(GetProcessHeap(), 0, (LPSTR)wic32 - sizeof(LPWAVEINCAPS16));
......@@ -1010,16 +1013,16 @@ static WINMM_MapType MMDRV_WaveIn_Map32ATo16 (UINT wMsg, LPDWORD lpdwUser, LPD
break;
case WIDM_GETDEVCAPS:
{
LPWAVEINCAPSA wic32 = (LPWAVEINCAPSA)*lpParam1;
LPSTR ptr = HeapAlloc( GetProcessHeap(), 0 ,sizeof(LPWAVEINCAPSA) + sizeof(WAVEINCAPS16));
LPWAVEINCAPSW wic32 = (LPWAVEINCAPSW)*lpParam1;
LPSTR ptr = HeapAlloc( GetProcessHeap(), 0 ,sizeof(LPWAVEINCAPSW) + sizeof(WAVEINCAPS16));
if (ptr) {
*(LPWAVEINCAPSA*)ptr = wic32;
*(LPWAVEINCAPSW*)ptr = wic32;
ret = WINMM_MAP_OKMEM;
} else {
ret = WINMM_MAP_NOMEM;
}
*lpParam1 = MapLS(ptr) + sizeof(LPWAVEINCAPSA);
*lpParam1 = MapLS(ptr) + sizeof(LPWAVEINCAPSW);
*lpParam2 = sizeof(WAVEINCAPS16);
}
break;
......@@ -1109,13 +1112,14 @@ static WINMM_MapType MMDRV_WaveIn_UnMap32ATo16(UINT wMsg, LPDWORD lpdwUser, LPD
case WIDM_GETDEVCAPS:
{
LPWAVEINCAPS16 wic16 = MapSL(*lpParam1);
LPSTR ptr = (LPSTR)wic16 - sizeof(LPWAVEINCAPSA);
LPWAVEINCAPSA wic32 = *(LPWAVEINCAPSA*)ptr;
LPSTR ptr = (LPSTR)wic16 - sizeof(LPWAVEINCAPSW);
LPWAVEINCAPSW wic32 = *(LPWAVEINCAPSW*)ptr;
wic32->wMid = wic16->wMid;
wic32->wPid = wic16->wPid;
wic32->vDriverVersion = wic16->vDriverVersion;
strcpy(wic32->szPname, wic16->szPname);
WideCharToMultiByte( CP_ACP, 0, wic32->szPname, -1, wic16->szPname,
sizeof(wic16->szPname), NULL, NULL );
wic32->dwFormats = wic16->dwFormats;
wic32->wChannels = wic16->wChannels;
UnMapLS( *lpParam1 );
......@@ -1222,14 +1226,14 @@ static WINMM_MapType MMDRV_WaveOut_Map16To32A (UINT wMsg, LPDWORD lpdwUser, LP
case WODM_GETDEVCAPS:
{
LPWAVEOUTCAPSA woc32 = HeapAlloc(GetProcessHeap(), 0, sizeof(LPWAVEOUTCAPS16) + sizeof(WAVEOUTCAPSA));
LPWAVEOUTCAPSW woc32 = HeapAlloc(GetProcessHeap(), 0, sizeof(LPWAVEOUTCAPS16) + sizeof(WAVEOUTCAPSW));
LPWAVEOUTCAPS16 woc16 = MapSL(*lpParam1);
if (woc32) {
*(LPWAVEOUTCAPS16*)woc32 = woc16;
woc32 = (LPWAVEOUTCAPSA)((LPSTR)woc32 + sizeof(LPWAVEOUTCAPS16));
woc32 = (LPWAVEOUTCAPSW)((LPSTR)woc32 + sizeof(LPWAVEOUTCAPS16));
*lpParam1 = (DWORD)woc32;
*lpParam2 = sizeof(WAVEOUTCAPSA);
*lpParam2 = sizeof(WAVEOUTCAPSW);
ret = WINMM_MAP_OKMEM;
} else {
......@@ -1341,13 +1345,14 @@ static WINMM_MapType MMDRV_WaveOut_UnMap16To32A(UINT wMsg, LPDWORD lpdwUser, LP
case WODM_GETDEVCAPS:
{
LPWAVEOUTCAPSA woc32 = (LPWAVEOUTCAPSA)(*lpParam1);
LPWAVEOUTCAPSW woc32 = (LPWAVEOUTCAPSW)(*lpParam1);
LPWAVEOUTCAPS16 woc16 = *(LPWAVEOUTCAPS16*)((LPSTR)woc32 - sizeof(LPWAVEOUTCAPS16));
woc16->wMid = woc32->wMid;
woc16->wPid = woc32->wPid;
woc16->vDriverVersion = woc32->vDriverVersion;
strcpy(woc16->szPname, woc32->szPname);
WideCharToMultiByte( CP_ACP, 0, woc32->szPname, -1, woc16->szPname,
sizeof(woc16->szPname), NULL, NULL );
woc16->dwFormats = woc32->dwFormats;
woc16->wChannels = woc32->wChannels;
woc16->dwSupport = woc32->dwSupport;
......@@ -1416,17 +1421,17 @@ static WINMM_MapType MMDRV_WaveOut_Map32ATo16 (UINT wMsg, LPDWORD lpdwUser, LP
case WODM_GETDEVCAPS:
{
LPWAVEOUTCAPSA woc32 = (LPWAVEOUTCAPSA)*lpParam1;
LPWAVEOUTCAPSW woc32 = (LPWAVEOUTCAPSW)*lpParam1;
LPSTR ptr = HeapAlloc( GetProcessHeap(), 0,
sizeof(LPWAVEOUTCAPSA) + sizeof(WAVEOUTCAPS16));
sizeof(LPWAVEOUTCAPSW) + sizeof(WAVEOUTCAPS16));
if (ptr) {
*(LPWAVEOUTCAPSA*)ptr = woc32;
*(LPWAVEOUTCAPSW*)ptr = woc32;
ret = WINMM_MAP_OKMEM;
} else {
ret = WINMM_MAP_NOMEM;
}
*lpParam1 = MapLS(ptr) + sizeof(LPWAVEOUTCAPSA);
*lpParam1 = MapLS(ptr) + sizeof(LPWAVEOUTCAPSW);
*lpParam2 = sizeof(WAVEOUTCAPS16);
}
break;
......@@ -1606,13 +1611,14 @@ static WINMM_MapType MMDRV_WaveOut_UnMap32ATo16(UINT wMsg, LPDWORD lpdwUser, LP
case WODM_GETDEVCAPS:
{
LPWAVEOUTCAPS16 woc16 = MapSL(*lpParam1);
LPSTR ptr = (LPSTR)woc16 - sizeof(LPWAVEOUTCAPSA);
LPWAVEOUTCAPSA woc32 = *(LPWAVEOUTCAPSA*)ptr;
LPSTR ptr = (LPSTR)woc16 - sizeof(LPWAVEOUTCAPSW);
LPWAVEOUTCAPSW woc32 = *(LPWAVEOUTCAPSW*)ptr;
woc32->wMid = woc16->wMid;
woc32->wPid = woc16->wPid;
woc32->vDriverVersion = woc16->vDriverVersion;
strcpy(woc32->szPname, woc16->szPname);
WideCharToMultiByte( CP_ACP, 0, woc32->szPname, -1, woc16->szPname,
sizeof(woc16->szPname), NULL, NULL );
woc32->dwFormats = woc16->dwFormats;
woc32->wChannels = woc16->wChannels;
woc32->dwSupport = woc16->dwSupport;
......
......@@ -32,6 +32,7 @@
#include "winuser.h"
#include "mmddk.h"
#include "winreg.h"
#include "wine/unicode.h"
#include "wine/debug.h"
/*
......@@ -80,7 +81,7 @@ WINE_DEFAULT_DEBUG_CHANNEL(msacm);
typedef struct tagMIDIOUTPORT
{
char name[MAXPNAMELEN];
WCHAR name[MAXPNAMELEN];
int loaded;
HMIDIOUT hMidi;
unsigned short uDevID;
......@@ -105,31 +106,36 @@ static BOOL MIDIMAP_IsBadData(MIDIMAPDATA* mm)
return TRUE;
}
static BOOL MIDIMAP_FindPort(const char* name, unsigned* dev)
static BOOL MIDIMAP_FindPort(const WCHAR* name, unsigned* dev)
{
for (*dev = 0; *dev < numMidiOutPorts; (*dev)++)
{
TRACE("%s\n", midiOutPorts[*dev].name);
if (strcmp(midiOutPorts[*dev].name, name) == 0)
TRACE("%s\n", wine_dbgstr_w(midiOutPorts[*dev].name));
if (strcmpW(midiOutPorts[*dev].name, name) == 0)
return TRUE;
}
/* try the form #nnn */
if (*name == '#' && isdigit(name[1]))
{
*dev = atoi(name + 1);
const WCHAR* ptr = name + 1;
*dev = 0;
do
{
*dev = *dev * 10 + *ptr - '0';
} while (isdigit(*++ptr));
if (*dev < numMidiOutPorts)
return TRUE;
}
return FALSE;
}
static BOOL MIDIMAP_LoadSettingsDefault(MIDIMAPDATA* mom, const char* port)
static BOOL MIDIMAP_LoadSettingsDefault(MIDIMAPDATA* mom, const WCHAR* port)
{
unsigned i, dev = 0;
if (port != NULL && !MIDIMAP_FindPort(port, &dev))
{
ERR("Registry glitch: couldn't find midi out (%s)\n", port);
ERR("Registry glitch: couldn't find midi out (%s)\n", wine_dbgstr_w(port));
dev = 0;
}
......@@ -142,11 +148,11 @@ static BOOL MIDIMAP_LoadSettingsDefault(MIDIMAPDATA* mom, const char* port)
return TRUE;
}
static BOOL MIDIMAP_LoadSettingsScheme(MIDIMAPDATA* mom, const char* scheme)
static BOOL MIDIMAP_LoadSettingsScheme(MIDIMAPDATA* mom, const WCHAR* scheme)
{
HKEY hSchemesKey, hKey, hPortKey;
unsigned i, idx, dev;
char buffer[256], port[256];
WCHAR buffer[256], port[256];
DWORD type, size, mask;
for (i = 0; i < 16; i++) mom->ChannelMap[i] = NULL;
......@@ -157,18 +163,18 @@ static BOOL MIDIMAP_LoadSettingsScheme(MIDIMAPDATA* mom, const char* scheme)
{
return FALSE;
}
if (RegOpenKeyA(hSchemesKey, scheme, &hKey))
if (RegOpenKeyW(hSchemesKey, scheme, &hKey))
{
RegCloseKey(hSchemesKey);
return FALSE;
}
for (idx = 0; !RegEnumKeyA(hKey, idx, buffer, sizeof(buffer)); idx++)
for (idx = 0; !RegEnumKeyW(hKey, idx, buffer, sizeof(buffer)); idx++)
{
if (RegOpenKeyA(hKey, buffer, &hPortKey)) continue;
if (RegOpenKeyW(hKey, buffer, &hPortKey)) continue;
size = sizeof(port);
if (RegQueryValueExA(hPortKey, NULL, 0, &type, port, &size)) continue;
if (RegQueryValueExW(hPortKey, NULL, 0, &type, (void*)port, &size)) continue;
if (!MIDIMAP_FindPort(port, &dev)) continue;
......@@ -206,14 +212,15 @@ static BOOL MIDIMAP_LoadSettings(MIDIMAPDATA* mom)
else
{
DWORD type, size, out;
char buffer[256];
WCHAR buffer[256];
ret = 2;
size = sizeof(out);
if (!RegQueryValueExA(hKey, "UseScheme", 0, &type, (void*)&out, &size) && out)
{
static const WCHAR cs[] = {'C','u','r','r','e','n','t','S','c','h','e','m','e',0};
size = sizeof(buffer);
if (!RegQueryValueExA(hKey, "CurrentScheme", 0, &type, buffer, &size))
if (!RegQueryValueExW(hKey, cs, 0, &type, (void*)buffer, &size))
{
if (!(ret = MIDIMAP_LoadSettingsScheme(mom, buffer)))
ret = MIDIMAP_LoadSettingsDefault(mom, NULL);
......@@ -225,8 +232,9 @@ static BOOL MIDIMAP_LoadSettings(MIDIMAPDATA* mom)
}
if (ret == 2)
{
static const WCHAR ci[] = {'C','u','r','r','e','n','t','I','n','s','t','r','u','m','e','n','t',0};
size = sizeof(buffer);
if (!RegQueryValueExA(hKey, "CurrentInstrument", 0, &type, buffer, &size) && *buffer)
if (!RegQueryValueExW(hKey, ci, 0, &type, (void*)buffer, &size) && *buffer)
{
ret = MIDIMAP_LoadSettingsDefault(mom, buffer);
}
......@@ -404,12 +412,13 @@ static DWORD modUnprepare(MIDIMAPDATA* mom, LPMIDIHDR lpMidiHdr, DWORD dwParam2)
return MMSYSERR_NOERROR;
}
static DWORD modGetDevCaps(UINT wDevID, MIDIMAPDATA* mom, LPMIDIOUTCAPSA lpMidiCaps, DWORD size)
static DWORD modGetDevCaps(UINT wDevID, MIDIMAPDATA* mom, LPMIDIOUTCAPSW lpMidiCaps, DWORD size)
{
static const WCHAR name[] = {'W','i','n','e',' ','m','i','d','i',' ','m','a','p','p','e','r',0};
lpMidiCaps->wMid = 0x00FF;
lpMidiCaps->wPid = 0x0001;
lpMidiCaps->vDriverVersion = 0x0100;
strcpy(lpMidiCaps->szPname, "Wine midi out mapper");
lstrcpyW(lpMidiCaps->szPname, name);
lpMidiCaps->wTechnology = MOD_MAPPER;
lpMidiCaps->wVoices = 0;
lpMidiCaps->wNotes = 0;
......@@ -465,7 +474,7 @@ DWORD WINAPI MIDIMAP_modMessage(UINT wDevID, UINT wMsg, DWORD dwUser,
case MODM_UNPREPARE: return modUnprepare ((MIDIMAPDATA*)dwUser, (LPMIDIHDR)dwParam1, dwParam2);
case MODM_RESET: return modReset ((MIDIMAPDATA*)dwUser);
case MODM_GETDEVCAPS: return modGetDevCaps (wDevID, (MIDIMAPDATA*)dwUser, (LPMIDIOUTCAPSA)dwParam1,dwParam2);
case MODM_GETDEVCAPS: return modGetDevCaps (wDevID, (MIDIMAPDATA*)dwUser, (LPMIDIOUTCAPSW)dwParam1,dwParam2);
case MODM_GETNUMDEVS: return 1;
case MODM_GETVOLUME: return MMSYSERR_NOTSUPPORTED;
case MODM_SETVOLUME: return MMSYSERR_NOTSUPPORTED;
......@@ -484,7 +493,7 @@ DWORD WINAPI MIDIMAP_modMessage(UINT wDevID, UINT wMsg, DWORD dwUser,
*/
static DWORD MIDIMAP_drvOpen(LPSTR str)
{
MIDIOUTCAPSA moc;
MIDIOUTCAPSW moc;
unsigned dev, i;
if (midiOutPorts)
......@@ -495,9 +504,9 @@ static DWORD MIDIMAP_drvOpen(LPSTR str)
numMidiOutPorts * sizeof(MIDIOUTPORT));
for (dev = 0; dev < numMidiOutPorts; dev++)
{
if (midiOutGetDevCapsA(dev, &moc, sizeof(moc)) == 0L)
if (midiOutGetDevCapsW(dev, &moc, sizeof(moc)) == 0L)
{
strcpy(midiOutPorts[dev].name, moc.szPname);
strcpyW(midiOutPorts[dev].name, moc.szPname);
midiOutPorts[dev].loaded = 0;
midiOutPorts[dev].hMidi = 0;
midiOutPorts[dev].uDevID = dev;
......
......@@ -1940,7 +1940,7 @@ LRESULT WINAPI mmThreadCreate16(FARPROC16 fpThreadAddr, LPHANDLE16 lpHndl, DWORD
lpMMThd->hTask = 0;
if ((dwFlags & 1) == 0 && (GetProcessFlags(GetCurrentThreadId()) & 8) == 0) {
lpMMThd->hEvent = CreateEventA(0, 0, 1, 0);
lpMMThd->hEvent = CreateEventW(NULL, FALSE, TRUE, NULL);
TRACE("Let's go crazy... trying new MM thread. lpMMThd=%p\n", lpMMThd);
if (lpMMThd->dwFlags & 2) {
......@@ -2712,7 +2712,6 @@ static LRESULT MMIO_Callback16(SEGPTR cb16, LPMMIOINFO lpmmioinfo, UINT uMessage
mmioInfo16.adwInfo[0] = lpmmioinfo->adwInfo[0];
mmioInfo16.adwInfo[1] = lpmmioinfo->adwInfo[1];
mmioInfo16.adwInfo[2] = lpmmioinfo->adwInfo[2];
mmioInfo16.adwInfo[3] = lpmmioinfo->adwInfo[3];
/* map (lParam1, lParam2) into (lp1, lp2) 32=>16 */
if ((result = MMIO_Map32To16(uMessage, &lp1, &lp2)) != MMSYSERR_NOERROR)
return result;
......@@ -2733,7 +2732,6 @@ static LRESULT MMIO_Callback16(SEGPTR cb16, LPMMIOINFO lpmmioinfo, UINT uMessage
lpmmioinfo->adwInfo[0] = mmioInfo16.adwInfo[0];
lpmmioinfo->adwInfo[1] = mmioInfo16.adwInfo[1];
lpmmioinfo->adwInfo[2] = mmioInfo16.adwInfo[2];
lpmmioinfo->adwInfo[3] = mmioInfo16.adwInfo[3];
return result;
}
......@@ -2777,7 +2775,6 @@ HMMIO16 WINAPI mmioOpen16(LPSTR szFileName, MMIOINFO16* lpmmioinfo16,
mmioinfo.adwInfo[0] = (DWORD)DosFileHandleToWin32Handle(mmioinfo.adwInfo[0]);
mmioinfo.adwInfo[1] = lpmmioinfo16->adwInfo[1];
mmioinfo.adwInfo[2] = lpmmioinfo16->adwInfo[2];
mmioinfo.adwInfo[3] = lpmmioinfo16->adwInfo[3];
ret = MMIO_Open(szFileName, &mmioinfo, dwOpenFlags, MMIO_PROC_16);
MMIO_SetSegmentedBuffer(mmioinfo.hmmio, (SEGPTR)lpmmioinfo16->pchBuffer, FALSE);
......@@ -2856,7 +2853,6 @@ MMRESULT16 WINAPI mmioGetInfo16(HMMIO16 hmmio, MMIOINFO16* lpmmioinfo, UINT16 uF
lpmmioinfo->adwInfo[0] = mmioinfo.adwInfo[0];
lpmmioinfo->adwInfo[1] = mmioinfo.adwInfo[1];
lpmmioinfo->adwInfo[2] = mmioinfo.adwInfo[2];
lpmmioinfo->adwInfo[3] = mmioinfo.adwInfo[3];
lpmmioinfo->dwReserved1 = 0;
lpmmioinfo->dwReserved2 = 0;
lpmmioinfo->hmmio = HMMIO_16(mmioinfo.hmmio);
......@@ -3065,7 +3061,11 @@ UINT16 WINAPI joyGetNumDevs16(void)
MMRESULT16 WINAPI joyGetDevCaps16(UINT16 wID, LPJOYCAPS16 lpCaps, UINT16 wSize)
{
JOYCAPSA jca;
MMRESULT ret = joyGetDevCapsA(wID, &jca, sizeof(jca));
MMRESULT ret;
if (lpCaps == NULL) return MMSYSERR_INVALPARAM;
ret = joyGetDevCapsA(wID, &jca, sizeof(jca));
if (ret != JOYERR_NOERROR) return ret;
lpCaps->wMid = jca.wMid;
......
......@@ -352,7 +352,7 @@ static DWORD WINAPI proc_PlaySound(LPVOID arg)
TRACE("Chunk Found ckid=%.4s fccType=%.4s cksize=%08lX\n",
(LPSTR)&mmckInfo.ckid, (LPSTR)&mmckInfo.fccType, mmckInfo.cksize);
s.hEvent = CreateEventA(NULL, FALSE, FALSE, NULL);
s.hEvent = CreateEventW(NULL, FALSE, FALSE, NULL);
if (waveOutOpen(&hWave, WAVE_MAPPER, lpWaveFormat, (DWORD)PlaySound_Callback,
(DWORD)&s, CALLBACK_FUNCTION) != MMSYSERR_NOERROR)
......@@ -374,9 +374,9 @@ static DWORD WINAPI proc_PlaySound(LPVOID arg)
}
s.dwEventCount = 1L; /* for first buffer */
index = 0;
do {
index = 0;
left = mmckInfo.cksize;
mmioSeek(hmmio, mmckInfo.dwDataOffset, SEEK_SET);
......
......@@ -37,6 +37,7 @@
#include "mmddk.h"
#include "mmreg.h"
#include "msacm.h"
#include "wine/unicode.h"
#include "wine/debug.h"
WINE_DEFAULT_DEBUG_CHANNEL(wavemap);
......@@ -422,13 +423,15 @@ static DWORD wodGetPosition(WAVEMAPDATA* wom, LPMMTIME lpTime, DWORD dwParam2)
return val;
}
static DWORD wodGetDevCaps(UINT wDevID, WAVEMAPDATA* wom, LPWAVEOUTCAPSA lpWaveCaps, DWORD dwParam2)
static DWORD wodGetDevCaps(UINT wDevID, WAVEMAPDATA* wom, LPWAVEOUTCAPSW lpWaveCaps, DWORD dwParam2)
{
static const WCHAR name[] = {'W','i','n','e',' ','w','a','v','e',' ','o','u','t',' ','m','a','p','p','e','r',0};
TRACE("(%04x %p %p %08lx)\n",wDevID, wom, lpWaveCaps, dwParam2);
/* if opened low driver, forward message */
if (WAVEMAP_IsData(wom))
return waveOutGetDevCapsA((UINT)wom->u.out.hInnerWave, lpWaveCaps, dwParam2);
return waveOutGetDevCapsW((UINT)wom->u.out.hInnerWave, lpWaveCaps, dwParam2);
/* else if no drivers, nothing to map so return bad device */
if (waveOutGetNumDevs() == 0) {
WARN("bad device id\n");
......@@ -436,11 +439,11 @@ static DWORD wodGetDevCaps(UINT wDevID, WAVEMAPDATA* wom, LPWAVEOUTCAPSA lpWaveC
}
/* otherwise, return caps of mapper itself */
if (wDevID == (UINT)-1 || wDevID == (UINT16)-1) {
WAVEOUTCAPSA woc;
WAVEOUTCAPSW woc;
woc.wMid = 0x00FF;
woc.wPid = 0x0001;
woc.vDriverVersion = 0x0100;
strcpy(woc.szPname, "Wine wave out mapper");
lstrcpyW(woc.szPname, name);
woc.dwFormats =
WAVE_FORMAT_96M08 | WAVE_FORMAT_96S08 | WAVE_FORMAT_96M16 | WAVE_FORMAT_96S16 |
WAVE_FORMAT_48M08 | WAVE_FORMAT_48S08 | WAVE_FORMAT_48M16 | WAVE_FORMAT_48S16 |
......@@ -556,7 +559,7 @@ DWORD WINAPI WAVEMAP_wodMessage(UINT wDevID, UINT wMsg, DWORD dwUser,
case WODM_BREAKLOOP: return wodBreakLoop ((WAVEMAPDATA*)dwUser);
case WODM_PREPARE: return wodPrepare ((WAVEMAPDATA*)dwUser, (LPWAVEHDR)dwParam1, dwParam2);
case WODM_UNPREPARE: return wodUnprepare ((WAVEMAPDATA*)dwUser, (LPWAVEHDR)dwParam1, dwParam2);
case WODM_GETDEVCAPS: return wodGetDevCaps (wDevID, (WAVEMAPDATA*)dwUser, (LPWAVEOUTCAPSA)dwParam1,dwParam2);
case WODM_GETDEVCAPS: return wodGetDevCaps (wDevID, (WAVEMAPDATA*)dwUser, (LPWAVEOUTCAPSW)dwParam1,dwParam2);
case WODM_GETNUMDEVS: return 1;
case WODM_GETPITCH: return MMSYSERR_NOTSUPPORTED;
case WODM_SETPITCH: return MMSYSERR_NOTSUPPORTED;
......@@ -916,13 +919,13 @@ static DWORD widGetPosition(WAVEMAPDATA* wim, LPMMTIME lpTime, DWORD dwParam2)
return val;
}
static DWORD widGetDevCaps(UINT wDevID, WAVEMAPDATA* wim, LPWAVEINCAPSA lpWaveCaps, DWORD dwParam2)
static DWORD widGetDevCaps(UINT wDevID, WAVEMAPDATA* wim, LPWAVEINCAPSW lpWaveCaps, DWORD dwParam2)
{
TRACE("(%04x, %p %p %08lx)\n", wDevID, wim, lpWaveCaps, dwParam2);
/* if opened low driver, forward message */
if (WAVEMAP_IsData(wim))
return waveInGetDevCapsA((UINT)wim->u.in.hInnerWave, lpWaveCaps, dwParam2);
return waveInGetDevCapsW((UINT)wim->u.in.hInnerWave, lpWaveCaps, dwParam2);
/* else if no drivers, nothing to map so return bad device */
if (waveInGetNumDevs() == 0) {
WARN("bad device id\n");
......@@ -930,11 +933,12 @@ static DWORD widGetDevCaps(UINT wDevID, WAVEMAPDATA* wim, LPWAVEINCAPSA lpWaveCa
}
/* otherwise, return caps of mapper itself */
if (wDevID == (UINT)-1 || wDevID == (UINT16)-1) {
WAVEINCAPSA wic;
WAVEINCAPSW wic;
static const WCHAR init[] = {'W','i','n','e',' ','w','a','v','e',' ','i','n',' ','m','a','p','p','e','r',0};
wic.wMid = 0x00FF;
wic.wPid = 0x0001;
wic.vDriverVersion = 0x0001;
strcpy(wic.szPname, "Wine wave in mapper");
strcpyW(wic.szPname, init);
wic.dwFormats =
WAVE_FORMAT_96M08 | WAVE_FORMAT_96S08 | WAVE_FORMAT_96M16 | WAVE_FORMAT_96S16 |
WAVE_FORMAT_48M08 | WAVE_FORMAT_48S08 | WAVE_FORMAT_48M16 | WAVE_FORMAT_48S16 |
......@@ -1023,7 +1027,7 @@ DWORD WINAPI WAVEMAP_widMessage(WORD wDevID, WORD wMsg, DWORD dwUser,
case WIDM_ADDBUFFER: return widAddBuffer ((WAVEMAPDATA*)dwUser, (LPWAVEHDR)dwParam1, dwParam2);
case WIDM_PREPARE: return widPrepare ((WAVEMAPDATA*)dwUser, (LPWAVEHDR)dwParam1, dwParam2);
case WIDM_UNPREPARE: return widUnprepare ((WAVEMAPDATA*)dwUser, (LPWAVEHDR)dwParam1, dwParam2);
case WIDM_GETDEVCAPS: return widGetDevCaps (wDevID, (WAVEMAPDATA*)dwUser, (LPWAVEINCAPSA)dwParam1, dwParam2);
case WIDM_GETDEVCAPS: return widGetDevCaps (wDevID, (WAVEMAPDATA*)dwUser, (LPWAVEINCAPSW)dwParam1, dwParam2);
case WIDM_GETNUMDEVS: return 1;
case WIDM_GETPOS: return widGetPosition ((WAVEMAPDATA*)dwUser, (LPMMTIME)dwParam1, dwParam2);
case WIDM_RESET: return widReset ((WAVEMAPDATA*)dwUser);
......
......@@ -62,6 +62,7 @@
#define ALSA_PCM_NEW_SW_PARAMS_API
#include "alsa.h"
#include "wine/library.h"
#include "wine/unicode.h"
#include "wine/debug.h"
WINE_DEFAULT_DEBUG_CHANNEL(wave);
......@@ -150,7 +151,7 @@ typedef struct {
WAVEOPENDESC waveDesc;
WORD wFlags;
WAVEFORMATPCMEX format;
WAVEOUTCAPSA caps;
WAVEOUTCAPSW caps;
/* ALSA information (ALSA 0.9/1.x uses two different devices for playback/capture) */
char* device;
......@@ -196,7 +197,7 @@ typedef struct {
WAVEOPENDESC waveDesc;
WORD wFlags;
WAVEFORMATPCMEX format;
WAVEOUTCAPSA caps;
WAVEOUTCAPSW caps;
/* ALSA information (ALSA 0.9/1.x uses two different devices for playback/capture) */
char* device;
......@@ -642,7 +643,7 @@ static char* ALSA_strdup(char *s) {
* Returns either "default" or reads the registry so the user can
* override the playback/record device used.
*/
static char *ALSA_GetDeviceFromReg(char *value)
static char *ALSA_GetDeviceFromReg(const char *value)
{
DWORD res;
DWORD type;
......@@ -688,6 +689,8 @@ LONG ALSA_WaveInit(void)
int err=0;
WINE_WAVEOUT* wwo;
WINE_WAVEIN* wwi;
static const WCHAR init_out[] = {'S','B','1','6',' ','W','a','v','e',' ','O','u','t',0};
static const WCHAR init_in [] = {'S','B','1','6',' ','W','a','v','e',' ','I','n',0};
wwo = &WOutDev[0];
......@@ -699,7 +702,7 @@ LONG ALSA_WaveInit(void)
wwo->caps.wMid = 0x0002;
wwo->caps.wPid = 0x0104;
strcpy(wwo->caps.szPname, "SB16 Wave Out");
strcpyW(wwo->caps.szPname, init_out);
wwo->caps.vDriverVersion = 0x0100;
wwo->caps.dwFormats = 0x00000000;
wwo->caps.dwSupport = WAVECAPS_VOLUME;
......@@ -813,7 +816,7 @@ LONG ALSA_WaveInit(void)
wwi->caps.wMid = 0x0002;
wwi->caps.wPid = 0x0104;
strcpy(wwi->caps.szPname, "SB16 Wave In");
strcpyW(wwi->caps.szPname, init_in);
wwi->caps.vDriverVersion = 0x0100;
wwi->caps.dwFormats = 0x00000000;
wwi->caps.dwSupport = WAVECAPS_VOLUME;
......@@ -932,7 +935,7 @@ static int ALSA_InitRingMessage(ALSA_MSG_RING* omr)
ERR("could not create pipe, error=%s\n", strerror(errno));
}
#else
omr->msg_event = CreateEventA(NULL, FALSE, FALSE, NULL);
omr->msg_event = CreateEventW(NULL, FALSE, FALSE, NULL);
#endif
omr->ring_buffer_size = ALSA_RING_BUFFER_INCREMENT;
omr->messages = HeapAlloc(GetProcessHeap(),HEAP_ZERO_MEMORY,omr->ring_buffer_size * sizeof(ALSA_MSG));
......@@ -989,7 +992,7 @@ static int ALSA_AddRingMessage(ALSA_MSG_RING* omr, enum win_wm_message msg, DWOR
}
if (wait)
{
hEvent = CreateEventA(NULL, FALSE, FALSE, NULL);
hEvent = CreateEventW(NULL, FALSE, FALSE, NULL);
if (hEvent == INVALID_HANDLE_VALUE)
{
ERR("can't create event !?\n");
......@@ -1564,7 +1567,7 @@ static DWORD CALLBACK wodPlayer(LPVOID pmt)
/**************************************************************************
* wodGetDevCaps [internal]
*/
static DWORD wodGetDevCaps(WORD wDevID, LPWAVEOUTCAPSA lpCaps, DWORD dwSize)
static DWORD wodGetDevCaps(WORD wDevID, LPWAVEOUTCAPSW lpCaps, DWORD dwSize)
{
TRACE("(%u, %p, %lu);\n", wDevID, lpCaps, dwSize);
......@@ -1782,7 +1785,7 @@ static DWORD wodOpen(WORD wDevID, LPWAVEOPENDESC lpDesc, DWORD dwFlags)
}
if (!(dwFlags & WAVE_DIRECTSOUND)) {
wwo->hStartUpEvent = CreateEventA(NULL, FALSE, FALSE, NULL);
wwo->hStartUpEvent = CreateEventW(NULL, FALSE, FALSE, NULL);
wwo->hThread = CreateThread(NULL, 0, wodPlayer, (LPVOID)(DWORD)wDevID, 0, &(wwo->dwThreadID));
WaitForSingleObject(wwo->hStartUpEvent, INFINITE);
CloseHandle(wwo->hStartUpEvent);
......@@ -2150,7 +2153,7 @@ DWORD WINAPI ALSA_wodMessage(UINT wDevID, UINT wMsg, DWORD dwUser,
return 0;
case WODM_OPEN: return wodOpen (wDevID, (LPWAVEOPENDESC)dwParam1, dwParam2);
case WODM_CLOSE: return wodClose (wDevID);
case WODM_GETDEVCAPS: return wodGetDevCaps (wDevID, (LPWAVEOUTCAPSA)dwParam1, dwParam2);
case WODM_GETDEVCAPS: return wodGetDevCaps (wDevID, (LPWAVEOUTCAPSW)dwParam1, dwParam2);
case WODM_GETNUMDEVS: return wodGetNumDevs ();
case WODM_GETPITCH: return MMSYSERR_NOTSUPPORTED;
case WODM_SETPITCH: return MMSYSERR_NOTSUPPORTED;
......@@ -2762,7 +2765,7 @@ static DWORD widNotifyClient(WINE_WAVEIN* wwi, WORD wMsg, DWORD dwParam1, DWORD
/**************************************************************************
* widGetDevCaps [internal]
*/
static DWORD widGetDevCaps(WORD wDevID, LPWAVEOUTCAPSA lpCaps, DWORD dwSize)
static DWORD widGetDevCaps(WORD wDevID, LPWAVEOUTCAPSW lpCaps, DWORD dwSize)
{
TRACE("(%u, %p, %lu);\n", wDevID, lpCaps, dwSize);
......@@ -3282,7 +3285,7 @@ static DWORD widOpen(WORD wDevID, LPWAVEOPENDESC lpDesc, DWORD dwFlags)
wwi->format.Format.nBlockAlign);
if (!(dwFlags & WAVE_DIRECTSOUND)) {
wwi->hStartUpEvent = CreateEventA(NULL, FALSE, FALSE, NULL);
wwi->hStartUpEvent = CreateEventW(NULL, FALSE, FALSE, NULL);
wwi->hThread = CreateThread(NULL, 0, widRecorder, (LPVOID)(DWORD)wDevID, 0, &(wwi->dwThreadID));
WaitForSingleObject(wwi->hStartUpEvent, INFINITE);
CloseHandle(wwi->hStartUpEvent);
......@@ -3561,7 +3564,7 @@ DWORD WINAPI ALSA_widMessage(UINT wDevID, UINT wMsg, DWORD dwUser,
case WIDM_ADDBUFFER: return widAddBuffer (wDevID, (LPWAVEHDR)dwParam1, dwParam2);
case WIDM_PREPARE: return widPrepare (wDevID, (LPWAVEHDR)dwParam1, dwParam2);
case WIDM_UNPREPARE: return widUnprepare (wDevID, (LPWAVEHDR)dwParam1, dwParam2);
case WIDM_GETDEVCAPS: return widGetDevCaps (wDevID, (LPWAVEOUTCAPSA)dwParam1, dwParam2);
case WIDM_GETDEVCAPS: return widGetDevCaps (wDevID, (LPWAVEOUTCAPSW)dwParam1, dwParam2);
case WIDM_GETNUMDEVS: return widGetNumDevs ();
case WIDM_GETPOS: return widGetPosition (wDevID, (LPMMTIME)dwParam1, dwParam2);
case WIDM_RESET: return widReset (wDevID);
......
......@@ -112,7 +112,7 @@ typedef struct {
WAVEOPENDESC waveDesc;
WORD wFlags;
PCMWAVEFORMAT format;
WAVEOUTCAPSA caps;
WAVEOUTCAPSW caps;
/* ALSA information */
snd_pcm_t* handle; /* handle to ALSA device */
......@@ -172,6 +172,8 @@ LONG ALSA_WaveInit(void)
snd_pcm_info_t info;
snd_pcm_channel_info_t chn_info;
static const WCHAR ini_out[] = {'A','L','S','A',' ','W','a','v','e','O','u','t',' ','D','r','i','v','e','r',0};
TRACE("There are %d cards\n", snd_cards());
ALSA_WodNumDevs = 0;
......@@ -241,7 +243,7 @@ LONG ALSA_WaveInit(void)
/* FIXME: use better values */
WOutDev[0].caps.wMid = 0x0002;
WOutDev[0].caps.wPid = 0x0104;
strcpy(WOutDev[0].caps.szPname, "SB16 Wave Out");
strcpyW(WOutDev[0].caps.szPname, ini);
WOutDev[0].caps.vDriverVersion = 0x0100;
WOutDev[0].caps.dwFormats = 0x00000000;
WOutDev[0].caps.dwSupport = WAVECAPS_VOLUME;
......@@ -297,7 +299,7 @@ static int ALSA_InitRingMessage(ALSA_MSG_RING* omr)
{
omr->msg_toget = 0;
omr->msg_tosave = 0;
omr->msg_event = CreateEventA(NULL, FALSE, FALSE, NULL);
omr->msg_event = CreateEventW(NULL, FALSE, FALSE, NULL);
memset(omr->messages, 0, sizeof(ALSA_MSG) * ALSA_RING_BUFFER_SIZE);
InitializeCriticalSection(&omr->msg_crst);
return 0;
......@@ -332,7 +334,7 @@ static int ALSA_AddRingMessage(ALSA_MSG_RING* omr, enum win_wm_message msg, DWOR
}
if (wait)
{
hEvent = CreateEventA(NULL, FALSE, FALSE, NULL);
hEvent = CreateEventW(NULL, FALSE, FALSE, NULL);
if (hEvent == INVALID_HANDLE_VALUE)
{
ERR("can't create event !?\n");
......@@ -409,7 +411,8 @@ static DWORD wodNotifyClient(WINE_WAVEOUT* wwo, WORD wMsg, DWORD dwParam1, DWORD
case WOM_CLOSE:
case WOM_DONE:
if (wwo->wFlags != DCB_NULL &&
!DriverCallback(wwo->waveDesc.dwCallback, wwo->wFlags, wwo->waveDesc.hWave,
!DriverCallback(wwo->waveDesc.dwCallback, wwo->wFlags,
(HDRVR)wwo->waveDesc.hWave,
wMsg, wwo->waveDesc.dwInstance, dwParam1, dwParam2)) {
WARN("can't notify client !\n");
return MMSYSERR_ERROR;
......@@ -839,7 +842,7 @@ static DWORD CALLBACK wodPlayer(LPVOID pmt)
/**************************************************************************
* wodGetDevCaps [internal]
*/
static DWORD wodGetDevCaps(WORD wDevID, LPWAVEOUTCAPSA lpCaps, DWORD dwSize)
static DWORD wodGetDevCaps(WORD wDevID, LPWAVEOUTCAPSW lpCaps, DWORD dwSize)
{
TRACE("(%u, %p, %lu);\n", wDevID, lpCaps, dwSize);
......@@ -963,7 +966,7 @@ static DWORD wodOpen(WORD wDevID, LPWAVEOPENDESC lpDesc, DWORD dwFlags)
ALSA_InitRingMessage(&wwo->msgRing);
if (!(dwFlags & WAVE_DIRECTSOUND)) {
wwo->hStartUpEvent = CreateEventA(NULL, FALSE, FALSE, NULL);
wwo->hStartUpEvent = CreateEventW(NULL, FALSE, FALSE, NULL);
wwo->hThread = CreateThread(NULL, 0, wodPlayer, (LPVOID)(DWORD)wDevID, 0, &(wwo->dwThreadID));
WaitForSingleObject(wwo->hStartUpEvent, INFINITE);
CloseHandle(wwo->hStartUpEvent);
......@@ -1331,7 +1334,7 @@ DWORD WINAPI ALSA_wodMessage(UINT wDevID, UINT wMsg, DWORD dwUser,
case WODM_BREAKLOOP: return wodBreakLoop (wDevID);
case WODM_PREPARE: return wodPrepare (wDevID, (LPWAVEHDR)dwParam1, dwParam2);
case WODM_UNPREPARE: return wodUnprepare (wDevID, (LPWAVEHDR)dwParam1, dwParam2);
case WODM_GETDEVCAPS: return wodGetDevCaps (wDevID, (LPWAVEOUTCAPSA)dwParam1, dwParam2);
case WODM_GETDEVCAPS: return wodGetDevCaps (wDevID, (LPWAVEOUTCAPSW)dwParam1, dwParam2);
case WODM_GETNUMDEVS: return wodGetNumDevs ();
case WODM_GETPITCH: return MMSYSERR_NOTSUPPORTED;
case WODM_SETPITCH: return MMSYSERR_NOTSUPPORTED;
......
......@@ -46,6 +46,7 @@
#include "winbase.h"
#include "wingdi.h"
#include "winuser.h"
#include "winnls.h"
#include "mmddk.h"
#ifdef HAVE_ALSA
# include "alsa.h"
......@@ -67,7 +68,7 @@ typedef struct {
unsigned char incPrev;
char incLen;
DWORD startTime;
MIDIINCAPSA caps;
MIDIINCAPSW caps;
snd_seq_addr_t addr;
} WINE_MIDIIN;
......@@ -79,7 +80,7 @@ typedef struct {
LPMIDIHDR lpQueueHdr;
DWORD dwTotalPlayed;
void* lpExtra; /* according to port type (MIDI, FM...), extra data when needed */
MIDIOUTCAPSA caps;
MIDIOUTCAPSW caps;
snd_seq_addr_t addr;
} WINE_MIDIOUT;
......@@ -395,7 +396,7 @@ static DWORD WINAPI midRecThread(LPVOID arg)
/**************************************************************************
* midGetDevCaps [internal]
*/
static DWORD midGetDevCaps(WORD wDevID, LPMIDIINCAPSA lpCaps, DWORD dwSize)
static DWORD midGetDevCaps(WORD wDevID, LPMIDIINCAPSW lpCaps, DWORD dwSize)
{
TRACE("(%04X, %p, %08lX);\n", wDevID, lpCaps, dwSize);
......@@ -665,7 +666,7 @@ static DWORD midStop(WORD wDevID)
/**************************************************************************
* modGetDevCaps [internal]
*/
static DWORD modGetDevCaps(WORD wDevID, LPMIDIOUTCAPSA lpCaps, DWORD dwSize)
static DWORD modGetDevCaps(WORD wDevID, LPMIDIOUTCAPSW lpCaps, DWORD dwSize)
{
TRACE("(%04X, %p, %08lX);\n", wDevID, lpCaps, dwSize);
......@@ -1117,7 +1118,9 @@ static void ALSA_AddMidiPort(snd_seq_client_info_t* cinfo, snd_seq_port_info_t*
* not MIDICAPS_CACHE.
*/
MidiOutDev[MODM_NumDevs].caps.dwSupport = MIDICAPS_VOLUME|MIDICAPS_LRVOLUME;
strcpy(MidiOutDev[MODM_NumDevs].caps.szPname, snd_seq_client_info_get_name(cinfo));
MultiByteToWideChar(CP_ACP, 0, snd_seq_client_info_get_name(cinfo), -1,
MidiOutDev[MODM_NumDevs].caps.szPname,
sizeof(MidiOutDev[MODM_NumDevs].caps.szPname) / sizeof(WCHAR));
MidiOutDev[MODM_NumDevs].caps.wTechnology = MIDI_AlsaToWindowsDeviceType(type);
MidiOutDev[MODM_NumDevs].caps.wVoices = 16;
......@@ -1132,10 +1135,11 @@ static void ALSA_AddMidiPort(snd_seq_client_info_t* cinfo, snd_seq_port_info_t*
TRACE("MidiOut[%d]\tname='%s' techn=%d voices=%d notes=%d chnMsk=%04x support=%ld\n"
"\tALSA info: midi dev-type=%lx, capa=%lx\n",
MODM_NumDevs, MidiOutDev[MODM_NumDevs].caps.szPname, MidiOutDev[MODM_NumDevs].caps.wTechnology,
MidiOutDev[MODM_NumDevs].caps.wVoices, MidiOutDev[MODM_NumDevs].caps.wNotes,
MidiOutDev[MODM_NumDevs].caps.wChannelMask, MidiOutDev[MODM_NumDevs].caps.dwSupport,
(long)type, (long)0);
MODM_NumDevs, wine_dbgstr_w(MidiOutDev[MODM_NumDevs].caps.szPname),
MidiOutDev[MODM_NumDevs].caps.wTechnology,
MidiOutDev[MODM_NumDevs].caps.wVoices, MidiOutDev[MODM_NumDevs].caps.wNotes,
MidiOutDev[MODM_NumDevs].caps.wChannelMask, MidiOutDev[MODM_NumDevs].caps.dwSupport,
(long)type, (long)0);
MODM_NumDevs++;
}
......@@ -1169,14 +1173,16 @@ static void ALSA_AddMidiPort(snd_seq_client_info_t* cinfo, snd_seq_port_info_t*
* not MIDICAPS_CACHE.
*/
MidiInDev[MIDM_NumDevs].caps.dwSupport = MIDICAPS_VOLUME|MIDICAPS_LRVOLUME;
strcpy(MidiInDev[MIDM_NumDevs].caps.szPname, snd_seq_client_info_get_name(cinfo));
MultiByteToWideChar(CP_ACP, 0, snd_seq_client_info_get_name(cinfo), -1,
MidiInDev[MIDM_NumDevs].caps.szPname,
sizeof(MidiInDev[MIDM_NumDevs].caps.szPname) / sizeof(WCHAR));
MidiInDev[MIDM_NumDevs].state = 0;
TRACE("MidiIn [%d]\tname='%s' support=%ld\n"
"\tALSA info: midi dev-type=%lx, capa=%lx\n",
MIDM_NumDevs, MidiInDev[MIDM_NumDevs].caps.szPname, MidiInDev[MIDM_NumDevs].caps.dwSupport,
(long)type, (long)0);
"\tALSA info: midi dev-type=%lx, capa=%lx\n",
MIDM_NumDevs, wine_dbgstr_w(MidiInDev[MIDM_NumDevs].caps.szPname),
MidiInDev[MIDM_NumDevs].caps.dwSupport,
(long)type, (long)0);
MIDM_NumDevs++;
}
......@@ -1280,7 +1286,7 @@ DWORD WINAPI ALSA_midMessage(UINT wDevID, UINT wMsg, DWORD dwUser,
case MIDM_UNPREPARE:
return midUnprepare(wDevID, (LPMIDIHDR)dwParam1, dwParam2);
case MIDM_GETDEVCAPS:
return midGetDevCaps(wDevID, (LPMIDIINCAPSA)dwParam1,dwParam2);
return midGetDevCaps(wDevID, (LPMIDIINCAPSW)dwParam1,dwParam2);
case MIDM_GETNUMDEVS:
return MIDM_NumDevs;
case MIDM_RESET:
......@@ -1326,7 +1332,7 @@ DWORD WINAPI ALSA_modMessage(UINT wDevID, UINT wMsg, DWORD dwUser,
case MODM_UNPREPARE:
return modUnprepare(wDevID, (LPMIDIHDR)dwParam1, dwParam2);
case MODM_GETDEVCAPS:
return modGetDevCaps(wDevID, (LPMIDIOUTCAPSA)dwParam1, dwParam2);
return modGetDevCaps(wDevID, (LPMIDIOUTCAPSW)dwParam1, dwParam2);
case MODM_GETNUMDEVS:
return MODM_NumDevs;
case MODM_GETVOLUME:
......
......@@ -35,8 +35,6 @@
* does something need to be done in for WaveIn DirectSound?
*/
/*#define EMULATE_SB16*/
#include "config.h"
#include "wine/port.h"
......@@ -53,11 +51,12 @@
#include "winbase.h"
#include "wingdi.h"
#include "winerror.h"
#include "wine/winuser16.h"
#include "winuser.h"
#include "mmddk.h"
#include "dsound.h"
#include "dsdriver.h"
#include "arts.h"
#include "wine/unicode.h"
#include "wine/debug.h"
WINE_DEFAULT_DEBUG_CHANNEL(wave);
......@@ -147,7 +146,7 @@ typedef struct {
WAVEOPENDESC waveDesc;
WORD wFlags;
PCMWAVEFORMAT format;
WAVEOUTCAPSA caps;
WAVEOUTCAPSW caps;
char interface_name[32];
DWORD dwSleepTime; /* Num of milliseconds to sleep between filling the dsp buffers */
......@@ -185,7 +184,7 @@ typedef struct {
WAVEOPENDESC waveDesc;
WORD wFlags;
PCMWAVEFORMAT format;
WAVEINCAPSA caps;
WAVEINCAPSW caps;
char interface_name[32];
/* arts information */
......@@ -413,23 +412,14 @@ LONG ARTS_WaveInit(void)
/* initialize all device handles to -1 */
for (i = 0; i < MAX_WAVEOUTDRV; ++i)
{
static const WCHAR ini[] = {'a','R','t','s',' ','W','a','v','e','O','u','t','D','r','i','v','e','r',0};
WOutDev[i].play_stream = (arts_stream_t*)-1;
memset(&WOutDev[i].caps, 0, sizeof(WOutDev[i].caps)); /* zero out
caps values */
/* FIXME: some programs compare this string against the content of the registry
* for MM drivers. The names have to match in order for the program to work
* (e.g. MS win9x mplayer.exe)
*/
#ifdef EMULATE_SB16
WOutDev[i].caps.wMid = 0x0002;
WOutDev[i].caps.wPid = 0x0104;
strcpy(WOutDev[i].caps.szPname, "SB16 Wave Out");
#else
WOutDev[i].caps.wMid = 0x00FF; /* Manufac ID */
WOutDev[i].caps.wPid = 0x0001; /* Product ID */
/* strcpy(WOutDev[i].caps.szPname, "OpenSoundSystem WAVOUT Driver");*/
strcpy(WOutDev[i].caps.szPname, "CS4236/37/38");
#endif
strcpyW(WOutDev[i].caps.szPname, ini);
snprintf(WOutDev[i].interface_name, sizeof(WOutDev[i].interface_name), "winearts: %d", i);
WOutDev[i].caps.vDriverVersion = 0x0100;
......@@ -455,22 +445,14 @@ LONG ARTS_WaveInit(void)
for (i = 0; i < MAX_WAVEINDRV; ++i)
{
static const WCHAR ini[] = {'a','R','t','s',' ','W','a','v','e','I','n',' ','D','r','i','v','e','r',0};
WInDev[i].record_stream = (arts_stream_t*)-1;
memset(&WInDev[i].caps, 0, sizeof(WInDev[i].caps)); /* zero out
caps values */
/* FIXME: some programs compare this string against the content of the registry
* for MM drivers. The names have to match in order for the program to work
* (e.g. MS win9x mplayer.exe)
*/
#ifdef EMULATE_SB16
WInDev[i].caps.wMid = 0x0002;
WInDev[i].caps.wPid = 0x0104;
strcpy(WInDev[i].caps.szPname, "SB16 Wave In");
#else
WInDev[i].caps.wMid = 0x00FF;
WInDev[i].caps.wPid = 0x0001;
strcpy(WInDev[i].caps.szPname,"CS4236/37/38");
#endif
strcpyW(WInDev[i].caps.szPname, ini);
snprintf(WInDev[i].interface_name, sizeof(WInDev[i].interface_name), "winearts: %d", i);
WInDev[i].caps.vDriverVersion = 0x0100;
......@@ -506,7 +488,7 @@ static int ARTS_InitRingMessage(ARTS_MSG_RING* mr)
{
mr->msg_toget = 0;
mr->msg_tosave = 0;
mr->msg_event = CreateEventA(NULL, FALSE, FALSE, NULL);
mr->msg_event = CreateEventW(NULL, FALSE, FALSE, NULL);
mr->ring_buffer_size = ARTS_RING_BUFFER_INCREMENT;
mr->messages = HeapAlloc(GetProcessHeap(),HEAP_ZERO_MEMORY,mr->ring_buffer_size * sizeof(RING_MSG));
InitializeCriticalSection(&mr->msg_crst);
......@@ -557,7 +539,7 @@ static int ARTS_AddRingMessage(ARTS_MSG_RING* mr, enum win_wm_message msg, DWORD
}
if (wait)
{
hEvent = CreateEventA(NULL, FALSE, FALSE, NULL);
hEvent = CreateEventW(NULL, FALSE, FALSE, NULL);
if (hEvent == INVALID_HANDLE_VALUE)
{
ERR("can't create event !?\n");
......@@ -770,6 +752,12 @@ static int wodPlayer_WriteMaxFrags(WINE_WAVEOUT* wwo, DWORD* bytes)
TRACE("Writing wavehdr %p.%lu[%lu]\n",
wwo->lpPlayPtr, wwo->dwPartialOffset, wwo->lpPlayPtr->dwBufferLength);
if (dwLength == 0)
{
wodPlayer_PlayPtrNext(wwo);
return 0;
}
/* see if our buffer isn't large enough for the data we are writing */
if(wwo->buffer_size < toWrite)
{
......@@ -1118,7 +1106,7 @@ static DWORD CALLBACK wodPlayer(LPVOID pmt)
/**************************************************************************
* wodGetDevCaps [internal]
*/
static DWORD wodGetDevCaps(WORD wDevID, LPWAVEOUTCAPSA lpCaps, DWORD dwSize)
static DWORD wodGetDevCaps(WORD wDevID, LPWAVEOUTCAPSW lpCaps, DWORD dwSize)
{
TRACE("(%u, %p, %lu);\n", wDevID, lpCaps, dwSize);
......@@ -1226,7 +1214,7 @@ static DWORD wodOpen(WORD wDevID, LPWAVEOPENDESC lpDesc, DWORD dwFlags)
/* create player thread */
if (!(dwFlags & WAVE_DIRECTSOUND)) {
wwo->hStartUpEvent = CreateEventA(NULL, FALSE, FALSE, NULL);
wwo->hStartUpEvent = CreateEventW(NULL, FALSE, FALSE, NULL);
wwo->hThread = CreateThread(NULL, 0, wodPlayer, (LPVOID)(DWORD)wDevID, 0, &(wwo->dwThreadID));
WaitForSingleObject(wwo->hStartUpEvent, INFINITE);
CloseHandle(wwo->hStartUpEvent);
......@@ -1565,7 +1553,7 @@ DWORD WINAPI ARTS_wodMessage(UINT wDevID, UINT wMsg, DWORD dwUser,
case WODM_BREAKLOOP: return wodBreakLoop (wDevID);
case WODM_PREPARE: return wodPrepare (wDevID, (LPWAVEHDR)dwParam1, dwParam2);
case WODM_UNPREPARE: return wodUnprepare (wDevID, (LPWAVEHDR)dwParam1, dwParam2);
case WODM_GETDEVCAPS: return wodGetDevCaps (wDevID, (LPWAVEOUTCAPSA)dwParam1, dwParam2);
case WODM_GETDEVCAPS: return wodGetDevCaps (wDevID, (LPWAVEOUTCAPSW)dwParam1, dwParam2);
case WODM_GETNUMDEVS: return wodGetNumDevs ();
case WODM_GETPITCH: return MMSYSERR_NOTSUPPORTED;
case WODM_SETPITCH: return MMSYSERR_NOTSUPPORTED;
......@@ -1656,7 +1644,7 @@ static DWORD widNotifyClient(WINE_WAVEIN* wwi, WORD wMsg, DWORD dwParam1, DWORD
/**************************************************************************
* widGetDevCaps [internal]
*/
static DWORD widGetDevCaps(WORD wDevID, LPWAVEINCAPSA lpCaps, DWORD dwSize)
static DWORD widGetDevCaps(WORD wDevID, LPWAVEINCAPSW lpCaps, DWORD dwSize)
{
TRACE("(%u, %p, %lu);\n", wDevID, lpCaps, dwSize);
......@@ -1919,7 +1907,7 @@ static DWORD widOpen(WORD wDevID, LPWAVEOPENDESC lpDesc, DWORD dwFlags)
/* create recorder thread */
if (!(dwFlags & WAVE_DIRECTSOUND)) {
wwi->hStartUpEvent = CreateEventA(NULL, FALSE, FALSE, NULL);
wwi->hStartUpEvent = CreateEventW(NULL, FALSE, FALSE, NULL);
wwi->hThread = CreateThread(NULL, 0, widRecorder, (LPVOID)(DWORD)wDevID, 0, &(wwi->dwThreadID));
WaitForSingleObject(wwi->hStartUpEvent, INFINITE);
CloseHandle(wwi->hStartUpEvent);
......@@ -2098,7 +2086,7 @@ DWORD WINAPI ARTS_widMessage(UINT wDevID, UINT wMsg, DWORD dwUser,
case WIDM_ADDBUFFER: return widAddBuffer (wDevID, (LPWAVEHDR)dwParam1, dwParam2);
case WIDM_PREPARE: return widPrepare (wDevID, (LPWAVEHDR)dwParam1, dwParam2);
case WIDM_UNPREPARE: return widUnprepare (wDevID, (LPWAVEHDR)dwParam1, dwParam2);
case WIDM_GETDEVCAPS: return widGetDevCaps (wDevID, (LPWAVEINCAPSA)dwParam1, dwParam2);
case WIDM_GETDEVCAPS: return widGetDevCaps (wDevID, (LPWAVEINCAPSW)dwParam1, dwParam2);
case WIDM_GETNUMDEVS: return widGetNumDevs ();
case WIDM_RESET: return widReset (wDevID);
case WIDM_START: return widStart (wDevID);
......
/* -*- tab-width: 8; c-basic-offset: 4 -*- */
/*
* Wine Driver for Libaudioio
* Derived from the Wine OSS Sample Driver
......@@ -36,8 +35,6 @@
* better)
*/
/*#define EMULATE_SB16*/
#include "config.h"
#include <stdlib.h>
......@@ -62,7 +59,6 @@
#include "winbase.h"
#include "wingdi.h"
#include "winerror.h"
#include "wine/winuser16.h"
#include "mmddk.h"
#include "dsound.h"
#include "dsdriver.h"
......@@ -150,7 +146,7 @@ typedef struct {
int msg_toget;
HANDLE msg_event;
CRITICAL_SECTION msg_crst;
WAVEOUTCAPSA caps;
WAVEOUTCAPSW caps;
/* DirectSound stuff */
LPBYTE mapping;
......@@ -166,7 +162,7 @@ typedef struct {
PCMWAVEFORMAT format;
LPWAVEHDR lpQueuePtr;
DWORD dwTotalRecorded;
WAVEINCAPSA caps;
WAVEINCAPSW caps;
BOOL bTriggerSupport;
/* synchronization stuff */
......@@ -248,49 +244,40 @@ LONG LIBAUDIOIO_WaveInit(void)
int bytespersmpl;
int caps;
int mask;
int i;
int i;
int audio_fd;
int mode;
static const WCHAR ini_out[] = {'A','u','d','i','o','I','O',' ','W','a','v','e','O','u','t',' ','D','r','i','v','e','r',0};
static const WCHAR ini_in [] = {'A','u','d','i','o','I','O',' ','W','a','v','e','I','n',' ',' ','D','r','i','v','e','r',0};
int audio_fd;
int mode;
TRACE("Init ENTERED rate = %d\n",spec[PLAYBACK].rate);
spec[RECORD].channels=spec[PLAYBACK].channels=2;
spec[RECORD].max_blocks=spec[PLAYBACK].max_blocks=16;
spec[RECORD].rate=spec[PLAYBACK].rate=44100;
spec[RECORD].encoding=spec[PLAYBACK].encoding= ENCODE_PCM;
spec[RECORD].precision=spec[PLAYBACK].precision=16 ;
spec[RECORD].endian=spec[PLAYBACK].endian=ENDIAN_INTEL;
spec[RECORD].disable_threads=spec[PLAYBACK].disable_threads=1;
spec[RECORD].type=spec[PLAYBACK].type=TYPE_SIGNED; /* in 16 bit mode this is what typical PC hardware expects */
spec[RECORD].channels=spec[PLAYBACK].channels=2;
spec[RECORD].max_blocks=spec[PLAYBACK].max_blocks=16;
spec[RECORD].rate=spec[PLAYBACK].rate=44100;
spec[RECORD].encoding=spec[PLAYBACK].encoding= ENCODE_PCM;
spec[RECORD].precision=spec[PLAYBACK].precision=16 ;
spec[RECORD].endian=spec[PLAYBACK].endian=ENDIAN_INTEL;
spec[RECORD].disable_threads=spec[PLAYBACK].disable_threads=1;
spec[RECORD].type=spec[PLAYBACK].type=TYPE_SIGNED; /* in 16 bit mode this is what typical PC hardware expects */
mode = O_WRONLY|O_NDELAY;
mode = O_WRONLY|O_NDELAY;
/* start with output device */
/* start with output device */
/* initialize all device handles to -1 */
for (i = 0; i < MAX_WAVEOUTDRV; ++i)
{
WOutDev[i].unixdev = -1;
}
/* initialize all device handles to -1 */
for (i = 0; i < MAX_WAVEOUTDRV; ++i)
{
WOutDev[i].unixdev = -1;
}
/* FIXME: only one device is supported */
memset(&WOutDev[0].caps, 0, sizeof(WOutDev[0].caps));
/* FIXME: some programs compare this string against the content of the registry
* for MM drivers. The names have to match in order for the program to work
* (e.g. MS win9x mplayer.exe)
*/
#ifdef EMULATE_SB16
WOutDev[0].caps.wMid = 0x0002;
WOutDev[0].caps.wPid = 0x0104;
strcpy(WOutDev[0].caps.szPname, "SB16 Wave Out");
#else
WOutDev[0].caps.wMid = 0x00FF; /* Manufac ID */
WOutDev[0].caps.wPid = 0x0001; /* Product ID */
/* strcpy(WOutDev[0].caps.szPname, "OpenSoundSystem WAVOUT Driver");*/
strcpy(WOutDev[0].caps.szPname, "CS4236/37/38");
#endif
strcpyW(WOutDev[0].caps.szPname, ini_out);
WOutDev[0].caps.vDriverVersion = 0x0100;
WOutDev[0].caps.dwFormats = 0x00000000;
WOutDev[0].caps.dwSupport = WAVECAPS_VOLUME;
......@@ -317,9 +304,9 @@ LONG LIBAUDIOIO_WaveInit(void)
* For Big Endian machines libaudioio will convert the data to bigendian for us
*/
WOutDev[0].caps.dwFormats |= WAVE_FORMAT_4M16;
if (WOutDev[0].caps.wChannels > 1)
WOutDev[0].caps.dwFormats |= WAVE_FORMAT_4S16;
WOutDev[0].caps.dwFormats |= WAVE_FORMAT_4M16;
if (WOutDev[0].caps.wChannels > 1)
WOutDev[0].caps.dwFormats |= WAVE_FORMAT_4S16;
/* Don't understand this yet, but I don't think this functionality is portable, leave it here for future evaluation
* if (IOCTL(audio, SNDCTL_DSP_GETCAPS, caps) == 0) {
......@@ -342,24 +329,16 @@ LONG LIBAUDIOIO_WaveInit(void)
TRACE("out dwFormats = %08lX, dwSupport = %08lX\n",
WOutDev[0].caps.dwFormats, WOutDev[0].caps.dwSupport);
for (i = 0; i < MAX_WAVEINDRV; ++i)
{
WInDev[i].unixdev = -1;
}
memset(&WInDev[0].caps, 0, sizeof(WInDev[0].caps));
for (i = 0; i < MAX_WAVEINDRV; ++i)
{
WInDev[i].unixdev = -1;
}
memset(&WInDev[0].caps, 0, sizeof(WInDev[0].caps));
#ifdef EMULATE_SB16
WInDev[0].caps.wMid = 0x0002;
WInDev[0].caps.wPid = 0x0004;
strcpy(WInDev[0].caps.szPname, "SB16 Wave In");
#else
WInDev[0].caps.wMid = 0x00FF; /* Manufac ID */
WInDev[0].caps.wPid = 0x0001; /* Product ID */
strcpy(WInDev[0].caps.szPname, "OpenSoundSystem WAVIN Driver");
#endif
strcpyW(WInDev[0].caps.szPname, ini_in);
WInDev[0].caps.dwFormats = 0x00000000;
WInDev[0].caps.wChannels = spec[RECORD].channels;
......@@ -778,7 +757,7 @@ static DWORD CALLBACK wodPlayer(LPVOID pmt)
/**************************************************************************
* wodGetDevCaps [internal]
*/
static DWORD wodGetDevCaps(WORD wDevID, LPWAVEOUTCAPSA lpCaps, DWORD dwSize)
static DWORD wodGetDevCaps(WORD wDevID, LPWAVEOUTCAPSW lpCaps, DWORD dwSize)
{
TRACE("(%u, %p, %lu);\n", wDevID, lpCaps, dwSize);
......@@ -912,12 +891,12 @@ static DWORD wodOpen(WORD wDevID, LPWAVEOPENDESC lpDesc, DWORD dwFlags)
wwo->msg_toget = 0;
wwo->msg_tosave = 0;
wwo->msg_event = CreateEventA(NULL, FALSE, FALSE, NULL);
wwo->msg_event = CreateEventW(NULL, FALSE, FALSE, NULL);
memset(wwo->messages, 0, sizeof(WWO_MSG)*WWO_RING_BUFFER_SIZE);
InitializeCriticalSection(&wwo->msg_crst);
if (!(dwFlags & WAVE_DIRECTSOUND)) {
wwo->hEvent = CreateEventA(NULL, FALSE, FALSE, NULL);
wwo->hEvent = CreateEventW(NULL, FALSE, FALSE, NULL);
wwo->hThread = CreateThread(NULL, 0, wodPlayer, (LPVOID)(DWORD)wDevID, 0, &(wwo->dwThreadID));
WaitForSingleObject(wwo->hEvent, INFINITE);
} else {
......@@ -1247,7 +1226,7 @@ DWORD WINAPI LIBAUDIOIO_wodMessage(UINT wDevID, UINT wMsg, DWORD dwUser,
case WODM_BREAKLOOP: return MMSYSERR_NOTSUPPORTED;
case WODM_PREPARE: return wodPrepare (wDevID, (LPWAVEHDR)dwParam1, dwParam2);
case WODM_UNPREPARE: return wodUnprepare (wDevID, (LPWAVEHDR)dwParam1, dwParam2);
case WODM_GETDEVCAPS: return wodGetDevCaps (wDevID, (LPWAVEOUTCAPSA)dwParam1, dwParam2);
case WODM_GETDEVCAPS: return wodGetDevCaps (wDevID, (LPWAVEOUTCAPSW)dwParam1, dwParam2);
case WODM_GETNUMDEVS: return wodGetNumDevs ();
case WODM_GETPITCH: return MMSYSERR_NOTSUPPORTED;
case WODM_SETPITCH: return MMSYSERR_NOTSUPPORTED;
......@@ -1708,7 +1687,7 @@ static DWORD wodDsDesc(UINT wDevID, PDSDRIVERDESC desc)
/**************************************************************************
* widGetDevCaps [internal]
*/
static DWORD widGetDevCaps(WORD wDevID, LPWAVEINCAPSA lpCaps, DWORD dwSize)
static DWORD widGetDevCaps(WORD wDevID, LPWAVEINCAPSW lpCaps, DWORD dwSize)
{
TRACE("(%u, %p, %lu);\n", wDevID, lpCaps, dwSize);
......@@ -2041,7 +2020,7 @@ static DWORD widOpen(WORD wDevID, LPWAVEOPENDESC lpDesc, DWORD dwFlags)
wwi->format.wf.nSamplesPerSec, wwi->format.wf.nChannels,
wwi->format.wf.nBlockAlign);
wwi->hEvent = CreateEventA(NULL, FALSE, FALSE, NULL);
wwi->hEvent = CreateEventW(NULL, FALSE, FALSE, NULL);
wwi->hThread = CreateThread(NULL, 0, widRecorder, (LPVOID)(DWORD)wDevID, 0, &(wwi->dwThreadID));
WaitForSingleObject(wwi->hEvent, INFINITE);
......@@ -2239,7 +2218,7 @@ DWORD WINAPI LIBAUDIOIO_widMessage(WORD wDevID, WORD wMsg, DWORD dwUser,
case WIDM_ADDBUFFER: return widAddBuffer (wDevID, (LPWAVEHDR)dwParam1, dwParam2);
case WIDM_PREPARE: return widPrepare (wDevID, (LPWAVEHDR)dwParam1, dwParam2);
case WIDM_UNPREPARE: return widUnprepare (wDevID, (LPWAVEHDR)dwParam1, dwParam2);
case WIDM_GETDEVCAPS: return widGetDevCaps (wDevID, (LPWAVEINCAPSA)dwParam1, dwParam2);
case WIDM_GETDEVCAPS: return widGetDevCaps (wDevID, (LPWAVEINCAPSW)dwParam1, dwParam2);
case WIDM_GETNUMDEVS: return wodGetNumDevs (); /* same number of devices in output as in input */
case WIDM_GETPOS: return widGetPosition(wDevID, (LPMMTIME)dwParam1, dwParam2);
case WIDM_RESET: return widReset (wDevID);
......
/* -*- tab-width: 8; c-basic-offset: 2 -*- */
/*
* Wine Driver for jack Sound Server
* http://jackit.sourceforge.net
......@@ -48,7 +47,6 @@
#include "winbase.h"
#include "wingdi.h"
#include "winerror.h"
#include "wine/winuser16.h"
#include "mmddk.h"
#include "dsound.h"
#include "dsdriver.h"
......@@ -126,7 +124,7 @@ typedef struct {
WAVEOPENDESC waveDesc;
WORD wFlags;
PCMWAVEFORMAT format;
WAVEOUTCAPSA caps;
WAVEOUTCAPSW caps;
WORD wDevID;
char interface_name[32];
......@@ -169,7 +167,7 @@ typedef struct {
PCMWAVEFORMAT format;
LPWAVEHDR lpQueuePtr;
DWORD dwTotalRecorded;
WAVEINCAPSA caps;
WAVEINCAPSW caps;
BOOL bTriggerSupport;
WORD wDevID;
char interface_name[32];
......@@ -894,6 +892,9 @@ LONG JACK_WaveInit(void)
{
int i;
static const WCHAR ini_out[] = {'J','A','C','K',' ','W','a','v','e','O','u','t',' ','D','r','i','v','e','r',0};
static const WCHAR ini_in [] = {'J','A','C','K',' ','W','a','v','e','I','n',' ',' ','D','r','i','v','e','r',0};
TRACE("called\n");
/* setup function pointers */
......@@ -928,20 +929,9 @@ LONG JACK_WaveInit(void)
memset(&WOutDev[i].caps, 0, sizeof(WOutDev[i].caps));
/* FIXME: some programs compare this string against the content of the registry
* for MM drivers. The names have to match in order for the program to work
* (e.g. MS win9x mplayer.exe)
*/
#ifdef EMULATE_SB16
WOutDev[i].caps.wMid = 0x0002;
WOutDev[i].caps.wPid = 0x0104;
strcpy(WOutDev[i].caps.szPname, "SB16 Wave Out");
#else
WOutDev[i].caps.wMid = 0x00FF; /* Manufac ID */
WOutDev[i].caps.wPid = 0x0001; /* Product ID */
/* strcpy(WOutDev[i].caps.szPname, "OpenSoundSystem WAVOUT Driver");*/
strcpy(WOutDev[i].caps.szPname, "CS4236/37/38");
#endif
strcpyW(WOutDev[i].caps.szPname, ini_out);
snprintf(WOutDev[i].interface_name, sizeof(WOutDev[i].interface_name), "winejack: %d", i);
......@@ -973,19 +963,9 @@ LONG JACK_WaveInit(void)
/* TODO: we should initialize read stuff here */
memset(&WInDev[0].caps, 0, sizeof(WInDev[0].caps));
/* FIXME: some programs compare this string against the content of the registry
* for MM drivers. The names have to match in order for the program to work
* (e.g. MS win9x mplayer.exe)
*/
#ifdef EMULATE_SB16
WInDev[i].caps.wMid = 0x0002;
WInDev[i].caps.wPid = 0x0104;
strcpy(WInDev[i].caps.szPname, "SB16 Wave In");
#else
WInDev[i].caps.wMid = 0x00FF;
WInDev[i].caps.wPid = 0x0001;
strcpy(WInDev[i].caps.szPname,"CS4236/37/38");
#endif
strcpyW(WInDev[i].caps.szPname, ini_in);
snprintf(WInDev[i].interface_name, sizeof(WInDev[i].interface_name), "winejack: %d", i);
WInDev[i].caps.vDriverVersion = 0x0100;
......@@ -1237,7 +1217,7 @@ static void wodHelper_Reset(WINE_WAVEOUT* wwo, BOOL reset)
/**************************************************************************
* wodGetDevCaps [internal]
*/
static DWORD wodGetDevCaps(WORD wDevID, LPWAVEOUTCAPSA lpCaps, DWORD dwSize)
static DWORD wodGetDevCaps(WORD wDevID, LPWAVEOUTCAPSW lpCaps, DWORD dwSize)
{
TRACE("(%u, %p, %lu);\n", wDevID, lpCaps, dwSize);
......@@ -1751,7 +1731,7 @@ DWORD WINAPI JACK_wodMessage(UINT wDevID, UINT wMsg, DWORD dwUser,
case WODM_BREAKLOOP: return wodBreakLoop(wDevID);
case WODM_PREPARE: return wodPrepare(wDevID, (LPWAVEHDR)dwParam1, dwParam2);
case WODM_UNPREPARE: return wodUnprepare(wDevID, (LPWAVEHDR)dwParam1, dwParam2);
case WODM_GETDEVCAPS: return wodGetDevCaps(wDevID, (LPWAVEOUTCAPSA)dwParam1, dwParam2);
case WODM_GETDEVCAPS: return wodGetDevCaps(wDevID, (LPWAVEOUTCAPSW)dwParam1, dwParam2);
case WODM_GETNUMDEVS: return wodGetNumDevs();
case WODM_GETPITCH: return MMSYSERR_NOTSUPPORTED;
case WODM_SETPITCH: return MMSYSERR_NOTSUPPORTED;
......@@ -2094,7 +2074,7 @@ static int JACK_OpenWaveInDevice(WINE_WAVEIN* wwi, WORD nChannels)
/**************************************************************************
* widGetDevCaps [internal]
*/
static DWORD widGetDevCaps(WORD wDevID, LPWAVEINCAPSA lpCaps, DWORD dwSize)
static DWORD widGetDevCaps(WORD wDevID, LPWAVEINCAPSW lpCaps, DWORD dwSize)
{
TRACE("(%u, %p, %lu);\n", wDevID, lpCaps, dwSize);
......@@ -2486,7 +2466,7 @@ DWORD WINAPI JACK_widMessage(WORD wDevID, WORD wMsg, DWORD dwUser,
case WIDM_ADDBUFFER: return widAddBuffer (wDevID, (LPWAVEHDR)dwParam1, dwParam2);
case WIDM_PREPARE: return widPrepare (wDevID, (LPWAVEHDR)dwParam1, dwParam2);
case WIDM_UNPREPARE: return widUnprepare (wDevID, (LPWAVEHDR)dwParam1, dwParam2);
case WIDM_GETDEVCAPS: return widGetDevCaps (wDevID, (LPWAVEINCAPSA)dwParam1, dwParam2);
case WIDM_GETDEVCAPS: return widGetDevCaps (wDevID, (LPWAVEINCAPSW)dwParam1, dwParam2);
case WIDM_GETNUMDEVS: return widGetNumDevs();
case WIDM_RESET: return widReset (wDevID);
case WIDM_START: return widStart (wDevID);
......
......@@ -47,10 +47,8 @@
# include <sys/time.h>
#endif
#include <fcntl.h>
#include <math.h>
#if 0
#define EMULATE_SB16
#endif
#define FRAG_SIZE 1024
#define FRAG_COUNT 10
......@@ -75,12 +73,13 @@
#include "windef.h"
#include "winbase.h"
#include "wingdi.h"
#include "winuser.h"
#include "winerror.h"
#include "wine/winuser16.h"
#include "mmddk.h"
#include "dsound.h"
#include "dsdriver.h"
#include "nas.h"
#include "wine/unicode.h"
#include "wine/debug.h"
WINE_DEFAULT_DEBUG_CHANNEL(wave);
......@@ -148,7 +147,7 @@ typedef struct {
WAVEOPENDESC waveDesc;
WORD wFlags;
PCMWAVEFORMAT format;
WAVEOUTCAPSA caps;
WAVEOUTCAPSW caps;
int Id;
int open;
......@@ -417,25 +416,15 @@ LONG NAS_WaveInit(void)
/* initialize all device handles to -1 */
for (i = 0; i < MAX_WAVEOUTDRV; ++i)
{
static const WCHAR ini[] = {'N','A','S',' ','W','A','V','E','O','U','T',' ','D','r','i','v','e','r',0};
memset(&WOutDev[i].caps, 0, sizeof(WOutDev[i].caps)); /* zero out caps values */
WOutDev[i].AuServ = AuServ;
WOutDev[i].AuDev = AuNone;
WOutDev[i].Id = i;
/* FIXME: some programs compare this string against the content of the registry
* for MM drivers. The names have to match in order for the program to work
* (e.g. MS win9x mplayer.exe)
*/
#ifdef EMULATE_SB16
WOutDev[i].caps.wMid = 0x0002;
WOutDev[i].caps.wPid = 0x0104;
strcpy(WOutDev[i].caps.szPname, "SB16 Wave Out");
#else
WOutDev[i].caps.wMid = 0x00FF; /* Manufac ID */
WOutDev[i].caps.wPid = 0x0001; /* Product ID */
/* strcpy(WOutDev[i].caps.szPname, "OpenSoundSystem WAVOUT Driver");*/
strcpy(WOutDev[i].caps.szPname, "CS4236/37/38");
#endif
strcpyW(WOutDev[i].caps.szPname, ini);
WOutDev[i].AuFlow = 0;
WOutDev[i].caps.vDriverVersion = 0x0100;
WOutDev[i].caps.dwFormats = 0x00000000;
......@@ -472,7 +461,7 @@ static int NAS_InitRingMessage(MSG_RING* mr)
{
mr->msg_toget = 0;
mr->msg_tosave = 0;
mr->msg_event = CreateEventA(NULL, FALSE, FALSE, NULL);
mr->msg_event = CreateEventW(NULL, FALSE, FALSE, NULL);
mr->ring_buffer_size = NAS_RING_BUFFER_INCREMENT;
mr->messages = HeapAlloc(GetProcessHeap(),HEAP_ZERO_MEMORY,mr->ring_buffer_size * sizeof(RING_MSG));
InitializeCriticalSection(&mr->msg_crst);
......@@ -522,7 +511,7 @@ static int NAS_AddRingMessage(MSG_RING* mr, enum win_wm_message msg, DWORD param
}
if (wait)
{
hEvent = CreateEventA(NULL, FALSE, FALSE, NULL);
hEvent = CreateEventW(NULL, FALSE, FALSE, NULL);
if (hEvent == INVALID_HANDLE_VALUE)
{
ERR("can't create event !?\n");
......@@ -884,7 +873,7 @@ static DWORD CALLBACK wodPlayer(LPVOID pmt)
/**************************************************************************
* wodGetDevCaps [internal]
*/
static DWORD wodGetDevCaps(WORD wDevID, LPWAVEOUTCAPSA lpCaps, DWORD dwSize)
static DWORD wodGetDevCaps(WORD wDevID, LPWAVEOUTCAPSW lpCaps, DWORD dwSize)
{
TRACE("(%u, %p, %lu);\n", wDevID, lpCaps, dwSize);
......@@ -969,7 +958,7 @@ static DWORD wodOpen(WORD wDevID, LPWAVEOPENDESC lpDesc, DWORD dwFlags)
/* create player thread */
if (!(dwFlags & WAVE_DIRECTSOUND)) {
wwo->hStartUpEvent = CreateEventA(NULL, FALSE, FALSE, NULL);
wwo->hStartUpEvent = CreateEventW(NULL, FALSE, FALSE, NULL);
wwo->hThread = CreateThread(NULL, 0, wodPlayer, (LPVOID)(DWORD)wDevID, 0, &(wwo->dwThreadID));
WaitForSingleObject(wwo->hStartUpEvent, INFINITE);
CloseHandle(wwo->hStartUpEvent);
......@@ -1273,7 +1262,7 @@ DWORD WINAPI NAS_wodMessage(UINT wDevID, UINT wMsg, DWORD dwUser,
case WODM_BREAKLOOP: return wodBreakLoop (wDevID);
case WODM_PREPARE: return wodPrepare (wDevID, (LPWAVEHDR)dwParam1, dwParam2);
case WODM_UNPREPARE: return wodUnprepare (wDevID, (LPWAVEHDR)dwParam1, dwParam2);
case WODM_GETDEVCAPS: return wodGetDevCaps (wDevID, (LPWAVEOUTCAPSA)dwParam1, dwParam2);
case WODM_GETDEVCAPS: return wodGetDevCaps (wDevID, (LPWAVEOUTCAPSW)dwParam1, dwParam2);
case WODM_GETNUMDEVS: return wodGetNumDevs ();
case WODM_GETPITCH: return MMSYSERR_NOTSUPPORTED;
case WODM_SETPITCH: return MMSYSERR_NOTSUPPORTED;
......
......@@ -26,8 +26,6 @@
* Direct Sound Capture driver does not work (not complete yet)
*/
/*#define EMULATE_SB16*/
/* an exact wodGetPosition is usually not worth the extra context switches,
* as we're going to have near fragment accuracy anyway */
#define EXACT_WODPOSITION
......@@ -58,8 +56,9 @@
#include "windef.h"
#include "winbase.h"
#include "wingdi.h"
#include "winuser.h"
#include "winnls.h"
#include "winerror.h"
#include "wine/winuser16.h"
#include "mmddk.h"
#include "mmreg.h"
#include "dsound.h"
......@@ -121,7 +120,7 @@ static const char * getCmdString(enum win_wm_message msg)
#undef MSG_TO_STR
sprintf(unknown, "UNKNOWN(0x%08x)", msg);
return unknown;
};
}
int getEnables(OSS_DEVICE *ossdev)
{
......@@ -518,9 +517,10 @@ void OSS_CloseDevice(OSS_DEVICE* ossdev)
}
if (ossdev->open_count == 0)
{
/* reset the device before we close it in case it is in a bad state */
ioctl(ossdev->fd, SNDCTL_DSP_RESET, 0);
close(ossdev->fd);
fcntl(ossdev->fd, F_SETFL, fcntl(ossdev->fd, F_GETFL) & ~O_NDELAY);
/* reset the device before we close it in case it is in a bad state */
ioctl(ossdev->fd, SNDCTL_DSP_RESET, 0);
if (close(ossdev->fd) != 0) FIXME("Cannot close %d: %s\n", ossdev->fd, strerror(errno));
}
}
......@@ -555,9 +555,9 @@ static DWORD OSS_ResetDevice(OSS_DEVICE* ossdev)
return ret;
}
const static int win_std_oss_fmts[2]={AFMT_U8,AFMT_S16_LE};
const static int win_std_rates[5]={96000,48000,44100,22050,11025};
const static int win_std_formats[2][2][5]=
static const int win_std_oss_fmts[2]={AFMT_U8,AFMT_S16_LE};
static const int win_std_rates[5]={96000,48000,44100,22050,11025};
static const int win_std_formats[2][2][5]=
{{{WAVE_FORMAT_96M08, WAVE_FORMAT_48M08, WAVE_FORMAT_4M08,
WAVE_FORMAT_2M08, WAVE_FORMAT_1M08},
{WAVE_FORMAT_96S08, WAVE_FORMAT_48S08, WAVE_FORMAT_4S08,
......@@ -688,7 +688,9 @@ static BOOL OSS_WaveOutInit(OSS_DEVICE* ossdev)
if (ioctl(mixer, SOUND_MIXER_INFO, &info) >= 0) {
strncpy(ossdev->ds_desc.szDesc, info.name, sizeof(info.name));
strcpy(ossdev->ds_desc.szDrvName, "wineoss.drv");
strncpy(ossdev->out_caps.szPname, info.name, sizeof(info.name));
MultiByteToWideChar(CP_ACP, 0, info.name, sizeof(info.name),
ossdev->out_caps.szPname,
sizeof(ossdev->out_caps.szPname) / sizeof(WCHAR));
TRACE("%s\n", ossdev->ds_desc.szDesc);
} else {
/* FreeBSD up to at least 5.2 provides this ioctl, but does not
......@@ -709,18 +711,9 @@ static BOOL OSS_WaveOutInit(OSS_DEVICE* ossdev)
if (WINE_TRACE_ON(wave))
OSS_Info(ossdev->fd);
/* FIXME: some programs compare this string against the content of the
* registry for MM drivers. The names have to match in order for the
* program to work (e.g. MS win9x mplayer.exe)
*/
#ifdef EMULATE_SB16
ossdev->out_caps.wMid = 0x0002;
ossdev->out_caps.wPid = 0x0104;
strcpy(ossdev->out_caps.szPname, "SB16 Wave Out");
#else
ossdev->out_caps.wMid = 0x00FF; /* Manufac ID */
ossdev->out_caps.wPid = 0x0001; /* Product ID */
#endif
ossdev->out_caps.vDriverVersion = 0x0100;
ossdev->out_caps.wChannels = 1;
ossdev->out_caps.dwFormats = 0x00000000;
......@@ -844,7 +837,9 @@ static BOOL OSS_WaveInInit(OSS_DEVICE* ossdev)
if ((mixer = open(ossdev->mixer_name, O_RDONLY|O_NDELAY)) >= 0) {
mixer_info info;
if (ioctl(mixer, SOUND_MIXER_INFO, &info) >= 0) {
strncpy(ossdev->in_caps.szPname, info.name, sizeof(info.name));
MultiByteToWideChar(CP_ACP, 0, info.name, -1,
ossdev->in_caps.szPname,
sizeof(ossdev->in_caps.szPname) / sizeof(WCHAR));
TRACE("%s\n", ossdev->ds_desc.szDesc);
} else {
/* FreeBSD up to at least 5.2 provides this ioctl, but does not
......@@ -865,15 +860,9 @@ static BOOL OSS_WaveInInit(OSS_DEVICE* ossdev)
if (WINE_TRACE_ON(wave))
OSS_Info(ossdev->fd);
/* See comment in OSS_WaveOutInit */
#ifdef EMULATE_SB16
ossdev->in_caps.wMid = 0x0002;
ossdev->in_caps.wPid = 0x0004;
strcpy(ossdev->in_caps.szPname, "SB16 Wave In");
#else
ossdev->in_caps.wMid = 0x00FF; /* Manufac ID */
ossdev->in_caps.wPid = 0x0001; /* Product ID */
#endif
ossdev->in_caps.dwFormats = 0x00000000;
ossdev->in_caps.wChannels = 1;
ossdev->in_caps.wReserved1 = 0;
......@@ -1128,7 +1117,7 @@ static int OSS_InitRingMessage(OSS_MSG_RING* omr)
ERR("could not create pipe, error=%s\n", strerror(errno));
}
#else
omr->msg_event = CreateEventA(NULL, FALSE, FALSE, NULL);
omr->msg_event = CreateEventW(NULL, FALSE, FALSE, NULL);
#endif
omr->ring_buffer_size = OSS_RING_BUFFER_INCREMENT;
omr->messages = HeapAlloc(GetProcessHeap(),HEAP_ZERO_MEMORY,omr->ring_buffer_size * sizeof(OSS_MSG));
......@@ -1185,7 +1174,7 @@ static int OSS_AddRingMessage(OSS_MSG_RING* omr, enum win_wm_message msg, DWORD
}
if (wait)
{
hEvent = CreateEventA(NULL, FALSE, FALSE, NULL);
hEvent = CreateEventW(NULL, FALSE, FALSE, NULL);
if (hEvent == INVALID_HANDLE_VALUE)
{
ERR("can't create event !?\n");
......@@ -1477,8 +1466,9 @@ static DWORD wodPlayer_NotifyCompletions(WINE_WAVEOUT* wwo, BOOL force)
* - we hit the beginning of a running loop
* - we hit a wavehdr which hasn't finished playing
*/
while ((lpWaveHdr = wwo->lpQueuePtr) &&
(force ||
#if 0
while ((lpWaveHdr = wwo->lpQueuePtr) &&
(force ||
(lpWaveHdr != wwo->lpPlayPtr &&
lpWaveHdr != wwo->lpLoopPtr &&
lpWaveHdr->reserved <= wwo->dwPlayedTotal))) {
......@@ -1490,7 +1480,26 @@ static DWORD wodPlayer_NotifyCompletions(WINE_WAVEOUT* wwo, BOOL force)
wodNotifyClient(wwo, WOM_DONE, (DWORD)lpWaveHdr, 0);
}
return (lpWaveHdr && lpWaveHdr != wwo->lpPlayPtr && lpWaveHdr != wwo->lpLoopPtr) ?
#else
for (;;)
{
lpWaveHdr = wwo->lpQueuePtr;
if (!lpWaveHdr) {TRACE("Empty queue\n"); break;}
if (!force)
{
if (lpWaveHdr == wwo->lpPlayPtr) {TRACE("play %p\n", lpWaveHdr); break;}
if (lpWaveHdr == wwo->lpLoopPtr) {TRACE("loop %p\n", lpWaveHdr); break;}
if (lpWaveHdr->reserved > wwo->dwPlayedTotal){TRACE("still playing %p (%lu/%lu)\n", lpWaveHdr, lpWaveHdr->reserved, wwo->dwPlayedTotal);break;}
}
wwo->lpQueuePtr = lpWaveHdr->lpNext;
lpWaveHdr->dwFlags &= ~WHDR_INQUEUE;
lpWaveHdr->dwFlags |= WHDR_DONE;
wodNotifyClient(wwo, WOM_DONE, (DWORD)lpWaveHdr, 0);
}
#endif
return (lpWaveHdr && lpWaveHdr != wwo->lpPlayPtr && lpWaveHdr != wwo->lpLoopPtr) ?
wodPlayer_NotifyWait(wwo, lpWaveHdr) : INFINITE;
}
......@@ -1649,7 +1658,7 @@ static DWORD wodPlayer_FeedDSP(WINE_WAVEOUT* wwo)
audio_buf_info dspspace;
DWORD availInQ;
wodUpdatePlayedTotal(wwo, &dspspace);
if (!wodUpdatePlayedTotal(wwo, &dspspace)) return INFINITE;
availInQ = dspspace.bytes;
TRACE("fragments=%d/%d, fragsize=%d, bytes=%d\n",
dspspace.fragments, dspspace.fragstotal, dspspace.fragsize, dspspace.bytes);
......@@ -1742,7 +1751,7 @@ static DWORD CALLBACK wodPlayer(LPVOID pmt)
/**************************************************************************
* wodGetDevCaps [internal]
*/
static DWORD wodGetDevCaps(WORD wDevID, LPWAVEOUTCAPSA lpCaps, DWORD dwSize)
static DWORD wodGetDevCaps(WORD wDevID, LPWAVEOUTCAPSW lpCaps, DWORD dwSize)
{
TRACE("(%u, %p, %lu);\n", wDevID, lpCaps, dwSize);
......@@ -1922,7 +1931,7 @@ DWORD wodOpen(WORD wDevID, LPWAVEOPENDESC lpDesc, DWORD dwFlags)
OSS_InitRingMessage(&wwo->msgRing);
wwo->hStartUpEvent = CreateEventA(NULL, FALSE, FALSE, NULL);
wwo->hStartUpEvent = CreateEventW(NULL, FALSE, FALSE, NULL);
wwo->hThread = CreateThread(NULL, 0, wodPlayer, (LPVOID)(DWORD)wDevID, 0, &(wwo->dwThreadID));
WaitForSingleObject(wwo->hStartUpEvent, INFINITE);
CloseHandle(wwo->hStartUpEvent);
......@@ -2257,7 +2266,7 @@ DWORD WINAPI OSS_wodMessage(UINT wDevID, UINT wMsg, DWORD dwUser,
case WODM_BREAKLOOP: return wodBreakLoop (wDevID);
case WODM_PREPARE: return wodPrepare (wDevID, (LPWAVEHDR)dwParam1, dwParam2);
case WODM_UNPREPARE: return wodUnprepare (wDevID, (LPWAVEHDR)dwParam1, dwParam2);
case WODM_GETDEVCAPS: return wodGetDevCaps (wDevID, (LPWAVEOUTCAPSA)dwParam1, dwParam2);
case WODM_GETDEVCAPS: return wodGetDevCaps (wDevID, (LPWAVEOUTCAPSW)dwParam1, dwParam2);
case WODM_GETNUMDEVS: return numOutDev;
case WODM_GETPITCH: return MMSYSERR_NOTSUPPORTED;
case WODM_SETPITCH: return MMSYSERR_NOTSUPPORTED;
......@@ -2313,7 +2322,7 @@ static DWORD widNotifyClient(WINE_WAVEIN* wwi, WORD wMsg, DWORD dwParam1, DWORD
/**************************************************************************
* widGetDevCaps [internal]
*/
static DWORD widGetDevCaps(WORD wDevID, LPWAVEINCAPSA lpCaps, DWORD dwSize)
static DWORD widGetDevCaps(WORD wDevID, LPWAVEINCAPSW lpCaps, DWORD dwSize)
{
TRACE("(%u, %p, %lu);\n", wDevID, lpCaps, dwSize);
......@@ -2810,7 +2819,7 @@ DWORD widOpen(WORD wDevID, LPWAVEOPENDESC lpDesc, DWORD dwFlags)
OSS_InitRingMessage(&wwi->msgRing);
wwi->hStartUpEvent = CreateEventA(NULL, FALSE, FALSE, NULL);
wwi->hStartUpEvent = CreateEventW(NULL, FALSE, FALSE, NULL);
wwi->hThread = CreateThread(NULL, 0, widRecorder, (LPVOID)(DWORD)wDevID, 0, &(wwi->dwThreadID));
WaitForSingleObject(wwi->hStartUpEvent, INFINITE);
CloseHandle(wwi->hStartUpEvent);
......@@ -3006,7 +3015,7 @@ DWORD WINAPI OSS_widMessage(WORD wDevID, WORD wMsg, DWORD dwUser,
case WIDM_ADDBUFFER: return widAddBuffer (wDevID, (LPWAVEHDR)dwParam1, dwParam2);
case WIDM_PREPARE: return widPrepare (wDevID, (LPWAVEHDR)dwParam1, dwParam2);
case WIDM_UNPREPARE: return widUnprepare (wDevID, (LPWAVEHDR)dwParam1, dwParam2);
case WIDM_GETDEVCAPS: return widGetDevCaps (wDevID, (LPWAVEINCAPSA)dwParam1, dwParam2);
case WIDM_GETDEVCAPS: return widGetDevCaps (wDevID, (LPWAVEINCAPSW)dwParam1, dwParam2);
case WIDM_GETNUMDEVS: return numInDev;
case WIDM_GETPOS: return widGetPosition(wDevID, (LPMMTIME)dwParam1, dwParam2);
case WIDM_RESET: return widReset (wDevID);
......
......@@ -84,9 +84,9 @@ typedef struct tagOSS_DEVICE {
char* mixer_name;
char* interface_name;
unsigned open_count;
WAVEOUTCAPSA out_caps;
WAVEOUTCAPSA duplex_out_caps;
WAVEINCAPSA in_caps;
WAVEOUTCAPSW out_caps;
WAVEOUTCAPSW duplex_out_caps;
WAVEINCAPSW in_caps;
DWORD in_caps_support;
unsigned open_access;
int fd;
......
......@@ -43,8 +43,8 @@
#include "windef.h"
#include "winbase.h"
#include "wingdi.h"
#include "winuser.h"
#include "winerror.h"
#include "wine/winuser16.h"
#include "mmddk.h"
#include "mmreg.h"
#include "dsound.h"
......@@ -961,8 +961,6 @@ static DWORD CALLBACK DSCDB_Thread(LPVOID lpParameter)
}
}
}
return TRUE;
}
static HRESULT WINAPI IDsCaptureDriverImpl_CreateCaptureBuffer(
......@@ -1202,8 +1200,8 @@ static HRESULT WINAPI IDsCaptureDriverImpl_CreateCaptureBuffer(
This->capture_buffer = *ippdscdb;
(*ippdscdb)->hStartUpEvent = CreateEventA(NULL, FALSE, FALSE, NULL);
(*ippdscdb)->hExitEvent = CreateEventA(NULL, FALSE, FALSE, NULL);
(*ippdscdb)->hStartUpEvent = CreateEventW(NULL, FALSE, FALSE, NULL);
(*ippdscdb)->hExitEvent = CreateEventW(NULL, FALSE, FALSE, NULL);
(*ippdscdb)->hThread = CreateThread(NULL, 0, DSCDB_Thread, (LPVOID)(*ippdscdb), 0, &((*ippdscdb)->dwThreadID));
WaitForSingleObject((*ippdscdb)->hStartUpEvent, INFINITE);
......
......@@ -46,8 +46,8 @@
#include "windef.h"
#include "winbase.h"
#include "wingdi.h"
#include "winuser.h"
#include "winerror.h"
#include "wine/winuser16.h"
#include "mmddk.h"
#include "mmreg.h"
#include "dsound.h"
......@@ -920,7 +920,7 @@ static HRESULT WINAPI IDsDriverNotifyImpl_Create(
*pdsdn = dsdn;
return DS_OK;
};
}
DWORD wodDsCreate(UINT wDevID, PIDSDRIVER* drv)
{
......
......@@ -60,8 +60,10 @@
#include "winbase.h"
#include "wingdi.h"
#include "winuser.h"
#include "winnls.h"
#include "mmddk.h"
#include "oss.h"
#include "wine/unicode.h"
#include "wine/debug.h"
WINE_DEFAULT_DEBUG_CHANNEL(midi);
......@@ -81,7 +83,7 @@ typedef struct {
unsigned char incPrev;
char incLen;
DWORD startTime;
MIDIINCAPSA caps;
MIDIINCAPSW caps;
} WINE_MIDIIN;
typedef struct {
......@@ -92,7 +94,7 @@ typedef struct {
LPMIDIHDR lpQueueHdr;
DWORD dwTotalPlayed;
void* lpExtra; /* according to port type (MIDI, FM...), extra data when needed */
MIDIOUTCAPSA caps;
MIDIOUTCAPSW caps;
} WINE_MIDIOUT;
static WINE_MIDIIN MidiInDev [MAX_MIDIINDRV ];
......@@ -159,7 +161,6 @@ static int MIDI_UnixToWindowsDeviceType(int type)
"Assuming FM Synth\n");
return MOD_FMSYNTH;
}
return MOD_FMSYNTH;
}
/**************************************************************************
......@@ -221,16 +222,19 @@ BOOL OSS_MidiInit(void)
sinfo.device = i;
status = ioctl(midiSeqFD, SNDCTL_SYNTH_INFO, &sinfo);
if (status == -1) {
static const WCHAR fmt[] = {'W','i','n','e',' ','O','S','S',' ','M','i','d','i',' ','O','u','t',' ','(','#','%','d',')',' ','-',' ','d','i','s','a','b','l','e','d',0};
ERR("ioctl for synth info failed on %d, disabling it.\n", i);
sprintf(MidiOutDev[i].caps.szPname, "Wine OSS Midi Out (#%d) - disabled", i);
wsprintfW(MidiOutDev[i].caps.szPname, fmt, i);
MidiOutDev[i].caps.wTechnology = MOD_MIDIPORT;
MidiOutDev[i].caps.wVoices = 16;
MidiOutDev[i].caps.wNotes = 16;
MidiOutDev[i].bEnabled = FALSE;
} else {
strcpy(MidiOutDev[i].caps.szPname, sinfo.name);
MultiByteToWideChar( CP_ACP, 0, sinfo.name, -1,
MidiOutDev[i].caps.szPname,
sizeof(MidiOutDev[i].caps.szPname)/sizeof(WCHAR) );
MidiOutDev[i].caps.wTechnology = MIDI_UnixToWindowsDeviceType(sinfo.synth_type);
MidiOutDev[i].caps.wVoices = sinfo.nr_voices;
......@@ -253,7 +257,8 @@ BOOL OSS_MidiInit(void)
TRACE("SynthOut[%d]\tname='%s' techn=%d voices=%d notes=%d chnMsk=%04x support=%ld\n"
"\tOSS info: synth subtype=%d capa=%lx\n",
i, MidiOutDev[i].caps.szPname, MidiOutDev[i].caps.wTechnology,
i, wine_dbgstr_w(MidiOutDev[i].caps.szPname),
MidiOutDev[i].caps.wTechnology,
MidiOutDev[i].caps.wVoices, MidiOutDev[i].caps.wNotes,
MidiOutDev[i].caps.wChannelMask, MidiOutDev[i].caps.dwSupport,
sinfo.synth_subtype, (long)sinfo.capabilities);
......@@ -297,10 +302,13 @@ BOOL OSS_MidiInit(void)
/* Product Version. We simply say "1" */
MidiOutDev[numsynthdevs + i].caps.vDriverVersion = 0x001;
if (status == -1) {
sprintf(MidiOutDev[numsynthdevs + i].caps.szPname, "Wine OSS Midi Out (#%d) - disabled", numsynthdevs + i);
static const WCHAR fmt[] = {'W','i','n','e',' ','O','S','S',' ','M','i','d','i',' ','O','u','t',' ','(','#','%','d',')',' ','-',' ','d','i','s','a','b','l','e','d',0};
wsprintfW(MidiOutDev[numsynthdevs + i].caps.szPname, fmt, numsynthdevs + i);
MidiOutDev[numsynthdevs + i].bEnabled = FALSE;
} else {
strcpy(MidiOutDev[numsynthdevs + i].caps.szPname, minfo.name);
MultiByteToWideChar(CP_ACP, 0, minfo.name, -1,
MidiOutDev[numsynthdevs + i].caps.szPname,
sizeof(MidiOutDev[numsynthdevs + i].caps.szPname) / sizeof(WCHAR));
MidiOutDev[numsynthdevs + i].bEnabled = TRUE;
}
MidiOutDev[numsynthdevs + i].caps.wTechnology = MOD_MIDIPORT; /* FIXME Is this right? */
......@@ -325,10 +333,13 @@ BOOL OSS_MidiInit(void)
/* Product Version. We simply say "1" */
MidiInDev[i].caps.vDriverVersion = 0x001;
if (status == -1) {
sprintf(MidiInDev[i].caps.szPname, "Wine OSS Midi In (#%d) - disabled", numsynthdevs + i);
static const WCHAR fmt[] = {'W','i','n','e',' ','O','S','S',' ','M','i','d','i',' ','I','n',' ','(','#','%','d',')',' ','-',' ','d','i','s','a','b','l','e','d',0};
wsprintfW(MidiInDev[i].caps.szPname, fmt, numsynthdevs + i);
MidiInDev[i].state = -1;
} else {
strcpy(MidiInDev[i].caps.szPname, minfo.name);
MultiByteToWideChar(CP_ACP, 0, minfo.name, -1,
MidiInDev[i].caps.szPname,
sizeof(MidiInDev[i].caps.szPname) / sizeof(WCHAR));
MidiInDev[i].state = 0;
}
/* FIXME : could we get better information than that ? */
......@@ -337,10 +348,11 @@ BOOL OSS_MidiInit(void)
TRACE("MidiOut[%d]\tname='%s' techn=%d voices=%d notes=%d chnMsk=%04x support=%ld\n"
"MidiIn [%d]\tname='%s' support=%ld\n"
"\tOSS info: midi dev-type=%d, capa=%lx\n",
i, MidiOutDev[numsynthdevs + i].caps.szPname, MidiOutDev[numsynthdevs + i].caps.wTechnology,
i, wine_dbgstr_w(MidiOutDev[numsynthdevs + i].caps.szPname),
MidiOutDev[numsynthdevs + i].caps.wTechnology,
MidiOutDev[numsynthdevs + i].caps.wVoices, MidiOutDev[numsynthdevs + i].caps.wNotes,
MidiOutDev[numsynthdevs + i].caps.wChannelMask, MidiOutDev[numsynthdevs + i].caps.dwSupport,
i, MidiInDev[i].caps.szPname, MidiInDev[i].caps.dwSupport,
i, wine_dbgstr_w(MidiInDev[i].caps.szPname), MidiInDev[i].caps.dwSupport,
minfo.dev_type, (long)minfo.capabilities);
}
......@@ -663,7 +675,7 @@ static DWORD WINAPI midRecThread(LPVOID arg)
/**************************************************************************
* midGetDevCaps [internal]
*/
static DWORD midGetDevCaps(WORD wDevID, LPMIDIINCAPSA lpCaps, DWORD dwSize)
static DWORD midGetDevCaps(WORD wDevID, LPMIDIINCAPSW lpCaps, DWORD dwSize)
{
TRACE("(%04X, %p, %08lX);\n", wDevID, lpCaps, dwSize);
......@@ -1037,7 +1049,7 @@ static void modFMReset(WORD wDevID)
/**************************************************************************
* modGetDevCaps [internal]
*/
static DWORD modGetDevCaps(WORD wDevID, LPMIDIOUTCAPSA lpCaps, DWORD dwSize)
static DWORD modGetDevCaps(WORD wDevID, LPMIDIOUTCAPSW lpCaps, DWORD dwSize)
{
TRACE("(%04X, %p, %08lX);\n", wDevID, lpCaps, dwSize);
......@@ -1669,7 +1681,7 @@ DWORD WINAPI OSS_midMessage(UINT wDevID, UINT wMsg, DWORD dwUser,
case MIDM_UNPREPARE:
return midUnprepare(wDevID, (LPMIDIHDR)dwParam1, dwParam2);
case MIDM_GETDEVCAPS:
return midGetDevCaps(wDevID, (LPMIDIINCAPSA)dwParam1,dwParam2);
return midGetDevCaps(wDevID, (LPMIDIINCAPSW)dwParam1,dwParam2);
case MIDM_GETNUMDEVS:
return MIDM_NumDevs;
case MIDM_RESET:
......@@ -1715,7 +1727,7 @@ DWORD WINAPI OSS_modMessage(UINT wDevID, UINT wMsg, DWORD dwUser,
case MODM_UNPREPARE:
return modUnprepare(wDevID, (LPMIDIHDR)dwParam1, dwParam2);
case MODM_GETDEVCAPS:
return modGetDevCaps(wDevID, (LPMIDIOUTCAPSA)dwParam1, dwParam2);
return modGetDevCaps(wDevID, (LPMIDIOUTCAPSW)dwParam1, dwParam2);
case MODM_GETNUMDEVS:
return MODM_NumDevs;
case MODM_GETVOLUME:
......
......@@ -45,8 +45,10 @@
#define NONAMELESSSTRUCT
#include "windef.h"
#include "winbase.h"
#include "winnls.h"
#include "mmddk.h"
#include "oss.h"
#include "wine/unicode.h"
#include "wine/debug.h"
WINE_DEFAULT_DEBUG_CHANNEL(mixer);
......@@ -82,7 +84,7 @@ static const char* MIX_Names [SOUND_MIXER_NRDEVICES] = SOUND_DEVICE_NAMES;
struct mixerCtrl
{
DWORD dwLineID;
MIXERCONTROLA ctrl;
MIXERCONTROLW ctrl;
};
struct mixer
......@@ -257,6 +259,11 @@ static const char * getTargetType(DWORD dwType)
return str;
}
static const WCHAR sz_short_volume [] = {'V','o','l',0};
static const WCHAR sz_long_volume [] = {'V','o','l','u','m','e',0};
static const WCHAR sz_shrtlng_mute [] = {'M','u','t','e',0};
static const WCHAR sz_shrtlng_mixer[] = {'M','i','x','e','r',0};
/**************************************************************************
* MIX_FillLineControls [internal]
*/
......@@ -270,7 +277,7 @@ static void MIX_FillLineControls(struct mixer* mix, int c, DWORD lineID,
getControlType(dwControlType));
mc->dwLineID = lineID;
mc->ctrl.cbStruct = sizeof(MIXERCONTROLA);
mc->ctrl.cbStruct = sizeof(MIXERCONTROLW);
mc->ctrl.dwControlID = c + 1;
mc->ctrl.dwControlType = dwControlType;
......@@ -279,8 +286,8 @@ static void MIX_FillLineControls(struct mixer* mix, int c, DWORD lineID,
case MIXERCONTROL_CONTROLTYPE_VOLUME:
mc->ctrl.fdwControl = 0;
mc->ctrl.cMultipleItems = 0;
lstrcpynA(mc->ctrl.szShortName, "Vol", MIXER_SHORT_NAME_CHARS);
lstrcpynA(mc->ctrl.szName, "Volume", MIXER_LONG_NAME_CHARS);
strcpyW(mc->ctrl.szShortName, sz_short_volume);
strcpyW(mc->ctrl.szName, sz_long_volume);
memset(&mc->ctrl.Bounds, 0, sizeof(mc->ctrl.Bounds));
/* CONTROLTYPE_VOLUME uses the MIXER_CONTROLDETAILS_UNSIGNED struct,
* [0, 100] is the range supported by OSS
......@@ -296,8 +303,8 @@ static void MIX_FillLineControls(struct mixer* mix, int c, DWORD lineID,
case MIXERCONTROL_CONTROLTYPE_ONOFF:
mc->ctrl.fdwControl = 0;
mc->ctrl.cMultipleItems = 0;
lstrcpynA(mc->ctrl.szShortName, "Mute", MIXER_SHORT_NAME_CHARS);
lstrcpynA(mc->ctrl.szName, "Mute", MIXER_LONG_NAME_CHARS);
strcpyW(mc->ctrl.szShortName, sz_shrtlng_mute);
strcpyW(mc->ctrl.szName, sz_shrtlng_mute);
memset(&mc->ctrl.Bounds, 0, sizeof(mc->ctrl.Bounds));
mc->ctrl.Bounds.s1.dwMinimum = 0;
mc->ctrl.Bounds.s1.dwMaximum = 1;
......@@ -310,8 +317,8 @@ static void MIX_FillLineControls(struct mixer* mix, int c, DWORD lineID,
for (j = 0; j < SOUND_MIXER_NRDEVICES; j++)
if (WINE_CHN_SUPPORTS(mix->recMask, j))
mc->ctrl.cMultipleItems++;
lstrcpynA(mc->ctrl.szShortName, "Mixer", MIXER_SHORT_NAME_CHARS);
lstrcpynA(mc->ctrl.szName, "Mixer", MIXER_LONG_NAME_CHARS);
strcpyW(mc->ctrl.szShortName, sz_shrtlng_mixer);
strcpyW(mc->ctrl.szName, sz_shrtlng_mixer);
memset(&mc->ctrl.Bounds, 0, sizeof(mc->ctrl.Bounds));
mc->ctrl.Bounds.s1.dwMaximum = mc->ctrl.cMultipleItems - 1;
memset(&mc->ctrl.Metrics, 0, sizeof(mc->ctrl.Metrics));
......@@ -589,10 +596,11 @@ static BOOL MIX_SetRecSrc(struct mixer* mix, unsigned mask)
/**************************************************************************
* MIX_GetDevCaps [internal]
*/
static DWORD MIX_GetDevCaps(WORD wDevID, LPMIXERCAPSA lpCaps, DWORD dwSize)
static DWORD MIX_GetDevCaps(WORD wDevID, LPMIXERCAPSW lpCaps, DWORD dwSize)
{
struct mixer* mix;
MIXERCAPSA capsA;
MIXERCAPSW capsW;
const char* name;
TRACE("(%04X, %p, %lu);\n", wDevID, lpCaps, dwSize);
......@@ -606,18 +614,15 @@ static DWORD MIX_GetDevCaps(WORD wDevID, LPMIXERCAPSA lpCaps, DWORD dwSize)
return MMSYSERR_BADDEVICEID;
}
capsA.wMid = WINE_MIXER_MANUF_ID;
capsA.wPid = WINE_MIXER_PRODUCT_ID;
capsA.vDriverVersion = WINE_MIXER_VERSION;
if (mix->name)
strcpy(capsA.szPname, mix->name);
else
strcpy(capsA.szPname, WINE_MIXER_NAME);
capsA.cDestinations = 2; /* speakers & record */
capsA.fdwSupport = 0; /* No bits defined yet */
capsW.wMid = WINE_MIXER_MANUF_ID;
capsW.wPid = WINE_MIXER_PRODUCT_ID;
capsW.vDriverVersion = WINE_MIXER_VERSION;
if (!(name = mix->name)) name = WINE_MIXER_NAME;
MultiByteToWideChar(CP_ACP, 0, name, -1, capsW.szPname, sizeof(capsW.szPname) / sizeof(WCHAR));
capsW.cDestinations = 2; /* speakers & record */
capsW.fdwSupport = 0; /* No bits defined yet */
memcpy(lpCaps, &capsA, min(dwSize, sizeof(capsA)));
memcpy(lpCaps, &capsW, min(dwSize, sizeof(capsW)));
return MMSYSERR_NOERROR;
}
......@@ -625,7 +630,7 @@ static DWORD MIX_GetDevCaps(WORD wDevID, LPMIXERCAPSA lpCaps, DWORD dwSize)
/**************************************************************************
* MIX_GetLineInfoDst [internal]
*/
static DWORD MIX_GetLineInfoDst(struct mixer* mix, LPMIXERLINEA lpMl,
static DWORD MIX_GetLineInfoDst(struct mixer* mix, LPMIXERLINEW lpMl,
DWORD dst)
{
unsigned mask;
......@@ -653,8 +658,8 @@ static DWORD MIX_GetLineInfoDst(struct mixer* mix, LPMIXERLINEA lpMl,
return MMSYSERR_ERROR;
}
lpMl->dwSource = 0xFFFFFFFF;
lstrcpynA(lpMl->szShortName, MIX_Labels[j], MIXER_SHORT_NAME_CHARS);
lstrcpynA(lpMl->szName, MIX_Names[j], MIXER_LONG_NAME_CHARS);
MultiByteToWideChar(CP_ACP, 0, MIX_Labels[j], -1, lpMl->szShortName, sizeof(lpMl->szShortName) / sizeof(WCHAR));
MultiByteToWideChar(CP_ACP, 0, MIX_Names[j], -1, lpMl->szName, sizeof(lpMl->szName) / sizeof(WCHAR));
/* we have all connections found in the MIX_DevMask */
lpMl->cConnections = 0;
......@@ -676,7 +681,7 @@ static DWORD MIX_GetLineInfoDst(struct mixer* mix, LPMIXERLINEA lpMl,
/**************************************************************************
* MIX_GetLineInfoSrc [internal]
*/
static DWORD MIX_GetLineInfoSrc(struct mixer* mix, LPMIXERLINEA lpMl,
static DWORD MIX_GetLineInfoSrc(struct mixer* mix, LPMIXERLINEW lpMl,
DWORD idx, DWORD dst)
{
int i, j;
......@@ -684,8 +689,8 @@ static DWORD MIX_GetLineInfoSrc(struct mixer* mix, LPMIXERLINEA lpMl,
TRACE("(%p, %p, %ld, %08lx)\n", mix, lpMl, idx, dst);
strcpy(lpMl->szShortName, MIX_Labels[idx]);
strcpy(lpMl->szName, MIX_Names[idx]);
MultiByteToWideChar(CP_ACP, 0, MIX_Labels[idx], -1, lpMl->szShortName, sizeof(lpMl->szShortName) / sizeof(WCHAR));
MultiByteToWideChar(CP_ACP, 0, MIX_Names[idx], -1, lpMl->szName, sizeof(lpMl->szName) / sizeof(WCHAR));
lpMl->dwLineID = MAKELONG(dst, idx);
lpMl->dwDestination = dst;
lpMl->cConnections = 1;
......@@ -760,7 +765,7 @@ static BOOL MIX_CheckLine(DWORD lineID)
/**************************************************************************
* MIX_GetLineInfo [internal]
*/
static DWORD MIX_GetLineInfo(WORD wDevID, LPMIXERLINEA lpMl, DWORD fdwInfo)
static DWORD MIX_GetLineInfo(WORD wDevID, LPMIXERLINEW lpMl, DWORD fdwInfo)
{
int i, j;
DWORD ret = MMSYSERR_NOERROR;
......@@ -908,14 +913,13 @@ static DWORD MIX_GetLineInfo(WORD wDevID, LPMIXERLINEA lpMl, DWORD fdwInfo)
}
if ((fdwInfo & MIXER_GETLINEINFOF_QUERYMASK) != MIXER_GETLINEINFOF_TARGETTYPE) {
const char* name;
lpMl->Target.dwDeviceID = 0xFFFFFFFF;
lpMl->Target.wMid = WINE_MIXER_MANUF_ID;
lpMl->Target.wPid = WINE_MIXER_PRODUCT_ID;
lpMl->Target.vDriverVersion = WINE_MIXER_VERSION;
if (mix->name)
strcpy(lpMl->Target.szPname, mix->name);
else
strcpy(lpMl->Target.szPname, WINE_MIXER_NAME);
if (!(name = mix->name)) name = WINE_MIXER_NAME;
MultiByteToWideChar(CP_ACP, 0, name, -1, lpMl->Target.szPname, sizeof(lpMl->Target.szPname) / sizeof(WCHAR));
}
return ret;
......@@ -935,7 +939,7 @@ static BOOL MIX_CheckControl(struct mixer* mix, DWORD ctrlID)
/**************************************************************************
* MIX_GetLineControls [internal]
*/
static DWORD MIX_GetLineControls(WORD wDevID, LPMIXERLINECONTROLSA lpMlc,
static DWORD MIX_GetLineControls(WORD wDevID, LPMIXERLINECONTROLSW lpMlc,
DWORD flags)
{
DWORD dwRet = MMSYSERR_NOERROR;
......@@ -954,9 +958,9 @@ static DWORD MIX_GetLineControls(WORD wDevID, LPMIXERLINECONTROLSA lpMlc,
return MMSYSERR_INVALPARAM;
}
if (lpMlc->cbmxctrl < sizeof(MIXERCONTROLA)) {
if (lpMlc->cbmxctrl < sizeof(MIXERCONTROLW)) {
WARN("invalid parameter: lpMlc->cbmxctrl = %ld < %d\n",
lpMlc->cbmxctrl, sizeof(MIXERCONTROLA));
lpMlc->cbmxctrl, sizeof(MIXERCONTROLW));
return MMSYSERR_INVALPARAM;
}
......@@ -1212,17 +1216,18 @@ static DWORD MIX_GetControlDetails(WORD wDevID, LPMIXERCONTROLDETAILS lpmcd,
if (mix->ctrl[c].ctrl.dwControlType == MIXERCONTROL_CONTROLTYPE_MUX ||
mix->ctrl[c].ctrl.dwControlType == MIXERCONTROL_CONTROLTYPE_MIXER)
{
LPMIXERCONTROLDETAILS_LISTTEXTA mcdlt;
LPMIXERCONTROLDETAILS_LISTTEXTW mcdlt;
int i, j;
mcdlt = (LPMIXERCONTROLDETAILS_LISTTEXTA)lpmcd->paDetails;
mcdlt = (LPMIXERCONTROLDETAILS_LISTTEXTW)lpmcd->paDetails;
for (i = j = 0; j < SOUND_MIXER_NRDEVICES; j++)
{
if (WINE_CHN_SUPPORTS(mix->recMask, j))
{
mcdlt[i].dwParam1 = MAKELONG(LINEID_RECORD, j);
mcdlt[i].dwParam2 = 0;
strcpy(mcdlt[i].szName, MIX_Names[j]);
MultiByteToWideChar(CP_ACP, 0, MIX_Names[j], -1,
mcdlt[i].szName, sizeof(mcdlt[i]) / sizeof(WCHAR));
i++;
}
}
......@@ -1529,9 +1534,9 @@ DWORD WINAPI OSS_mxdMessage(UINT wDevID, UINT wMsg, DWORD dwUser,
/* FIXME: Pretend this is supported */
return 0;
case MXDM_GETDEVCAPS:
return MIX_GetDevCaps(wDevID, (LPMIXERCAPSA)dwParam1, dwParam2);
return MIX_GetDevCaps(wDevID, (LPMIXERCAPSW)dwParam1, dwParam2);
case MXDM_GETLINEINFO:
return MIX_GetLineInfo(wDevID, (LPMIXERLINEA)dwParam1, dwParam2);
return MIX_GetLineInfo(wDevID, (LPMIXERLINEW)dwParam1, dwParam2);
case MXDM_GETNUMDEVS:
return MIX_GetNumDevs();
case MXDM_OPEN:
......@@ -1540,7 +1545,7 @@ DWORD WINAPI OSS_mxdMessage(UINT wDevID, UINT wMsg, DWORD dwUser,
case MXDM_CLOSE:
return MMSYSERR_NOERROR;
case MXDM_GETLINECONTROLS:
return MIX_GetLineControls(wDevID, (LPMIXERLINECONTROLSA)dwParam1, dwParam2);
return MIX_GetLineControls(wDevID, (LPMIXERLINECONTROLSW)dwParam1, dwParam2);
case MXDM_GETCONTROLDETAILS:
return MIX_GetControlDetails(wDevID, (LPMIXERCONTROLDETAILS)dwParam1, dwParam2);
case MXDM_SETCONTROLDETAILS:
......
/* -*- tab-width: 8; c-basic-offset: 4 -*- */
/*
* Sample AUXILARY Wine Driver
*
......@@ -19,8 +18,6 @@
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
#define EMULATE_SB16
#include "config.h"
#include <stdarg.h>
......@@ -38,6 +35,7 @@
#include "winbase.h"
#include "mmddk.h"
#include "oss.h"
#include "wine/unicode.h"
#include "wine/debug.h"
WINE_DEFAULT_DEBUG_CHANNEL(mmaux);
......@@ -67,9 +65,10 @@ static int AUXDRV_Init(void)
/**************************************************************************
* AUX_GetDevCaps [internal]
*/
static DWORD AUX_GetDevCaps(WORD wDevID, LPAUXCAPSA lpCaps, DWORD dwSize)
static DWORD AUX_GetDevCaps(WORD wDevID, LPAUXCAPSW lpCaps, DWORD dwSize)
{
int mixer,volume;
int mixer, volume;
static const WCHAR ini[] = {'O','S','S',' ','A','u','x',0};
TRACE("(%04X, %p, %lu);\n", wDevID, lpCaps, dwSize);
if (lpCaps == NULL) return MMSYSERR_NOTENABLED;
......@@ -83,50 +82,13 @@ static DWORD AUX_GetDevCaps(WORD wDevID, LPAUXCAPSA lpCaps, DWORD dwSize)
return MMSYSERR_NOTENABLED;
}
close(mixer);
#ifdef EMULATE_SB16
lpCaps->wMid = 0x0002;
lpCaps->vDriverVersion = 0x0200;
lpCaps->dwSupport = AUXCAPS_VOLUME | AUXCAPS_LRVOLUME;
switch (wDevID) {
case 0:
lpCaps->wPid = 0x0196;
strcpy(lpCaps->szPname, "SB16 Aux: Wave");
lpCaps->wTechnology = AUXCAPS_AUXIN;
break;
case 1:
lpCaps->wPid = 0x0197;
strcpy(lpCaps->szPname, "SB16 Aux: Midi Synth");
lpCaps->wTechnology = AUXCAPS_AUXIN;
break;
case 2:
lpCaps->wPid = 0x0191;
strcpy(lpCaps->szPname, "SB16 Aux: CD");
lpCaps->wTechnology = AUXCAPS_CDAUDIO;
break;
case 3:
lpCaps->wPid = 0x0192;
strcpy(lpCaps->szPname, "SB16 Aux: Line-In");
lpCaps->wTechnology = AUXCAPS_AUXIN;
break;
case 4:
lpCaps->wPid = 0x0193;
strcpy(lpCaps->szPname, "SB16 Aux: Mic");
lpCaps->wTechnology = AUXCAPS_AUXIN;
break;
case 5:
lpCaps->wPid = 0x0194;
strcpy(lpCaps->szPname, "SB16 Aux: Master");
lpCaps->wTechnology = AUXCAPS_AUXIN;
break;
}
#else
lpCaps->wMid = 0xAA;
lpCaps->wPid = 0x55;
lpCaps->vDriverVersion = 0x0100;
strcpy(lpCaps->szPname, "Generic Linux Auxiliary Driver");
strcpyW(lpCaps->szPname, ini);
lpCaps->wTechnology = AUXCAPS_CDAUDIO;
lpCaps->dwSupport = AUXCAPS_VOLUME | AUXCAPS_LRVOLUME;
#endif
return MMSYSERR_NOERROR;
}
......@@ -264,7 +226,7 @@ DWORD WINAPI OSS_auxMessage(UINT wDevID, UINT wMsg, DWORD dwUser,
/* FIXME: Pretend this is supported */
return 0;
case AUXDM_GETDEVCAPS:
return AUX_GetDevCaps(wDevID, (LPAUXCAPSA)dwParam1,dwParam2);
return AUX_GetDevCaps(wDevID, (LPAUXCAPSW)dwParam1, dwParam2);
case AUXDM_GETNUMDEVS:
TRACE("return %d;\n", NumDev);
return NumDev;
......
......@@ -95,8 +95,8 @@ static BOOL WINMM_CreateIData(HINSTANCE hInstDLL)
WINMM_IData->hWinMM32Instance = hInstDLL;
InitializeCriticalSection(&WINMM_IData->cs);
WINMM_IData->cs.DebugInfo->Spare[1] = (DWORD)"WINMM_IData";
WINMM_IData->psStopEvent = CreateEventA(NULL, TRUE, FALSE, NULL);
WINMM_IData->psLastEvent = CreateEventA(NULL, TRUE, FALSE, NULL);
WINMM_IData->psStopEvent = CreateEventW(NULL, TRUE, FALSE, NULL);
WINMM_IData->psLastEvent = CreateEventW(NULL, TRUE, FALSE, NULL);
TRACE("Created IData (%p)\n", WINMM_IData);
return TRUE;
}
......@@ -291,14 +291,25 @@ UINT WINAPI mixerGetNumDevs(void)
*/
UINT WINAPI mixerGetDevCapsA(UINT_PTR uDeviceID, LPMIXERCAPSA lpCaps, UINT uSize)
{
LPWINE_MLD wmld;
MIXERCAPSW micW;
UINT ret;
if (lpCaps == NULL) return MMSYSERR_INVALPARAM;
if (lpCaps == NULL) return MMSYSERR_INVALPARAM;
if ((wmld = MMDRV_Get((HANDLE)uDeviceID, MMDRV_MIXER, TRUE)) == NULL)
return MMSYSERR_BADDEVICEID;
ret = mixerGetDevCapsW(uDeviceID, &micW, sizeof(micW));
return MMDRV_Message(wmld, MXDM_GETDEVCAPS, (DWORD_PTR)lpCaps, uSize, TRUE);
if (ret == MMSYSERR_NOERROR) {
MIXERCAPSA micA;
micA.wMid = micW.wMid;
micA.wPid = micW.wPid;
micA.vDriverVersion = micW.vDriverVersion;
WideCharToMultiByte( CP_ACP, 0, micW.szPname, -1, micA.szPname,
sizeof(micA.szPname), NULL, NULL );
micA.fdwSupport = micW.fdwSupport;
micA.cDestinations = micW.cDestinations;
memcpy(lpCaps, &micA, min(uSize, sizeof(micA)));
}
return ret;
}
/**************************************************************************
......@@ -306,24 +317,14 @@ UINT WINAPI mixerGetDevCapsA(UINT_PTR uDeviceID, LPMIXERCAPSA lpCaps, UINT uSize
*/
UINT WINAPI mixerGetDevCapsW(UINT_PTR uDeviceID, LPMIXERCAPSW lpCaps, UINT uSize)
{
MIXERCAPSA micA;
UINT ret;
LPWINE_MLD wmld;
if (lpCaps == NULL) return MMSYSERR_INVALPARAM;
if (lpCaps == NULL) return MMSYSERR_INVALPARAM;
ret = mixerGetDevCapsA(uDeviceID, &micA, sizeof(micA));
if (ret == MMSYSERR_NOERROR) {
MIXERCAPSW micW;
micW.wMid = micA.wMid;
micW.wPid = micA.wPid;
micW.vDriverVersion = micA.vDriverVersion;
MultiByteToWideChar( CP_ACP, 0, micA.szPname, -1, micW.szPname,
sizeof(micW.szPname)/sizeof(WCHAR) );
micW.fdwSupport = micA.fdwSupport;
micW.cDestinations = micA.cDestinations;
memcpy(lpCaps, &micW, min(uSize, sizeof(micW)));
}
return ret;
if ((wmld = MMDRV_Get((HANDLE)uDeviceID, MMDRV_MIXER, TRUE)) == NULL)
return MMSYSERR_BADDEVICEID;
return MMDRV_Message(wmld, MXDM_GETDEVCAPS, (DWORD_PTR)lpCaps, uSize, TRUE);
}
UINT MIXER_Open(LPHMIXER lphMix, UINT uDeviceID, DWORD_PTR dwCallback,
......@@ -404,75 +405,76 @@ UINT WINAPI mixerGetID(HMIXEROBJ hmix, LPUINT lpid, DWORD fdwID)
}
/**************************************************************************
* mixerGetControlDetailsA [WINMM.@]
* mixerGetControlDetailsW [WINMM.@]
*/
UINT WINAPI mixerGetControlDetailsA(HMIXEROBJ hmix, LPMIXERCONTROLDETAILS lpmcdA,
UINT WINAPI mixerGetControlDetailsW(HMIXEROBJ hmix, LPMIXERCONTROLDETAILS lpmcdW,
DWORD fdwDetails)
{
LPWINE_MIXER lpwm;
UINT uRet = MMSYSERR_NOERROR;
TRACE("(%p, %p, %08lx)\n", hmix, lpmcdA, fdwDetails);
TRACE("(%p, %p, %08lx)\n", hmix, lpmcdW, fdwDetails);
if ((uRet = MIXER_GetDev(hmix, fdwDetails, &lpwm)) != MMSYSERR_NOERROR)
return uRet;
if (lpmcdA == NULL || lpmcdA->cbStruct != sizeof(*lpmcdA))
if (lpmcdW == NULL || lpmcdW->cbStruct != sizeof(*lpmcdW))
return MMSYSERR_INVALPARAM;
return MMDRV_Message(&lpwm->mld, MXDM_GETCONTROLDETAILS, (DWORD_PTR)lpmcdA,
return MMDRV_Message(&lpwm->mld, MXDM_GETCONTROLDETAILS, (DWORD_PTR)lpmcdW,
fdwDetails, TRUE);
}
/**************************************************************************
* mixerGetControlDetailsW [WINMM.@]
* mixerGetControlDetailsA [WINMM.@]
*/
UINT WINAPI mixerGetControlDetailsW(HMIXEROBJ hmix, LPMIXERCONTROLDETAILS lpmcd, DWORD fdwDetails)
UINT WINAPI mixerGetControlDetailsA(HMIXEROBJ hmix, LPMIXERCONTROLDETAILS lpmcdA,
DWORD fdwDetails)
{
DWORD ret = MMSYSERR_NOTENABLED;
TRACE("(%p, %p, %08lx)\n", hmix, lpmcd, fdwDetails);
TRACE("(%p, %p, %08lx)\n", hmix, lpmcdA, fdwDetails);
if (lpmcd == NULL || lpmcd->cbStruct != sizeof(*lpmcd))
if (lpmcdA == NULL || lpmcdA->cbStruct != sizeof(*lpmcdA))
return MMSYSERR_INVALPARAM;
switch (fdwDetails & MIXER_GETCONTROLDETAILSF_QUERYMASK) {
case MIXER_GETCONTROLDETAILSF_VALUE:
/* can savely use W structure as it is, no string inside */
ret = mixerGetControlDetailsA(hmix, lpmcd, fdwDetails);
/* can savely use A structure as it is, no string inside */
ret = mixerGetControlDetailsW(hmix, lpmcdA, fdwDetails);
break;
case MIXER_GETCONTROLDETAILSF_LISTTEXT:
{
MIXERCONTROLDETAILS_LISTTEXTW *pDetailsW = (MIXERCONTROLDETAILS_LISTTEXTW *)lpmcd->paDetails;
MIXERCONTROLDETAILS_LISTTEXTA *pDetailsA;
int size = max(1, lpmcd->cChannels) * sizeof(MIXERCONTROLDETAILS_LISTTEXTA);
MIXERCONTROLDETAILS_LISTTEXTA *pDetailsA = (MIXERCONTROLDETAILS_LISTTEXTA *)lpmcdA->paDetails;
MIXERCONTROLDETAILS_LISTTEXTW *pDetailsW;
int size = max(1, lpmcdA->cChannels) * sizeof(MIXERCONTROLDETAILS_LISTTEXTW);
unsigned int i;
if (lpmcd->u.cMultipleItems != 0) {
size *= lpmcd->u.cMultipleItems;
if (lpmcdA->u.cMultipleItems != 0) {
size *= lpmcdA->u.cMultipleItems;
}
pDetailsA = (MIXERCONTROLDETAILS_LISTTEXTA *)HeapAlloc(GetProcessHeap(), 0, size);
lpmcd->paDetails = pDetailsA;
lpmcd->cbDetails = sizeof(MIXERCONTROLDETAILS_LISTTEXTA);
pDetailsW = (MIXERCONTROLDETAILS_LISTTEXTW *)HeapAlloc(GetProcessHeap(), 0, size);
lpmcdA->paDetails = pDetailsW;
lpmcdA->cbDetails = sizeof(MIXERCONTROLDETAILS_LISTTEXTW);
/* set up lpmcd->paDetails */
ret = mixerGetControlDetailsA(hmix, lpmcd, fdwDetails);
ret = mixerGetControlDetailsW(hmix, lpmcdA, fdwDetails);
/* copy from lpmcd->paDetails back to paDetailsW; */
if(ret == MMSYSERR_NOERROR) {
for(i=0;i<lpmcd->u.cMultipleItems*lpmcd->cChannels;i++) {
pDetailsW->dwParam1 = pDetailsA->dwParam1;
pDetailsW->dwParam2 = pDetailsA->dwParam2;
MultiByteToWideChar( CP_ACP, 0, pDetailsA->szName, -1,
pDetailsW->szName,
sizeof(pDetailsW->szName)/sizeof(WCHAR) );
if (ret == MMSYSERR_NOERROR) {
for (i = 0; i < lpmcdA->u.cMultipleItems * lpmcdA->cChannels; i++) {
pDetailsA->dwParam1 = pDetailsW->dwParam1;
pDetailsA->dwParam2 = pDetailsW->dwParam2;
WideCharToMultiByte( CP_ACP, 0, pDetailsW->szName, -1,
pDetailsA->szName,
sizeof(pDetailsA->szName), NULL, NULL );
pDetailsA++;
pDetailsW++;
}
pDetailsA -= lpmcd->u.cMultipleItems*lpmcd->cChannels;
pDetailsW -= lpmcd->u.cMultipleItems*lpmcd->cChannels;
pDetailsA -= lpmcdA->u.cMultipleItems * lpmcdA->cChannels;
pDetailsW -= lpmcdA->u.cMultipleItems * lpmcdA->cChannels;
}
HeapFree(GetProcessHeap(), 0, pDetailsA);
lpmcd->paDetails = pDetailsW;
lpmcd->cbDetails = sizeof(MIXERCONTROLDETAILS_LISTTEXTW);
HeapFree(GetProcessHeap(), 0, pDetailsW);
lpmcdA->paDetails = pDetailsA;
lpmcdA->cbDetails = sizeof(MIXERCONTROLDETAILS_LISTTEXTA);
}
break;
default:
......@@ -488,19 +490,59 @@ UINT WINAPI mixerGetControlDetailsW(HMIXEROBJ hmix, LPMIXERCONTROLDETAILS lpmcd,
UINT WINAPI mixerGetLineControlsA(HMIXEROBJ hmix, LPMIXERLINECONTROLSA lpmlcA,
DWORD fdwControls)
{
LPWINE_MIXER lpwm;
UINT uRet = MMSYSERR_NOERROR;
MIXERLINECONTROLSW mlcW;
DWORD ret;
unsigned int i;
TRACE("(%p, %p, %08lx)\n", hmix, lpmlcA, fdwControls);
if ((uRet = MIXER_GetDev(hmix, fdwControls, &lpwm)) != MMSYSERR_NOERROR)
return uRet;
if (lpmlcA == NULL || lpmlcA->cbStruct != sizeof(*lpmlcA))
if (lpmlcA == NULL || lpmlcA->cbStruct != sizeof(*lpmlcA) ||
lpmlcA->cbmxctrl != sizeof(MIXERCONTROLA))
return MMSYSERR_INVALPARAM;
return MMDRV_Message(&lpwm->mld, MXDM_GETLINECONTROLS, (DWORD_PTR)lpmlcA,
fdwControls, TRUE);
mlcW.cbStruct = sizeof(mlcW);
mlcW.dwLineID = lpmlcA->dwLineID;
mlcW.u.dwControlID = lpmlcA->u.dwControlID;
mlcW.u.dwControlType = lpmlcA->u.dwControlType;
mlcW.cControls = lpmlcA->cControls;
mlcW.cbmxctrl = sizeof(MIXERCONTROLW);
mlcW.pamxctrl = HeapAlloc(GetProcessHeap(), 0,
mlcW.cControls * mlcW.cbmxctrl);
ret = mixerGetLineControlsW(hmix, &mlcW, fdwControls);
if (ret == MMSYSERR_NOERROR) {
lpmlcA->dwLineID = mlcW.dwLineID;
lpmlcA->u.dwControlID = mlcW.u.dwControlID;
lpmlcA->u.dwControlType = mlcW.u.dwControlType;
lpmlcA->cControls = mlcW.cControls;
for (i = 0; i < mlcW.cControls; i++) {
lpmlcA->pamxctrl[i].cbStruct = sizeof(MIXERCONTROLA);
lpmlcA->pamxctrl[i].dwControlID = mlcW.pamxctrl[i].dwControlID;
lpmlcA->pamxctrl[i].dwControlType = mlcW.pamxctrl[i].dwControlType;
lpmlcA->pamxctrl[i].fdwControl = mlcW.pamxctrl[i].fdwControl;
lpmlcA->pamxctrl[i].cMultipleItems = mlcW.pamxctrl[i].cMultipleItems;
WideCharToMultiByte( CP_ACP, 0, mlcW.pamxctrl[i].szShortName, -1,
lpmlcA->pamxctrl[i].szShortName,
sizeof(lpmlcA->pamxctrl[i].szShortName), NULL, NULL );
WideCharToMultiByte( CP_ACP, 0, mlcW.pamxctrl[i].szName, -1,
lpmlcA->pamxctrl[i].szName,
sizeof(lpmlcA->pamxctrl[i].szName), NULL, NULL );
/* sizeof(lpmlcA->pamxctrl[i].Bounds) ==
* sizeof(mlcW.pamxctrl[i].Bounds) */
memcpy(&lpmlcA->pamxctrl[i].Bounds, &mlcW.pamxctrl[i].Bounds,
sizeof(mlcW.pamxctrl[i].Bounds));
/* sizeof(lpmlcA->pamxctrl[i].Metrics) ==
* sizeof(mlcW.pamxctrl[i].Metrics) */
memcpy(&lpmlcA->pamxctrl[i].Metrics, &mlcW.pamxctrl[i].Metrics,
sizeof(mlcW.pamxctrl[i].Metrics));
}
}
HeapFree(GetProcessHeap(), 0, mlcW.pamxctrl);
return ret;
}
/**************************************************************************
......@@ -509,65 +551,25 @@ UINT WINAPI mixerGetLineControlsA(HMIXEROBJ hmix, LPMIXERLINECONTROLSA lpmlcA,
UINT WINAPI mixerGetLineControlsW(HMIXEROBJ hmix, LPMIXERLINECONTROLSW lpmlcW,
DWORD fdwControls)
{
MIXERLINECONTROLSA mlcA;
DWORD ret;
unsigned int i;
LPWINE_MIXER lpwm;
UINT uRet = MMSYSERR_NOERROR;
TRACE("(%p, %p, %08lx)\n", hmix, lpmlcW, fdwControls);
if (lpmlcW == NULL || lpmlcW->cbStruct != sizeof(*lpmlcW) ||
lpmlcW->cbmxctrl != sizeof(MIXERCONTROLW))
return MMSYSERR_INVALPARAM;
mlcA.cbStruct = sizeof(mlcA);
mlcA.dwLineID = lpmlcW->dwLineID;
mlcA.u.dwControlID = lpmlcW->u.dwControlID;
mlcA.u.dwControlType = lpmlcW->u.dwControlType;
mlcA.cControls = lpmlcW->cControls;
mlcA.cbmxctrl = sizeof(MIXERCONTROLA);
mlcA.pamxctrl = HeapAlloc(GetProcessHeap(), 0,
mlcA.cControls * mlcA.cbmxctrl);
ret = mixerGetLineControlsA(hmix, &mlcA, fdwControls);
if (ret == MMSYSERR_NOERROR) {
lpmlcW->dwLineID = mlcA.dwLineID;
lpmlcW->u.dwControlID = mlcA.u.dwControlID;
lpmlcW->u.dwControlType = mlcA.u.dwControlType;
lpmlcW->cControls = mlcA.cControls;
for (i = 0; i < mlcA.cControls; i++) {
lpmlcW->pamxctrl[i].cbStruct = sizeof(MIXERCONTROLW);
lpmlcW->pamxctrl[i].dwControlID = mlcA.pamxctrl[i].dwControlID;
lpmlcW->pamxctrl[i].dwControlType = mlcA.pamxctrl[i].dwControlType;
lpmlcW->pamxctrl[i].fdwControl = mlcA.pamxctrl[i].fdwControl;
lpmlcW->pamxctrl[i].cMultipleItems = mlcA.pamxctrl[i].cMultipleItems;
MultiByteToWideChar( CP_ACP, 0, mlcA.pamxctrl[i].szShortName, -1,
lpmlcW->pamxctrl[i].szShortName,
sizeof(lpmlcW->pamxctrl[i].szShortName)/sizeof(WCHAR) );
MultiByteToWideChar( CP_ACP, 0, mlcA.pamxctrl[i].szName, -1,
lpmlcW->pamxctrl[i].szName,
sizeof(lpmlcW->pamxctrl[i].szName)/sizeof(WCHAR) );
/* sizeof(lpmlcW->pamxctrl[i].Bounds) ==
* sizeof(mlcA.pamxctrl[i].Bounds) */
memcpy(&lpmlcW->pamxctrl[i].Bounds, &mlcA.pamxctrl[i].Bounds,
sizeof(mlcA.pamxctrl[i].Bounds));
/* sizeof(lpmlcW->pamxctrl[i].Metrics) ==
* sizeof(mlcA.pamxctrl[i].Metrics) */
memcpy(&lpmlcW->pamxctrl[i].Metrics, &mlcA.pamxctrl[i].Metrics,
sizeof(mlcA.pamxctrl[i].Metrics));
}
}
if ((uRet = MIXER_GetDev(hmix, fdwControls, &lpwm)) != MMSYSERR_NOERROR)
return uRet;
HeapFree(GetProcessHeap(), 0, mlcA.pamxctrl);
if (lpmlcW == NULL || lpmlcW->cbStruct != sizeof(*lpmlcW))
return MMSYSERR_INVALPARAM;
return ret;
return MMDRV_Message(&lpwm->mld, MXDM_GETLINECONTROLS, (DWORD_PTR)lpmlcW,
fdwControls, TRUE);
}
/**************************************************************************
* mixerGetLineInfoA [WINMM.@]
* mixerGetLineInfoW [WINMM.@]
*/
UINT WINAPI mixerGetLineInfoA(HMIXEROBJ hmix, LPMIXERLINEA lpmliW, DWORD fdwInfo)
UINT WINAPI mixerGetLineInfoW(HMIXEROBJ hmix, LPMIXERLINEW lpmliW, DWORD fdwInfo)
{
LPWINE_MIXER lpwm;
UINT uRet = MMSYSERR_NOERROR;
......@@ -582,68 +584,68 @@ UINT WINAPI mixerGetLineInfoA(HMIXEROBJ hmix, LPMIXERLINEA lpmliW, DWORD fdwInfo
}
/**************************************************************************
* mixerGetLineInfoW [WINMM.@]
* mixerGetLineInfoA [WINMM.@]
*/
UINT WINAPI mixerGetLineInfoW(HMIXEROBJ hmix, LPMIXERLINEW lpmliW,
UINT WINAPI mixerGetLineInfoA(HMIXEROBJ hmix, LPMIXERLINEA lpmliA,
DWORD fdwInfo)
{
MIXERLINEA mliA;
MIXERLINEW mliW;
UINT ret;
TRACE("(%p, %p, %08lx)\n", hmix, lpmliW, fdwInfo);
TRACE("(%p, %p, %08lx)\n", hmix, lpmliA, fdwInfo);
if (lpmliW == NULL || lpmliW->cbStruct != sizeof(*lpmliW))
if (lpmliA == NULL || lpmliA->cbStruct != sizeof(*lpmliA))
return MMSYSERR_INVALPARAM;
mliA.cbStruct = sizeof(mliA);
mliW.cbStruct = sizeof(mliW);
switch (fdwInfo & MIXER_GETLINEINFOF_QUERYMASK) {
case MIXER_GETLINEINFOF_COMPONENTTYPE:
mliA.dwComponentType = lpmliW->dwComponentType;
mliW.dwComponentType = lpmliA->dwComponentType;
break;
case MIXER_GETLINEINFOF_DESTINATION:
mliA.dwDestination = lpmliW->dwDestination;
mliW.dwDestination = lpmliA->dwDestination;
break;
case MIXER_GETLINEINFOF_LINEID:
mliA.dwLineID = lpmliW->dwLineID;
mliW.dwLineID = lpmliA->dwLineID;
break;
case MIXER_GETLINEINFOF_SOURCE:
mliA.dwDestination = lpmliW->dwDestination;
mliA.dwSource = lpmliW->dwSource;
mliW.dwDestination = lpmliA->dwDestination;
mliW.dwSource = lpmliA->dwSource;
break;
case MIXER_GETLINEINFOF_TARGETTYPE:
mliA.Target.dwType = lpmliW->Target.dwType;
mliA.Target.wMid = lpmliW->Target.wMid;
mliA.Target.wPid = lpmliW->Target.wPid;
mliA.Target.vDriverVersion = lpmliW->Target.vDriverVersion;
WideCharToMultiByte( CP_ACP, 0, lpmliW->Target.szPname, -1, mliA.Target.szPname, sizeof(mliA.Target.szPname), NULL, NULL);
mliW.Target.dwType = lpmliA->Target.dwType;
mliW.Target.wMid = lpmliA->Target.wMid;
mliW.Target.wPid = lpmliA->Target.wPid;
mliW.Target.vDriverVersion = lpmliA->Target.vDriverVersion;
MultiByteToWideChar( CP_ACP, 0, lpmliA->Target.szPname, -1, mliW.Target.szPname, sizeof(mliW.Target.szPname));
break;
default:
WARN("Unsupported fdwControls=0x%08lx\n", fdwInfo);
return MMSYSERR_INVALFLAG;
}
ret = mixerGetLineInfoA(hmix, &mliA, fdwInfo);
lpmliW->dwDestination = mliA.dwDestination;
lpmliW->dwSource = mliA.dwSource;
lpmliW->dwLineID = mliA.dwLineID;
lpmliW->fdwLine = mliA.fdwLine;
lpmliW->dwUser = mliA.dwUser;
lpmliW->dwComponentType = mliA.dwComponentType;
lpmliW->cChannels = mliA.cChannels;
lpmliW->cConnections = mliA.cConnections;
lpmliW->cControls = mliA.cControls;
MultiByteToWideChar( CP_ACP, 0, mliA.szShortName, -1, lpmliW->szShortName,
sizeof(lpmliW->szShortName)/sizeof(WCHAR) );
MultiByteToWideChar( CP_ACP, 0, mliA.szName, -1, lpmliW->szName,
sizeof(lpmliW->szName)/sizeof(WCHAR) );
lpmliW->Target.dwType = mliA.Target.dwType;
lpmliW->Target.dwDeviceID = mliA.Target.dwDeviceID;
lpmliW->Target.wMid = mliA.Target.wMid;
lpmliW->Target.wPid = mliA.Target.wPid;
lpmliW->Target.vDriverVersion = mliA.Target.vDriverVersion;
MultiByteToWideChar( CP_ACP, 0, mliA.Target.szPname, -1, lpmliW->Target.szPname,
sizeof(lpmliW->Target.szPname)/sizeof(WCHAR) );
ret = mixerGetLineInfoW(hmix, &mliW, fdwInfo);
lpmliA->dwDestination = mliW.dwDestination;
lpmliA->dwSource = mliW.dwSource;
lpmliA->dwLineID = mliW.dwLineID;
lpmliA->fdwLine = mliW.fdwLine;
lpmliA->dwUser = mliW.dwUser;
lpmliA->dwComponentType = mliW.dwComponentType;
lpmliA->cChannels = mliW.cChannels;
lpmliA->cConnections = mliW.cConnections;
lpmliA->cControls = mliW.cControls;
WideCharToMultiByte( CP_ACP, 0, mliW.szShortName, -1, lpmliA->szShortName,
sizeof(lpmliA->szShortName), NULL, NULL);
WideCharToMultiByte( CP_ACP, 0, mliW.szName, -1, lpmliA->szName,
sizeof(lpmliA->szName), NULL, NULL );
lpmliA->Target.dwType = mliW.Target.dwType;
lpmliA->Target.dwDeviceID = mliW.Target.dwDeviceID;
lpmliA->Target.wMid = mliW.Target.wMid;
lpmliA->Target.wPid = mliW.Target.wPid;
lpmliA->Target.vDriverVersion = mliW.Target.vDriverVersion;
WideCharToMultiByte( CP_ACP, 0, mliW.Target.szPname, -1, lpmliA->Target.szPname,
sizeof(lpmliA->Target.szPname), NULL, NULL );
return ret;
}
......@@ -651,18 +653,18 @@ UINT WINAPI mixerGetLineInfoW(HMIXEROBJ hmix, LPMIXERLINEW lpmliW,
/**************************************************************************
* mixerSetControlDetails [WINMM.@]
*/
UINT WINAPI mixerSetControlDetails(HMIXEROBJ hmix, LPMIXERCONTROLDETAILS lpmcdA,
UINT WINAPI mixerSetControlDetails(HMIXEROBJ hmix, LPMIXERCONTROLDETAILS lpmcd,
DWORD fdwDetails)
{
LPWINE_MIXER lpwm;
UINT uRet = MMSYSERR_NOERROR;
TRACE("(%p, %p, %08lx)\n", hmix, lpmcdA, fdwDetails);
TRACE("(%p, %p, %08lx)\n", hmix, lpmcd, fdwDetails);
if ((uRet = MIXER_GetDev(hmix, fdwDetails, &lpwm)) != MMSYSERR_NOERROR)
return uRet;
return MMDRV_Message(&lpwm->mld, MXDM_SETCONTROLDETAILS, (DWORD_PTR)lpmcdA,
return MMDRV_Message(&lpwm->mld, MXDM_SETCONTROLDETAILS, (DWORD_PTR)lpmcd,
fdwDetails, TRUE);
}
......@@ -695,24 +697,15 @@ UINT WINAPI auxGetNumDevs(void)
*/
UINT WINAPI auxGetDevCapsW(UINT_PTR uDeviceID, LPAUXCAPSW lpCaps, UINT uSize)
{
AUXCAPSA acA;
UINT ret;
LPWINE_MLD wmld;
if (lpCaps == NULL) return MMSYSERR_INVALPARAM;
TRACE("(%04X, %p, %d) !\n", uDeviceID, lpCaps, uSize);
ret = auxGetDevCapsA(uDeviceID, &acA, sizeof(acA));
if (ret == MMSYSERR_NOERROR) {
AUXCAPSW acW;
acW.wMid = acA.wMid;
acW.wPid = acA.wPid;
acW.vDriverVersion = acA.vDriverVersion;
MultiByteToWideChar( CP_ACP, 0, acA.szPname, -1, acW.szPname,
sizeof(acW.szPname)/sizeof(WCHAR) );
acW.wTechnology = acA.wTechnology;
acW.dwSupport = acA.dwSupport;
memcpy(lpCaps, &acW, min(uSize, sizeof(acW)));
}
return ret;
if (lpCaps == NULL) return MMSYSERR_INVALPARAM;
if ((wmld = MMDRV_Get((HANDLE)uDeviceID, MMDRV_AUX, TRUE)) == NULL)
return MMSYSERR_INVALHANDLE;
return MMDRV_Message(wmld, AUXDM_GETDEVCAPS, (DWORD_PTR)lpCaps, uSize, TRUE);
}
/**************************************************************************
......@@ -720,15 +713,25 @@ UINT WINAPI auxGetDevCapsW(UINT_PTR uDeviceID, LPAUXCAPSW lpCaps, UINT uSize)
*/
UINT WINAPI auxGetDevCapsA(UINT_PTR uDeviceID, LPAUXCAPSA lpCaps, UINT uSize)
{
LPWINE_MLD wmld;
AUXCAPSW acW;
UINT ret;
TRACE("(%04X, %p, %d) !\n", uDeviceID, lpCaps, uSize);
if (lpCaps == NULL) return MMSYSERR_INVALPARAM;
if (lpCaps == NULL) return MMSYSERR_INVALPARAM;
ret = auxGetDevCapsW(uDeviceID, &acW, sizeof(acW));
if ((wmld = MMDRV_Get((HANDLE)uDeviceID, MMDRV_AUX, TRUE)) == NULL)
return MMSYSERR_INVALHANDLE;
return MMDRV_Message(wmld, AUXDM_GETDEVCAPS, (DWORD_PTR)lpCaps, uSize, TRUE);
if (ret == MMSYSERR_NOERROR) {
AUXCAPSA acA;
acA.wMid = acW.wMid;
acA.wPid = acW.wPid;
acA.vDriverVersion = acW.vDriverVersion;
WideCharToMultiByte( CP_ACP, 0, acW.szPname, -1, acA.szPname,
sizeof(acA.szPname), NULL, NULL );
acA.wTechnology = acW.wTechnology;
acA.dwSupport = acW.dwSupport;
memcpy(lpCaps, &acA, min(uSize, sizeof(acA)));
}
return ret;
}
/**************************************************************************
......@@ -999,7 +1002,6 @@ static int MCI_MapMsgWtoA(UINT msg, DWORD_PTR dwParam1, DWORD_PTR *dwParam2)
FIXME("Message 0x%04x needs translation\n", msg);
return -1;
}
return 0;
}
static DWORD MCI_UnmapMsgWtoA(UINT msg, DWORD_PTR dwParam1, DWORD_PTR dwParam2,
......@@ -1250,27 +1252,16 @@ UINT WINAPI midiOutGetNumDevs(void)
UINT WINAPI midiOutGetDevCapsW(UINT_PTR uDeviceID, LPMIDIOUTCAPSW lpCaps,
UINT uSize)
{
MIDIOUTCAPSA mocA;
UINT ret;
LPWINE_MLD wmld;
if (lpCaps == NULL) return MMSYSERR_INVALPARAM;
TRACE("(%u, %p, %u);\n", uDeviceID, lpCaps, uSize);
ret = midiOutGetDevCapsA(uDeviceID, &mocA, sizeof(mocA));
if (ret == MMSYSERR_NOERROR) {
MIDIOUTCAPSW mocW;
mocW.wMid = mocA.wMid;
mocW.wPid = mocA.wPid;
mocW.vDriverVersion = mocA.vDriverVersion;
MultiByteToWideChar( CP_ACP, 0, mocA.szPname, -1, mocW.szPname,
sizeof(mocW.szPname)/sizeof(WCHAR) );
mocW.wTechnology = mocA.wTechnology;
mocW.wVoices = mocA.wVoices;
mocW.wNotes = mocA.wNotes;
mocW.wChannelMask = mocA.wChannelMask;
mocW.dwSupport = mocA.dwSupport;
memcpy(lpCaps, &mocW, min(uSize, sizeof(mocW)));
}
return ret;
if (lpCaps == NULL) return MMSYSERR_INVALPARAM;
if ((wmld = MMDRV_Get((HANDLE)uDeviceID, MMDRV_MIDIOUT, TRUE)) == NULL)
return MMSYSERR_INVALHANDLE;
return MMDRV_Message(wmld, MODM_GETDEVCAPS, (DWORD_PTR)lpCaps, uSize, TRUE);
}
/**************************************************************************
......@@ -1279,16 +1270,28 @@ UINT WINAPI midiOutGetDevCapsW(UINT_PTR uDeviceID, LPMIDIOUTCAPSW lpCaps,
UINT WINAPI midiOutGetDevCapsA(UINT_PTR uDeviceID, LPMIDIOUTCAPSA lpCaps,
UINT uSize)
{
LPWINE_MLD wmld;
MIDIOUTCAPSW mocW;
UINT ret;
TRACE("(%u, %p, %u);\n", uDeviceID, lpCaps, uSize);
if (lpCaps == NULL) return MMSYSERR_INVALPARAM;
if (lpCaps == NULL) return MMSYSERR_INVALPARAM;
ret = midiOutGetDevCapsW(uDeviceID, &mocW, sizeof(mocW));
if ((wmld = MMDRV_Get((HANDLE)uDeviceID, MMDRV_MIDIOUT, TRUE)) == NULL)
return MMSYSERR_INVALHANDLE;
return MMDRV_Message(wmld, MODM_GETDEVCAPS, (DWORD_PTR)lpCaps, uSize, TRUE);
if (ret == MMSYSERR_NOERROR) {
MIDIOUTCAPSA mocA;
mocA.wMid = mocW.wMid;
mocA.wPid = mocW.wPid;
mocA.vDriverVersion = mocW.vDriverVersion;
WideCharToMultiByte( CP_ACP, 0, mocW.szPname, -1, mocA.szPname,
sizeof(mocA.szPname), NULL, NULL );
mocA.wTechnology = mocW.wTechnology;
mocA.wVoices = mocW.wVoices;
mocA.wNotes = mocW.wNotes;
mocA.wChannelMask = mocW.wChannelMask;
mocA.dwSupport = mocW.dwSupport;
memcpy(lpCaps, &mocA, min(uSize, sizeof(mocA)));
}
return ret;
}
/**************************************************************************
......@@ -1630,23 +1633,16 @@ UINT WINAPI midiInGetNumDevs(void)
*/
UINT WINAPI midiInGetDevCapsW(UINT_PTR uDeviceID, LPMIDIINCAPSW lpCaps, UINT uSize)
{
MIDIINCAPSA micA;
UINT ret;
LPWINE_MLD wmld;
if (lpCaps == NULL) return MMSYSERR_INVALPARAM;
TRACE("(%d, %p, %d);\n", uDeviceID, lpCaps, uSize);
ret = midiInGetDevCapsA(uDeviceID, &micA, sizeof(micA));
if (ret == MMSYSERR_NOERROR) {
MIDIINCAPSW micW;
micW.wMid = micA.wMid;
micW.wPid = micA.wPid;
micW.vDriverVersion = micA.vDriverVersion;
MultiByteToWideChar( CP_ACP, 0, micA.szPname, -1, micW.szPname,
sizeof(micW.szPname)/sizeof(WCHAR) );
micW.dwSupport = micA.dwSupport;
memcpy(lpCaps, &micW, min(uSize, sizeof(micW)));
}
return ret;
if (lpCaps == NULL) return MMSYSERR_INVALPARAM;
if ((wmld = MMDRV_Get((HANDLE)uDeviceID, MMDRV_MIDIIN, TRUE)) == NULL)
return MMSYSERR_INVALHANDLE;
return MMDRV_Message(wmld, MIDM_GETDEVCAPS, (DWORD_PTR)lpCaps, uSize, TRUE);
}
/**************************************************************************
......@@ -1654,16 +1650,24 @@ UINT WINAPI midiInGetDevCapsW(UINT_PTR uDeviceID, LPMIDIINCAPSW lpCaps, UINT uSi
*/
UINT WINAPI midiInGetDevCapsA(UINT_PTR uDeviceID, LPMIDIINCAPSA lpCaps, UINT uSize)
{
LPWINE_MLD wmld;
TRACE("(%d, %p, %d);\n", uDeviceID, lpCaps, uSize);
MIDIINCAPSW micW;
UINT ret;
if (lpCaps == NULL) return MMSYSERR_INVALPARAM;
if (lpCaps == NULL) return MMSYSERR_INVALPARAM;
if ((wmld = MMDRV_Get((HANDLE)uDeviceID, MMDRV_MIDIIN, TRUE)) == NULL)
return MMSYSERR_INVALHANDLE;
ret = midiInGetDevCapsW(uDeviceID, &micW, sizeof(micW));
return MMDRV_Message(wmld, MIDM_GETDEVCAPS, (DWORD_PTR)lpCaps, uSize, TRUE);
if (ret == MMSYSERR_NOERROR) {
MIDIINCAPSA micA;
micA.wMid = micW.wMid;
micA.wPid = micW.wPid;
micA.vDriverVersion = micW.vDriverVersion;
WideCharToMultiByte( CP_ACP, 0, micW.szPname, -1, micA.szPname,
sizeof(micA.szPname), NULL, NULL );
micA.dwSupport = micW.dwSupport;
memcpy(lpCaps, &micA, min(uSize, sizeof(micA)));
}
return ret;
}
/**************************************************************************
......@@ -2269,7 +2273,7 @@ MMRESULT MIDI_StreamOpen(HMIDISTRM* lphMidiStrm, LPUINT lpuDeviceID, DWORD cMidi
lpwm->mld.uDeviceID = *lpuDeviceID;
ret = MMDRV_Open(&lpwm->mld, MODM_OPEN, (DWORD)&lpwm->mod, fdwOpen);
lpMidiStrm->hEvent = CreateEventA(NULL, FALSE, FALSE, NULL);
lpMidiStrm->hEvent = CreateEventW(NULL, FALSE, FALSE, NULL);
lpMidiStrm->wFlags = HIWORD(fdwOpen);
lpMidiStrm->hThread = CreateThread(NULL, 0, MMSYSTEM_MidiStream_Player,
......@@ -2579,17 +2583,26 @@ UINT WINAPI waveOutGetNumDevs(void)
UINT WINAPI waveOutGetDevCapsA(UINT_PTR uDeviceID, LPWAVEOUTCAPSA lpCaps,
UINT uSize)
{
LPWINE_MLD wmld;
TRACE("(%u %p %u)!\n", uDeviceID, lpCaps, uSize);
if (lpCaps == NULL) return MMSYSERR_INVALPARAM;
WAVEOUTCAPSW wocW;
UINT ret;
if ((wmld = MMDRV_Get((HANDLE)uDeviceID, MMDRV_WAVEOUT, TRUE)) == NULL)
return MMSYSERR_BADDEVICEID;
if (lpCaps == NULL) return MMSYSERR_INVALPARAM;
return MMDRV_Message(wmld, WODM_GETDEVCAPS, (DWORD_PTR)lpCaps, uSize, TRUE);
ret = waveOutGetDevCapsW(uDeviceID, &wocW, sizeof(wocW));
if (ret == MMSYSERR_NOERROR) {
WAVEOUTCAPSA wocA;
wocA.wMid = wocW.wMid;
wocA.wPid = wocW.wPid;
wocA.vDriverVersion = wocW.vDriverVersion;
WideCharToMultiByte( CP_ACP, 0, wocW.szPname, -1, wocA.szPname,
sizeof(wocA.szPname), NULL, NULL );
wocA.dwFormats = wocW.dwFormats;
wocA.wChannels = wocW.wChannels;
wocA.dwSupport = wocW.dwSupport;
memcpy(lpCaps, &wocA, min(uSize, sizeof(wocA)));
}
return ret;
}
/**************************************************************************
......@@ -2598,25 +2611,17 @@ UINT WINAPI waveOutGetDevCapsA(UINT_PTR uDeviceID, LPWAVEOUTCAPSA lpCaps,
UINT WINAPI waveOutGetDevCapsW(UINT_PTR uDeviceID, LPWAVEOUTCAPSW lpCaps,
UINT uSize)
{
WAVEOUTCAPSA wocA;
UINT ret;
LPWINE_MLD wmld;
if (lpCaps == NULL) return MMSYSERR_INVALPARAM;
TRACE("(%u %p %u)!\n", uDeviceID, lpCaps, uSize);
if (lpCaps == NULL) return MMSYSERR_INVALPARAM;
if ((wmld = MMDRV_Get((HANDLE)uDeviceID, MMDRV_WAVEOUT, TRUE)) == NULL)
return MMSYSERR_BADDEVICEID;
return MMDRV_Message(wmld, WODM_GETDEVCAPS, (DWORD_PTR)lpCaps, uSize, TRUE);
ret = waveOutGetDevCapsA(uDeviceID, &wocA, sizeof(wocA));
if (ret == MMSYSERR_NOERROR) {
WAVEOUTCAPSW wocW;
wocW.wMid = wocA.wMid;
wocW.wPid = wocA.wPid;
wocW.vDriverVersion = wocA.vDriverVersion;
MultiByteToWideChar( CP_ACP, 0, wocA.szPname, -1, wocW.szPname,
sizeof(wocW.szPname)/sizeof(WCHAR) );
wocW.dwFormats = wocA.dwFormats;
wocW.wChannels = wocA.wChannels;
wocW.dwSupport = wocA.dwSupport;
memcpy(lpCaps, &wocW, min(uSize, sizeof(wocW)));
}
return ret;
}
/**************************************************************************
......@@ -2993,24 +2998,16 @@ UINT WINAPI waveInGetNumDevs(void)
*/
UINT WINAPI waveInGetDevCapsW(UINT_PTR uDeviceID, LPWAVEINCAPSW lpCaps, UINT uSize)
{
WAVEINCAPSA wicA;
UINT ret;
LPWINE_MLD wmld;
if (lpCaps == NULL) return MMSYSERR_INVALPARAM;
TRACE("(%u %p %u)!\n", uDeviceID, lpCaps, uSize);
ret = waveInGetDevCapsA(uDeviceID, &wicA, sizeof(wicA));
if (ret == MMSYSERR_NOERROR) {
WAVEINCAPSW wicW;
wicW.wMid = wicA.wMid;
wicW.wPid = wicA.wPid;
wicW.vDriverVersion = wicA.vDriverVersion;
MultiByteToWideChar( CP_ACP, 0, wicA.szPname, -1, wicW.szPname,
sizeof(wicW.szPname)/sizeof(WCHAR) );
wicW.dwFormats = wicA.dwFormats;
wicW.wChannels = wicA.wChannels;
memcpy(lpCaps, &wicW, min(uSize, sizeof(wicW)));
}
return ret;
if (lpCaps == NULL) return MMSYSERR_INVALPARAM;
if ((wmld = MMDRV_Get((HANDLE)uDeviceID, MMDRV_WAVEIN, TRUE)) == NULL)
return MMSYSERR_BADDEVICEID;
return MMDRV_Message(wmld, WIDM_GETDEVCAPS, (DWORD_PTR)lpCaps, uSize, TRUE);
}
/**************************************************************************
......@@ -3018,16 +3015,25 @@ UINT WINAPI waveInGetDevCapsW(UINT_PTR uDeviceID, LPWAVEINCAPSW lpCaps, UINT uSi
*/
UINT WINAPI waveInGetDevCapsA(UINT_PTR uDeviceID, LPWAVEINCAPSA lpCaps, UINT uSize)
{
LPWINE_MLD wmld;
TRACE("(%u %p %u)!\n", uDeviceID, lpCaps, uSize);
WAVEINCAPSW wicW;
UINT ret;
if (lpCaps == NULL) return MMSYSERR_INVALPARAM;
if ((wmld = MMDRV_Get((HANDLE)uDeviceID, MMDRV_WAVEIN, TRUE)) == NULL)
return MMSYSERR_BADDEVICEID;
ret = waveInGetDevCapsW(uDeviceID, &wicW, sizeof(wicW));
return MMDRV_Message(wmld, WIDM_GETDEVCAPS, (DWORD_PTR)lpCaps, uSize, TRUE);
if (ret == MMSYSERR_NOERROR) {
WAVEINCAPSA wicA;
wicA.wMid = wicW.wMid;
wicA.wPid = wicW.wPid;
wicA.vDriverVersion = wicW.vDriverVersion;
WideCharToMultiByte( CP_ACP, 0, wicW.szPname, -1, wicA.szPname,
sizeof(wicA.szPname), NULL, NULL );
wicA.dwFormats = wicW.dwFormats;
wicA.wChannels = wicW.wChannels;
memcpy(lpCaps, &wicA, min(uSize, sizeof(wicA)));
}
return ret;
}
/**************************************************************************
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment