Signed-off-by: Huw Davies huw@codeweavers.com --- dlls/wineoss.drv/mmaux.c | 135 --------------------------------------- dlls/wineoss.drv/oss.c | 121 +++++++++++++++++++++++++++++++++++ 2 files changed, 121 insertions(+), 135 deletions(-)
diff --git a/dlls/wineoss.drv/mmaux.c b/dlls/wineoss.drv/mmaux.c index a3a12a96bea..ae52293f944 100644 --- a/dlls/wineoss.drv/mmaux.c +++ b/dlls/wineoss.drv/mmaux.c @@ -18,16 +18,7 @@ * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA */
-#include "config.h" - #include <stdarg.h> -#include <stdlib.h> -#include <string.h> -#include <sys/types.h> -#include <unistd.h> -#include <fcntl.h> -#include <sys/ioctl.h> -#include <sys/soundcard.h>
#include "windef.h" #include "winbase.h" @@ -42,125 +33,6 @@
WINE_DEFAULT_DEBUG_CHANNEL(mmaux);
-#define MIXER_DEV "/dev/mixer" - -/*-----------------------------------------------------------------------*/ - -/************************************************************************** - * AUX_GetVolume [internal] - */ -static DWORD AUX_GetVolume(WORD wDevID, LPDWORD 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("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); - close(mixer); - return MMSYSERR_NOTENABLED; - } - if (ioctl(mixer, cmd, &volume) == -1) { - WARN("unable to read mixer !\n"); - close(mixer); - 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; -} - -/************************************************************************** - * AUX_SetVolume [internal] - */ -static DWORD AUX_SetVolume(WORD wDevID, DWORD dwParam) -{ - int mixer; - int volume, left, right; - int cmd; - - TRACE("(%04X, %08X);\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); - close(mixer); - return MMSYSERR_NOTENABLED; - } - if (ioctl(mixer, cmd, &volume) == -1) { - WARN("unable to set mixer !\n"); - close(mixer); - return MMSYSERR_NOTENABLED; - } - close(mixer); - return MMSYSERR_NOERROR; -} - /************************************************************************** * auxMessage (WINEOSS.2) */ @@ -173,13 +45,6 @@ DWORD WINAPI OSS_auxMessage(UINT wDevID, UINT wMsg, DWORD_PTR dwUser, TRACE("(%04X, %04X, %08lX, %08lX, %08lX);\n", wDevID, wMsg, dwUser, dwParam1, dwParam2);
- switch (wMsg) { - case AUXDM_GETVOLUME: - return AUX_GetVolume(wDevID, (LPDWORD)dwParam1); - case AUXDM_SETVOLUME: - return AUX_SetVolume(wDevID, dwParam1); - } - params.dev_id = wDevID; params.msg = wMsg; params.user = dwUser; diff --git a/dlls/wineoss.drv/oss.c b/dlls/wineoss.drv/oss.c index e387a2a4a71..6490081e069 100644 --- a/dlls/wineoss.drv/oss.c +++ b/dlls/wineoss.drv/oss.c @@ -1444,6 +1444,121 @@ static UINT aux_get_devcaps(WORD dev_id, AUXCAPSW *caps, UINT size) return MMSYSERR_NOERROR; }
+static UINT aux_get_volume(WORD dev_id, UINT *vol) +{ + int mixer, volume, left, right, cmd; + + TRACE("(%04X, %p);\n", dev_id, vol); + if (vol == NULL) return MMSYSERR_NOTENABLED; + if ((mixer = open(MIXER_DEV, O_RDWR)) < 0) + { + WARN("mixer device not available !\n"); + return MMSYSERR_NOTENABLED; + } + switch(dev_id) + { + 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", dev_id); + close(mixer); + return MMSYSERR_NOTENABLED; + } + if (ioctl(mixer, cmd, &volume) == -1) + { + WARN("unable to read mixer !\n"); + close(mixer); + return MMSYSERR_NOTENABLED; + } + close(mixer); + left = LOBYTE(LOWORD(volume)); + right = HIBYTE(LOWORD(volume)); + TRACE("left=%d right=%d !\n", left, right); + *vol = MAKELONG((left * 0xFFFFL) / 100, (right * 0xFFFFL) / 100); + return MMSYSERR_NOERROR; +} + +static UINT aux_set_volume(WORD dev_id, UINT vol) +{ + int mixer; + int volume, left, right; + int cmd; + + TRACE("(%04X, %08X);\n", dev_id, vol); + + left = (LOWORD(vol) * 100) >> 16; + right = (HIWORD(vol) * 100) >> 16; + volume = (right << 8) | left; + + if ((mixer = open(MIXER_DEV, O_RDWR)) < 0) + { + WARN("mixer device not available !\n"); + return MMSYSERR_NOTENABLED; + } + + switch(dev_id) + { + 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", dev_id); + close(mixer); + return MMSYSERR_NOTENABLED; + } + if (ioctl(mixer, cmd, &volume) == -1) + { + WARN("unable to set mixer !\n"); + close(mixer); + return MMSYSERR_NOTENABLED; + } + close(mixer); + return MMSYSERR_NOERROR; +} + static NTSTATUS aux_message(void *args) { struct aux_message_params *params = args; @@ -1468,6 +1583,12 @@ static NTSTATUS aux_message(void *args) TRACE("return %d;\n", num_aux); *params->err = num_aux; break; + case AUXDM_GETVOLUME: + *params->err = aux_get_volume(params->dev_id, (UINT *)params->param_1); + break; + case AUXDM_SETVOLUME: + *params->err = aux_set_volume(params->dev_id, params->param_1); + break; default: WARN("unknown message !\n"); *params->err = MMSYSERR_NOTSUPPORTED;