diff --git a/multimedia/audio.c b/multimedia/audio.c index f11dc7402ce..2f696536ed6 100644 --- a/multimedia/audio.c +++ b/multimedia/audio.c @@ -97,7 +97,7 @@ typedef struct { typedef struct { int unixdev; volatile int state; - DWORD dwFragmentSize; /* OpenSound '/dev/dsp' give us that size */ + DWORD dwFragmentSize; /* OpenSound '/dev/dsp' give us that size */ WAVEOPENDESC waveDesc; WORD wFlags; PCMWAVEFORMAT format; @@ -115,8 +115,8 @@ static WINE_WAVEIN WInDev [MAX_WAVEOUTDRV]; /************************************************************************** * WAVE_NotifyClient [internal] */ -static DWORD WAVE_NotifyClient(UINT16 wDevID, WORD wMsg, - DWORD dwParam1, DWORD dwParam2) +static DWORD WAVE_NotifyClient(UINT wDevID, WORD wMsg, DWORD dwParam1, + DWORD dwParam2) { TRACE("wDevID = %04X wMsg = %d dwParm1 = %04lX dwParam2 = %04lX\n",wDevID, wMsg, dwParam1, dwParam2); @@ -127,13 +127,13 @@ static DWORD WAVE_NotifyClient(UINT16 wDevID, WORD wMsg, if (wDevID > MAX_WAVEOUTDRV) return MCIERR_INTERNAL; if (WOutDev[wDevID].wFlags != DCB_NULL && - !DriverCallback16(WOutDev[wDevID].waveDesc.dwCallBack, - WOutDev[wDevID].wFlags, - WOutDev[wDevID].waveDesc.hWave, - wMsg, - WOutDev[wDevID].waveDesc.dwInstance, - dwParam1, - dwParam2)) { + !DriverCallback(WOutDev[wDevID].waveDesc.dwCallback, + WOutDev[wDevID].wFlags, + WOutDev[wDevID].waveDesc.hWave, + wMsg, + WOutDev[wDevID].waveDesc.dwInstance, + dwParam1, + dwParam2)) { WARN("can't notify client !\n"); return MMSYSERR_NOERROR; } @@ -145,13 +145,13 @@ static DWORD WAVE_NotifyClient(UINT16 wDevID, WORD wMsg, if (wDevID > MAX_WAVEINDRV) return MCIERR_INTERNAL; if (WInDev[wDevID].wFlags != DCB_NULL && - !DriverCallback16(WInDev[wDevID].waveDesc.dwCallBack, - WInDev[wDevID].wFlags, - WInDev[wDevID].waveDesc.hWave, - wMsg, - WInDev[wDevID].waveDesc.dwInstance, - dwParam1, - dwParam2)) { + !DriverCallback(WInDev[wDevID].waveDesc.dwCallback, + WInDev[wDevID].wFlags, + WInDev[wDevID].waveDesc.hWave, + wMsg, + WInDev[wDevID].waveDesc.dwInstance, + dwParam1, + dwParam2)) { WARN("can't notify client !\n"); return MMSYSERR_NOERROR; } @@ -440,7 +440,7 @@ static DWORD CALLBACK wodPlayer(LPVOID pmt) /************************************************************************** * wodGetDevCaps [internal] */ -static DWORD wodGetDevCaps(WORD wDevID, LPWAVEOUTCAPS16 lpCaps, DWORD dwSize) +static DWORD wodGetDevCaps(WORD wDevID, LPWAVEOUTCAPSA lpCaps, DWORD dwSize) { int audio; int smplrate; @@ -552,7 +552,7 @@ static DWORD wodOpen(WORD wDevID, LPWAVEOPENDESC lpDesc, DWORD dwFlags) int dsp_stereo; int audio_fragment; int fragment_size; - WAVEOUTCAPS16 woc; + WAVEOUTCAPSA woc; TRACE("(%u, %p, %08lX);\n", wDevID, lpDesc, dwFlags); if (lpDesc == NULL) { @@ -575,8 +575,12 @@ static DWORD wodOpen(WORD wDevID, LPWAVEOPENDESC lpDesc, DWORD dwFlags) return WAVERR_BADFORMAT; } - if (dwFlags & WAVE_FORMAT_QUERY) + if (dwFlags & WAVE_FORMAT_QUERY) { + TRACE("Query format: tag=%04X nChannels=%d nSamplesPerSec=%ld !\n", + lpDesc->lpFormat->wFormatTag, lpDesc->lpFormat->nChannels, + lpDesc->lpFormat->nSamplesPerSec); return MMSYSERR_NOERROR; + } WOutDev[wDevID].unixdev = 0; if (access(SOUND_DEV, 0) != 0) @@ -606,7 +610,7 @@ static DWORD wodOpen(WORD wDevID, LPWAVEOPENDESC lpDesc, DWORD dwFlags) audio_fragment = 0x000F000A; sample_size = WOutDev[wDevID].format.wBitsPerSample; sample_rate = WOutDev[wDevID].format.wf.nSamplesPerSec; - dsp_stereo = (WOutDev[wDevID].format.wf.nChannels > 1) ? TRUE : FALSE; + dsp_stereo = (WOutDev[wDevID].format.wf.nChannels > 1) ? 1 : 0; IOCTL(audio, SNDCTL_DSP_SETFRAGMENT, audio_fragment); /* First size and stereo then samplerate */ @@ -614,6 +618,17 @@ static DWORD wodOpen(WORD wDevID, LPWAVEOPENDESC lpDesc, DWORD dwFlags) IOCTL(audio, SNDCTL_DSP_STEREO, dsp_stereo); IOCTL(audio, SNDCTL_DSP_SPEED, sample_rate); + /* paranoid checks */ + if (sample_size != WOutDev[wDevID].format.wBitsPerSample) + ERR("Can't set sample_size to %u (%d)\n", + WOutDev[wDevID].format.wBitsPerSample, sample_size); + if (dsp_stereo != (WOutDev[wDevID].format.wf.nChannels > 1) ? 1 : 0) + ERR("Can't set stereo to %u (%d)\n", + (WOutDev[wDevID].format.wf.nChannels > 1) ? 1 : 0, dsp_stereo); + if (sample_rate != WOutDev[wDevID].format.wf.nSamplesPerSec) + ERR("Can't set sample_rate to %lu (%d)\n", + WOutDev[wDevID].format.wf.nSamplesPerSec, sample_rate); + /* even if we set fragment size above, read it again, just in case */ IOCTL(audio, SNDCTL_DSP_GETBLKSIZE, fragment_size); @@ -628,9 +643,10 @@ static DWORD wodOpen(WORD wDevID, LPWAVEOPENDESC lpDesc, DWORD dwFlags) TRACE("fd=%d fragmentSize=%ld\n", WOutDev[wDevID].unixdev, WOutDev[wDevID].dwFragmentSize); - TRACE("wBitsPerSample=%u, nAvgBytesPerSec=%lu, nSamplesPerSec=%lu, nChannels=%u !\n", + TRACE("wBitsPerSample=%u, nAvgBytesPerSec=%lu, nSamplesPerSec=%lu, nChannels=%u nBlockAlign=%u!\n", WOutDev[wDevID].format.wBitsPerSample, WOutDev[wDevID].format.wf.nAvgBytesPerSec, - WOutDev[wDevID].format.wf.nSamplesPerSec, WOutDev[wDevID].format.wf.nChannels); + WOutDev[wDevID].format.wf.nSamplesPerSec, WOutDev[wDevID].format.wf.nChannels, + WOutDev[wDevID].format.wf.nBlockAlign); if (WAVE_NotifyClient(wDevID, WOM_OPEN, 0L, 0L) != MMSYSERR_NOERROR) { WARN("can't notify client !\n"); @@ -811,7 +827,7 @@ static DWORD wodReset(WORD wDevID) /************************************************************************** * wodGetPosition [internal] */ -static DWORD wodGetPosition(WORD wDevID, LPMMTIME16 lpTime, DWORD uSize) +static DWORD wodGetPosition(WORD wDevID, LPMMTIME lpTime, DWORD uSize) { int time; DWORD val; @@ -944,25 +960,30 @@ static DWORD wodGetNumDevs(void) } /************************************************************************** - * wodMessage [sample driver] + * OSS_wodMessage [sample driver] */ -DWORD WINAPI wodMessage(WORD wDevID, WORD wMsg, DWORD dwUser, - DWORD dwParam1, DWORD dwParam2) +DWORD WINAPI OSS_wodMessage(UINT wDevID, UINT wMsg, DWORD dwUser, + DWORD dwParam1, DWORD dwParam2) { TRACE("(%u, %04X, %08lX, %08lX, %08lX);\n", wDevID, wMsg, dwUser, dwParam1, dwParam2); switch (wMsg) { + case DRVM_INIT: + case DRVM_EXIT: + case DRVM_ENABLE: + case DRVM_DISABLE: + /* FIXME: Pretend this is supported */ + return 0; case WODM_OPEN: return wodOpen (wDevID, (LPWAVEOPENDESC)dwParam1, dwParam2); case WODM_CLOSE: return wodClose (wDevID); case WODM_WRITE: return wodWrite (wDevID, (LPWAVEHDR)dwParam1, dwParam2); case WODM_PAUSE: return wodPause (wDevID); - /* case WODM_STOP: */ - case WODM_GETPOS: return wodGetPosition (wDevID, (LPMMTIME16)dwParam1, dwParam2); + case WODM_GETPOS: return wodGetPosition (wDevID, (LPMMTIME)dwParam1, dwParam2); 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, (LPWAVEOUTCAPS16)dwParam1, dwParam2); + case WODM_GETDEVCAPS: return wodGetDevCaps (wDevID, (LPWAVEOUTCAPSA)dwParam1, dwParam2); case WODM_GETNUMDEVS: return wodGetNumDevs (); case WODM_GETPITCH: return MMSYSERR_NOTSUPPORTED; case WODM_SETPITCH: return MMSYSERR_NOTSUPPORTED; @@ -985,9 +1006,9 @@ DWORD WINAPI wodMessage(WORD wDevID, WORD wMsg, DWORD dwUser, /************************************************************************** * widGetDevCaps [internal] */ -static DWORD widGetDevCaps(WORD wDevID, LPWAVEINCAPS16 lpCaps, DWORD dwSize) +static DWORD widGetDevCaps(WORD wDevID, LPWAVEINCAPSA lpCaps, DWORD dwSize) { - int audio,smplrate,samplesize=16,dsp_stereo=1,bytespersmpl; + int audio, smplrate, samplesize=16, dsp_stereo=1, bytespersmpl; TRACE("(%u, %p, %lu);\n", wDevID, lpCaps, dwSize); if (lpCaps == NULL) return MMSYSERR_NOTENABLED; @@ -1049,7 +1070,7 @@ static DWORD widGetDevCaps(WORD wDevID, LPWAVEINCAPS16 lpCaps, DWORD dwSize) */ static DWORD widOpen(WORD wDevID, LPWAVEOPENDESC lpDesc, DWORD dwFlags) { - int audio,abuf_size,smplrate,samplesize,dsp_stereo; + int audio, abuf_size, smplrate, samplesize, dsp_stereo; LPWAVEFORMAT lpFormat; TRACE("(%u, %p, %08lX);\n", wDevID, lpDesc, dwFlags); @@ -1061,6 +1082,24 @@ static DWORD widOpen(WORD wDevID, LPWAVEOPENDESC lpDesc, DWORD dwFlags) TRACE("MAX_WAVINDRV reached !\n"); return MMSYSERR_ALLOCATED; } + + /* only PCM format is supported so far... */ + if (lpDesc->lpFormat->wFormatTag != WAVE_FORMAT_PCM || + lpDesc->lpFormat->nChannels == 0 || + lpDesc->lpFormat->nSamplesPerSec == 0) { + WARN("Bad format: tag=%04X nChannels=%d nSamplesPerSec=%ld !\n", + lpDesc->lpFormat->wFormatTag, lpDesc->lpFormat->nChannels, + lpDesc->lpFormat->nSamplesPerSec); + return WAVERR_BADFORMAT; + } + + if (dwFlags & WAVE_FORMAT_QUERY) { + TRACE("Query format: tag=%04X nChannels=%d nSamplesPerSec=%ld !\n", + lpDesc->lpFormat->wFormatTag, lpDesc->lpFormat->nChannels, + lpDesc->lpFormat->nSamplesPerSec); + return MMSYSERR_NOERROR; + } + WInDev[wDevID].unixdev = 0; if (access(SOUND_DEV,0) != 0) return MMSYSERR_NOTENABLED; audio = open(SOUND_DEV, O_RDONLY, 0); @@ -1087,11 +1126,7 @@ static DWORD widOpen(WORD wDevID, LPWAVEOPENDESC lpDesc, DWORD dwFlags) WInDev[wDevID].dwTotalRecorded = 0; memcpy(&WInDev[wDevID].waveDesc, lpDesc, sizeof(WAVEOPENDESC)); lpFormat = (LPWAVEFORMAT) lpDesc->lpFormat; - if (lpFormat->wFormatTag != WAVE_FORMAT_PCM) { - WARN("Bad format %04X !\n", - lpFormat->wFormatTag); - return WAVERR_BADFORMAT; - } + memcpy(&WInDev[wDevID].format, lpFormat, sizeof(PCMWAVEFORMAT)); WInDev[wDevID].format.wBitsPerSample = 8; /* <-------------- */ if (WInDev[wDevID].format.wf.nChannels == 0) return WAVERR_BADFORMAT; @@ -1306,7 +1341,7 @@ static DWORD widReset(WORD wDevID) /************************************************************************** * widGetPosition [internal] */ -static DWORD widGetPosition(WORD wDevID, LPMMTIME16 lpTime, DWORD uSize) +static DWORD widGetPosition(WORD wDevID, LPMMTIME lpTime, DWORD uSize) { int time; @@ -1359,23 +1394,29 @@ static DWORD widGetPosition(WORD wDevID, LPMMTIME16 lpTime, DWORD uSize) } /************************************************************************** - * widMessage [sample driver] + * OSS_widMessage [sample driver] */ -DWORD WINAPI widMessage(WORD wDevID, WORD wMsg, DWORD dwUser, - DWORD dwParam1, DWORD dwParam2) +DWORD WINAPI OSS_widMessage(WORD wDevID, WORD wMsg, DWORD dwUser, + DWORD dwParam1, DWORD dwParam2) { TRACE("(%u, %04X, %08lX, %08lX, %08lX);\n", wDevID, wMsg, dwUser, dwParam1, dwParam2); switch (wMsg) { + case DRVM_INIT: + case DRVM_EXIT: + case DRVM_ENABLE: + case DRVM_DISABLE: + /* FIXME: Pretend this is supported */ + return 0; case WIDM_OPEN: return widOpen(wDevID, (LPWAVEOPENDESC)dwParam1, dwParam2); case WIDM_CLOSE: return widClose(wDevID); 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, (LPWAVEINCAPS16)dwParam1,dwParam2); + case WIDM_GETDEVCAPS: return widGetDevCaps(wDevID, (LPWAVEINCAPSA)dwParam1, dwParam2); case WIDM_GETNUMDEVS: return wodGetNumDevs(); /* same number of devices in output as in input */ - case WIDM_GETPOS: return widGetPosition(wDevID, (LPMMTIME16)dwParam1, dwParam2); + case WIDM_GETPOS: return widGetPosition(wDevID, (LPMMTIME)dwParam1, dwParam2); case WIDM_RESET: return widReset(wDevID); case WIDM_START: return widStart(wDevID); case WIDM_STOP: return widStop(wDevID); @@ -1385,42 +1426,13 @@ DWORD WINAPI widMessage(WORD wDevID, WORD wMsg, DWORD dwUser, return MMSYSERR_NOTSUPPORTED; } -/*======================================================================* - * Low level WAVE implemantation - DriverProc * - *======================================================================*/ - -/************************************************************************** - * WAVE_DriverProc [sample driver] - */ -LONG CALLBACK WAVE_DriverProc(DWORD dwDevID, HDRVR16 hDriv, DWORD wMsg, - DWORD dwParam1, DWORD dwParam2) -{ - TRACE("(%08lX, %04X, %08lX, %08lX, %08lX)\n", dwDevID, hDriv, wMsg, dwParam1, dwParam2); - switch (wMsg) { - case DRV_LOAD: return 1; - case DRV_FREE: return 1; - case DRV_OPEN: return 1; - case DRV_CLOSE: return 1; - case DRV_ENABLE: return 1; - case DRV_DISABLE: return 1; - case DRV_QUERYCONFIGURE: return 1; - case DRV_CONFIGURE: MessageBoxA(0, "Sample MultiMedia Linux Driver !", "MMLinux Driver", MB_OK); return 1; - case DRV_INSTALL: return DRVCNF_RESTART; - case DRV_REMOVE: return DRVCNF_RESTART; - default: - FIXME("is probably wrong msg=0x%04lx\n", wMsg); - return DefDriverProc(dwDevID, hDriv, wMsg, dwParam1, dwParam2); - } - return MMSYSERR_NOTENABLED; -} - #else /* !HAVE_OSS */ /************************************************************************** * wodMessage [sample driver] */ -DWORD WINAPI wodMessage(WORD wDevID, WORD wMsg, DWORD dwUser, - DWORD dwParam1, DWORD dwParam2) +DWORD WINAPI OSS_wodMessage(WORD wDevID, WORD wMsg, DWORD dwUser, + DWORD dwParam1, DWORD dwParam2) { FIXME("(%u, %04X, %08lX, %08lX, %08lX):stub\n", wDevID, wMsg, dwUser, dwParam1, dwParam2); return MMSYSERR_NOTENABLED; @@ -1429,19 +1441,11 @@ DWORD WINAPI wodMessage(WORD wDevID, WORD wMsg, DWORD dwUser, /************************************************************************** * widMessage [sample driver] */ -DWORD WINAPI widMessage(WORD wDevID, WORD wMsg, DWORD dwUser, - DWORD dwParam1, DWORD dwParam2) +DWORD WINAPI OSS_widMessage(WORD wDevID, WORD wMsg, DWORD dwUser, + DWORD dwParam1, DWORD dwParam2) { FIXME("(%u, %04X, %08lX, %08lX, %08lX):stub\n", wDevID, wMsg, dwUser, dwParam1, dwParam2); return MMSYSERR_NOTENABLED; } -/************************************************************************** - * WAVE_DriverProc [sample driver] - */ -LONG CALLBACK WAVE_DriverProc(DWORD dwDevID, HDRVR16 hDriv, DWORD wMsg, - DWORD dwParam1, DWORD dwParam2) -{ - return MMSYSERR_NOTENABLED; -} #endif /* HAVE_OSS */ diff --git a/multimedia/mixer.c b/multimedia/mixer.c index e6602e70a8e..43b7cfc84d2 100644 --- a/multimedia/mixer.c +++ b/multimedia/mixer.c @@ -505,16 +505,22 @@ static DWORD MIX_SetControlDetails(WORD wDevID, LPMIXERCONTROLDETAILS lpmcd, DWO #endif /* HAVE_OSS */ /************************************************************************** - * mixMessage [sample driver] + * OSS_mixMessage [sample driver] */ -DWORD WINAPI mixMessage(WORD wDevID, WORD wMsg, DWORD dwUser, - DWORD dwParam1, DWORD dwParam2) +DWORD WINAPI OSS_mixMessage(UINT wDevID, UINT wMsg, DWORD dwUser, + DWORD dwParam1, DWORD dwParam2) { TRACE("(%04X, %04X, %08lX, %08lX, %08lX);\n", wDevID, wMsg, dwUser, dwParam1, dwParam2); #ifdef HAVE_OSS switch(wMsg) { + case DRVM_INIT: + case DRVM_EXIT: + case DRVM_ENABLE: + case DRVM_DISABLE: + /* FIXME: Pretend this is supported */ + return 0; case MXDM_GETDEVCAPS: return MIX_GetDevCaps(wDevID, (LPMIXERCAPSA)dwParam1, dwParam2); case MXDM_GETLINEINFO: diff --git a/multimedia/mmaux.c b/multimedia/mmaux.c index 589edbdc2f1..6e87663961a 100644 --- a/multimedia/mmaux.c +++ b/multimedia/mmaux.c @@ -1,3 +1,4 @@ +/* -*- tab-width: 8; c-basic-offset: 4 -*- */ /* * Sample AUXILARY Wine Driver * @@ -15,13 +16,12 @@ #include "driver.h" #include "mmddk.h" #include "oss.h" - #include "debugtools.h" DEFAULT_DEBUG_CHANNEL(mmaux) - + #define MIXER_DEV "/dev/mixer" - + static int NumDev = 6; /*-----------------------------------------------------------------------*/ @@ -30,70 +30,70 @@ static int NumDev = 6; /************************************************************************** * AUX_GetDevCaps [internal] */ -static DWORD AUX_GetDevCaps(WORD wDevID, LPAUXCAPS16 lpCaps, DWORD dwSize) +static DWORD AUX_GetDevCaps(WORD wDevID, LPAUXCAPSA lpCaps, DWORD dwSize) { #ifdef HAVE_OSS - int mixer,volume; - - TRACE("(%04X, %p, %lu);\n", wDevID, lpCaps, dwSize); - if (lpCaps == NULL) return MMSYSERR_NOTENABLED; - if ((mixer = open(MIXER_DEV, O_RDWR)) < 0) { - WARN("mixer device not available !\n"); - return MMSYSERR_NOTENABLED; - } - if (ioctl(mixer, SOUND_MIXER_READ_LINE, &volume) == -1) { - close(mixer); - WARN("unable read mixer !\n"); - 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"); - lpCaps->wTechnology = AUXCAPS_CDAUDIO; - lpCaps->dwSupport = AUXCAPS_VOLUME | AUXCAPS_LRVOLUME; -#endif - return MMSYSERR_NOERROR; -#else + int mixer,volume; + + TRACE("(%04X, %p, %lu);\n", wDevID, lpCaps, dwSize); + if (lpCaps == NULL) return MMSYSERR_NOTENABLED; + if ((mixer = open(MIXER_DEV, O_RDWR)) < 0) { + WARN("mixer device not available !\n"); return MMSYSERR_NOTENABLED; + } + if (ioctl(mixer, SOUND_MIXER_READ_LINE, &volume) == -1) { + close(mixer); + WARN("unable read mixer !\n"); + 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"); + lpCaps->wTechnology = AUXCAPS_CDAUDIO; + lpCaps->dwSupport = AUXCAPS_VOLUME | AUXCAPS_LRVOLUME; +#endif + return MMSYSERR_NOERROR; +#else + return MMSYSERR_NOTENABLED; #endif } @@ -104,55 +104,55 @@ static DWORD AUX_GetDevCaps(WORD wDevID, LPAUXCAPS16 lpCaps, DWORD dwSize) static DWORD AUX_GetVolume(WORD wDevID, LPDWORD lpdwVol) { #ifdef HAVE_OSS - int mixer, volume, left, right, cmd; - - TRACE("(%04X, %p);\n", wDevID, lpdwVol); - if (lpdwVol == NULL) return MMSYSERR_NOTENABLED; - if ((mixer = open(MIXER_DEV, O_RDWR)) < 0) { - WARN("mixer device not available !\n"); - return MMSYSERR_NOTENABLED; - } - switch(wDevID) { - case 0: - TRACE("SOUND_MIXER_READ_PCM !\n"); - cmd = SOUND_MIXER_READ_PCM; - break; - case 1: - TRACE("SOUND_MIXER_READ_SYNTH !\n"); - cmd = SOUND_MIXER_READ_SYNTH; - break; - case 2: - TRACE("SOUND_MIXER_READ_CD !\n"); - cmd = SOUND_MIXER_READ_CD; - break; - case 3: - TRACE("SOUND_MIXER_READ_LINE !\n"); - cmd = SOUND_MIXER_READ_LINE; - break; - case 4: - TRACE("SOUND_MIXER_READ_MIC !\n"); - cmd = SOUND_MIXER_READ_MIC; - break; - case 5: - TRACE("SOUND_MIXER_READ_VOLUME !\n"); - cmd = SOUND_MIXER_READ_VOLUME; - break; - default: - WARN("invalid device id=%04X !\n", wDevID); - return MMSYSERR_NOTENABLED; - } - if (ioctl(mixer, cmd, &volume) == -1) { - WARN("unable read mixer !\n"); - return MMSYSERR_NOTENABLED; - } - close(mixer); - left = LOBYTE(LOWORD(volume)); - right = HIBYTE(LOWORD(volume)); - TRACE("left=%d right=%d !\n", left, right); - *lpdwVol = MAKELONG((left * 0xFFFFL) / 100, (right * 0xFFFFL) / 100); - return MMSYSERR_NOERROR; -#else + int mixer, volume, left, right, cmd; + + TRACE("(%04X, %p);\n", wDevID, lpdwVol); + if (lpdwVol == NULL) return MMSYSERR_NOTENABLED; + if ((mixer = open(MIXER_DEV, O_RDWR)) < 0) { + WARN("mixer device not available !\n"); return MMSYSERR_NOTENABLED; + } + switch(wDevID) { + case 0: + TRACE("SOUND_MIXER_READ_PCM !\n"); + cmd = SOUND_MIXER_READ_PCM; + break; + case 1: + TRACE("SOUND_MIXER_READ_SYNTH !\n"); + cmd = SOUND_MIXER_READ_SYNTH; + break; + case 2: + TRACE("SOUND_MIXER_READ_CD !\n"); + cmd = SOUND_MIXER_READ_CD; + break; + case 3: + TRACE("SOUND_MIXER_READ_LINE !\n"); + cmd = SOUND_MIXER_READ_LINE; + break; + case 4: + TRACE("SOUND_MIXER_READ_MIC !\n"); + cmd = SOUND_MIXER_READ_MIC; + break; + case 5: + TRACE("SOUND_MIXER_READ_VOLUME !\n"); + cmd = SOUND_MIXER_READ_VOLUME; + break; + default: + WARN("invalid device id=%04X !\n", wDevID); + return MMSYSERR_NOTENABLED; + } + if (ioctl(mixer, cmd, &volume) == -1) { + WARN("unable read mixer !\n"); + return MMSYSERR_NOTENABLED; + } + close(mixer); + left = LOBYTE(LOWORD(volume)); + right = HIBYTE(LOWORD(volume)); + TRACE("left=%d right=%d !\n", left, right); + *lpdwVol = MAKELONG((left * 0xFFFFL) / 100, (right * 0xFFFFL) / 100); + return MMSYSERR_NOERROR; +#else + return MMSYSERR_NOTENABLED; #endif } @@ -162,82 +162,88 @@ static DWORD AUX_GetVolume(WORD wDevID, LPDWORD lpdwVol) static DWORD AUX_SetVolume(WORD wDevID, DWORD dwParam) { #ifdef HAVE_OSS - int mixer; - int volume, left, right; - int cmd; - - TRACE("(%04X, %08lX);\n", wDevID, dwParam); - - left = (LOWORD(dwParam) * 100) >> 16; - right = (HIWORD(dwParam) * 100) >> 16; - volume = (right << 8) | left; - - if ((mixer = open(MIXER_DEV, O_RDWR)) < 0) { - WARN("mixer device not available !\n"); - return MMSYSERR_NOTENABLED; - } - - switch(wDevID) { - case 0: - TRACE("SOUND_MIXER_WRITE_PCM !\n"); - cmd = SOUND_MIXER_WRITE_PCM; - break; - case 1: - TRACE("SOUND_MIXER_WRITE_SYNTH !\n"); - cmd = SOUND_MIXER_WRITE_SYNTH; - break; - case 2: - TRACE("SOUND_MIXER_WRITE_CD !\n"); - cmd = SOUND_MIXER_WRITE_CD; - break; - case 3: - TRACE("SOUND_MIXER_WRITE_LINE !\n"); - cmd = SOUND_MIXER_WRITE_LINE; - break; - case 4: - TRACE("SOUND_MIXER_WRITE_MIC !\n"); - cmd = SOUND_MIXER_WRITE_MIC; - break; - case 5: - TRACE("SOUND_MIXER_WRITE_VOLUME !\n"); - cmd = SOUND_MIXER_WRITE_VOLUME; - break; - default: - WARN("invalid device id=%04X !\n", wDevID); - return MMSYSERR_NOTENABLED; - } - if (ioctl(mixer, cmd, &volume) == -1) { - WARN("unable set mixer !\n"); - return MMSYSERR_NOTENABLED; - } - close(mixer); - return MMSYSERR_NOERROR; -#else + int mixer; + int volume, left, right; + int cmd; + + TRACE("(%04X, %08lX);\n", wDevID, dwParam); + + left = (LOWORD(dwParam) * 100) >> 16; + right = (HIWORD(dwParam) * 100) >> 16; + volume = (right << 8) | left; + + if ((mixer = open(MIXER_DEV, O_RDWR)) < 0) { + WARN("mixer device not available !\n"); return MMSYSERR_NOTENABLED; + } + + switch(wDevID) { + case 0: + TRACE("SOUND_MIXER_WRITE_PCM !\n"); + cmd = SOUND_MIXER_WRITE_PCM; + break; + case 1: + TRACE("SOUND_MIXER_WRITE_SYNTH !\n"); + cmd = SOUND_MIXER_WRITE_SYNTH; + break; + case 2: + TRACE("SOUND_MIXER_WRITE_CD !\n"); + cmd = SOUND_MIXER_WRITE_CD; + break; + case 3: + TRACE("SOUND_MIXER_WRITE_LINE !\n"); + cmd = SOUND_MIXER_WRITE_LINE; + break; + case 4: + TRACE("SOUND_MIXER_WRITE_MIC !\n"); + cmd = SOUND_MIXER_WRITE_MIC; + break; + case 5: + TRACE("SOUND_MIXER_WRITE_VOLUME !\n"); + cmd = SOUND_MIXER_WRITE_VOLUME; + break; + default: + WARN("invalid device id=%04X !\n", wDevID); + return MMSYSERR_NOTENABLED; + } + if (ioctl(mixer, cmd, &volume) == -1) { + WARN("unable set mixer !\n"); + return MMSYSERR_NOTENABLED; + } + close(mixer); + return MMSYSERR_NOERROR; +#else + return MMSYSERR_NOTENABLED; #endif } /************************************************************************** - * auxMessage [sample driver] + * OSS_auxMessage [sample driver] */ -DWORD WINAPI auxMessage(WORD wDevID, WORD wMsg, DWORD dwUser, - DWORD dwParam1, DWORD dwParam2) +DWORD WINAPI OSS_auxMessage(UINT wDevID, UINT wMsg, DWORD dwUser, + DWORD dwParam1, DWORD dwParam2) { - TRACE("(%04X, %04X, %08lX, %08lX, %08lX);\n", - wDevID, wMsg, dwUser, dwParam1, dwParam2); - switch(wMsg) { - case AUXDM_GETDEVCAPS: - return AUX_GetDevCaps(wDevID,(LPAUXCAPS16)dwParam1,dwParam2); - case AUXDM_GETNUMDEVS: - TRACE("return %d;\n", NumDev); - return NumDev; - case AUXDM_GETVOLUME: - return AUX_GetVolume(wDevID,(LPDWORD)dwParam1); - case AUXDM_SETVOLUME: - return AUX_SetVolume(wDevID,dwParam1); - default: - WARN("unknown message !\n"); - } - return MMSYSERR_NOTSUPPORTED; + TRACE("(%04X, %04X, %08lX, %08lX, %08lX);\n", + wDevID, wMsg, dwUser, dwParam1, dwParam2); + switch(wMsg) { + case DRVM_INIT: + case DRVM_EXIT: + case DRVM_ENABLE: + case DRVM_DISABLE: + /* FIXME: Pretend this is supported */ + return 0; + case AUXDM_GETDEVCAPS: + return AUX_GetDevCaps(wDevID, (LPAUXCAPSA)dwParam1,dwParam2); + case AUXDM_GETNUMDEVS: + TRACE("return %d;\n", NumDev); + return NumDev; + case AUXDM_GETVOLUME: + return AUX_GetVolume(wDevID, (LPDWORD)dwParam1); + case AUXDM_SETVOLUME: + return AUX_SetVolume(wDevID, dwParam1); + default: + WARN("unknown message !\n"); + } + return MMSYSERR_NOTSUPPORTED; }