wineoss.drv: Move opening devices to their respective xxxMessage functions.

oldstable
Maarten Lankhorst 2010-04-21 13:45:31 +02:00 committed by Alexandre Julliard
parent ce91ee441a
commit c0a602c2e9
6 changed files with 44 additions and 75 deletions

View File

@ -1140,18 +1140,22 @@ static char* StrDup(const char* str, const char* def)
return dst;
}
static int WAVE_loadcount;
/******************************************************************
* OSS_WaveInit
*
* Initialize internal structures from OSS information
*/
LRESULT OSS_WaveInit(void)
static LRESULT OSS_WaveInit(void)
{
char* str;
unsigned int i;
/* FIXME: Remove unneeded members of WOutDev and WInDev */
TRACE("()\n");
TRACE("(%i)\n", WAVE_loadcount);
if (WAVE_loadcount++)
return 1;
str=getenv("AUDIODEV");
if (str!=NULL)
@ -1230,10 +1234,12 @@ LRESULT OSS_WaveInit(void)
*
* Delete/clear internal structures of OSS information
*/
LRESULT OSS_WaveExit(void)
static LRESULT OSS_WaveExit(void)
{
int i;
TRACE("()\n");
TRACE("(%i)\n", WAVE_loadcount);
if (--WAVE_loadcount)
return 1;
for (i = 0; i < MAX_WAVEDRV; ++i)
{
@ -3136,7 +3142,9 @@ DWORD WINAPI OSS_widMessage(WORD wDevID, WORD wMsg, DWORD_PTR dwUser,
switch (wMsg) {
case DRVM_INIT:
return OSS_WaveInit();
case DRVM_EXIT:
return OSS_WaveExit();
case DRVM_ENABLE:
case DRVM_DISABLE:
/* FIXME: Pretend this is supported */

View File

@ -170,23 +170,23 @@ static int MIDI_UnixToWindowsDeviceType(int type)
}
}
static int MIDI_loadcount;
/**************************************************************************
* OSS_MidiInit [internal]
*
* Initializes the MIDI devices information variables
*/
LRESULT OSS_MidiInit(void)
static LRESULT OSS_MidiInit(void)
{
int i, status, numsynthdevs = 255, nummididevs = 255;
struct synth_info sinfo;
struct midi_info minfo;
static BOOL bInitDone = FALSE;
if (bInitDone)
return 0;
TRACE("(%i)\n", MIDI_loadcount);
if (MIDI_loadcount++)
return 1;
TRACE("Initializing the MIDI variables.\n");
bInitDone = TRUE;
/* try to open device */
if (midiOpenSeq() == -1) {
@ -381,9 +381,12 @@ LRESULT OSS_MidiInit(void)
*
* Release the MIDI devices information variables
*/
LRESULT OSS_MidiExit(void)
static LRESULT OSS_MidiExit(void)
{
TRACE("()\n");
TRACE("(%i)\n", MIDI_loadcount);
if (--MIDI_loadcount)
return 1;
ZeroMemory(MidiInDev, sizeof(MidiInDev));
ZeroMemory(MidiOutDev, sizeof(MidiOutDev));
@ -1654,21 +1657,6 @@ static DWORD modReset(WORD wDevID)
return MMSYSERR_NOERROR;
}
#else /* HAVE_OSS_MIDI */
LRESULT OSS_MidiInit(void)
{
TRACE("()\n");
return FALSE;
}
LRESULT OSS_MidiExit(void)
{
TRACE("()\n");
return 0;
}
#endif /* HAVE_OSS_MIDI */
/*======================================================================*
@ -1686,7 +1674,9 @@ DWORD WINAPI OSS_midMessage(UINT wDevID, UINT wMsg, DWORD_PTR dwUser,
switch (wMsg) {
#ifdef HAVE_OSS_MIDI
case DRVM_INIT:
return OSS_MidiInit();
case DRVM_EXIT:
return OSS_MidiExit();
case DRVM_ENABLE:
case DRVM_DISABLE:
/* FIXME: Pretend this is supported */
@ -1711,6 +1701,10 @@ DWORD WINAPI OSS_midMessage(UINT wDevID, UINT wMsg, DWORD_PTR dwUser,
return midStart(wDevID);
case MIDM_STOP:
return midStop(wDevID);
#else
case DRVM_INIT:
case MIDM_GETNUMDEVS:
return 0;
#endif
default:
TRACE("Unsupported message\n");
@ -1730,7 +1724,9 @@ DWORD WINAPI OSS_modMessage(UINT wDevID, UINT wMsg, DWORD_PTR dwUser,
switch (wMsg) {
#ifdef HAVE_OSS_MIDI
case DRVM_INIT:
return OSS_MidiInit();
case DRVM_EXIT:
return OSS_MidiExit();
case DRVM_ENABLE:
case DRVM_DISABLE:
/* FIXME: Pretend this is supported */
@ -1757,6 +1753,10 @@ DWORD WINAPI OSS_modMessage(UINT wDevID, UINT wMsg, DWORD_PTR dwUser,
return 0;
case MODM_RESET:
return modReset(wDevID);
#else
case DRVM_INIT:
case MODM_GETNUMDEVS:
return 0;
#endif
default:
TRACE("Unsupported message\n");

View File

@ -1433,7 +1433,7 @@ static DWORD MIX_SetControlDetails(WORD wDevID, LPMIXERCONTROLDETAILS lpmcd,
/**************************************************************************
* MIX_Init [internal]
*/
LRESULT OSS_MixerInit(void)
static LRESULT OSS_MixerInit(void)
{
int i, mixer;
@ -1485,7 +1485,7 @@ LRESULT OSS_MixerInit(void)
/**************************************************************************
* MIX_Exit [internal]
*/
LRESULT OSS_MixerExit(void)
static LRESULT OSS_MixerExit(void)
{
int i;
@ -1524,7 +1524,9 @@ DWORD WINAPI OSS_mxdMessage(UINT wDevID, UINT wMsg, DWORD_PTR dwUser,
switch (wMsg)
{
case DRVM_INIT:
return OSS_MixerInit();
case DRVM_EXIT:
return OSS_MixerExit();
case DRVM_ENABLE:
case DRVM_DISABLE:
/* FIXME: Pretend this is supported */

View File

@ -49,7 +49,7 @@ static int NumDev = 6;
/*-----------------------------------------------------------------------*/
LRESULT OSS_AuxInit(void)
static LRESULT OSS_AuxInit(void)
{
int mixer;
TRACE("()\n");
@ -66,7 +66,7 @@ LRESULT OSS_AuxInit(void)
/*-----------------------------------------------------------------------*/
LRESULT OSS_AuxExit(void)
static LRESULT OSS_AuxExit(void)
{
TRACE("()\n");
return 0;
@ -232,7 +232,9 @@ DWORD WINAPI OSS_auxMessage(UINT wDevID, UINT wMsg, DWORD_PTR dwUser,
#ifdef HAVE_OSS
switch (wMsg) {
case DRVM_INIT:
return OSS_AuxInit();
case DRVM_EXIT:
return OSS_AuxExit();
case DRVM_ENABLE:
case DRVM_DISABLE:
/* FIXME: Pretend this is supported */

View File

@ -33,37 +33,6 @@
WINE_DEFAULT_DEBUG_CHANNEL(wave);
#ifdef HAVE_OSS
/**************************************************************************
* OSS_drvLoad [internal]
*/
static LRESULT OSS_drvLoad(void)
{
TRACE("()\n");
OSS_WaveInit();
OSS_MidiInit();
OSS_MixerInit();
OSS_AuxInit();
return 1;
}
/**************************************************************************
* OSS_drvFree [internal]
*/
static LRESULT OSS_drvFree(void)
{
TRACE("()\n");
OSS_WaveExit();
OSS_MidiExit();
OSS_MixerExit();
OSS_AuxExit();
return 1;
}
#endif
/**************************************************************************
* DriverProc (WINEOSS.1)
*/
@ -75,8 +44,8 @@ LRESULT CALLBACK OSS_DriverProc(DWORD_PTR dwDevID, HDRVR hDriv, UINT wMsg,
switch(wMsg) {
#ifdef HAVE_OSS
case DRV_LOAD: return OSS_drvLoad();
case DRV_FREE: return OSS_drvFree();
case DRV_LOAD:
case DRV_FREE:
case DRV_OPEN:
case DRV_CLOSE:
case DRV_ENABLE:

View File

@ -37,15 +37,3 @@
#ifdef SNDCTL_DSP_STEREO
# define HAVE_OSS
#endif
LRESULT OSS_WaveInit(void);
LRESULT OSS_WaveExit(void);
LRESULT OSS_MidiInit(void);
LRESULT OSS_MidiExit(void);
LRESULT OSS_MixerInit(void);
LRESULT OSS_MixerExit(void);
LRESULT OSS_AuxInit(void);
LRESULT OSS_AuxExit(void);