1998-11-24 17:36:18 +01:00
|
|
|
/* -*- tab-width: 8; c-basic-offset: 4 -*- */
|
|
|
|
/*
|
1999-09-05 18:31:37 +02:00
|
|
|
* Sample Wine Driver for MCI wave forms
|
1998-11-24 17:36:18 +01:00
|
|
|
*
|
1999-09-05 18:31:37 +02:00
|
|
|
* Copyright 1994 Martin Ayotte
|
|
|
|
* 1999 Eric Pouech
|
1998-11-24 17:36:18 +01:00
|
|
|
*/
|
|
|
|
/*
|
|
|
|
* FIXME:
|
|
|
|
* - record/play should and must be done asynchronous
|
|
|
|
*/
|
|
|
|
|
1999-04-22 17:26:11 +02:00
|
|
|
#include "winuser.h"
|
1998-11-24 17:36:18 +01:00
|
|
|
#include "driver.h"
|
1999-09-05 18:31:37 +02:00
|
|
|
#include "mmddk.h"
|
1998-11-24 17:36:18 +01:00
|
|
|
#include "heap.h"
|
1999-05-24 10:18:53 +02:00
|
|
|
#include "debugtools.h"
|
1998-11-24 17:36:18 +01:00
|
|
|
|
1999-04-19 16:56:29 +02:00
|
|
|
DEFAULT_DEBUG_CHANNEL(mciwave)
|
|
|
|
|
1998-11-24 17:36:18 +01:00
|
|
|
typedef struct {
|
1999-09-05 18:31:37 +02:00
|
|
|
UINT wDevID;
|
|
|
|
HANDLE hWave;
|
1998-11-24 17:36:18 +01:00
|
|
|
int nUseCount; /* Incremented for each shared open */
|
1999-09-05 18:31:37 +02:00
|
|
|
BOOL fShareable; /* TRUE if first open was shareable */
|
1998-11-24 17:36:18 +01:00
|
|
|
WORD wNotifyDeviceID;/* MCI device ID with a pending notification */
|
1999-02-26 12:11:13 +01:00
|
|
|
HMMIO hFile; /* mmio file handle open as Element */
|
|
|
|
MCI_WAVE_OPEN_PARMSA openParms;
|
1999-12-05 03:18:35 +01:00
|
|
|
LPWAVEFORMATEX lpWaveFormat;
|
1999-09-05 18:31:37 +02:00
|
|
|
BOOL fInput; /* FALSE = Output, TRUE = Input */
|
2000-01-09 03:38:24 +01:00
|
|
|
volatile WORD dwStatus; /* one from MCI_MODE_xxxx */
|
1998-11-24 17:36:18 +01:00
|
|
|
DWORD dwMciTimeFormat;/* One of the supported MCI_FORMAT_xxxx */
|
|
|
|
DWORD dwFileOffset; /* Offset of chunk in mmio file */
|
|
|
|
DWORD dwLength; /* number of bytes in chunk for playing */
|
|
|
|
DWORD dwPosition; /* position in bytes in chunk for playing */
|
1999-12-12 22:26:09 +01:00
|
|
|
HANDLE hEvent; /* for synchronization */
|
|
|
|
DWORD dwEventCount; /* for synchronization */
|
1998-11-24 17:36:18 +01:00
|
|
|
} WINE_MCIWAVE;
|
|
|
|
|
1999-09-27 15:38:57 +02:00
|
|
|
/* ===================================================================
|
|
|
|
* ===================================================================
|
|
|
|
* FIXME: should be using the new mmThreadXXXX functions from WINMM
|
|
|
|
* instead of those
|
|
|
|
* it would require to add a wine internal flag to mmThreadCreate
|
1999-12-05 03:18:35 +01:00
|
|
|
* in order to pass a 32 bit function instead of a 16 bit one
|
1999-09-27 15:38:57 +02:00
|
|
|
* ===================================================================
|
|
|
|
* =================================================================== */
|
|
|
|
|
|
|
|
struct SCA {
|
|
|
|
UINT wDevID;
|
|
|
|
UINT wMsg;
|
|
|
|
DWORD dwParam1;
|
|
|
|
DWORD dwParam2;
|
|
|
|
BOOL allocatedCopy;
|
|
|
|
};
|
|
|
|
|
|
|
|
/**************************************************************************
|
|
|
|
* MCI_SCAStarter [internal]
|
|
|
|
*/
|
|
|
|
static DWORD CALLBACK MCI_SCAStarter(LPVOID arg)
|
|
|
|
{
|
|
|
|
struct SCA* sca = (struct SCA*)arg;
|
|
|
|
DWORD ret;
|
|
|
|
|
|
|
|
TRACE("In thread before async command (%08x,%u,%08lx,%08lx)\n",
|
|
|
|
sca->wDevID, sca->wMsg, sca->dwParam1, sca->dwParam2);
|
|
|
|
ret = mciSendCommandA(sca->wDevID, sca->wMsg, sca->dwParam1 | MCI_WAIT, sca->dwParam2);
|
|
|
|
TRACE("In thread after async command (%08x,%u,%08lx,%08lx)\n",
|
|
|
|
sca->wDevID, sca->wMsg, sca->dwParam1, sca->dwParam2);
|
|
|
|
if (sca->allocatedCopy)
|
|
|
|
HeapFree(GetProcessHeap(), 0, (LPVOID)sca->dwParam2);
|
|
|
|
HeapFree(GetProcessHeap(), 0, sca);
|
|
|
|
ExitThread(ret);
|
|
|
|
WARN("Should not happen ? what's wrong \n");
|
|
|
|
/* should not go after this point */
|
|
|
|
return ret;
|
|
|
|
}
|
|
|
|
|
|
|
|
/**************************************************************************
|
|
|
|
* MCI_SendCommandAsync [internal]
|
|
|
|
*/
|
|
|
|
static DWORD MCI_SendCommandAsync(UINT wDevID, UINT wMsg, DWORD dwParam1,
|
|
|
|
DWORD dwParam2, UINT size)
|
|
|
|
{
|
|
|
|
struct SCA* sca = HeapAlloc(GetProcessHeap(), 0, sizeof(struct SCA));
|
|
|
|
|
|
|
|
if (sca == 0)
|
|
|
|
return MCIERR_OUT_OF_MEMORY;
|
|
|
|
|
|
|
|
sca->wDevID = wDevID;
|
|
|
|
sca->wMsg = wMsg;
|
|
|
|
sca->dwParam1 = dwParam1;
|
|
|
|
|
|
|
|
if (size) {
|
|
|
|
sca->dwParam2 = (DWORD)HeapAlloc(GetProcessHeap(), 0, size);
|
|
|
|
if (sca->dwParam2 == 0) {
|
|
|
|
HeapFree(GetProcessHeap(), 0, sca);
|
|
|
|
return MCIERR_OUT_OF_MEMORY;
|
|
|
|
}
|
|
|
|
sca->allocatedCopy = TRUE;
|
|
|
|
/* copy structure passed by program in dwParam2 to be sure
|
|
|
|
* we can still use it whatever the program does
|
|
|
|
*/
|
|
|
|
memcpy((LPVOID)sca->dwParam2, (LPVOID)dwParam2, size);
|
|
|
|
} else {
|
|
|
|
sca->dwParam2 = dwParam2;
|
|
|
|
sca->allocatedCopy = FALSE;
|
|
|
|
}
|
|
|
|
|
|
|
|
if (CreateThread(NULL, 0, MCI_SCAStarter, sca, 0, NULL) == 0) {
|
|
|
|
WARN("Couldn't allocate thread for async command handling, sending synchonously\n");
|
|
|
|
return MCI_SCAStarter(&sca);
|
|
|
|
}
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
1998-11-24 17:36:18 +01:00
|
|
|
/*======================================================================*
|
|
|
|
* MCI WAVE implemantation *
|
|
|
|
*======================================================================*/
|
|
|
|
|
1999-09-05 18:31:37 +02:00
|
|
|
static DWORD WAVE_mciResume(UINT wDevID, DWORD dwFlags, LPMCI_GENERIC_PARMS lpParms);
|
1999-05-24 10:18:53 +02:00
|
|
|
|
1999-05-02 12:21:49 +02:00
|
|
|
/**************************************************************************
|
|
|
|
* MCIWAVE_drvOpen [internal]
|
|
|
|
*/
|
|
|
|
static DWORD WAVE_drvOpen(LPSTR str, LPMCI_OPEN_DRIVER_PARMSA modp)
|
|
|
|
{
|
1999-07-15 16:36:15 +02:00
|
|
|
WINE_MCIWAVE* wmw = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(WINE_MCIWAVE));
|
1999-05-02 12:21:49 +02:00
|
|
|
|
1999-07-15 16:36:15 +02:00
|
|
|
if (!wmw)
|
|
|
|
return 0;
|
|
|
|
|
|
|
|
wmw->wDevID = modp->wDeviceID;
|
|
|
|
mciSetDriverData(wmw->wDevID, (DWORD)wmw);
|
1999-07-24 12:45:24 +02:00
|
|
|
modp->wCustomCommandTable = MCI_NO_COMMAND_TABLE;
|
1999-07-15 16:36:15 +02:00
|
|
|
modp->wType = MCI_DEVTYPE_WAVEFORM_AUDIO;
|
|
|
|
return modp->wDeviceID;
|
1999-05-02 12:21:49 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
/**************************************************************************
|
|
|
|
* MCIWAVE_drvClose [internal]
|
|
|
|
*/
|
|
|
|
static DWORD WAVE_drvClose(DWORD dwDevID)
|
|
|
|
{
|
1999-07-15 16:36:15 +02:00
|
|
|
WINE_MCIWAVE* wmw = (WINE_MCIWAVE*)mciGetDriverData(dwDevID);
|
1999-05-02 12:21:49 +02:00
|
|
|
|
1999-07-15 16:36:15 +02:00
|
|
|
if (wmw) {
|
|
|
|
HeapFree(GetProcessHeap(), 0, wmw);
|
|
|
|
mciSetDriverData(dwDevID, 0);
|
1999-05-02 12:21:49 +02:00
|
|
|
return 1;
|
|
|
|
}
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
1998-11-24 17:36:18 +01:00
|
|
|
/**************************************************************************
|
|
|
|
* WAVE_mciGetOpenDev [internal]
|
|
|
|
*/
|
1999-09-05 18:31:37 +02:00
|
|
|
static WINE_MCIWAVE* WAVE_mciGetOpenDev(UINT wDevID)
|
1998-11-24 17:36:18 +01:00
|
|
|
{
|
1999-07-15 16:36:15 +02:00
|
|
|
WINE_MCIWAVE* wmw = (WINE_MCIWAVE*)mciGetDriverData(wDevID);
|
1999-05-02 12:21:49 +02:00
|
|
|
|
|
|
|
if (wmw == NULL || wmw->nUseCount == 0) {
|
1999-05-24 10:18:53 +02:00
|
|
|
WARN("Invalid wDevID=%u\n", wDevID);
|
1998-11-24 17:36:18 +01:00
|
|
|
return 0;
|
|
|
|
}
|
1999-05-02 12:21:49 +02:00
|
|
|
return wmw;
|
1998-11-24 17:36:18 +01:00
|
|
|
}
|
|
|
|
|
1999-07-24 12:45:24 +02:00
|
|
|
/**************************************************************************
|
|
|
|
* WAVE_ConvertByteToTimeFormat [internal]
|
|
|
|
*/
|
|
|
|
static DWORD WAVE_ConvertByteToTimeFormat(WINE_MCIWAVE* wmw, DWORD val, LPDWORD lpRet)
|
1998-11-24 17:36:18 +01:00
|
|
|
{
|
|
|
|
DWORD ret = 0;
|
1999-03-15 16:16:13 +01:00
|
|
|
|
1998-11-24 17:36:18 +01:00
|
|
|
switch (wmw->dwMciTimeFormat) {
|
|
|
|
case MCI_FORMAT_MILLISECONDS:
|
1999-12-05 03:18:35 +01:00
|
|
|
ret = (val * 1000) / wmw->lpWaveFormat->nAvgBytesPerSec;
|
1998-11-24 17:36:18 +01:00
|
|
|
break;
|
|
|
|
case MCI_FORMAT_BYTES:
|
|
|
|
ret = val;
|
|
|
|
break;
|
|
|
|
case MCI_FORMAT_SAMPLES: /* FIXME: is this correct ? */
|
1999-12-05 03:18:35 +01:00
|
|
|
ret = (val * 8) / wmw->lpWaveFormat->wBitsPerSample;
|
1998-11-24 17:36:18 +01:00
|
|
|
break;
|
|
|
|
default:
|
1999-05-24 10:18:53 +02:00
|
|
|
WARN("Bad time format %lu!\n", wmw->dwMciTimeFormat);
|
1998-11-24 17:36:18 +01:00
|
|
|
}
|
1999-05-24 10:18:53 +02:00
|
|
|
TRACE("val=%lu=0x%08lx [tf=%lu] => ret=%lu\n", val, val, wmw->dwMciTimeFormat, ret);
|
1999-07-24 12:45:24 +02:00
|
|
|
*lpRet = 0;
|
1998-11-24 17:36:18 +01:00
|
|
|
return ret;
|
|
|
|
}
|
|
|
|
|
1999-07-24 12:45:24 +02:00
|
|
|
/**************************************************************************
|
|
|
|
* WAVE_ConvertTimeFormatToByte [internal]
|
|
|
|
*/
|
1998-11-24 17:36:18 +01:00
|
|
|
static DWORD WAVE_ConvertTimeFormatToByte(WINE_MCIWAVE* wmw, DWORD val)
|
|
|
|
{
|
|
|
|
DWORD ret = 0;
|
1999-03-15 16:16:13 +01:00
|
|
|
|
1998-11-24 17:36:18 +01:00
|
|
|
switch (wmw->dwMciTimeFormat) {
|
|
|
|
case MCI_FORMAT_MILLISECONDS:
|
1999-12-05 03:18:35 +01:00
|
|
|
ret = (val * wmw->lpWaveFormat->nAvgBytesPerSec) / 1000;
|
1998-11-24 17:36:18 +01:00
|
|
|
break;
|
|
|
|
case MCI_FORMAT_BYTES:
|
|
|
|
ret = val;
|
|
|
|
break;
|
|
|
|
case MCI_FORMAT_SAMPLES: /* FIXME: is this correct ? */
|
1999-12-05 03:18:35 +01:00
|
|
|
ret = (val * wmw->lpWaveFormat->wBitsPerSample) / 8;
|
1998-11-24 17:36:18 +01:00
|
|
|
break;
|
|
|
|
default:
|
1999-05-24 10:18:53 +02:00
|
|
|
WARN("Bad time format %lu!\n", wmw->dwMciTimeFormat);
|
1998-11-24 17:36:18 +01:00
|
|
|
}
|
1999-05-24 10:18:53 +02:00
|
|
|
TRACE("val=%lu=0x%08lx [tf=%lu] => ret=%lu\n", val, val, wmw->dwMciTimeFormat, ret);
|
1998-11-24 17:36:18 +01:00
|
|
|
return ret;
|
|
|
|
}
|
|
|
|
|
1999-07-24 12:45:24 +02:00
|
|
|
/**************************************************************************
|
|
|
|
* WAVE_mciReadFmt [internal]
|
|
|
|
*/
|
1998-12-01 09:27:22 +01:00
|
|
|
static DWORD WAVE_mciReadFmt(WINE_MCIWAVE* wmw, MMCKINFO* pckMainRIFF)
|
|
|
|
{
|
|
|
|
MMCKINFO mmckInfo;
|
1999-12-05 03:18:35 +01:00
|
|
|
long r;
|
|
|
|
|
1998-12-01 09:27:22 +01:00
|
|
|
mmckInfo.ckid = mmioFOURCC('f', 'm', 't', ' ');
|
|
|
|
if (mmioDescend(wmw->hFile, &mmckInfo, pckMainRIFF, MMIO_FINDCHUNK) != 0)
|
|
|
|
return MCIERR_INVALID_FILE;
|
1999-05-24 10:18:53 +02:00
|
|
|
TRACE("Chunk Found ckid=%.4s fccType=%.4s cksize=%08lX \n",
|
1998-12-01 09:27:22 +01:00
|
|
|
(LPSTR)&mmckInfo.ckid, (LPSTR)&mmckInfo.fccType, mmckInfo.cksize);
|
1999-12-05 03:18:35 +01:00
|
|
|
|
|
|
|
wmw->lpWaveFormat = HeapAlloc(GetProcessHeap(), 0, mmckInfo.cksize);
|
|
|
|
r = mmioRead(wmw->hFile, (HPSTR)wmw->lpWaveFormat, mmckInfo.cksize);
|
|
|
|
if (r < sizeof(WAVEFORMAT))
|
1998-12-01 09:27:22 +01:00
|
|
|
return MCIERR_INVALID_FILE;
|
1999-03-15 16:16:13 +01:00
|
|
|
|
1999-12-05 03:18:35 +01:00
|
|
|
TRACE("wFormatTag=%04X !\n", wmw->lpWaveFormat->wFormatTag);
|
|
|
|
TRACE("nChannels=%d \n", wmw->lpWaveFormat->nChannels);
|
|
|
|
TRACE("nSamplesPerSec=%ld\n", wmw->lpWaveFormat->nSamplesPerSec);
|
|
|
|
TRACE("nAvgBytesPerSec=%ld\n", wmw->lpWaveFormat->nAvgBytesPerSec);
|
|
|
|
TRACE("nBlockAlign=%d \n", wmw->lpWaveFormat->nBlockAlign);
|
|
|
|
TRACE("wBitsPerSample=%u !\n", wmw->lpWaveFormat->wBitsPerSample);
|
|
|
|
if (r >= (long)sizeof(WAVEFORMATEX))
|
|
|
|
TRACE("cbSize=%u !\n", wmw->lpWaveFormat->cbSize);
|
|
|
|
|
|
|
|
mmioAscend(wmw->hFile, &mmckInfo, 0);
|
1998-12-01 09:27:22 +01:00
|
|
|
mmckInfo.ckid = mmioFOURCC('d', 'a', 't', 'a');
|
1999-07-15 16:36:15 +02:00
|
|
|
if (mmioDescend(wmw->hFile, &mmckInfo, pckMainRIFF, MMIO_FINDCHUNK) != 0) {
|
|
|
|
TRACE("can't find data chunk\n");
|
1998-12-01 09:27:22 +01:00
|
|
|
return MCIERR_INVALID_FILE;
|
1999-07-15 16:36:15 +02:00
|
|
|
}
|
1999-05-24 10:18:53 +02:00
|
|
|
TRACE("Chunk Found ckid=%.4s fccType=%.4s cksize=%08lX \n",
|
1998-12-01 09:27:22 +01:00
|
|
|
(LPSTR)&mmckInfo.ckid, (LPSTR)&mmckInfo.fccType, mmckInfo.cksize);
|
1999-05-24 10:18:53 +02:00
|
|
|
TRACE("nChannels=%d nSamplesPerSec=%ld\n",
|
1999-12-05 03:18:35 +01:00
|
|
|
wmw->lpWaveFormat->nChannels, wmw->lpWaveFormat->nSamplesPerSec);
|
1998-12-01 09:27:22 +01:00
|
|
|
wmw->dwLength = mmckInfo.cksize;
|
1999-12-05 03:18:35 +01:00
|
|
|
wmw->dwFileOffset = mmckInfo.dwDataOffset;
|
1998-12-01 09:27:22 +01:00
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
1998-11-24 17:36:18 +01:00
|
|
|
/**************************************************************************
|
|
|
|
* WAVE_mciOpen [internal]
|
|
|
|
*/
|
1999-09-05 18:31:37 +02:00
|
|
|
static DWORD WAVE_mciOpen(UINT wDevID, DWORD dwFlags, LPMCI_WAVE_OPEN_PARMSA lpOpenParms)
|
1998-11-24 17:36:18 +01:00
|
|
|
{
|
1998-12-01 09:27:22 +01:00
|
|
|
DWORD dwRet = 0;
|
1998-11-24 17:36:18 +01:00
|
|
|
DWORD dwDeviceID;
|
1999-07-15 16:36:15 +02:00
|
|
|
WINE_MCIWAVE* wmw = (WINE_MCIWAVE*)mciGetDriverData(wDevID);
|
1998-11-24 17:36:18 +01:00
|
|
|
|
1999-05-24 10:18:53 +02:00
|
|
|
TRACE("(%04X, %08lX, %p)\n", wDevID, dwFlags, lpOpenParms);
|
1999-05-02 12:21:49 +02:00
|
|
|
if (lpOpenParms == NULL) return MCIERR_NULL_PARAMETER_BLOCK;
|
|
|
|
if (wmw == NULL) return MCIERR_INVALID_DEVICE_ID;
|
|
|
|
|
1999-02-14 12:26:34 +01:00
|
|
|
if (dwFlags & MCI_OPEN_SHAREABLE)
|
|
|
|
return MCIERR_HARDWARE;
|
1999-03-15 16:16:13 +01:00
|
|
|
|
1998-11-24 17:36:18 +01:00
|
|
|
if (wmw->nUseCount > 0) {
|
1999-02-14 12:26:34 +01:00
|
|
|
/* The driver is already opened on this channel
|
|
|
|
* Wave driver cannot be shared
|
|
|
|
*/
|
|
|
|
return MCIERR_DEVICE_OPEN;
|
1998-11-24 17:36:18 +01:00
|
|
|
}
|
1999-02-14 12:26:34 +01:00
|
|
|
wmw->nUseCount++;
|
1998-11-24 17:36:18 +01:00
|
|
|
|
|
|
|
dwDeviceID = lpOpenParms->wDeviceID;
|
|
|
|
|
|
|
|
wmw->fInput = FALSE;
|
1999-09-05 18:31:37 +02:00
|
|
|
wmw->hWave = 0;
|
1999-05-02 12:21:49 +02:00
|
|
|
|
1999-05-24 10:18:53 +02:00
|
|
|
TRACE("wDevID=%04X (lpParams->wDeviceID=%08lX)\n", wDevID, dwDeviceID);
|
1999-03-15 16:16:13 +01:00
|
|
|
|
1998-11-24 17:36:18 +01:00
|
|
|
if (dwFlags & MCI_OPEN_ELEMENT) {
|
1999-02-13 13:38:09 +01:00
|
|
|
if (dwFlags & MCI_OPEN_ELEMENT_ID) {
|
|
|
|
/* could it be that (DWORD)lpOpenParms->lpstrElementName
|
|
|
|
* contains the hFile value ?
|
|
|
|
*/
|
|
|
|
dwRet = MCIERR_UNRECOGNIZED_COMMAND;
|
1998-11-24 17:36:18 +01:00
|
|
|
} else {
|
1999-02-13 13:38:09 +01:00
|
|
|
LPCSTR lpstrElementName = lpOpenParms->lpstrElementName;
|
|
|
|
|
|
|
|
/*FIXME : what should be done id wmw->hFile is already != 0, or the driver is playin' */
|
1999-05-24 10:18:53 +02:00
|
|
|
TRACE("MCI_OPEN_ELEMENT '%s' !\n", lpstrElementName);
|
1999-02-13 13:38:09 +01:00
|
|
|
if (lpstrElementName && (strlen(lpstrElementName) > 0)) {
|
1999-02-26 12:11:13 +01:00
|
|
|
wmw->hFile = mmioOpenA((LPSTR)lpstrElementName, NULL,
|
1999-07-15 16:36:15 +02:00
|
|
|
MMIO_ALLOCBUF | MMIO_READ | MMIO_DENYWRITE);
|
1999-02-13 13:38:09 +01:00
|
|
|
if (wmw->hFile == 0) {
|
1999-05-24 10:18:53 +02:00
|
|
|
WARN("can't find file='%s' !\n", lpstrElementName);
|
1999-02-13 13:38:09 +01:00
|
|
|
dwRet = MCIERR_FILE_NOT_FOUND;
|
|
|
|
}
|
|
|
|
} else {
|
|
|
|
wmw->hFile = 0;
|
|
|
|
}
|
1998-11-24 17:36:18 +01:00
|
|
|
}
|
|
|
|
}
|
1999-05-24 10:18:53 +02:00
|
|
|
TRACE("hFile=%u\n", wmw->hFile);
|
1999-03-15 16:16:13 +01:00
|
|
|
|
1999-02-26 12:11:13 +01:00
|
|
|
memcpy(&wmw->openParms, lpOpenParms, sizeof(MCI_WAVE_OPEN_PARMSA));
|
1998-11-24 17:36:18 +01:00
|
|
|
wmw->wNotifyDeviceID = dwDeviceID;
|
|
|
|
wmw->dwStatus = MCI_MODE_NOT_READY; /* while loading file contents */
|
|
|
|
|
1999-02-13 13:38:09 +01:00
|
|
|
if (dwRet == 0 && wmw->hFile != 0) {
|
1998-11-24 17:36:18 +01:00
|
|
|
MMCKINFO ckMainRIFF;
|
1999-03-15 16:16:13 +01:00
|
|
|
|
1998-12-01 09:27:22 +01:00
|
|
|
if (mmioDescend(wmw->hFile, &ckMainRIFF, NULL, 0) != 0) {
|
|
|
|
dwRet = MCIERR_INVALID_FILE;
|
|
|
|
} else {
|
1999-05-24 10:18:53 +02:00
|
|
|
TRACE("ParentChunk ckid=%.4s fccType=%.4s cksize=%08lX \n",
|
1999-02-13 13:38:09 +01:00
|
|
|
(LPSTR)&ckMainRIFF.ckid, (LPSTR)&ckMainRIFF.fccType, ckMainRIFF.cksize);
|
|
|
|
if ((ckMainRIFF.ckid != FOURCC_RIFF) ||
|
1998-12-01 09:27:22 +01:00
|
|
|
(ckMainRIFF.fccType != mmioFOURCC('W', 'A', 'V', 'E'))) {
|
|
|
|
dwRet = MCIERR_INVALID_FILE;
|
|
|
|
} else {
|
|
|
|
dwRet = WAVE_mciReadFmt(wmw, &ckMainRIFF);
|
|
|
|
}
|
|
|
|
}
|
1998-11-24 17:36:18 +01:00
|
|
|
} else {
|
|
|
|
wmw->dwLength = 0;
|
|
|
|
}
|
1998-12-01 09:27:22 +01:00
|
|
|
if (dwRet == 0) {
|
1999-12-05 03:18:35 +01:00
|
|
|
if (wmw->lpWaveFormat) {
|
|
|
|
switch (wmw->lpWaveFormat->wFormatTag) {
|
|
|
|
case WAVE_FORMAT_PCM:
|
|
|
|
if (wmw->lpWaveFormat->nAvgBytesPerSec !=
|
|
|
|
wmw->lpWaveFormat->nSamplesPerSec * wmw->lpWaveFormat->nBlockAlign) {
|
|
|
|
WARN("Incorrect nAvgBytesPerSec (%ld), setting it to %ld\n",
|
|
|
|
wmw->lpWaveFormat->nAvgBytesPerSec,
|
|
|
|
wmw->lpWaveFormat->nSamplesPerSec *
|
|
|
|
wmw->lpWaveFormat->nBlockAlign);
|
|
|
|
wmw->lpWaveFormat->nAvgBytesPerSec =
|
|
|
|
wmw->lpWaveFormat->nSamplesPerSec *
|
|
|
|
wmw->lpWaveFormat->nBlockAlign;
|
|
|
|
}
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
1999-02-13 13:38:09 +01:00
|
|
|
wmw->dwPosition = 0;
|
1999-03-15 16:16:13 +01:00
|
|
|
|
1999-02-13 13:38:09 +01:00
|
|
|
wmw->dwStatus = MCI_MODE_STOP;
|
1998-12-01 09:27:22 +01:00
|
|
|
} else {
|
|
|
|
wmw->nUseCount--;
|
|
|
|
if (wmw->hFile != 0)
|
1999-02-26 12:11:13 +01:00
|
|
|
mmioClose(wmw->hFile, 0);
|
1998-12-01 09:27:22 +01:00
|
|
|
wmw->hFile = 0;
|
|
|
|
}
|
1999-03-15 16:16:13 +01:00
|
|
|
return dwRet;
|
1998-11-24 17:36:18 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
/**************************************************************************
|
|
|
|
* WAVE_mciCue [internal]
|
|
|
|
*/
|
1999-09-05 18:31:37 +02:00
|
|
|
static DWORD WAVE_mciCue(UINT wDevID, DWORD dwParam, LPMCI_GENERIC_PARMS lpParms)
|
1998-11-24 17:36:18 +01:00
|
|
|
{
|
|
|
|
/*
|
|
|
|
FIXME
|
|
|
|
|
|
|
|
This routine is far from complete. At the moment only a check is done on the
|
|
|
|
MCI_WAVE_INPUT flag. No explicit check on MCI_WAVE_OUTPUT is done since that
|
|
|
|
is the default.
|
|
|
|
|
|
|
|
The flags MCI_NOTIFY (and the callback parameter in lpParms) and MCI_WAIT
|
|
|
|
are ignored
|
|
|
|
*/
|
|
|
|
|
|
|
|
DWORD dwRet;
|
|
|
|
WINE_MCIWAVE* wmw = WAVE_mciGetOpenDev(wDevID);
|
1999-03-15 16:16:13 +01:00
|
|
|
|
1999-09-05 18:31:37 +02:00
|
|
|
FIXME("(%u, %08lX, %p); likely to fail\n", wDevID, dwParam, lpParms);
|
1999-03-15 16:16:13 +01:00
|
|
|
|
1998-11-24 17:36:18 +01:00
|
|
|
if (wmw == NULL) return MCIERR_INVALID_DEVICE_ID;
|
1999-03-15 16:16:13 +01:00
|
|
|
|
1998-11-24 17:36:18 +01:00
|
|
|
/* always close elements ? */
|
|
|
|
if (wmw->hFile != 0) {
|
1999-02-26 12:11:13 +01:00
|
|
|
mmioClose(wmw->hFile, 0);
|
1998-11-24 17:36:18 +01:00
|
|
|
wmw->hFile = 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
dwRet = MMSYSERR_NOERROR; /* assume success */
|
1999-03-15 16:16:13 +01:00
|
|
|
|
1998-11-24 17:36:18 +01:00
|
|
|
if ((dwParam & MCI_WAVE_INPUT) && !wmw->fInput) {
|
1999-09-05 18:31:37 +02:00
|
|
|
dwRet = waveOutClose(wmw->hWave);
|
1998-11-24 17:36:18 +01:00
|
|
|
if (dwRet != MMSYSERR_NOERROR) return MCIERR_INTERNAL;
|
|
|
|
wmw->fInput = TRUE;
|
|
|
|
} else if (wmw->fInput) {
|
1999-09-05 18:31:37 +02:00
|
|
|
dwRet = waveInClose(wmw->hWave);
|
1998-11-24 17:36:18 +01:00
|
|
|
if (dwRet != MMSYSERR_NOERROR) return MCIERR_INTERNAL;
|
|
|
|
wmw->fInput = FALSE;
|
|
|
|
}
|
1999-09-05 18:31:37 +02:00
|
|
|
wmw->hWave = 0;
|
1998-11-24 17:36:18 +01:00
|
|
|
return (dwRet == MMSYSERR_NOERROR) ? 0 : MCIERR_INTERNAL;
|
|
|
|
}
|
|
|
|
|
|
|
|
/**************************************************************************
|
|
|
|
* WAVE_mciStop [internal]
|
|
|
|
*/
|
1999-09-05 18:31:37 +02:00
|
|
|
static DWORD WAVE_mciStop(UINT wDevID, DWORD dwFlags, LPMCI_GENERIC_PARMS lpParms)
|
1998-11-24 17:36:18 +01:00
|
|
|
{
|
1999-12-12 22:26:09 +01:00
|
|
|
DWORD dwRet = 0;
|
1998-11-24 17:36:18 +01:00
|
|
|
WINE_MCIWAVE* wmw = WAVE_mciGetOpenDev(wDevID);
|
|
|
|
|
1999-05-24 10:18:53 +02:00
|
|
|
TRACE("(%u, %08lX, %p);\n", wDevID, dwFlags, lpParms);
|
1999-03-15 16:16:13 +01:00
|
|
|
|
1998-11-24 17:36:18 +01:00
|
|
|
if (wmw == NULL) return MCIERR_INVALID_DEVICE_ID;
|
1999-03-15 16:16:13 +01:00
|
|
|
|
1999-12-12 22:26:09 +01:00
|
|
|
/* wait for playback thread (if any) to exit before processing further */
|
|
|
|
switch (wmw->dwStatus) {
|
|
|
|
case MCI_MODE_PAUSE:
|
|
|
|
case MCI_MODE_PLAY:
|
|
|
|
case MCI_MODE_RECORD:
|
|
|
|
{
|
|
|
|
int oldStat = wmw->dwStatus;
|
|
|
|
wmw->dwStatus = MCI_MODE_NOT_READY;
|
|
|
|
if (oldStat == MCI_MODE_PAUSE)
|
|
|
|
dwRet = (wmw->fInput) ? waveInReset(wmw->hWave) : waveOutReset(wmw->hWave);
|
|
|
|
}
|
2000-01-09 03:38:24 +01:00
|
|
|
while (wmw->dwStatus != MCI_MODE_STOP)
|
1999-12-12 22:26:09 +01:00
|
|
|
Sleep(10);
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
|
1998-11-24 17:36:18 +01:00
|
|
|
wmw->dwPosition = 0;
|
1999-12-12 22:26:09 +01:00
|
|
|
|
|
|
|
/* sanity resets */
|
|
|
|
wmw->dwStatus = MCI_MODE_STOP;
|
1998-11-24 17:36:18 +01:00
|
|
|
|
1999-12-12 22:26:09 +01:00
|
|
|
if ((dwFlags & MCI_NOTIFY) && lpParms) {
|
1999-09-05 18:31:37 +02:00
|
|
|
mciDriverNotify((HWND)LOWORD(lpParms->dwCallback),
|
|
|
|
wmw->wNotifyDeviceID, MCI_NOTIFY_SUCCESSFUL);
|
1998-11-24 17:36:18 +01:00
|
|
|
}
|
1999-03-15 16:16:13 +01:00
|
|
|
|
1999-12-12 22:26:09 +01:00
|
|
|
return dwRet;
|
1998-11-24 17:36:18 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
/**************************************************************************
|
|
|
|
* WAVE_mciClose [internal]
|
|
|
|
*/
|
1999-09-05 18:31:37 +02:00
|
|
|
static DWORD WAVE_mciClose(UINT wDevID, DWORD dwFlags, LPMCI_GENERIC_PARMS lpParms)
|
1998-11-24 17:36:18 +01:00
|
|
|
{
|
1999-02-14 12:26:34 +01:00
|
|
|
DWORD dwRet = 0;
|
1998-11-24 17:36:18 +01:00
|
|
|
WINE_MCIWAVE* wmw = WAVE_mciGetOpenDev(wDevID);
|
|
|
|
|
1999-05-24 10:18:53 +02:00
|
|
|
TRACE("(%u, %08lX, %p);\n", wDevID, dwFlags, lpParms);
|
1998-11-24 17:36:18 +01:00
|
|
|
|
1999-02-14 12:26:34 +01:00
|
|
|
if (wmw == NULL) return MCIERR_INVALID_DEVICE_ID;
|
1999-03-15 16:16:13 +01:00
|
|
|
|
1998-11-24 17:36:18 +01:00
|
|
|
if (wmw->dwStatus != MCI_MODE_STOP) {
|
1999-02-14 12:26:34 +01:00
|
|
|
dwRet = WAVE_mciStop(wDevID, MCI_WAIT, lpParms);
|
1998-11-24 17:36:18 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
wmw->nUseCount--;
|
1999-03-15 16:16:13 +01:00
|
|
|
|
1998-11-24 17:36:18 +01:00
|
|
|
if (wmw->nUseCount == 0) {
|
|
|
|
if (wmw->hFile != 0) {
|
1999-02-26 12:11:13 +01:00
|
|
|
mmioClose(wmw->hFile, 0);
|
1998-11-24 17:36:18 +01:00
|
|
|
wmw->hFile = 0;
|
|
|
|
}
|
|
|
|
}
|
1999-03-15 16:16:13 +01:00
|
|
|
|
1999-12-05 03:18:35 +01:00
|
|
|
HeapFree(GetProcessHeap(), 0, wmw->lpWaveFormat);
|
|
|
|
wmw->lpWaveFormat = NULL;
|
|
|
|
|
1999-03-15 16:16:13 +01:00
|
|
|
if ((dwFlags & MCI_NOTIFY) && lpParms) {
|
1999-09-05 18:31:37 +02:00
|
|
|
mciDriverNotify((HWND)LOWORD(lpParms->dwCallback),
|
|
|
|
wmw->wNotifyDeviceID,
|
|
|
|
(dwRet == 0) ? MCI_NOTIFY_SUCCESSFUL : MCI_NOTIFY_FAILURE);
|
1998-11-24 17:36:18 +01:00
|
|
|
}
|
1999-12-12 22:26:09 +01:00
|
|
|
|
1998-11-24 17:36:18 +01:00
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
1999-12-12 22:26:09 +01:00
|
|
|
/**************************************************************************
|
|
|
|
* WAVE_mciPlayCallback [internal]
|
|
|
|
*/
|
|
|
|
static void CALLBACK WAVE_mciPlayCallback(HWAVEOUT hwo, UINT uMsg,
|
|
|
|
DWORD dwInstance,
|
|
|
|
DWORD dwParam1, DWORD dwParam2)
|
|
|
|
{
|
|
|
|
WINE_MCIWAVE* wmw = (WINE_MCIWAVE*)dwInstance;
|
|
|
|
|
|
|
|
switch (uMsg) {
|
|
|
|
case WOM_OPEN:
|
|
|
|
case WOM_CLOSE:
|
|
|
|
break;
|
|
|
|
case WOM_DONE:
|
|
|
|
InterlockedIncrement(&wmw->dwEventCount);
|
|
|
|
TRACE("Returning waveHdr=%lx\n", dwParam1);
|
|
|
|
SetEvent(wmw->hEvent);
|
|
|
|
break;
|
|
|
|
default:
|
|
|
|
ERR("Unknown uMsg=%d\n", uMsg);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
static void WAVE_mciPlayWaitDone(WINE_MCIWAVE* wmw)
|
|
|
|
{
|
|
|
|
for (;;) {
|
|
|
|
ResetEvent(wmw->hEvent);
|
|
|
|
if (InterlockedDecrement(&wmw->dwEventCount) >= 0) {
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
InterlockedIncrement(&wmw->dwEventCount);
|
|
|
|
|
|
|
|
WaitForSingleObject(wmw->hEvent, INFINITE);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
1998-11-24 17:36:18 +01:00
|
|
|
/**************************************************************************
|
|
|
|
* WAVE_mciPlay [internal]
|
|
|
|
*/
|
1999-09-05 18:31:37 +02:00
|
|
|
static DWORD WAVE_mciPlay(UINT wDevID, DWORD dwFlags, LPMCI_PLAY_PARMS lpParms)
|
1998-11-24 17:36:18 +01:00
|
|
|
{
|
|
|
|
DWORD end;
|
1999-12-05 03:18:35 +01:00
|
|
|
LONG bufsize, count, left;
|
1999-12-12 22:26:09 +01:00
|
|
|
DWORD dwRet = 0;
|
|
|
|
LPWAVEHDR waveHdr = NULL;
|
1998-11-24 17:36:18 +01:00
|
|
|
WINE_MCIWAVE* wmw = WAVE_mciGetOpenDev(wDevID);
|
1999-12-05 03:18:35 +01:00
|
|
|
int whidx;
|
|
|
|
|
1999-05-24 10:18:53 +02:00
|
|
|
TRACE("(%u, %08lX, %p);\n", wDevID, dwFlags, lpParms);
|
1998-11-24 17:36:18 +01:00
|
|
|
|
1999-02-14 12:26:34 +01:00
|
|
|
if (wmw == NULL) return MCIERR_INVALID_DEVICE_ID;
|
|
|
|
if (lpParms == NULL) return MCIERR_NULL_PARAMETER_BLOCK;
|
1999-03-15 16:16:13 +01:00
|
|
|
|
1998-11-24 17:36:18 +01:00
|
|
|
if (wmw->fInput) {
|
1999-05-24 10:18:53 +02:00
|
|
|
WARN("cannot play on input device\n");
|
1998-11-24 17:36:18 +01:00
|
|
|
return MCIERR_NONAPPLICABLE_FUNCTION;
|
|
|
|
}
|
|
|
|
|
|
|
|
if (wmw->hFile == 0) {
|
1999-05-24 10:18:53 +02:00
|
|
|
WARN("Can't play: no file='%s' !\n", wmw->openParms.lpstrElementName);
|
1998-11-24 17:36:18 +01:00
|
|
|
return MCIERR_FILE_NOT_FOUND;
|
|
|
|
}
|
1999-03-15 16:16:13 +01:00
|
|
|
|
1999-05-24 10:18:53 +02:00
|
|
|
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);
|
|
|
|
}
|
2000-01-09 03:38:24 +01:00
|
|
|
|
|
|
|
/** This function will be called again by a thread when async is used.
|
|
|
|
* We have to set MCI_MODE_PLAY before we do this so that the app can spin
|
|
|
|
* on MCI_STATUS, so we have to allow it here if we're not going to start this thread.
|
|
|
|
*/
|
|
|
|
if ((wmw->dwStatus != MCI_MODE_STOP) && ((wmw->dwStatus != MCI_MODE_PLAY) && (dwFlags & MCI_WAIT))) {
|
1999-05-24 10:18:53 +02:00
|
|
|
return MCIERR_INTERNAL;
|
|
|
|
}
|
|
|
|
|
2000-01-09 03:38:24 +01:00
|
|
|
wmw->dwStatus = MCI_MODE_PLAY;
|
|
|
|
|
|
|
|
if (!(dwFlags & MCI_WAIT)) {
|
|
|
|
return MCI_SendCommandAsync(wmw->wNotifyDeviceID, MCI_PLAY, dwFlags,
|
|
|
|
(DWORD)lpParms, sizeof(MCI_PLAY_PARMS));
|
|
|
|
}
|
|
|
|
|
1998-11-24 17:36:18 +01:00
|
|
|
end = 0xFFFFFFFF;
|
|
|
|
if (lpParms && (dwFlags & MCI_FROM)) {
|
|
|
|
wmw->dwPosition = WAVE_ConvertTimeFormatToByte(wmw, lpParms->dwFrom);
|
|
|
|
}
|
|
|
|
if (lpParms && (dwFlags & MCI_TO)) {
|
|
|
|
end = WAVE_ConvertTimeFormatToByte(wmw, lpParms->dwTo);
|
|
|
|
}
|
1999-03-15 16:16:13 +01:00
|
|
|
|
1999-05-24 10:18:53 +02:00
|
|
|
TRACE("Playing from byte=%lu to byte=%lu\n", wmw->dwPosition, end);
|
1999-03-15 16:16:13 +01:00
|
|
|
|
1999-12-05 03:18:35 +01:00
|
|
|
if (end <= wmw->dwPosition)
|
|
|
|
return TRUE;
|
|
|
|
|
|
|
|
#define WAVE_ALIGN_ON_BLOCK(wmw,v) \
|
|
|
|
((((v) + (wmw)->lpWaveFormat->nBlockAlign - 1) / (wmw)->lpWaveFormat->nBlockAlign) * (wmw)->lpWaveFormat->nBlockAlign)
|
|
|
|
|
|
|
|
wmw->dwPosition = WAVE_ALIGN_ON_BLOCK(wmw, wmw->dwPosition);
|
|
|
|
wmw->dwLength = WAVE_ALIGN_ON_BLOCK(wmw, wmw->dwLength);
|
|
|
|
/* go back to begining of chunk plus the requested position */
|
|
|
|
/* FIXME: I'm not sure this is correct, notably because some data linked to
|
|
|
|
* the decompression state machine will not be correcly initialized.
|
|
|
|
* try it this way (other way would be to decompress from 0 up to dwPosition
|
|
|
|
* and to start sending to hWave when dwPosition is reached)
|
|
|
|
*/
|
|
|
|
mmioSeek(wmw->hFile, wmw->dwFileOffset + wmw->dwPosition, SEEK_SET); /* >= 0 */
|
1999-12-12 22:26:09 +01:00
|
|
|
|
1999-03-15 16:16:13 +01:00
|
|
|
/* By default the device will be opened for output, the MCI_CUE function is there to
|
|
|
|
* change from output to input and back
|
|
|
|
*/
|
1999-12-05 03:18:35 +01:00
|
|
|
/* FIXME: how to choose between several output channels ? here mapper is forced */
|
1999-12-12 22:26:09 +01:00
|
|
|
dwRet = waveOutOpen(&wmw->hWave, WAVE_MAPPER, wmw->lpWaveFormat,
|
|
|
|
(DWORD)WAVE_mciPlayCallback, (DWORD)wmw, CALLBACK_FUNCTION);
|
|
|
|
|
1999-03-15 16:16:13 +01:00
|
|
|
if (dwRet != 0) {
|
1999-05-24 10:18:53 +02:00
|
|
|
TRACE("Can't open low level audio device %ld\n", dwRet);
|
1999-12-12 22:26:09 +01:00
|
|
|
dwRet = MCIERR_DEVICE_OPEN;
|
|
|
|
wmw->hWave = 0;
|
|
|
|
goto cleanUp;
|
1999-03-15 16:16:13 +01:00
|
|
|
}
|
1998-11-24 17:36:18 +01:00
|
|
|
|
1999-12-05 03:18:35 +01:00
|
|
|
/* make it so that 3 buffers per second are needed */
|
|
|
|
bufsize = WAVE_ALIGN_ON_BLOCK(wmw, wmw->lpWaveFormat->nAvgBytesPerSec / 3);
|
|
|
|
|
|
|
|
waveHdr = HeapAlloc(GetProcessHeap(), 0, 2 * sizeof(WAVEHDR) + 2 * bufsize);
|
|
|
|
waveHdr[0].lpData = (char*)waveHdr + 2 * sizeof(WAVEHDR);
|
|
|
|
waveHdr[1].lpData = (char*)waveHdr + 2 * sizeof(WAVEHDR) + bufsize;
|
1999-12-12 22:26:09 +01:00
|
|
|
waveHdr[0].dwUser = waveHdr[1].dwUser = 0L;
|
|
|
|
waveHdr[0].dwLoops = waveHdr[1].dwLoops = 0L;
|
|
|
|
waveHdr[0].dwFlags = waveHdr[1].dwFlags = 0L;
|
|
|
|
waveHdr[0].dwBufferLength = waveHdr[1].dwBufferLength = bufsize;
|
|
|
|
if (waveOutPrepareHeader(wmw->hWave, &waveHdr[0], sizeof(WAVEHDR)) ||
|
|
|
|
waveOutPrepareHeader(wmw->hWave, &waveHdr[1], sizeof(WAVEHDR))) {
|
|
|
|
dwRet = MCIERR_INTERNAL;
|
|
|
|
goto cleanUp;
|
|
|
|
}
|
1999-12-05 03:18:35 +01:00
|
|
|
|
|
|
|
whidx = 0;
|
|
|
|
left = MIN(wmw->dwLength, end - wmw->dwPosition);
|
1999-12-12 22:26:09 +01:00
|
|
|
wmw->hEvent = CreateEventA(NULL, FALSE, FALSE, NULL);
|
|
|
|
wmw->dwEventCount = 1L; /* for first buffer */
|
1999-12-05 03:18:35 +01:00
|
|
|
|
|
|
|
TRACE("Playing (normalized) from byte=%lu for %lu bytes\n", wmw->dwPosition, left);
|
1999-12-12 22:26:09 +01:00
|
|
|
|
1998-11-24 17:36:18 +01:00
|
|
|
/* FIXME: this doesn't work if wmw->dwPosition != 0 */
|
1999-12-12 22:26:09 +01:00
|
|
|
while (left > 0 && wmw->dwStatus != MCI_MODE_STOP && wmw->dwStatus != MCI_MODE_NOT_READY) {
|
1999-12-05 03:18:35 +01:00
|
|
|
count = mmioRead(wmw->hFile, waveHdr[whidx].lpData, MIN(bufsize, left));
|
1999-05-24 10:18:53 +02:00
|
|
|
TRACE("mmioRead bufsize=%ld count=%ld\n", bufsize, count);
|
1999-03-15 16:16:13 +01:00
|
|
|
if (count < 1)
|
|
|
|
break;
|
1999-12-12 22:26:09 +01:00
|
|
|
/* count is always <= bufsize, so this is correct regarding the
|
|
|
|
* waveOutPrepareHeader function
|
|
|
|
*/
|
1999-12-05 03:18:35 +01:00
|
|
|
waveHdr[whidx].dwBufferLength = count;
|
1999-12-12 22:26:09 +01:00
|
|
|
waveHdr[whidx].dwFlags &= ~WHDR_DONE;
|
1999-05-24 10:18:53 +02:00
|
|
|
TRACE("before WODM_WRITE lpWaveHdr=%p dwBufferLength=%lu dwBytesRecorded=%lu\n",
|
1999-12-05 03:18:35 +01:00
|
|
|
&waveHdr[whidx], waveHdr[whidx].dwBufferLength,
|
|
|
|
waveHdr[whidx].dwBytesRecorded);
|
|
|
|
dwRet = waveOutWrite(wmw->hWave, &waveHdr[whidx], sizeof(WAVEHDR));
|
1999-12-12 22:26:09 +01:00
|
|
|
left -= count;
|
1998-11-24 17:36:18 +01:00
|
|
|
wmw->dwPosition += count;
|
1999-05-24 10:18:53 +02:00
|
|
|
TRACE("after WODM_WRITE dwPosition=%lu\n", wmw->dwPosition);
|
1999-12-05 03:18:35 +01:00
|
|
|
|
1999-12-12 22:26:09 +01:00
|
|
|
WAVE_mciPlayWaitDone(wmw);
|
1999-12-05 03:18:35 +01:00
|
|
|
whidx ^= 1;
|
1998-11-24 17:36:18 +01:00
|
|
|
}
|
1999-03-15 16:16:13 +01:00
|
|
|
|
1999-12-12 22:26:09 +01:00
|
|
|
WAVE_mciPlayWaitDone(wmw); /* to balance first buffer */
|
|
|
|
|
|
|
|
/* just to get rid of some race conditions between play, stop and pause */
|
1999-09-05 18:31:37 +02:00
|
|
|
waveOutReset(wmw->hWave);
|
1999-03-15 16:16:13 +01:00
|
|
|
|
1999-12-12 22:26:09 +01:00
|
|
|
waveOutUnprepareHeader(wmw->hWave, &waveHdr[0], sizeof(WAVEHDR));
|
|
|
|
waveOutUnprepareHeader(wmw->hWave, &waveHdr[1], sizeof(WAVEHDR));
|
|
|
|
|
|
|
|
dwRet = 0;
|
|
|
|
|
|
|
|
cleanUp:
|
|
|
|
HeapFree(GetProcessHeap(), 0, waveHdr);
|
|
|
|
|
|
|
|
if (wmw->hWave) {
|
|
|
|
waveOutClose(wmw->hWave);
|
|
|
|
wmw->hWave = 0;
|
|
|
|
}
|
|
|
|
CloseHandle(wmw->hEvent);
|
|
|
|
|
1998-11-24 17:36:18 +01:00
|
|
|
if (lpParms && (dwFlags & MCI_NOTIFY)) {
|
1999-09-05 18:31:37 +02:00
|
|
|
mciDriverNotify((HWND)LOWORD(lpParms->dwCallback),
|
1999-12-12 22:26:09 +01:00
|
|
|
wmw->wNotifyDeviceID,
|
|
|
|
dwRet ? MCI_NOTIFY_FAILURE : MCI_NOTIFY_SUCCESSFUL);
|
1998-11-24 17:36:18 +01:00
|
|
|
}
|
1999-12-12 22:26:09 +01:00
|
|
|
|
|
|
|
wmw->dwStatus = MCI_MODE_STOP;
|
|
|
|
|
|
|
|
return dwRet;
|
1998-11-24 17:36:18 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
/**************************************************************************
|
|
|
|
* WAVE_mciRecord [internal]
|
|
|
|
*/
|
1999-09-05 18:31:37 +02:00
|
|
|
static DWORD WAVE_mciRecord(UINT wDevID, DWORD dwFlags, LPMCI_RECORD_PARMS lpParms)
|
1998-11-24 17:36:18 +01:00
|
|
|
{
|
|
|
|
int start, end;
|
|
|
|
LONG bufsize;
|
1999-12-05 03:18:35 +01:00
|
|
|
WAVEHDR waveHdr;
|
1998-11-24 17:36:18 +01:00
|
|
|
DWORD dwRet;
|
|
|
|
WINE_MCIWAVE* wmw = WAVE_mciGetOpenDev(wDevID);
|
1999-03-15 16:16:13 +01:00
|
|
|
|
1999-05-24 10:18:53 +02:00
|
|
|
TRACE("(%u, %08lX, %p);\n", wDevID, dwFlags, lpParms);
|
1998-11-24 17:36:18 +01:00
|
|
|
|
1999-02-14 12:26:34 +01:00
|
|
|
if (wmw == NULL) return MCIERR_INVALID_DEVICE_ID;
|
|
|
|
if (lpParms == NULL) return MCIERR_NULL_PARAMETER_BLOCK;
|
1999-03-15 16:16:13 +01:00
|
|
|
|
1998-11-24 17:36:18 +01:00
|
|
|
if (!wmw->fInput) {
|
1999-05-24 10:18:53 +02:00
|
|
|
WARN("cannot record on output device\n");
|
1998-11-24 17:36:18 +01:00
|
|
|
return MCIERR_NONAPPLICABLE_FUNCTION;
|
|
|
|
}
|
|
|
|
|
|
|
|
if (wmw->hFile == 0) {
|
1999-05-24 10:18:53 +02:00
|
|
|
WARN("can't find file='%s' !\n",
|
1998-11-24 17:36:18 +01:00
|
|
|
wmw->openParms.lpstrElementName);
|
|
|
|
return MCIERR_FILE_NOT_FOUND;
|
|
|
|
}
|
|
|
|
start = 1; end = 99999;
|
|
|
|
if (dwFlags & MCI_FROM) {
|
|
|
|
start = lpParms->dwFrom;
|
1999-05-24 10:18:53 +02:00
|
|
|
TRACE("MCI_FROM=%d \n", start);
|
1998-11-24 17:36:18 +01:00
|
|
|
}
|
|
|
|
if (dwFlags & MCI_TO) {
|
|
|
|
end = lpParms->dwTo;
|
1999-05-24 10:18:53 +02:00
|
|
|
TRACE("MCI_TO=%d \n", end);
|
1998-11-24 17:36:18 +01:00
|
|
|
}
|
|
|
|
bufsize = 64000;
|
1999-12-05 03:18:35 +01:00
|
|
|
waveHdr.lpData = HeapAlloc(GetProcessHeap(), 0, bufsize);
|
|
|
|
waveHdr.dwBufferLength = bufsize;
|
|
|
|
waveHdr.dwUser = 0L;
|
|
|
|
waveHdr.dwFlags = 0L;
|
|
|
|
waveHdr.dwLoops = 0L;
|
|
|
|
dwRet = waveInPrepareHeader(wmw->hWave, &waveHdr, sizeof(WAVEHDR));
|
1999-09-22 18:42:31 +02:00
|
|
|
|
|
|
|
for (;;) { /* FIXME: I don't see any waveInAddBuffer ? */
|
1999-12-05 03:18:35 +01:00
|
|
|
waveHdr.dwBytesRecorded = 0;
|
1999-09-05 18:31:37 +02:00
|
|
|
dwRet = waveInStart(wmw->hWave);
|
1999-09-22 18:42:31 +02:00
|
|
|
TRACE("waveInStart => lpWaveHdr=%p dwBytesRecorded=%lu\n",
|
1999-12-05 03:18:35 +01:00
|
|
|
&waveHdr, waveHdr.dwBytesRecorded);
|
|
|
|
if (waveHdr.dwBytesRecorded == 0) break;
|
1998-11-24 17:36:18 +01:00
|
|
|
}
|
1999-12-05 03:18:35 +01:00
|
|
|
dwRet = waveInUnprepareHeader(wmw->hWave, &waveHdr, sizeof(WAVEHDR));
|
|
|
|
HeapFree(GetProcessHeap(), 0, waveHdr.lpData);
|
|
|
|
|
1998-11-24 17:36:18 +01:00
|
|
|
if (dwFlags & MCI_NOTIFY) {
|
1999-09-05 18:31:37 +02:00
|
|
|
mciDriverNotify((HWND)LOWORD(lpParms->dwCallback),
|
|
|
|
wmw->wNotifyDeviceID, MCI_NOTIFY_SUCCESSFUL);
|
1998-11-24 17:36:18 +01:00
|
|
|
}
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
/**************************************************************************
|
|
|
|
* WAVE_mciPause [internal]
|
|
|
|
*/
|
1999-09-05 18:31:37 +02:00
|
|
|
static DWORD WAVE_mciPause(UINT wDevID, DWORD dwFlags, LPMCI_GENERIC_PARMS lpParms)
|
1998-11-24 17:36:18 +01:00
|
|
|
{
|
|
|
|
DWORD dwRet;
|
|
|
|
WINE_MCIWAVE* wmw = WAVE_mciGetOpenDev(wDevID);
|
|
|
|
|
1999-05-24 10:18:53 +02:00
|
|
|
TRACE("(%u, %08lX, %p);\n", wDevID, dwFlags, lpParms);
|
1999-03-15 16:16:13 +01:00
|
|
|
|
1998-12-01 09:27:22 +01:00
|
|
|
if (lpParms == NULL) return MCIERR_NULL_PARAMETER_BLOCK;
|
1998-11-24 17:36:18 +01:00
|
|
|
if (wmw == NULL) return MCIERR_INVALID_DEVICE_ID;
|
1999-03-15 16:16:13 +01:00
|
|
|
|
1998-11-24 17:36:18 +01:00
|
|
|
if (wmw->dwStatus == MCI_MODE_PLAY) {
|
|
|
|
wmw->dwStatus = MCI_MODE_PAUSE;
|
|
|
|
}
|
1999-03-15 16:16:13 +01:00
|
|
|
|
1999-09-05 18:31:37 +02:00
|
|
|
if (wmw->fInput) dwRet = waveInStop(wmw->hWave);
|
|
|
|
else dwRet = waveOutPause(wmw->hWave);
|
1998-11-24 17:36:18 +01:00
|
|
|
|
|
|
|
return (dwRet == MMSYSERR_NOERROR) ? 0 : MCIERR_INTERNAL;
|
|
|
|
}
|
|
|
|
|
|
|
|
/**************************************************************************
|
|
|
|
* WAVE_mciResume [internal]
|
|
|
|
*/
|
1999-09-05 18:31:37 +02:00
|
|
|
static DWORD WAVE_mciResume(UINT wDevID, DWORD dwFlags, LPMCI_GENERIC_PARMS lpParms)
|
1998-11-24 17:36:18 +01:00
|
|
|
{
|
|
|
|
WINE_MCIWAVE* wmw = WAVE_mciGetOpenDev(wDevID);
|
|
|
|
DWORD dwRet = 0;
|
1999-03-15 16:16:13 +01:00
|
|
|
|
1999-05-24 10:18:53 +02:00
|
|
|
TRACE("(%u, %08lX, %p);\n", wDevID, dwFlags, lpParms);
|
1999-03-15 16:16:13 +01:00
|
|
|
|
1998-11-24 17:36:18 +01:00
|
|
|
if (wmw == NULL) return MCIERR_INVALID_DEVICE_ID;
|
1999-03-15 16:16:13 +01:00
|
|
|
|
1998-11-24 17:36:18 +01:00
|
|
|
if (wmw->dwStatus == MCI_MODE_PAUSE) {
|
|
|
|
wmw->dwStatus = MCI_MODE_PLAY;
|
|
|
|
}
|
1999-03-15 16:16:13 +01:00
|
|
|
|
1999-09-05 18:31:37 +02:00
|
|
|
if (wmw->fInput) dwRet = waveInStart(wmw->hWave);
|
|
|
|
else dwRet = waveOutRestart(wmw->hWave);
|
1998-11-24 17:36:18 +01:00
|
|
|
return (dwRet == MMSYSERR_NOERROR) ? 0 : MCIERR_INTERNAL;
|
|
|
|
}
|
|
|
|
|
|
|
|
/**************************************************************************
|
|
|
|
* WAVE_mciSeek [internal]
|
|
|
|
*/
|
1999-09-05 18:31:37 +02:00
|
|
|
static DWORD WAVE_mciSeek(UINT wDevID, DWORD dwFlags, LPMCI_SEEK_PARMS lpParms)
|
1998-11-24 17:36:18 +01:00
|
|
|
{
|
|
|
|
DWORD ret = 0;
|
|
|
|
WINE_MCIWAVE* wmw = WAVE_mciGetOpenDev(wDevID);
|
1999-03-15 16:16:13 +01:00
|
|
|
|
1999-05-24 10:18:53 +02:00
|
|
|
TRACE("(%04X, %08lX, %p);\n", wDevID, dwFlags, lpParms);
|
1999-03-15 16:16:13 +01:00
|
|
|
|
1998-11-24 17:36:18 +01:00
|
|
|
if (lpParms == NULL) {
|
|
|
|
ret = MCIERR_NULL_PARAMETER_BLOCK;
|
|
|
|
} else if (wmw == NULL) {
|
|
|
|
ret = MCIERR_INVALID_DEVICE_ID;
|
|
|
|
} else {
|
|
|
|
WAVE_mciStop(wDevID, MCI_WAIT, 0);
|
|
|
|
|
|
|
|
if (dwFlags & MCI_SEEK_TO_START) {
|
|
|
|
wmw->dwPosition = 0;
|
|
|
|
} else if (dwFlags & MCI_SEEK_TO_END) {
|
1999-12-05 03:18:35 +01:00
|
|
|
wmw->dwPosition = wmw->dwLength;
|
1998-11-24 17:36:18 +01:00
|
|
|
} else if (dwFlags & MCI_TO) {
|
|
|
|
wmw->dwPosition = WAVE_ConvertTimeFormatToByte(wmw, lpParms->dwTo);
|
|
|
|
} else {
|
1999-05-24 10:18:53 +02:00
|
|
|
WARN("dwFlag doesn't tell where to seek to...\n");
|
1998-11-24 17:36:18 +01:00
|
|
|
return MCIERR_MISSING_PARAMETER;
|
|
|
|
}
|
|
|
|
|
1999-05-24 10:18:53 +02:00
|
|
|
TRACE("Seeking to position=%lu bytes\n", wmw->dwPosition);
|
1998-11-24 17:36:18 +01:00
|
|
|
|
|
|
|
if (dwFlags & MCI_NOTIFY) {
|
1999-09-05 18:31:37 +02:00
|
|
|
mciDriverNotify((HWND)LOWORD(lpParms->dwCallback),
|
|
|
|
wmw->wNotifyDeviceID, MCI_NOTIFY_SUCCESSFUL);
|
1998-11-24 17:36:18 +01:00
|
|
|
}
|
|
|
|
}
|
|
|
|
return ret;
|
|
|
|
}
|
|
|
|
|
|
|
|
/**************************************************************************
|
|
|
|
* WAVE_mciSet [internal]
|
|
|
|
*/
|
1999-09-05 18:31:37 +02:00
|
|
|
static DWORD WAVE_mciSet(UINT wDevID, DWORD dwFlags, LPMCI_SET_PARMS lpParms)
|
1998-11-24 17:36:18 +01:00
|
|
|
{
|
|
|
|
WINE_MCIWAVE* wmw = WAVE_mciGetOpenDev(wDevID);
|
1999-03-15 16:16:13 +01:00
|
|
|
|
1999-05-24 10:18:53 +02:00
|
|
|
TRACE("(%u, %08lX, %p);\n", wDevID, dwFlags, lpParms);
|
1999-03-15 16:16:13 +01:00
|
|
|
|
1998-12-01 09:27:22 +01:00
|
|
|
if (lpParms == NULL) return MCIERR_NULL_PARAMETER_BLOCK;
|
1998-11-24 17:36:18 +01:00
|
|
|
if (wmw == NULL) return MCIERR_INVALID_DEVICE_ID;
|
1999-03-15 16:16:13 +01:00
|
|
|
|
1998-11-24 17:36:18 +01:00
|
|
|
if (dwFlags & MCI_SET_TIME_FORMAT) {
|
|
|
|
switch (lpParms->dwTimeFormat) {
|
|
|
|
case MCI_FORMAT_MILLISECONDS:
|
1999-05-24 10:18:53 +02:00
|
|
|
TRACE("MCI_FORMAT_MILLISECONDS !\n");
|
1998-11-24 17:36:18 +01:00
|
|
|
wmw->dwMciTimeFormat = MCI_FORMAT_MILLISECONDS;
|
|
|
|
break;
|
|
|
|
case MCI_FORMAT_BYTES:
|
1999-05-24 10:18:53 +02:00
|
|
|
TRACE("MCI_FORMAT_BYTES !\n");
|
1998-11-24 17:36:18 +01:00
|
|
|
wmw->dwMciTimeFormat = MCI_FORMAT_BYTES;
|
|
|
|
break;
|
|
|
|
case MCI_FORMAT_SAMPLES:
|
1999-05-24 10:18:53 +02:00
|
|
|
TRACE("MCI_FORMAT_SAMPLES !\n");
|
1998-11-24 17:36:18 +01:00
|
|
|
wmw->dwMciTimeFormat = MCI_FORMAT_SAMPLES;
|
|
|
|
break;
|
|
|
|
default:
|
1999-05-24 10:18:53 +02:00
|
|
|
WARN("Bad time format %lu!\n", lpParms->dwTimeFormat);
|
1998-11-24 17:36:18 +01:00
|
|
|
return MCIERR_BAD_TIME_FORMAT;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
if (dwFlags & MCI_SET_VIDEO) {
|
1999-05-24 10:18:53 +02:00
|
|
|
TRACE("No support for video !\n");
|
1998-11-24 17:36:18 +01:00
|
|
|
return MCIERR_UNSUPPORTED_FUNCTION;
|
|
|
|
}
|
|
|
|
if (dwFlags & MCI_SET_DOOR_OPEN) {
|
1999-05-24 10:18:53 +02:00
|
|
|
TRACE("No support for door open !\n");
|
1998-11-24 17:36:18 +01:00
|
|
|
return MCIERR_UNSUPPORTED_FUNCTION;
|
|
|
|
}
|
|
|
|
if (dwFlags & MCI_SET_DOOR_CLOSED) {
|
1999-05-24 10:18:53 +02:00
|
|
|
TRACE("No support for door close !\n");
|
1998-11-24 17:36:18 +01:00
|
|
|
return MCIERR_UNSUPPORTED_FUNCTION;
|
|
|
|
}
|
|
|
|
if (dwFlags & MCI_SET_AUDIO) {
|
|
|
|
if (dwFlags & MCI_SET_ON) {
|
1999-05-24 10:18:53 +02:00
|
|
|
TRACE("MCI_SET_ON audio !\n");
|
1998-11-24 17:36:18 +01:00
|
|
|
} else if (dwFlags & MCI_SET_OFF) {
|
1999-05-24 10:18:53 +02:00
|
|
|
TRACE("MCI_SET_OFF audio !\n");
|
1998-11-24 17:36:18 +01:00
|
|
|
} else {
|
1999-05-24 10:18:53 +02:00
|
|
|
WARN("MCI_SET_AUDIO without SET_ON or SET_OFF\n");
|
1998-11-24 17:36:18 +01:00
|
|
|
return MCIERR_BAD_INTEGER;
|
|
|
|
}
|
1999-03-15 16:16:13 +01:00
|
|
|
|
1998-11-24 17:36:18 +01:00
|
|
|
if (lpParms->dwAudio & MCI_SET_AUDIO_ALL)
|
1999-05-24 10:18:53 +02:00
|
|
|
TRACE("MCI_SET_AUDIO_ALL !\n");
|
1998-11-24 17:36:18 +01:00
|
|
|
if (lpParms->dwAudio & MCI_SET_AUDIO_LEFT)
|
1999-05-24 10:18:53 +02:00
|
|
|
TRACE("MCI_SET_AUDIO_LEFT !\n");
|
1998-11-24 17:36:18 +01:00
|
|
|
if (lpParms->dwAudio & MCI_SET_AUDIO_RIGHT)
|
1999-05-24 10:18:53 +02:00
|
|
|
TRACE("MCI_SET_AUDIO_RIGHT !\n");
|
1998-11-24 17:36:18 +01:00
|
|
|
}
|
|
|
|
if (dwFlags & MCI_WAVE_INPUT)
|
1999-05-24 10:18:53 +02:00
|
|
|
TRACE("MCI_WAVE_INPUT !\n");
|
1998-11-24 17:36:18 +01:00
|
|
|
if (dwFlags & MCI_WAVE_OUTPUT)
|
1999-05-24 10:18:53 +02:00
|
|
|
TRACE("MCI_WAVE_OUTPUT !\n");
|
1998-11-24 17:36:18 +01:00
|
|
|
if (dwFlags & MCI_WAVE_SET_ANYINPUT)
|
1999-05-24 10:18:53 +02:00
|
|
|
TRACE("MCI_WAVE_SET_ANYINPUT !\n");
|
1998-11-24 17:36:18 +01:00
|
|
|
if (dwFlags & MCI_WAVE_SET_ANYOUTPUT)
|
1999-05-24 10:18:53 +02:00
|
|
|
TRACE("MCI_WAVE_SET_ANYOUTPUT !\n");
|
1998-11-24 17:36:18 +01:00
|
|
|
if (dwFlags & MCI_WAVE_SET_AVGBYTESPERSEC)
|
1999-05-24 10:18:53 +02:00
|
|
|
TRACE("MCI_WAVE_SET_AVGBYTESPERSEC !\n");
|
1998-11-24 17:36:18 +01:00
|
|
|
if (dwFlags & MCI_WAVE_SET_BITSPERSAMPLE)
|
1999-05-24 10:18:53 +02:00
|
|
|
TRACE("MCI_WAVE_SET_BITSPERSAMPLE !\n");
|
1998-11-24 17:36:18 +01:00
|
|
|
if (dwFlags & MCI_WAVE_SET_BLOCKALIGN)
|
1999-05-24 10:18:53 +02:00
|
|
|
TRACE("MCI_WAVE_SET_BLOCKALIGN !\n");
|
1998-11-24 17:36:18 +01:00
|
|
|
if (dwFlags & MCI_WAVE_SET_CHANNELS)
|
1999-05-24 10:18:53 +02:00
|
|
|
TRACE("MCI_WAVE_SET_CHANNELS !\n");
|
1998-11-24 17:36:18 +01:00
|
|
|
if (dwFlags & MCI_WAVE_SET_FORMATTAG)
|
1999-05-24 10:18:53 +02:00
|
|
|
TRACE("MCI_WAVE_SET_FORMATTAG !\n");
|
1998-11-24 17:36:18 +01:00
|
|
|
if (dwFlags & MCI_WAVE_SET_SAMPLESPERSEC)
|
1999-05-24 10:18:53 +02:00
|
|
|
TRACE("MCI_WAVE_SET_SAMPLESPERSEC !\n");
|
1998-11-24 17:36:18 +01:00
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
/**************************************************************************
|
|
|
|
* WAVE_mciStatus [internal]
|
|
|
|
*/
|
1999-09-05 18:31:37 +02:00
|
|
|
static DWORD WAVE_mciStatus(UINT wDevID, DWORD dwFlags, LPMCI_STATUS_PARMS lpParms)
|
1998-11-24 17:36:18 +01:00
|
|
|
{
|
|
|
|
WINE_MCIWAVE* wmw = WAVE_mciGetOpenDev(wDevID);
|
1999-12-05 03:18:35 +01:00
|
|
|
DWORD ret = 0;
|
1999-07-24 12:45:24 +02:00
|
|
|
|
1999-05-24 10:18:53 +02:00
|
|
|
TRACE("(%u, %08lX, %p);\n", wDevID, dwFlags, lpParms);
|
1998-12-01 09:27:22 +01:00
|
|
|
if (lpParms == NULL) return MCIERR_NULL_PARAMETER_BLOCK;
|
1998-11-24 17:36:18 +01:00
|
|
|
if (wmw == NULL) return MCIERR_INVALID_DEVICE_ID;
|
1999-03-15 16:16:13 +01:00
|
|
|
|
1998-11-24 17:36:18 +01:00
|
|
|
if (dwFlags & MCI_STATUS_ITEM) {
|
1999-09-05 18:31:37 +02:00
|
|
|
switch (lpParms->dwItem) {
|
1998-11-24 17:36:18 +01:00
|
|
|
case MCI_STATUS_CURRENT_TRACK:
|
|
|
|
lpParms->dwReturn = 1;
|
1999-05-24 10:18:53 +02:00
|
|
|
TRACE("MCI_STATUS_CURRENT_TRACK => %lu\n", lpParms->dwReturn);
|
1998-11-24 17:36:18 +01:00
|
|
|
break;
|
|
|
|
case MCI_STATUS_LENGTH:
|
1999-12-05 03:18:35 +01:00
|
|
|
if (!wmw->hFile) {
|
|
|
|
lpParms->dwReturn = 0;
|
|
|
|
return MCIERR_UNSUPPORTED_FUNCTION;
|
|
|
|
}
|
1998-11-24 17:36:18 +01:00
|
|
|
/* only one track in file is currently handled, so don't take care of MCI_TRACK flag */
|
1999-07-24 12:45:24 +02:00
|
|
|
lpParms->dwReturn = WAVE_ConvertByteToTimeFormat(wmw, wmw->dwLength, &ret);
|
1999-05-24 10:18:53 +02:00
|
|
|
TRACE("MCI_STATUS_LENGTH => %lu\n", lpParms->dwReturn);
|
1998-11-24 17:36:18 +01:00
|
|
|
break;
|
|
|
|
case MCI_STATUS_MODE:
|
1999-07-24 12:45:24 +02:00
|
|
|
TRACE("MCI_STATUS_MODE => %u\n", wmw->dwStatus);
|
|
|
|
lpParms->dwReturn = MAKEMCIRESOURCE(wmw->dwStatus, wmw->dwStatus);
|
|
|
|
ret = MCI_RESOURCE_RETURNED;
|
1998-11-24 17:36:18 +01:00
|
|
|
break;
|
|
|
|
case MCI_STATUS_MEDIA_PRESENT:
|
1999-05-24 10:18:53 +02:00
|
|
|
TRACE("MCI_STATUS_MEDIA_PRESENT => TRUE!\n");
|
1999-07-24 12:45:24 +02:00
|
|
|
lpParms->dwReturn = MAKEMCIRESOURCE(TRUE, MCI_TRUE);
|
|
|
|
ret = MCI_RESOURCE_RETURNED;
|
1998-11-24 17:36:18 +01:00
|
|
|
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;
|
1999-05-24 10:18:53 +02:00
|
|
|
TRACE("MCI_STATUS_NUMBER_OF_TRACKS => %lu!\n", lpParms->dwReturn);
|
1998-11-24 17:36:18 +01:00
|
|
|
break;
|
|
|
|
case MCI_STATUS_POSITION:
|
1999-12-05 03:18:35 +01:00
|
|
|
if (!wmw->hFile) {
|
|
|
|
lpParms->dwReturn = 0;
|
|
|
|
return MCIERR_UNSUPPORTED_FUNCTION;
|
|
|
|
}
|
1998-11-24 17:36:18 +01:00
|
|
|
/* only one track in file is currently handled, so don't take care of MCI_TRACK flag */
|
|
|
|
lpParms->dwReturn = WAVE_ConvertByteToTimeFormat(wmw,
|
1999-07-24 12:45:24 +02:00
|
|
|
(dwFlags & MCI_STATUS_START) ? 0 : wmw->dwPosition,
|
|
|
|
&ret);
|
1999-05-24 10:18:53 +02:00
|
|
|
TRACE("MCI_STATUS_POSITION %s => %lu\n",
|
1998-11-24 17:36:18 +01:00
|
|
|
(dwFlags & MCI_STATUS_START) ? "start" : "current", lpParms->dwReturn);
|
|
|
|
break;
|
|
|
|
case MCI_STATUS_READY:
|
1999-07-24 12:45:24 +02:00
|
|
|
lpParms->dwReturn = (wmw->dwStatus == MCI_MODE_NOT_READY) ?
|
|
|
|
MAKEMCIRESOURCE(FALSE, MCI_FALSE) : MAKEMCIRESOURCE(TRUE, MCI_TRUE);
|
|
|
|
TRACE("MCI_STATUS_READY => %u!\n", LOWORD(lpParms->dwReturn));
|
|
|
|
ret = MCI_RESOURCE_RETURNED;
|
1998-11-24 17:36:18 +01:00
|
|
|
break;
|
|
|
|
case MCI_STATUS_TIME_FORMAT:
|
1999-07-24 12:45:24 +02:00
|
|
|
lpParms->dwReturn = MAKEMCIRESOURCE(wmw->dwMciTimeFormat, wmw->dwMciTimeFormat);
|
1999-05-24 10:18:53 +02:00
|
|
|
TRACE("MCI_STATUS_TIME_FORMAT => %lu\n", lpParms->dwReturn);
|
1999-07-24 12:45:24 +02:00
|
|
|
ret = MCI_RESOURCE_RETURNED;
|
1998-11-24 17:36:18 +01:00
|
|
|
break;
|
|
|
|
case MCI_WAVE_INPUT:
|
1999-05-24 10:18:53 +02:00
|
|
|
TRACE("MCI_WAVE_INPUT !\n");
|
1998-11-24 17:36:18 +01:00
|
|
|
lpParms->dwReturn = 0;
|
1999-12-05 03:18:35 +01:00
|
|
|
ret = MCIERR_WAVE_INPUTUNSPECIFIED;
|
1998-11-24 17:36:18 +01:00
|
|
|
break;
|
|
|
|
case MCI_WAVE_OUTPUT:
|
1999-05-24 10:18:53 +02:00
|
|
|
TRACE("MCI_WAVE_OUTPUT !\n");
|
1999-12-05 03:18:35 +01:00
|
|
|
{
|
|
|
|
UINT id;
|
|
|
|
if (waveOutGetID(wmw->hWave, &id) == MMSYSERR_NOERROR) {
|
|
|
|
lpParms->dwReturn = id;
|
|
|
|
} else {
|
|
|
|
lpParms->dwReturn = 0;
|
|
|
|
ret = MCIERR_WAVE_INPUTUNSPECIFIED;
|
|
|
|
}
|
|
|
|
}
|
1998-11-24 17:36:18 +01:00
|
|
|
break;
|
|
|
|
case MCI_WAVE_STATUS_AVGBYTESPERSEC:
|
1999-12-05 03:18:35 +01:00
|
|
|
if (!wmw->hFile) {
|
|
|
|
lpParms->dwReturn = 0;
|
|
|
|
return MCIERR_UNSUPPORTED_FUNCTION;
|
|
|
|
}
|
|
|
|
lpParms->dwReturn = wmw->lpWaveFormat->nAvgBytesPerSec;
|
1999-05-24 10:18:53 +02:00
|
|
|
TRACE("MCI_WAVE_STATUS_AVGBYTESPERSEC => %lu!\n", lpParms->dwReturn);
|
1998-11-24 17:36:18 +01:00
|
|
|
break;
|
|
|
|
case MCI_WAVE_STATUS_BITSPERSAMPLE:
|
1999-12-05 03:18:35 +01:00
|
|
|
if (!wmw->hFile) {
|
|
|
|
lpParms->dwReturn = 0;
|
|
|
|
return MCIERR_UNSUPPORTED_FUNCTION;
|
|
|
|
}
|
|
|
|
lpParms->dwReturn = wmw->lpWaveFormat->wBitsPerSample;
|
1999-05-24 10:18:53 +02:00
|
|
|
TRACE("MCI_WAVE_STATUS_BITSPERSAMPLE => %lu!\n", lpParms->dwReturn);
|
1998-11-24 17:36:18 +01:00
|
|
|
break;
|
|
|
|
case MCI_WAVE_STATUS_BLOCKALIGN:
|
1999-12-05 03:18:35 +01:00
|
|
|
if (!wmw->hFile) {
|
|
|
|
lpParms->dwReturn = 0;
|
|
|
|
return MCIERR_UNSUPPORTED_FUNCTION;
|
|
|
|
}
|
|
|
|
lpParms->dwReturn = wmw->lpWaveFormat->nBlockAlign;
|
1999-05-24 10:18:53 +02:00
|
|
|
TRACE("MCI_WAVE_STATUS_BLOCKALIGN => %lu!\n", lpParms->dwReturn);
|
1998-11-24 17:36:18 +01:00
|
|
|
break;
|
|
|
|
case MCI_WAVE_STATUS_CHANNELS:
|
1999-12-05 03:18:35 +01:00
|
|
|
if (!wmw->hFile) {
|
|
|
|
lpParms->dwReturn = 0;
|
|
|
|
return MCIERR_UNSUPPORTED_FUNCTION;
|
|
|
|
}
|
|
|
|
lpParms->dwReturn = wmw->lpWaveFormat->nChannels;
|
1999-05-24 10:18:53 +02:00
|
|
|
TRACE("MCI_WAVE_STATUS_CHANNELS => %lu!\n", lpParms->dwReturn);
|
1998-11-24 17:36:18 +01:00
|
|
|
break;
|
|
|
|
case MCI_WAVE_STATUS_FORMATTAG:
|
1999-12-05 03:18:35 +01:00
|
|
|
if (!wmw->hFile) {
|
|
|
|
lpParms->dwReturn = 0;
|
|
|
|
return MCIERR_UNSUPPORTED_FUNCTION;
|
|
|
|
}
|
|
|
|
lpParms->dwReturn = wmw->lpWaveFormat->wFormatTag;
|
1999-05-24 10:18:53 +02:00
|
|
|
TRACE("MCI_WAVE_FORMATTAG => %lu!\n", lpParms->dwReturn);
|
1998-11-24 17:36:18 +01:00
|
|
|
break;
|
|
|
|
case MCI_WAVE_STATUS_LEVEL:
|
1999-05-24 10:18:53 +02:00
|
|
|
TRACE("MCI_WAVE_STATUS_LEVEL !\n");
|
1998-11-24 17:36:18 +01:00
|
|
|
lpParms->dwReturn = 0xAAAA5555;
|
|
|
|
break;
|
|
|
|
case MCI_WAVE_STATUS_SAMPLESPERSEC:
|
1999-12-05 03:18:35 +01:00
|
|
|
if (!wmw->hFile) {
|
|
|
|
lpParms->dwReturn = 0;
|
|
|
|
return MCIERR_UNSUPPORTED_FUNCTION;
|
|
|
|
}
|
|
|
|
lpParms->dwReturn = wmw->lpWaveFormat->nSamplesPerSec;
|
1999-05-24 10:18:53 +02:00
|
|
|
TRACE("MCI_WAVE_STATUS_SAMPLESPERSEC => %lu!\n", lpParms->dwReturn);
|
1998-11-24 17:36:18 +01:00
|
|
|
break;
|
|
|
|
default:
|
1999-05-24 10:18:53 +02:00
|
|
|
WARN("unknown command %08lX !\n", lpParms->dwItem);
|
1998-11-24 17:36:18 +01:00
|
|
|
return MCIERR_UNRECOGNIZED_COMMAND;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
if (dwFlags & MCI_NOTIFY) {
|
1999-09-05 18:31:37 +02:00
|
|
|
mciDriverNotify((HWND)LOWORD(lpParms->dwCallback),
|
|
|
|
wmw->wNotifyDeviceID, MCI_NOTIFY_SUCCESSFUL);
|
1998-11-24 17:36:18 +01:00
|
|
|
}
|
1999-07-24 12:45:24 +02:00
|
|
|
return ret;
|
1998-11-24 17:36:18 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
/**************************************************************************
|
|
|
|
* WAVE_mciGetDevCaps [internal]
|
|
|
|
*/
|
1999-09-05 18:31:37 +02:00
|
|
|
static DWORD WAVE_mciGetDevCaps(UINT wDevID, DWORD dwFlags,
|
1998-11-24 17:36:18 +01:00
|
|
|
LPMCI_GETDEVCAPS_PARMS lpParms)
|
|
|
|
{
|
|
|
|
WINE_MCIWAVE* wmw = WAVE_mciGetOpenDev(wDevID);
|
1999-07-24 12:45:24 +02:00
|
|
|
DWORD ret = 0;
|
|
|
|
|
1999-05-24 10:18:53 +02:00
|
|
|
TRACE("(%u, %08lX, %p);\n", wDevID, dwFlags, lpParms);
|
1998-11-24 17:36:18 +01:00
|
|
|
|
1998-12-01 09:27:22 +01:00
|
|
|
if (lpParms == NULL) return MCIERR_NULL_PARAMETER_BLOCK;
|
1998-11-24 17:36:18 +01:00
|
|
|
if (wmw == NULL) return MCIERR_INVALID_DEVICE_ID;
|
1999-03-15 16:16:13 +01:00
|
|
|
|
1998-11-24 17:36:18 +01:00
|
|
|
if (dwFlags & MCI_GETDEVCAPS_ITEM) {
|
|
|
|
switch(lpParms->dwItem) {
|
|
|
|
case MCI_GETDEVCAPS_DEVICE_TYPE:
|
1999-07-24 12:45:24 +02:00
|
|
|
lpParms->dwReturn = MAKEMCIRESOURCE(MCI_DEVTYPE_WAVEFORM_AUDIO, MCI_DEVTYPE_WAVEFORM_AUDIO);
|
|
|
|
ret = MCI_RESOURCE_RETURNED;
|
1998-11-24 17:36:18 +01:00
|
|
|
break;
|
|
|
|
case MCI_GETDEVCAPS_HAS_AUDIO:
|
1999-07-24 12:45:24 +02:00
|
|
|
lpParms->dwReturn = MAKEMCIRESOURCE(TRUE, MCI_TRUE);
|
|
|
|
ret = MCI_RESOURCE_RETURNED;
|
1998-11-24 17:36:18 +01:00
|
|
|
break;
|
|
|
|
case MCI_GETDEVCAPS_HAS_VIDEO:
|
1999-07-24 12:45:24 +02:00
|
|
|
lpParms->dwReturn = MAKEMCIRESOURCE(FALSE, MCI_FALSE);
|
|
|
|
ret = MCI_RESOURCE_RETURNED;
|
1998-11-24 17:36:18 +01:00
|
|
|
break;
|
|
|
|
case MCI_GETDEVCAPS_USES_FILES:
|
1999-07-24 12:45:24 +02:00
|
|
|
lpParms->dwReturn = MAKEMCIRESOURCE(TRUE, MCI_TRUE);
|
|
|
|
ret = MCI_RESOURCE_RETURNED;
|
1998-11-24 17:36:18 +01:00
|
|
|
break;
|
|
|
|
case MCI_GETDEVCAPS_COMPOUND_DEVICE:
|
1999-07-24 12:45:24 +02:00
|
|
|
lpParms->dwReturn = MAKEMCIRESOURCE(TRUE, MCI_TRUE);
|
|
|
|
ret = MCI_RESOURCE_RETURNED;
|
1998-11-24 17:36:18 +01:00
|
|
|
break;
|
|
|
|
case MCI_GETDEVCAPS_CAN_RECORD:
|
1999-07-24 12:45:24 +02:00
|
|
|
lpParms->dwReturn = MAKEMCIRESOURCE(TRUE, MCI_TRUE);
|
|
|
|
ret = MCI_RESOURCE_RETURNED;
|
1998-11-24 17:36:18 +01:00
|
|
|
break;
|
|
|
|
case MCI_GETDEVCAPS_CAN_EJECT:
|
1999-07-24 12:45:24 +02:00
|
|
|
lpParms->dwReturn = MAKEMCIRESOURCE(FALSE, MCI_FALSE);
|
|
|
|
ret = MCI_RESOURCE_RETURNED;
|
1998-11-24 17:36:18 +01:00
|
|
|
break;
|
|
|
|
case MCI_GETDEVCAPS_CAN_PLAY:
|
1999-07-24 12:45:24 +02:00
|
|
|
lpParms->dwReturn = MAKEMCIRESOURCE(TRUE, MCI_TRUE);
|
|
|
|
ret = MCI_RESOURCE_RETURNED;
|
1998-11-24 17:36:18 +01:00
|
|
|
break;
|
|
|
|
case MCI_GETDEVCAPS_CAN_SAVE:
|
1999-07-24 12:45:24 +02:00
|
|
|
lpParms->dwReturn = MAKEMCIRESOURCE(TRUE, MCI_TRUE);
|
|
|
|
ret = MCI_RESOURCE_RETURNED;
|
1998-11-24 17:36:18 +01:00
|
|
|
break;
|
|
|
|
case MCI_WAVE_GETDEVCAPS_INPUTS:
|
|
|
|
lpParms->dwReturn = 1;
|
|
|
|
break;
|
|
|
|
case MCI_WAVE_GETDEVCAPS_OUTPUTS:
|
|
|
|
lpParms->dwReturn = 1;
|
|
|
|
break;
|
|
|
|
default:
|
1999-07-24 12:45:24 +02:00
|
|
|
FIXME("Unknown capability (%08lx) !\n", lpParms->dwItem);
|
1998-11-24 17:36:18 +01:00
|
|
|
return MCIERR_UNRECOGNIZED_COMMAND;
|
|
|
|
}
|
1999-07-24 12:45:24 +02:00
|
|
|
} else {
|
|
|
|
WARN("No GetDevCaps-Item !\n");
|
|
|
|
return MCIERR_UNRECOGNIZED_COMMAND;
|
1998-11-24 17:36:18 +01:00
|
|
|
}
|
1999-07-24 12:45:24 +02:00
|
|
|
return ret;
|
1998-11-24 17:36:18 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
/**************************************************************************
|
|
|
|
* WAVE_mciInfo [internal]
|
|
|
|
*/
|
1999-09-05 18:31:37 +02:00
|
|
|
static DWORD WAVE_mciInfo(UINT wDevID, DWORD dwFlags, LPMCI_INFO_PARMSA lpParms)
|
1998-11-24 17:36:18 +01:00
|
|
|
{
|
|
|
|
DWORD ret = 0;
|
|
|
|
LPCSTR str = 0;
|
|
|
|
WINE_MCIWAVE* wmw = WAVE_mciGetOpenDev(wDevID);
|
1999-03-15 16:16:13 +01:00
|
|
|
|
1999-05-24 10:18:53 +02:00
|
|
|
TRACE("(%u, %08lX, %p);\n", wDevID, dwFlags, lpParms);
|
1999-03-15 16:16:13 +01:00
|
|
|
|
1998-11-24 17:36:18 +01:00
|
|
|
if (lpParms == NULL || lpParms->lpstrReturn == NULL) {
|
|
|
|
ret = MCIERR_NULL_PARAMETER_BLOCK;
|
|
|
|
} else if (wmw == NULL) {
|
|
|
|
ret = MCIERR_INVALID_DEVICE_ID;
|
|
|
|
} else {
|
1999-05-24 10:18:53 +02:00
|
|
|
TRACE("buf=%p, len=%lu\n", lpParms->lpstrReturn, lpParms->dwRetSize);
|
1999-03-15 16:16:13 +01:00
|
|
|
|
1999-12-06 00:09:49 +01:00
|
|
|
switch (dwFlags & ~(MCI_WAIT|MCI_NOTIFY)) {
|
1998-11-24 17:36:18 +01:00
|
|
|
case MCI_INFO_PRODUCT:
|
|
|
|
str = "Wine's audio player";
|
|
|
|
break;
|
|
|
|
case MCI_INFO_FILE:
|
|
|
|
str = wmw->openParms.lpstrElementName;
|
|
|
|
break;
|
|
|
|
case MCI_WAVE_INPUT:
|
|
|
|
str = "Wine Wave In";
|
|
|
|
break;
|
|
|
|
case MCI_WAVE_OUTPUT:
|
|
|
|
str = "Wine Wave Out";
|
|
|
|
break;
|
|
|
|
default:
|
1999-05-24 10:18:53 +02:00
|
|
|
WARN("Don't know this info command (%lu)\n", dwFlags);
|
1999-02-13 13:38:09 +01:00
|
|
|
ret = MCIERR_UNRECOGNIZED_COMMAND;
|
1998-11-24 17:36:18 +01:00
|
|
|
}
|
|
|
|
}
|
|
|
|
if (str) {
|
|
|
|
if (strlen(str) + 1 > lpParms->dwRetSize) {
|
|
|
|
ret = MCIERR_PARAM_OVERFLOW;
|
|
|
|
} else {
|
1999-02-26 12:11:13 +01:00
|
|
|
lstrcpynA(lpParms->lpstrReturn, str, lpParms->dwRetSize);
|
1998-11-24 17:36:18 +01:00
|
|
|
}
|
|
|
|
} else {
|
|
|
|
lpParms->lpstrReturn[0] = 0;
|
|
|
|
}
|
1999-03-15 16:16:13 +01:00
|
|
|
|
1998-11-24 17:36:18 +01:00
|
|
|
return ret;
|
|
|
|
}
|
|
|
|
|
|
|
|
/**************************************************************************
|
1999-03-15 16:16:13 +01:00
|
|
|
* MCIWAVE_DriverProc [sample driver]
|
1998-11-24 17:36:18 +01:00
|
|
|
*/
|
1999-05-24 10:18:53 +02:00
|
|
|
LONG CALLBACK MCIWAVE_DriverProc(DWORD dwDevID, HDRVR hDriv, DWORD wMsg,
|
|
|
|
DWORD dwParam1, DWORD dwParam2)
|
1998-11-24 17:36:18 +01:00
|
|
|
{
|
1999-05-24 10:18:53 +02:00
|
|
|
TRACE("(%08lX, %04X, %08lX, %08lX, %08lX)\n",
|
1998-11-24 17:36:18 +01:00
|
|
|
dwDevID, hDriv, wMsg, dwParam1, dwParam2);
|
1999-03-15 16:16:13 +01:00
|
|
|
|
1998-11-24 17:36:18 +01:00
|
|
|
switch(wMsg) {
|
|
|
|
case DRV_LOAD: return 1;
|
|
|
|
case DRV_FREE: return 1;
|
1999-05-02 12:21:49 +02:00
|
|
|
case DRV_OPEN: return WAVE_drvOpen((LPSTR)dwParam1, (LPMCI_OPEN_DRIVER_PARMSA)dwParam2);
|
|
|
|
case DRV_CLOSE: return WAVE_drvClose(dwDevID);
|
1998-11-24 17:36:18 +01:00
|
|
|
case DRV_ENABLE: return 1;
|
|
|
|
case DRV_DISABLE: return 1;
|
|
|
|
case DRV_QUERYCONFIGURE: return 1;
|
1999-05-02 12:21:49 +02:00
|
|
|
case DRV_CONFIGURE: MessageBoxA(0, "Sample MultiMedia Driver !", "OSS Driver", MB_OK); return 1;
|
1998-11-24 17:36:18 +01:00
|
|
|
case DRV_INSTALL: return DRVCNF_RESTART;
|
|
|
|
case DRV_REMOVE: return DRVCNF_RESTART;
|
1999-03-15 16:16:13 +01:00
|
|
|
case MCI_OPEN_DRIVER: return WAVE_mciOpen (dwDevID, dwParam1, (LPMCI_WAVE_OPEN_PARMSA) dwParam2);
|
1998-11-24 17:36:18 +01:00
|
|
|
case MCI_CLOSE_DRIVER: return WAVE_mciClose (dwDevID, dwParam1, (LPMCI_GENERIC_PARMS) dwParam2);
|
|
|
|
case MCI_CUE: return WAVE_mciCue (dwDevID, dwParam1, (LPMCI_GENERIC_PARMS) dwParam2);
|
|
|
|
case MCI_PLAY: return WAVE_mciPlay (dwDevID, dwParam1, (LPMCI_PLAY_PARMS) dwParam2);
|
|
|
|
case MCI_RECORD: return WAVE_mciRecord (dwDevID, dwParam1, (LPMCI_RECORD_PARMS) dwParam2);
|
|
|
|
case MCI_STOP: return WAVE_mciStop (dwDevID, dwParam1, (LPMCI_GENERIC_PARMS) dwParam2);
|
|
|
|
case MCI_SET: return WAVE_mciSet (dwDevID, dwParam1, (LPMCI_SET_PARMS) dwParam2);
|
|
|
|
case MCI_PAUSE: return WAVE_mciPause (dwDevID, dwParam1, (LPMCI_GENERIC_PARMS) dwParam2);
|
|
|
|
case MCI_RESUME: return WAVE_mciResume (dwDevID, dwParam1, (LPMCI_GENERIC_PARMS) dwParam2);
|
|
|
|
case MCI_STATUS: return WAVE_mciStatus (dwDevID, dwParam1, (LPMCI_STATUS_PARMS) dwParam2);
|
|
|
|
case MCI_GETDEVCAPS: return WAVE_mciGetDevCaps(dwDevID, dwParam1, (LPMCI_GETDEVCAPS_PARMS) dwParam2);
|
1999-09-05 18:31:37 +02:00
|
|
|
case MCI_INFO: return WAVE_mciInfo (dwDevID, dwParam1, (LPMCI_INFO_PARMSA) dwParam2);
|
1998-11-24 17:36:18 +01:00
|
|
|
case MCI_SEEK: return WAVE_mciSeek (dwDevID, dwParam1, (LPMCI_SEEK_PARMS) dwParam2);
|
1999-07-24 12:45:24 +02:00
|
|
|
/* commands that should be supported */
|
1998-11-24 17:36:18 +01:00
|
|
|
case MCI_LOAD:
|
|
|
|
case MCI_SAVE:
|
|
|
|
case MCI_FREEZE:
|
|
|
|
case MCI_PUT:
|
|
|
|
case MCI_REALIZE:
|
|
|
|
case MCI_UNFREEZE:
|
|
|
|
case MCI_UPDATE:
|
|
|
|
case MCI_WHERE:
|
|
|
|
case MCI_STEP:
|
|
|
|
case MCI_SPIN:
|
|
|
|
case MCI_ESCAPE:
|
|
|
|
case MCI_COPY:
|
|
|
|
case MCI_CUT:
|
|
|
|
case MCI_DELETE:
|
|
|
|
case MCI_PASTE:
|
1999-09-27 15:38:57 +02:00
|
|
|
FIXME("Unsupported yet command [%lu]\n", wMsg);
|
1999-07-24 12:45:24 +02:00
|
|
|
break;
|
1999-12-05 03:18:35 +01:00
|
|
|
case MCI_WINDOW:
|
1999-09-27 15:38:57 +02:00
|
|
|
TRACE("Unsupported command [%lu]\n", wMsg);
|
1998-11-24 17:36:18 +01:00
|
|
|
break;
|
|
|
|
case MCI_OPEN:
|
|
|
|
case MCI_CLOSE:
|
1999-07-24 12:45:24 +02:00
|
|
|
ERR("Shouldn't receive a MCI_OPEN or CLOSE message\n");
|
1998-11-24 17:36:18 +01:00
|
|
|
break;
|
|
|
|
default:
|
1999-09-27 15:38:57 +02:00
|
|
|
FIXME("is probably wrong msg [%lu]\n", wMsg);
|
1999-02-26 12:11:13 +01:00
|
|
|
return DefDriverProc(dwDevID, hDriv, wMsg, dwParam1, dwParam2);
|
1998-11-24 17:36:18 +01:00
|
|
|
}
|
|
|
|
return MCIERR_UNRECOGNIZED_COMMAND;
|
|
|
|
}
|