small range fixes for OSS driver

changed to the new debug channel interface
This commit is contained in:
Eric Pouech 1999-05-03 09:43:30 +00:00 committed by Alexandre Julliard
parent 54e4ba048a
commit 1d1a6bb4a7
1 changed files with 120 additions and 115 deletions

View File

@ -14,7 +14,7 @@
#include "windef.h"
#include "driver.h"
#include "multimedia.h"
#include "debug.h"
#include "debugtools.h"
DEFAULT_DEBUG_CHANNEL(mmaux)
@ -32,16 +32,16 @@ static DWORD AUX_GetDevCaps(WORD wDevID, LPAUXCAPS16 lpCaps, DWORD dwSize)
{
#ifdef HAVE_OSS
int mixer,volume;
TRACE(mmaux,"(%04X, %p, %lu);\n", wDevID, lpCaps, dwSize);
TRACE("(%04X, %p, %lu);\n", wDevID, lpCaps, dwSize);
if (lpCaps == NULL) return MMSYSERR_NOTENABLED;
if ((mixer = open(MIXER_DEV, O_RDWR)) < 0) {
WARN(mmaux, "mixer device not available !\n");
WARN("mixer device not available !\n");
return MMSYSERR_NOTENABLED;
}
if (ioctl(mixer, SOUND_MIXER_READ_LINE, &volume) == -1) {
close(mixer);
WARN(mmaux, "unable read mixer !\n");
WARN("unable read mixer !\n");
return MMSYSERR_NOTENABLED;
}
close(mixer);
@ -50,37 +50,37 @@ static DWORD AUX_GetDevCaps(WORD wDevID, LPAUXCAPS16 lpCaps, DWORD dwSize)
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;
}
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;
@ -102,52 +102,52 @@ 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(mmaux,"(%04X, %p);\n", wDevID, lpdwVol);
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(mmaux, "mixer device not available !\n");
WARN("mixer device not available !\n");
return MMSYSERR_NOTENABLED;
}
switch(wDevID) {
case 0:
TRACE(mmaux,"SOUND_MIXER_READ_PCM !\n");
cmd = SOUND_MIXER_READ_PCM;
break;
case 1:
TRACE(mmaux,"SOUND_MIXER_READ_SYNTH !\n");
cmd = SOUND_MIXER_READ_SYNTH;
break;
case 2:
TRACE(mmaux,"SOUND_MIXER_READ_CD !\n");
cmd = SOUND_MIXER_READ_CD;
break;
case 3:
TRACE(mmaux,"SOUND_MIXER_READ_LINE !\n");
cmd = SOUND_MIXER_READ_LINE;
break;
case 4:
TRACE(mmaux,"SOUND_MIXER_READ_MIC !\n");
cmd = SOUND_MIXER_READ_MIC;
break;
case 5:
TRACE(mmaux,"SOUND_MIXER_READ_VOLUME !\n");
cmd = SOUND_MIXER_READ_VOLUME;
break;
default:
WARN(mmaux, "invalid device id=%04X !\n", wDevID);
return MMSYSERR_NOTENABLED;
}
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(mmaux, "unable read mixer !\n");
WARN("unable read mixer !\n");
return MMSYSERR_NOTENABLED;
}
close(mixer);
left = volume & 0x7F;
right = (volume >> 8) & 0x7F;
TRACE(mmaux,"left=%d right=%d !\n", left, right);
*lpdwVol = MAKELONG(left << 9, right << 9);
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;
@ -160,49 +160,54 @@ static DWORD AUX_GetVolume(WORD wDevID, LPDWORD lpdwVol)
static DWORD AUX_SetVolume(WORD wDevID, DWORD dwParam)
{
#ifdef HAVE_OSS
int mixer;
int volume;
int mixer;
int volume, left, right;
int cmd;
TRACE(mmaux,"(%04X, %08lX);\n", wDevID, dwParam);
volume = (LOWORD(dwParam) >> 9 & 0x7F) +
((HIWORD(dwParam) >> 9 & 0x7F) << 8);
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(mmaux, "mixer device not available !\n");
WARN("mixer device not available !\n");
return MMSYSERR_NOTENABLED;
}
}
switch(wDevID) {
case 0:
TRACE(mmaux,"SOUND_MIXER_WRITE_PCM !\n");
cmd = SOUND_MIXER_WRITE_PCM;
break;
case 1:
TRACE(mmaux,"SOUND_MIXER_WRITE_SYNTH !\n");
cmd = SOUND_MIXER_WRITE_SYNTH;
break;
case 2:
TRACE(mmaux,"SOUND_MIXER_WRITE_CD !\n");
cmd = SOUND_MIXER_WRITE_CD;
break;
case 3:
TRACE(mmaux,"SOUND_MIXER_WRITE_LINE !\n");
cmd = SOUND_MIXER_WRITE_LINE;
break;
case 4:
TRACE(mmaux,"SOUND_MIXER_WRITE_MIC !\n");
cmd = SOUND_MIXER_WRITE_MIC;
break;
case 5:
TRACE(mmaux,"SOUND_MIXER_WRITE_VOLUME !\n");
cmd = SOUND_MIXER_WRITE_VOLUME;
break;
default:
WARN(mmaux,"invalid device id=%04X !\n", wDevID);
return MMSYSERR_NOTENABLED;
}
if (ioctl(mixer, cmd, &volume) == -1) {
WARN(mmaux, "unable set mixer !\n");
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
@ -215,22 +220,22 @@ static DWORD AUX_SetVolume(WORD wDevID, DWORD dwParam)
* auxMessage [sample driver]
*/
DWORD WINAPI auxMessage(WORD wDevID, WORD wMsg, DWORD dwUser,
DWORD dwParam1, DWORD dwParam2)
DWORD dwParam1, DWORD dwParam2)
{
TRACE(mmaux,"(%04X, %04X, %08lX, %08lX, %08lX);\n",
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(mmaux,"return %d;\n", NumDev);
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(mmaux, "unknown message !\n");
WARN("unknown message !\n");
}
return MMSYSERR_NOTSUPPORTED;
}