moved to the new debug interface

fixed bugs in pause/play/stop functions
fixed signature of driver entry point
This commit is contained in:
Eric Pouech 1999-05-24 08:18:53 +00:00 committed by Alexandre Julliard
parent a2b3001a40
commit 9c75a8ab8a
1 changed files with 128 additions and 122 deletions

View File

@ -25,7 +25,7 @@
#include "multimedia.h"
#include "mmsystem.h"
#include "heap.h"
#include "debug.h"
#include "debugtools.h"
DEFAULT_DEBUG_CHANNEL(mciwave)
@ -57,6 +57,8 @@ static WINE_MCIWAVE MCIWaveDev[MAX_MCIWAVEDRV];
* MCI WAVE implemantation *
*======================================================================*/
static DWORD WAVE_mciResume(UINT16 wDevID, DWORD dwFlags, LPMCI_GENERIC_PARMS lpParms);
/**************************************************************************
* MCIWAVE_drvGetDrv [internal]
*/
@ -112,7 +114,7 @@ static WINE_MCIWAVE* WAVE_mciGetOpenDev(UINT16 wDevID)
WINE_MCIWAVE* wmw = WAVE_drvGetDrv(wDevID);
if (wmw == NULL || wmw->nUseCount == 0) {
WARN(mciwave, "Invalid wDevID=%u\n", wDevID);
WARN("Invalid wDevID=%u\n", wDevID);
return 0;
}
return wmw;
@ -133,9 +135,9 @@ static DWORD WAVE_ConvertByteToTimeFormat(WINE_MCIWAVE* wmw, DWORD val)
ret = (val * 8) / wmw->WaveFormat.wBitsPerSample;
break;
default:
WARN(mciwave, "Bad time format %lu!\n", wmw->dwMciTimeFormat);
WARN("Bad time format %lu!\n", wmw->dwMciTimeFormat);
}
TRACE(mciwave, "val=%lu=0x%08lx [tf=%lu] => ret=%lu\n", val, val, wmw->dwMciTimeFormat, ret);
TRACE("val=%lu=0x%08lx [tf=%lu] => ret=%lu\n", val, val, wmw->dwMciTimeFormat, ret);
return ret;
}
@ -154,9 +156,9 @@ static DWORD WAVE_ConvertTimeFormatToByte(WINE_MCIWAVE* wmw, DWORD val)
ret = (val * wmw->WaveFormat.wBitsPerSample) / 8;
break;
default:
WARN(mciwave, "Bad time format %lu!\n", wmw->dwMciTimeFormat);
WARN("Bad time format %lu!\n", wmw->dwMciTimeFormat);
}
TRACE(mciwave, "val=%lu=0x%08lx [tf=%lu] => ret=%lu\n", val, val, wmw->dwMciTimeFormat, ret);
TRACE("val=%lu=0x%08lx [tf=%lu] => ret=%lu\n", val, val, wmw->dwMciTimeFormat, ret);
return ret;
}
@ -167,24 +169,24 @@ static DWORD WAVE_mciReadFmt(WINE_MCIWAVE* wmw, MMCKINFO* pckMainRIFF)
mmckInfo.ckid = mmioFOURCC('f', 'm', 't', ' ');
if (mmioDescend(wmw->hFile, &mmckInfo, pckMainRIFF, MMIO_FINDCHUNK) != 0)
return MCIERR_INVALID_FILE;
TRACE(mciwave, "Chunk Found ckid=%.4s fccType=%.4s cksize=%08lX \n",
TRACE("Chunk Found ckid=%.4s fccType=%.4s cksize=%08lX \n",
(LPSTR)&mmckInfo.ckid, (LPSTR)&mmckInfo.fccType, mmckInfo.cksize);
if (mmioRead(wmw->hFile, (HPSTR)&wmw->WaveFormat,
(long)sizeof(PCMWAVEFORMAT)) != (long)sizeof(PCMWAVEFORMAT))
return MCIERR_INVALID_FILE;
TRACE(mciwave, "wFormatTag=%04X !\n", wmw->WaveFormat.wf.wFormatTag);
TRACE(mciwave, "nChannels=%d \n", wmw->WaveFormat.wf.nChannels);
TRACE(mciwave, "nSamplesPerSec=%ld\n", wmw->WaveFormat.wf.nSamplesPerSec);
TRACE(mciwave, "nAvgBytesPerSec=%ld\n", wmw->WaveFormat.wf.nAvgBytesPerSec);
TRACE(mciwave, "nBlockAlign=%d \n", wmw->WaveFormat.wf.nBlockAlign);
TRACE(mciwave, "wBitsPerSample=%u !\n", wmw->WaveFormat.wBitsPerSample);
TRACE("wFormatTag=%04X !\n", wmw->WaveFormat.wf.wFormatTag);
TRACE("nChannels=%d \n", wmw->WaveFormat.wf.nChannels);
TRACE("nSamplesPerSec=%ld\n", wmw->WaveFormat.wf.nSamplesPerSec);
TRACE("nAvgBytesPerSec=%ld\n", wmw->WaveFormat.wf.nAvgBytesPerSec);
TRACE("nBlockAlign=%d \n", wmw->WaveFormat.wf.nBlockAlign);
TRACE("wBitsPerSample=%u !\n", wmw->WaveFormat.wBitsPerSample);
mmckInfo.ckid = mmioFOURCC('d', 'a', 't', 'a');
if (mmioDescend(wmw->hFile, &mmckInfo, pckMainRIFF, MMIO_FINDCHUNK) != 0)
return MCIERR_INVALID_FILE;
TRACE(mciwave, "Chunk Found ckid=%.4s fccType=%.4s cksize=%08lX \n",
TRACE("Chunk Found ckid=%.4s fccType=%.4s cksize=%08lX \n",
(LPSTR)&mmckInfo.ckid, (LPSTR)&mmckInfo.fccType, mmckInfo.cksize);
TRACE(mciwave, "nChannels=%d nSamplesPerSec=%ld\n",
TRACE("nChannels=%d nSamplesPerSec=%ld\n",
wmw->WaveFormat.wf.nChannels, wmw->WaveFormat.wf.nSamplesPerSec);
wmw->dwLength = mmckInfo.cksize;
wmw->dwFileOffset = mmioSeek(wmw->hFile, 0, SEEK_CUR); /* >= 0 */
@ -200,7 +202,7 @@ static DWORD WAVE_mciOpen(UINT16 wDevID, DWORD dwFlags, LPMCI_WAVE_OPEN_PARMSA l
DWORD dwDeviceID;
WINE_MCIWAVE* wmw = WAVE_drvGetDrv(wDevID);
TRACE(mciwave, "(%04X, %08lX, %p)\n", wDevID, dwFlags, lpOpenParms);
TRACE("(%04X, %08lX, %p)\n", wDevID, dwFlags, lpOpenParms);
if (lpOpenParms == NULL) return MCIERR_NULL_PARAMETER_BLOCK;
if (wmw == NULL) return MCIERR_INVALID_DEVICE_ID;
@ -220,7 +222,7 @@ static DWORD WAVE_mciOpen(UINT16 wDevID, DWORD dwFlags, LPMCI_WAVE_OPEN_PARMSA l
wmw->fInput = FALSE;
wmw->wWavID = 0;
TRACE(mciwave, "wDevID=%04X (lpParams->wDeviceID=%08lX)\n", wDevID, dwDeviceID);
TRACE("wDevID=%04X (lpParams->wDeviceID=%08lX)\n", wDevID, dwDeviceID);
if (dwFlags & MCI_OPEN_ELEMENT) {
if (dwFlags & MCI_OPEN_ELEMENT_ID) {
@ -232,12 +234,12 @@ static DWORD WAVE_mciOpen(UINT16 wDevID, DWORD dwFlags, LPMCI_WAVE_OPEN_PARMSA l
LPCSTR lpstrElementName = lpOpenParms->lpstrElementName;
/*FIXME : what should be done id wmw->hFile is already != 0, or the driver is playin' */
TRACE(mciwave, "MCI_OPEN_ELEMENT '%s' !\n", lpstrElementName);
TRACE("MCI_OPEN_ELEMENT '%s' !\n", lpstrElementName);
if (lpstrElementName && (strlen(lpstrElementName) > 0)) {
wmw->hFile = mmioOpenA((LPSTR)lpstrElementName, NULL,
MMIO_ALLOCBUF | MMIO_READWRITE | MMIO_DENYWRITE);
if (wmw->hFile == 0) {
WARN(mciwave, "can't find file='%s' !\n", lpstrElementName);
WARN("can't find file='%s' !\n", lpstrElementName);
dwRet = MCIERR_FILE_NOT_FOUND;
}
} else {
@ -245,7 +247,7 @@ static DWORD WAVE_mciOpen(UINT16 wDevID, DWORD dwFlags, LPMCI_WAVE_OPEN_PARMSA l
}
}
}
TRACE(mciwave, "hFile=%u\n", wmw->hFile);
TRACE("hFile=%u\n", wmw->hFile);
memcpy(&wmw->openParms, lpOpenParms, sizeof(MCI_WAVE_OPEN_PARMSA));
wmw->wNotifyDeviceID = dwDeviceID;
@ -259,7 +261,7 @@ static DWORD WAVE_mciOpen(UINT16 wDevID, DWORD dwFlags, LPMCI_WAVE_OPEN_PARMSA l
if (mmioDescend(wmw->hFile, &ckMainRIFF, NULL, 0) != 0) {
dwRet = MCIERR_INVALID_FILE;
} else {
TRACE(mciwave, "ParentChunk ckid=%.4s fccType=%.4s cksize=%08lX \n",
TRACE("ParentChunk ckid=%.4s fccType=%.4s cksize=%08lX \n",
(LPSTR)&ckMainRIFF.ckid, (LPSTR)&ckMainRIFF.fccType, ckMainRIFF.cksize);
if ((ckMainRIFF.ckid != FOURCC_RIFF) ||
(ckMainRIFF.fccType != mmioFOURCC('W', 'A', 'V', 'E'))) {
@ -306,7 +308,7 @@ static DWORD WAVE_mciCue(UINT16 wDevID, DWORD dwParam, LPMCI_GENERIC_PARMS lpPar
DWORD dwRet;
WINE_MCIWAVE* wmw = WAVE_mciGetOpenDev(wDevID);
TRACE(mciwave, "(%u, %08lX, %p);\n", wDevID, dwParam, lpParms);
TRACE("(%u, %08lX, %p);\n", wDevID, dwParam, lpParms);
if (wmw == NULL) return MCIERR_INVALID_DEVICE_ID;
@ -340,22 +342,22 @@ static DWORD WAVE_mciStop(UINT16 wDevID, DWORD dwFlags, LPMCI_GENERIC_PARMS lpPa
DWORD dwRet;
WINE_MCIWAVE* wmw = WAVE_mciGetOpenDev(wDevID);
TRACE(mciwave, "(%u, %08lX, %p);\n", wDevID, dwFlags, lpParms);
TRACE("(%u, %08lX, %p);\n", wDevID, dwFlags, lpParms);
if (lpParms == NULL) return MCIERR_NULL_PARAMETER_BLOCK;
if (wmw == NULL) return MCIERR_INVALID_DEVICE_ID;
wmw->dwStatus = MCI_MODE_STOP;
wmw->dwPosition = 0;
TRACE(mciwave, "wmw->dwStatus=%d\n", wmw->dwStatus);
TRACE("wmw->dwStatus=%d\n", wmw->dwStatus);
if (wmw->fInput)
dwRet = widMessage(wmw->wWavID, WIDM_STOP, 0, dwFlags, (DWORD)lpParms);
dwRet = widMessage(wmw->wWavID, WIDM_RESET, 0, dwFlags, (DWORD)lpParms);
else
dwRet = wodMessage(wmw->wWavID, WODM_STOP, 0, dwFlags, (DWORD)lpParms);
dwRet = wodMessage(wmw->wWavID, WODM_RESET, 0, dwFlags, (DWORD)lpParms);
if (dwFlags & MCI_NOTIFY) {
TRACE(mciwave, "MCI_NOTIFY_SUCCESSFUL %08lX !\n", lpParms->dwCallback);
TRACE("MCI_NOTIFY_SUCCESSFUL %08lX !\n", lpParms->dwCallback);
mciDriverNotify16((HWND16)LOWORD(lpParms->dwCallback),
wmw->wNotifyDeviceID, MCI_NOTIFY_SUCCESSFUL);
}
@ -371,7 +373,7 @@ static DWORD WAVE_mciClose(UINT16 wDevID, DWORD dwFlags, LPMCI_GENERIC_PARMS lpP
DWORD dwRet = 0;
WINE_MCIWAVE* wmw = WAVE_mciGetOpenDev(wDevID);
TRACE(mciwave, "(%u, %08lX, %p);\n", wDevID, dwFlags, lpParms);
TRACE("(%u, %08lX, %p);\n", wDevID, dwFlags, lpParms);
if (wmw == NULL) return MCIERR_INVALID_DEVICE_ID;
@ -394,7 +396,7 @@ static DWORD WAVE_mciClose(UINT16 wDevID, DWORD dwFlags, LPMCI_GENERIC_PARMS lpP
}
if ((dwFlags & MCI_NOTIFY) && lpParms) {
TRACE(mciwave, "MCI_NOTIFY_SUCCESSFUL %08lX !\n", lpParms->dwCallback);
TRACE("MCI_NOTIFY_SUCCESSFUL %08lX !\n", lpParms->dwCallback);
mciDriverNotify16((HWND16)LOWORD(lpParms->dwCallback),
wmw->wNotifyDeviceID,
(dwRet == 0) ? MCI_NOTIFY_SUCCESSFUL : MCI_NOTIFY_FAILURE);
@ -413,18 +415,18 @@ static DWORD WAVE_mciPlay(UINT16 wDevID, DWORD dwFlags, LPMCI_PLAY_PARMS lpParms
DWORD dwRet;
WINE_MCIWAVE* wmw = WAVE_mciGetOpenDev(wDevID);
TRACE(mciwave, "(%u, %08lX, %p);\n", wDevID, dwFlags, lpParms);
TRACE("(%u, %08lX, %p);\n", wDevID, dwFlags, lpParms);
if (wmw == NULL) return MCIERR_INVALID_DEVICE_ID;
if (lpParms == NULL) return MCIERR_NULL_PARAMETER_BLOCK;
if (wmw->fInput) {
WARN(mciwave, "cannot play on input device\n");
WARN("cannot play on input device\n");
return MCIERR_NONAPPLICABLE_FUNCTION;
}
if (wmw->hFile == 0) {
WARN(mciwave, "Can't play: no file='%s' !\n", wmw->openParms.lpstrElementName);
WARN("Can't play: no file='%s' !\n", wmw->openParms.lpstrElementName);
return MCIERR_FILE_NOT_FOUND;
}
@ -432,7 +434,15 @@ static DWORD WAVE_mciPlay(UINT16 wDevID, DWORD dwFlags, LPMCI_PLAY_PARMS lpParms
return MCI_SendCommandAsync(wmw->wNotifyDeviceID, MCI_PLAY, dwFlags,
(DWORD)lpParms, sizeof(MCI_PLAY_PARMS));
}
if (wmw->dwStatus != MCI_MODE_STOP) {
if (wmw->dwStatus == MCI_MODE_PAUSE) {
/* FIXME: parameters (start/end) in lpParams may not be used */
return WAVE_mciResume(wDevID, dwFlags, (LPMCI_GENERIC_PARMS)lpParms);
}
return MCIERR_INTERNAL;
}
end = 0xFFFFFFFF;
if (lpParms && (dwFlags & MCI_FROM)) {
wmw->dwPosition = WAVE_ConvertTimeFormatToByte(wmw, lpParms->dwFrom);
@ -441,7 +451,7 @@ static DWORD WAVE_mciPlay(UINT16 wDevID, DWORD dwFlags, LPMCI_PLAY_PARMS lpParms
end = WAVE_ConvertTimeFormatToByte(wmw, lpParms->dwTo);
}
TRACE(mciwave, "Playing from byte=%lu to byte=%lu\n", wmw->dwPosition, end);
TRACE("Playing from byte=%lu to byte=%lu\n", wmw->dwPosition, end);
/* go back to begining of chunk */
mmioSeek(wmw->hFile, wmw->dwFileOffset, SEEK_SET); /* >= 0 */
@ -452,7 +462,7 @@ static DWORD WAVE_mciPlay(UINT16 wDevID, DWORD dwFlags, LPMCI_PLAY_PARMS lpParms
/* FIXME: how to choose between several output channels ? here 0 is forced */
dwRet = wodMessage(0, WODM_OPEN, 0, (DWORD)&wmw->waveDesc, CALLBACK_NULL);
if (dwRet != 0) {
TRACE(mciwave, "Can't open low level audio device %ld\n", dwRet);
TRACE("Can't open low level audio device %ld\n", dwRet);
return MCIERR_DEVICE_OPEN;
}
@ -471,7 +481,7 @@ static DWORD WAVE_mciPlay(UINT16 wDevID, DWORD dwFlags, LPMCI_PLAY_PARMS lpParms
wmw->WaveHdr.dwFlags = 0L;
wmw->WaveHdr.dwLoops = 0L;
count = mmioRead(wmw->hFile, wmw->WaveHdr.lpData, bufsize);
TRACE(mciwave, "mmioRead bufsize=%ld count=%ld\n", bufsize, count);
TRACE("mmioRead bufsize=%ld count=%ld\n", bufsize, count);
if (count < 1)
break;
dwRet = wodMessage(wmw->wWavID, WODM_PREPARE, 0, (DWORD)&wmw->WaveHdr, sizeof(WAVEHDR));
@ -479,7 +489,7 @@ static DWORD WAVE_mciPlay(UINT16 wDevID, DWORD dwFlags, LPMCI_PLAY_PARMS lpParms
wmw->WaveHdr.dwBytesRecorded = 0;
/* FIXME */
wmw->WaveHdr.reserved = (DWORD)&wmw->WaveHdr;
TRACE(mciwave, "before WODM_WRITE lpWaveHdr=%p dwBufferLength=%lu dwBytesRecorded=%lu\n",
TRACE("before WODM_WRITE lpWaveHdr=%p dwBufferLength=%lu dwBytesRecorded=%lu\n",
&wmw->WaveHdr, wmw->WaveHdr.dwBufferLength, wmw->WaveHdr.dwBytesRecorded);
dwRet = wodMessage(wmw->wWavID, WODM_WRITE, 0, (DWORD)&wmw->WaveHdr, sizeof(WAVEHDR));
/* FIXME: should use callback mechanisms from audio driver */
@ -488,7 +498,7 @@ static DWORD WAVE_mciPlay(UINT16 wDevID, DWORD dwFlags, LPMCI_PLAY_PARMS lpParms
Sleep(1);
#endif
wmw->dwPosition += count;
TRACE(mciwave, "after WODM_WRITE dwPosition=%lu\n", wmw->dwPosition);
TRACE("after WODM_WRITE dwPosition=%lu\n", wmw->dwPosition);
dwRet = wodMessage(wmw->wWavID, WODM_UNPREPARE, 0, (DWORD)&wmw->WaveHdr, sizeof(WAVEHDR));
}
@ -498,12 +508,12 @@ static DWORD WAVE_mciPlay(UINT16 wDevID, DWORD dwFlags, LPMCI_PLAY_PARMS lpParms
wmw->WaveHdr.lpData = NULL;
}
wodMessage(wmw->wWavID, WODM_STOP, 0, 0L, 0L);
wodMessage(wmw->wWavID, WODM_RESET, 0, 0L, 0L);
wodMessage(wmw->wWavID, WODM_CLOSE, 0, 0L, 0L);
wmw->dwStatus = MCI_MODE_STOP;
if (lpParms && (dwFlags & MCI_NOTIFY)) {
TRACE(mciwave, "MCI_NOTIFY_SUCCESSFUL %08lX !\n", lpParms->dwCallback);
TRACE("MCI_NOTIFY_SUCCESSFUL %08lX !\n", lpParms->dwCallback);
mciDriverNotify16((HWND16)LOWORD(lpParms->dwCallback),
wmw->wNotifyDeviceID, MCI_NOTIFY_SUCCESSFUL);
}
@ -522,29 +532,29 @@ static DWORD WAVE_mciRecord(UINT16 wDevID, DWORD dwFlags, LPMCI_RECORD_PARMS lpP
DWORD dwRet;
WINE_MCIWAVE* wmw = WAVE_mciGetOpenDev(wDevID);
TRACE(mciwave, "(%u, %08lX, %p);\n", wDevID, dwFlags, lpParms);
TRACE("(%u, %08lX, %p);\n", wDevID, dwFlags, lpParms);
if (wmw == NULL) return MCIERR_INVALID_DEVICE_ID;
if (lpParms == NULL) return MCIERR_NULL_PARAMETER_BLOCK;
if (!wmw->fInput) {
WARN(mciwave, "cannot record on output device\n");
WARN("cannot record on output device\n");
return MCIERR_NONAPPLICABLE_FUNCTION;
}
if (wmw->hFile == 0) {
WARN(mciwave, "can't find file='%s' !\n",
WARN("can't find file='%s' !\n",
wmw->openParms.lpstrElementName);
return MCIERR_FILE_NOT_FOUND;
}
start = 1; end = 99999;
if (dwFlags & MCI_FROM) {
start = lpParms->dwFrom;
TRACE(mciwave, "MCI_FROM=%d \n", start);
TRACE("MCI_FROM=%d \n", start);
}
if (dwFlags & MCI_TO) {
end = lpParms->dwTo;
TRACE(mciwave, "MCI_TO=%d \n", end);
TRACE("MCI_TO=%d \n", end);
}
bufsize = 64000;
lpWaveHdr = &wmw->WaveHdr;
@ -554,25 +564,25 @@ static DWORD WAVE_mciRecord(UINT16 wDevID, DWORD dwFlags, LPMCI_RECORD_PARMS lpP
lpWaveHdr->dwUser = 0L;
lpWaveHdr->dwFlags = 0L;
lpWaveHdr->dwLoops = 0L;
dwRet = widMessage(wmw->wWavID,WIDM_PREPARE,0,(DWORD)lpWaveHdr,sizeof(WAVEHDR));
TRACE(mciwave, "after WIDM_PREPARE \n");
dwRet = widMessage(wmw->wWavID, WIDM_PREPARE, 0, (DWORD)lpWaveHdr, sizeof(WAVEHDR));
TRACE("after WIDM_PREPARE \n");
while (TRUE) {
lpWaveHdr->dwBytesRecorded = 0;
dwRet = widMessage(wmw->wWavID, WIDM_START, 0, 0L, 0L);
TRACE(mciwave, "after WIDM_START lpWaveHdr=%p dwBytesRecorded=%lu\n",
TRACE("after WIDM_START lpWaveHdr=%p dwBytesRecorded=%lu\n",
lpWaveHdr, lpWaveHdr->dwBytesRecorded);
if (lpWaveHdr->dwBytesRecorded == 0) break;
}
TRACE(mciwave, "before WIDM_UNPREPARE \n");
dwRet = widMessage(wmw->wWavID,WIDM_UNPREPARE,0,(DWORD)lpWaveHdr,sizeof(WAVEHDR));
TRACE(mciwave, "after WIDM_UNPREPARE \n");
TRACE("before WIDM_UNPREPARE \n");
dwRet = widMessage(wmw->wWavID, WIDM_UNPREPARE, 0, (DWORD)lpWaveHdr, sizeof(WAVEHDR));
TRACE("after WIDM_UNPREPARE \n");
if (lpWaveHdr->lpData != NULL) {
GlobalUnlock16(hData);
GlobalFree16(hData);
lpWaveHdr->lpData = NULL;
}
if (dwFlags & MCI_NOTIFY) {
TRACE(mciwave, "MCI_NOTIFY_SUCCESSFUL %08lX !\n", lpParms->dwCallback);
TRACE("MCI_NOTIFY_SUCCESSFUL %08lX !\n", lpParms->dwCallback);
mciDriverNotify16((HWND16)LOWORD(lpParms->dwCallback),
wmw->wNotifyDeviceID, MCI_NOTIFY_SUCCESSFUL);
}
@ -587,7 +597,7 @@ static DWORD WAVE_mciPause(UINT16 wDevID, DWORD dwFlags, LPMCI_GENERIC_PARMS lpP
DWORD dwRet;
WINE_MCIWAVE* wmw = WAVE_mciGetOpenDev(wDevID);
TRACE(mciwave, "(%u, %08lX, %p);\n", wDevID, dwFlags, lpParms);
TRACE("(%u, %08lX, %p);\n", wDevID, dwFlags, lpParms);
if (lpParms == NULL) return MCIERR_NULL_PARAMETER_BLOCK;
if (wmw == NULL) return MCIERR_INVALID_DEVICE_ID;
@ -596,8 +606,8 @@ static DWORD WAVE_mciPause(UINT16 wDevID, DWORD dwFlags, LPMCI_GENERIC_PARMS lpP
wmw->dwStatus = MCI_MODE_PAUSE;
}
if (wmw->fInput) dwRet = widMessage(wmw->wWavID, WIDM_PAUSE, 0, dwFlags, (DWORD)lpParms);
else dwRet = wodMessage(wmw->wWavID, WODM_PAUSE, 0, dwFlags, (DWORD)lpParms);
if (wmw->fInput) dwRet = widMessage(wmw->wWavID, WIDM_PAUSE, 0, 0L, 0L);
else dwRet = wodMessage(wmw->wWavID, WODM_PAUSE, 0, 0L, 0L);
return (dwRet == MMSYSERR_NOERROR) ? 0 : MCIERR_INTERNAL;
}
@ -610,7 +620,7 @@ static DWORD WAVE_mciResume(UINT16 wDevID, DWORD dwFlags, LPMCI_GENERIC_PARMS lp
WINE_MCIWAVE* wmw = WAVE_mciGetOpenDev(wDevID);
DWORD dwRet = 0;
TRACE(mciwave, "(%u, %08lX, %p);\n", wDevID, dwFlags, lpParms);
TRACE("(%u, %08lX, %p);\n", wDevID, dwFlags, lpParms);
if (lpParms == NULL) return MCIERR_NULL_PARAMETER_BLOCK;
if (wmw == NULL) return MCIERR_INVALID_DEVICE_ID;
@ -619,14 +629,10 @@ static DWORD WAVE_mciResume(UINT16 wDevID, DWORD dwFlags, LPMCI_GENERIC_PARMS lp
wmw->dwStatus = MCI_MODE_PLAY;
}
#if 0
if (wmw->fInput) dwRet = widMessage(wmw->wWavID, WIDM_PLAY, 0, dwFlags, (DWORD)lpParms);
else dwRet = wodMessage(wmw->wWavID, WODM_PLAY, 0, dwFlags, (DWORD)lpParms);
/* FIXME: I doubt WIDM_START is correct */
if (wmw->fInput) dwRet = widMessage(wmw->wWavID, WIDM_START, 0, 0L, 0L);
else dwRet = wodMessage(wmw->wWavID, WODM_RESTART, 0, 0L, 0L);
return (dwRet == MMSYSERR_NOERROR) ? 0 : MCIERR_INTERNAL;
#else
return dwRet;
#endif
}
/**************************************************************************
@ -637,7 +643,7 @@ static DWORD WAVE_mciSeek(UINT16 wDevID, DWORD dwFlags, LPMCI_SEEK_PARMS lpParms
DWORD ret = 0;
WINE_MCIWAVE* wmw = WAVE_mciGetOpenDev(wDevID);
TRACE(mciwave, "(%04X, %08lX, %p);\n", wDevID, dwFlags, lpParms);
TRACE("(%04X, %08lX, %p);\n", wDevID, dwFlags, lpParms);
if (lpParms == NULL) {
ret = MCIERR_NULL_PARAMETER_BLOCK;
@ -653,14 +659,14 @@ static DWORD WAVE_mciSeek(UINT16 wDevID, DWORD dwFlags, LPMCI_SEEK_PARMS lpParms
} else if (dwFlags & MCI_TO) {
wmw->dwPosition = WAVE_ConvertTimeFormatToByte(wmw, lpParms->dwTo);
} else {
WARN(mciwave, "dwFlag doesn't tell where to seek to...\n");
WARN("dwFlag doesn't tell where to seek to...\n");
return MCIERR_MISSING_PARAMETER;
}
TRACE(mciwave, "Seeking to position=%lu bytes\n", wmw->dwPosition);
TRACE("Seeking to position=%lu bytes\n", wmw->dwPosition);
if (dwFlags & MCI_NOTIFY) {
TRACE(mciwave, "MCI_NOTIFY_SUCCESSFUL %08lX !\n", lpParms->dwCallback);
TRACE("MCI_NOTIFY_SUCCESSFUL %08lX !\n", lpParms->dwCallback);
mciDriverNotify16((HWND16)LOWORD(lpParms->dwCallback),
wmw->wNotifyDeviceID, MCI_NOTIFY_SUCCESSFUL);
}
@ -675,7 +681,7 @@ static DWORD WAVE_mciSet(UINT16 wDevID, DWORD dwFlags, LPMCI_SET_PARMS lpParms)
{
WINE_MCIWAVE* wmw = WAVE_mciGetOpenDev(wDevID);
TRACE(mciwave, "(%u, %08lX, %p);\n", wDevID, dwFlags, lpParms);
TRACE("(%u, %08lX, %p);\n", wDevID, dwFlags, lpParms);
if (lpParms == NULL) return MCIERR_NULL_PARAMETER_BLOCK;
if (wmw == NULL) return MCIERR_INVALID_DEVICE_ID;
@ -683,71 +689,71 @@ static DWORD WAVE_mciSet(UINT16 wDevID, DWORD dwFlags, LPMCI_SET_PARMS lpParms)
if (dwFlags & MCI_SET_TIME_FORMAT) {
switch (lpParms->dwTimeFormat) {
case MCI_FORMAT_MILLISECONDS:
TRACE(mciwave, "MCI_FORMAT_MILLISECONDS !\n");
TRACE("MCI_FORMAT_MILLISECONDS !\n");
wmw->dwMciTimeFormat = MCI_FORMAT_MILLISECONDS;
break;
case MCI_FORMAT_BYTES:
TRACE(mciwave, "MCI_FORMAT_BYTES !\n");
TRACE("MCI_FORMAT_BYTES !\n");
wmw->dwMciTimeFormat = MCI_FORMAT_BYTES;
break;
case MCI_FORMAT_SAMPLES:
TRACE(mciwave, "MCI_FORMAT_SAMPLES !\n");
TRACE("MCI_FORMAT_SAMPLES !\n");
wmw->dwMciTimeFormat = MCI_FORMAT_SAMPLES;
break;
default:
WARN(mciwave, "Bad time format %lu!\n", lpParms->dwTimeFormat);
WARN("Bad time format %lu!\n", lpParms->dwTimeFormat);
return MCIERR_BAD_TIME_FORMAT;
}
}
if (dwFlags & MCI_SET_VIDEO) {
TRACE(mciwave, "No support for video !\n");
TRACE("No support for video !\n");
return MCIERR_UNSUPPORTED_FUNCTION;
}
if (dwFlags & MCI_SET_DOOR_OPEN) {
TRACE(mciwave, "No support for door open !\n");
TRACE("No support for door open !\n");
return MCIERR_UNSUPPORTED_FUNCTION;
}
if (dwFlags & MCI_SET_DOOR_CLOSED) {
TRACE(mciwave, "No support for door close !\n");
TRACE("No support for door close !\n");
return MCIERR_UNSUPPORTED_FUNCTION;
}
if (dwFlags & MCI_SET_AUDIO) {
if (dwFlags & MCI_SET_ON) {
TRACE(mciwave, "MCI_SET_ON audio !\n");
TRACE("MCI_SET_ON audio !\n");
} else if (dwFlags & MCI_SET_OFF) {
TRACE(mciwave, "MCI_SET_OFF audio !\n");
TRACE("MCI_SET_OFF audio !\n");
} else {
WARN(mciwave, "MCI_SET_AUDIO without SET_ON or SET_OFF\n");
WARN("MCI_SET_AUDIO without SET_ON or SET_OFF\n");
return MCIERR_BAD_INTEGER;
}
if (lpParms->dwAudio & MCI_SET_AUDIO_ALL)
TRACE(mciwave, "MCI_SET_AUDIO_ALL !\n");
TRACE("MCI_SET_AUDIO_ALL !\n");
if (lpParms->dwAudio & MCI_SET_AUDIO_LEFT)
TRACE(mciwave, "MCI_SET_AUDIO_LEFT !\n");
TRACE("MCI_SET_AUDIO_LEFT !\n");
if (lpParms->dwAudio & MCI_SET_AUDIO_RIGHT)
TRACE(mciwave, "MCI_SET_AUDIO_RIGHT !\n");
TRACE("MCI_SET_AUDIO_RIGHT !\n");
}
if (dwFlags & MCI_WAVE_INPUT)
TRACE(mciwave, "MCI_WAVE_INPUT !\n");
TRACE("MCI_WAVE_INPUT !\n");
if (dwFlags & MCI_WAVE_OUTPUT)
TRACE(mciwave, "MCI_WAVE_OUTPUT !\n");
TRACE("MCI_WAVE_OUTPUT !\n");
if (dwFlags & MCI_WAVE_SET_ANYINPUT)
TRACE(mciwave, "MCI_WAVE_SET_ANYINPUT !\n");
TRACE("MCI_WAVE_SET_ANYINPUT !\n");
if (dwFlags & MCI_WAVE_SET_ANYOUTPUT)
TRACE(mciwave, "MCI_WAVE_SET_ANYOUTPUT !\n");
TRACE("MCI_WAVE_SET_ANYOUTPUT !\n");
if (dwFlags & MCI_WAVE_SET_AVGBYTESPERSEC)
TRACE(mciwave, "MCI_WAVE_SET_AVGBYTESPERSEC !\n");
TRACE("MCI_WAVE_SET_AVGBYTESPERSEC !\n");
if (dwFlags & MCI_WAVE_SET_BITSPERSAMPLE)
TRACE(mciwave, "MCI_WAVE_SET_BITSPERSAMPLE !\n");
TRACE("MCI_WAVE_SET_BITSPERSAMPLE !\n");
if (dwFlags & MCI_WAVE_SET_BLOCKALIGN)
TRACE(mciwave, "MCI_WAVE_SET_BLOCKALIGN !\n");
TRACE("MCI_WAVE_SET_BLOCKALIGN !\n");
if (dwFlags & MCI_WAVE_SET_CHANNELS)
TRACE(mciwave, "MCI_WAVE_SET_CHANNELS !\n");
TRACE("MCI_WAVE_SET_CHANNELS !\n");
if (dwFlags & MCI_WAVE_SET_FORMATTAG)
TRACE(mciwave, "MCI_WAVE_SET_FORMATTAG !\n");
TRACE("MCI_WAVE_SET_FORMATTAG !\n");
if (dwFlags & MCI_WAVE_SET_SAMPLESPERSEC)
TRACE(mciwave, "MCI_WAVE_SET_SAMPLESPERSEC !\n");
TRACE("MCI_WAVE_SET_SAMPLESPERSEC !\n");
return 0;
}
@ -758,7 +764,7 @@ static DWORD WAVE_mciStatus(UINT16 wDevID, DWORD dwFlags, LPMCI_STATUS_PARMS lpP
{
WINE_MCIWAVE* wmw = WAVE_mciGetOpenDev(wDevID);
TRACE(mciwave, "(%u, %08lX, %p);\n", wDevID, dwFlags, lpParms);
TRACE("(%u, %08lX, %p);\n", wDevID, dwFlags, lpParms);
if (lpParms == NULL) return MCIERR_NULL_PARAMETER_BLOCK;
if (wmw == NULL) return MCIERR_INVALID_DEVICE_ID;
@ -766,84 +772,84 @@ static DWORD WAVE_mciStatus(UINT16 wDevID, DWORD dwFlags, LPMCI_STATUS_PARMS lpP
switch(lpParms->dwItem) {
case MCI_STATUS_CURRENT_TRACK:
lpParms->dwReturn = 1;
TRACE(mciwave, "MCI_STATUS_CURRENT_TRACK => %lu\n", lpParms->dwReturn);
TRACE("MCI_STATUS_CURRENT_TRACK => %lu\n", lpParms->dwReturn);
break;
case MCI_STATUS_LENGTH:
/* only one track in file is currently handled, so don't take care of MCI_TRACK flag */
lpParms->dwReturn = WAVE_ConvertByteToTimeFormat(wmw, wmw->dwLength);
TRACE(mciwave, "MCI_STATUS_LENGTH => %lu\n", lpParms->dwReturn);
TRACE("MCI_STATUS_LENGTH => %lu\n", lpParms->dwReturn);
break;
case MCI_STATUS_MODE:
lpParms->dwReturn = wmw->dwStatus;
TRACE(mciwave, "MCI_STATUS_MODE => %lu\n", lpParms->dwReturn);
TRACE("MCI_STATUS_MODE => %lu\n", lpParms->dwReturn);
break;
case MCI_STATUS_MEDIA_PRESENT:
TRACE(mciwave, "MCI_STATUS_MEDIA_PRESENT => TRUE!\n");
TRACE("MCI_STATUS_MEDIA_PRESENT => TRUE!\n");
lpParms->dwReturn = TRUE;
break;
case MCI_STATUS_NUMBER_OF_TRACKS:
/* only one track in file is currently handled, so don't take care of MCI_TRACK flag */
lpParms->dwReturn = 1;
TRACE(mciwave, "MCI_STATUS_NUMBER_OF_TRACKS => %lu!\n", lpParms->dwReturn);
TRACE("MCI_STATUS_NUMBER_OF_TRACKS => %lu!\n", lpParms->dwReturn);
break;
case MCI_STATUS_POSITION:
/* only one track in file is currently handled, so don't take care of MCI_TRACK flag */
lpParms->dwReturn = WAVE_ConvertByteToTimeFormat(wmw,
(dwFlags & MCI_STATUS_START) ? 0 : wmw->dwPosition);
TRACE(mciwave, "MCI_STATUS_POSITION %s => %lu\n",
TRACE("MCI_STATUS_POSITION %s => %lu\n",
(dwFlags & MCI_STATUS_START) ? "start" : "current", lpParms->dwReturn);
break;
case MCI_STATUS_READY:
lpParms->dwReturn = (wmw->dwStatus != MCI_MODE_NOT_READY);
TRACE(mciwave, "MCI_STATUS_READY => %lu!\n", lpParms->dwReturn);
TRACE("MCI_STATUS_READY => %lu!\n", lpParms->dwReturn);
break;
case MCI_STATUS_TIME_FORMAT:
lpParms->dwReturn = wmw->dwMciTimeFormat;
TRACE(mciwave, "MCI_STATUS_TIME_FORMAT => %lu\n", lpParms->dwReturn);
TRACE("MCI_STATUS_TIME_FORMAT => %lu\n", lpParms->dwReturn);
break;
case MCI_WAVE_INPUT:
TRACE(mciwave, "MCI_WAVE_INPUT !\n");
TRACE("MCI_WAVE_INPUT !\n");
lpParms->dwReturn = 0;
break;
case MCI_WAVE_OUTPUT:
TRACE(mciwave, "MCI_WAVE_OUTPUT !\n");
TRACE("MCI_WAVE_OUTPUT !\n");
lpParms->dwReturn = 0;
break;
case MCI_WAVE_STATUS_AVGBYTESPERSEC:
lpParms->dwReturn = wmw->WaveFormat.wf.nAvgBytesPerSec;
TRACE(mciwave, "MCI_WAVE_STATUS_AVGBYTESPERSEC => %lu!\n", lpParms->dwReturn);
TRACE("MCI_WAVE_STATUS_AVGBYTESPERSEC => %lu!\n", lpParms->dwReturn);
break;
case MCI_WAVE_STATUS_BITSPERSAMPLE:
lpParms->dwReturn = wmw->WaveFormat.wBitsPerSample;
TRACE(mciwave, "MCI_WAVE_STATUS_BITSPERSAMPLE => %lu!\n", lpParms->dwReturn);
TRACE("MCI_WAVE_STATUS_BITSPERSAMPLE => %lu!\n", lpParms->dwReturn);
break;
case MCI_WAVE_STATUS_BLOCKALIGN:
lpParms->dwReturn = wmw->WaveFormat.wf.nBlockAlign;
TRACE(mciwave, "MCI_WAVE_STATUS_BLOCKALIGN => %lu!\n", lpParms->dwReturn);
TRACE("MCI_WAVE_STATUS_BLOCKALIGN => %lu!\n", lpParms->dwReturn);
break;
case MCI_WAVE_STATUS_CHANNELS:
lpParms->dwReturn = wmw->WaveFormat.wf.nChannels;
TRACE(mciwave, "MCI_WAVE_STATUS_CHANNELS => %lu!\n", lpParms->dwReturn);
TRACE("MCI_WAVE_STATUS_CHANNELS => %lu!\n", lpParms->dwReturn);
break;
case MCI_WAVE_STATUS_FORMATTAG:
lpParms->dwReturn = wmw->WaveFormat.wf.wFormatTag;
TRACE(mciwave, "MCI_WAVE_FORMATTAG => %lu!\n", lpParms->dwReturn);
TRACE("MCI_WAVE_FORMATTAG => %lu!\n", lpParms->dwReturn);
break;
case MCI_WAVE_STATUS_LEVEL:
TRACE(mciwave, "MCI_WAVE_STATUS_LEVEL !\n");
TRACE("MCI_WAVE_STATUS_LEVEL !\n");
lpParms->dwReturn = 0xAAAA5555;
break;
case MCI_WAVE_STATUS_SAMPLESPERSEC:
lpParms->dwReturn = wmw->WaveFormat.wf.nSamplesPerSec;
TRACE(mciwave, "MCI_WAVE_STATUS_SAMPLESPERSEC => %lu!\n", lpParms->dwReturn);
TRACE("MCI_WAVE_STATUS_SAMPLESPERSEC => %lu!\n", lpParms->dwReturn);
break;
default:
WARN(mciwave, "unknown command %08lX !\n", lpParms->dwItem);
WARN("unknown command %08lX !\n", lpParms->dwItem);
return MCIERR_UNRECOGNIZED_COMMAND;
}
}
if (dwFlags & MCI_NOTIFY) {
TRACE(mciwave, "MCI_NOTIFY_SUCCESSFUL %08lX !\n", lpParms->dwCallback);
TRACE("MCI_NOTIFY_SUCCESSFUL %08lX !\n", lpParms->dwCallback);
mciDriverNotify16((HWND16)LOWORD(lpParms->dwCallback),
wmw->wNotifyDeviceID, MCI_NOTIFY_SUCCESSFUL);
}
@ -858,7 +864,7 @@ static DWORD WAVE_mciGetDevCaps(UINT16 wDevID, DWORD dwFlags,
{
WINE_MCIWAVE* wmw = WAVE_mciGetOpenDev(wDevID);
TRACE(mciwave, "(%u, %08lX, %p);\n", wDevID, dwFlags, lpParms);
TRACE("(%u, %08lX, %p);\n", wDevID, dwFlags, lpParms);
if (lpParms == NULL) return MCIERR_NULL_PARAMETER_BLOCK;
if (wmw == NULL) return MCIERR_INVALID_DEVICE_ID;
@ -899,7 +905,7 @@ static DWORD WAVE_mciGetDevCaps(UINT16 wDevID, DWORD dwFlags,
lpParms->dwReturn = 1;
break;
default:
TRACE(mciwave, "Unknown capability (%08lx) !\n", lpParms->dwItem);
TRACE("Unknown capability (%08lx) !\n", lpParms->dwItem);
return MCIERR_UNRECOGNIZED_COMMAND;
}
}
@ -915,14 +921,14 @@ static DWORD WAVE_mciInfo(UINT16 wDevID, DWORD dwFlags, LPMCI_INFO_PARMS16 lpPar
LPCSTR str = 0;
WINE_MCIWAVE* wmw = WAVE_mciGetOpenDev(wDevID);
TRACE(mciwave, "(%u, %08lX, %p);\n", wDevID, dwFlags, lpParms);
TRACE("(%u, %08lX, %p);\n", wDevID, dwFlags, lpParms);
if (lpParms == NULL || lpParms->lpstrReturn == NULL) {
ret = MCIERR_NULL_PARAMETER_BLOCK;
} else if (wmw == NULL) {
ret = MCIERR_INVALID_DEVICE_ID;
} else {
TRACE(mciwave, "buf=%p, len=%lu\n", lpParms->lpstrReturn, lpParms->dwRetSize);
TRACE("buf=%p, len=%lu\n", lpParms->lpstrReturn, lpParms->dwRetSize);
switch(dwFlags) {
case MCI_INFO_PRODUCT:
@ -938,7 +944,7 @@ static DWORD WAVE_mciInfo(UINT16 wDevID, DWORD dwFlags, LPMCI_INFO_PARMS16 lpPar
str = "Wine Wave Out";
break;
default:
WARN(mciwave, "Don't know this info command (%lu)\n", dwFlags);
WARN("Don't know this info command (%lu)\n", dwFlags);
ret = MCIERR_UNRECOGNIZED_COMMAND;
}
}
@ -958,10 +964,10 @@ static DWORD WAVE_mciInfo(UINT16 wDevID, DWORD dwFlags, LPMCI_INFO_PARMS16 lpPar
/**************************************************************************
* MCIWAVE_DriverProc [sample driver]
*/
LONG MCIWAVE_DriverProc(DWORD dwDevID, HDRVR hDriv, DWORD wMsg,
DWORD dwParam1, DWORD dwParam2)
LONG CALLBACK MCIWAVE_DriverProc(DWORD dwDevID, HDRVR hDriv, DWORD wMsg,
DWORD dwParam1, DWORD dwParam2)
{
TRACE(mciwave, "(%08lX, %04X, %08lX, %08lX, %08lX)\n",
TRACE("(%08lX, %04X, %08lX, %08lX, %08lX)\n",
dwDevID, hDriv, wMsg, dwParam1, dwParam2);
switch(wMsg) {
@ -1004,14 +1010,14 @@ LONG MCIWAVE_DriverProc(DWORD dwDevID, HDRVR hDriv, DWORD wMsg,
case MCI_CUT:
case MCI_DELETE:
case MCI_PASTE:
WARN(mciwave, "Unsupported command=%s\n", MCI_CommandToString(wMsg));
WARN("Unsupported command=%s\n", MCI_CommandToString(wMsg));
break;
case MCI_OPEN:
case MCI_CLOSE:
FIXME(mciwave, "Shouldn't receive a MCI_OPEN or CLOSE message\n");
FIXME("Shouldn't receive a MCI_OPEN or CLOSE message\n");
break;
default:
FIXME(mciwave, "is probably wrong msg=%s\n", MCI_CommandToString(wMsg));
FIXME("is probably wrong msg=%s\n", MCI_CommandToString(wMsg));
return DefDriverProc(dwDevID, hDriv, wMsg, dwParam1, dwParam2);
}
return MCIERR_UNRECOGNIZED_COMMAND;