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;
......
......@@ -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:
......
/* -*- 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;
......
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