📄 wodm.c
字号:
//
// Copyright (c) Microsoft Corporation. All rights reserved.
//
//
// Use of this source code is subject to the terms of the Microsoft end-user
// license agreement (EULA) under which you licensed this SOFTWARE PRODUCT.
// If you did not accept the terms of the EULA, you are not authorized to use
// this source code. For a copy of the EULA, please see the LICENSE.RTF on your
// install media.
//
// -----------------------------------------------------------------------------
//
// THIS CODE AND INFORMATION IS PROVIDED "AS IS" WITHOUT WARRANTY OF
// ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING BUT NOT LIMITED TO
// THE IMPLIED WARRANTIES OF MERCHANTABILITY AND/OR FITNESS FOR A
// PARTICULAR PURPOSE.
//
// -----------------------------------------------------------------------------
//
// @doc WDEV_EXT
//
// @module wodm.c | Implements the WODM_XXX messages that are passed to the
// wave audio driver via the <f WAV_IOControl> function.
//
// @xref <t Wave Output Driver Messages>
//
// -----------------------------------------------------------------------------
#include <wavemdd.h>
// -----------------------------------------------------------------------------
//
// @doc WDEV_EXT
//
// @topic Wave Output Driver Messages |
// The wave output driver receives messages via the <f WAV_IOControl>
// function.
//
// @xref <nl>
// <m WODM_BREAKLOOP> <nl>
// <m WODM_CLOSE> <nl>
// <m WODM_GETDEVCAPS> <nl>
// <m WODM_GETNUMDEVS> <nl>
// <m WODM_GETPITCH> <nl>
// <m WODM_GETPLAYBACKRATE> <nl>
// <m WODM_GETPOS> <nl>
// <m WODM_GETVOLUME> <nl>
// <m WODM_OPEN> <nl>
// <m WODM_PAUSE> <nl>
// <m WODM_PREPARE> <nl>
// <m WODM_RESET> <nl>
// <m WODM_RESTART> <nl>
// <m WODM_SETPITCH> <nl>
// <m WODM_SETPLAYBACKRATE> <nl>
// <m WODM_SETVOLUME> <nl>
// <m WODM_UNPREPARE> <nl>
// <m WODM_WRITE> <nl>
//
// -----------------------------------------------------------------------------
// -----------------------------------------------------------------------------
//
// @doc WDEV_EXT
//
// @msg WODM_BREAKLOOP |
// The WODM_BREAKLOOP message requests a waveform output driver to
// break an output loop that was created with a <m WODM_WRITE> message.
//
// @parm UINT | uDeviceId |
// Device identifier (0, 1, 2, and so on) for the target device.
//
// @parm UINT | uMsg |
// WODM_BREAKLOOP
//
// @parm DWORD | dwUser |
// Device instance identifier.
//
// @parm DWORD | dwParam1 |
// Not used.
//
// @parm DWORD | dwParam2 |
// Not used.
//
// @rdesc The driver should return MMSYSERR_NOERROR if the operation succeeds.
// Otherwise it should return one of the MMSYSERR or WAVERR error
// codes defined in mmsystem.h. See <f waveOutBreakLoop> return values
// in the Win32 SDK.
//
// @comm The Wave API Manager (WAVEAPI.DLL) sends the WODM_GETPITCH message
// by calling the audio driver's (WAVEDEV.DLL) <f WAV_IOControl>() entry
// point via DeviceIoControl().
//
// The driver should stop output of the loop buffers at the end of
// the next loop iteration.
//
// If the driver receives this message and a loop is not in progress,
// it should return MMSYSERR_NOERROR.
//
// -----------------------------------------------------------------------------
DWORD
wdev_WODM_BREAKLOOP(
UINT uDeviceId,
DWORD dwUser,
DWORD dwParam1,
DWORD dwParam2
)
{
FUNC_WMDD("+wdev_WODM_BREAKLOOP");
LOCK_GSI(WAPI_OUT);
MarkAllAsNotInLoop(WAPI_OUT);
UNLOCK_GSI(WAPI_OUT);
FUNC_WMDD("-wdev_WODM_BREAKLOOP");
return(MMSYSERR_NOERROR);
}
// -----------------------------------------------------------------------------
//
// @doc WDEV_EXT
//
// @msg WODM_GETPITCH |
// The WODM_GETPITCH message requests a waveform output driver to
// return the specified device's current pitch multiplier value.
//
// @parm UINT | uDeviceId |
// Device identifier (0, 1, 2, and so on) for the target device.
//
// @parm UINT | uMsg |
// WODM_GETPITCH
//
// @parm DWORD | dwUser |
// Device instance identifier.
//
// @parm DWORD | dwParam1 |
// Pointer to a DWORD location used to return the current pitch
// multiplier value. This is specified as a fixed-point value, where
// the high-order word of the DWORD contains the signed integer part
// of the number, and the low-order word contains the fractional
// part. The fraction consists of a WORD value, for which 0x8000
// represents one half, and 0x4000 represents one quarter. For
// example, the value 0x00010000 specifies a multiplier of 1.0
// (no pitch change), and a value of 0x000F8000 specifies a multiplier
// of 15.5.
//
// @parm DWORD | dwParam2 |
// Not used.
//
// @rdesc The driver should return MMSYSERR_NOERROR if the operation succeeds.
// Otherwise it should return one of the MMSYSERR or WAVERR error
// codes defined in mmsystem.h. See <f waveOutGetPitch> return values
// in the Win32 SDK.
//
// @comm The Wave API Manager (WAVEAPI.DLL) sends the WODM_GETPITCH message
// by calling the audio driver's (WAVEDEV.DLL) <f WAV_IOControl>() entry
// point via DeviceIoControl().
//
// Support for the WODM_GETPITCH message by drivers is optional.
// If a driver supports the <m WODM_SETPITCH> message, it must
// also support <m WODM_GETPITCH>.
//
// -----------------------------------------------------------------------------
DWORD
wdev_WODM_GETPITCH(
UINT uDeviceId,
DWORD dwUser,
DWORD dwParam1,
DWORD dwParam2
)
{
FUNC_WMDD("+wdev_WODM_GETPITCH");
//
// MDD Library does not support this function.
//
FUNC_WMDD("-wdev_WODM_GETPITCH");
return(MMSYSERR_NOTSUPPORTED);
}
// -----------------------------------------------------------------------------
//
// @doc WDEV_EXT
//
// @msg WODM_GETPLAYBACKRATE |
// The WODM_GETPLAYBACKRATE message requests a waveform output driver
// to return the current playback rate multiplier value for the
// specified device.
//
// @parm UINT | uDeviceId |
// Device identifier (0, 1, 2, and so on) for the target device.
//
// @parm UINT | uMsg |
// WODM_GETPLAYBACKRATE
//
// @parm DWORD | dwUser |
// Device instance identifier.
//
// @parm DWORD | dwParam1 |
// Pointer to a DWORD location used to return the current playback
// rate multiplier value. This is specified as a fixed-point value,
// where the high-order word of the DWORD contains the signed integer part
// of the number, and the low-order word contains the fractional
// part. The fraction consists of a WORD value, for which 0x8000
// represents one half, and 0x4000 represents one quarter. For
// example, the value 0x00010000 specifies a multiplier of 1.0
// (no pitch change), and a value of 0x000F8000 specifies a multiplier
// of 15.5.
//
// @parm DWORD | dwParam2 |
// Not used.
//
// @rdesc The driver should return MMSYSERR_NOERROR if the operation succeeds.
// Otherwise it should return one of the MMSYSERR or WAVERR error
// codes defined in mmsystem.h. See <f waveOutGetPlaybackRate> return values
// in the Win32 SDK.
//
// @comm The Wave API Manager (WAVEAPI.DLL) sends the WODM_GETPLAYBACKRATE message
// by calling the audio driver's (WAVEDEV.DLL) <f WAV_IOControl>() entry
// point via DeviceIoControl().
//
// Support for the WODM_GETPLAYBACKRATE message by drivers
// is optional. If a driver supports the <m WODM_SETPLAYBACKRATE> message,
// it must also support <m WODM_GETPLAYBACKRATE>.
//
// -----------------------------------------------------------------------------
DWORD
wdev_WODM_GETPLAYBACKRATE(
UINT uDeviceId,
DWORD dwUser,
DWORD dwParam1,
DWORD dwParam2
)
{
FUNC_WMDD("+wdev_WODM_GETPLAYBACKRATE");
//
// MDD Library does not support this function.
//
FUNC_WMDD("-wdev_WODM_GETPLAYBACKRATE");
return(MMSYSERR_NOTSUPPORTED);
}
// -----------------------------------------------------------------------------
//
// @doc WDEV_EXT
//
// @msg WODM_GETVOLUME |
// The WODM_GETVOLUME message requests a waveform output driver to
// return the current volume level setting for the specified device.
//
// @parm UINT | uDeviceId |
// Device identifier (0, 1, 2, and so on) for the target device.
//
// @parm UINT | uMsg |
// WODM_GETVOLUME
//
// @parm DWORD | dwUser |
// Device instance identifier.
//
// @parm DWORD | dwParam1 |
// Pointer to a DWORD location to receive the volume setting.
//
// @parm DWORD | dwParam2 |
// Not used.
//
// @rdesc The driver should return MMSYSERR_NOERROR if the operation succeeds.
// Otherwise it should return one of the MMSYSERR or WAVERR error
// codes defined in mmsystem.h. See <f waveOutGetVolume> return values
// in the Win32 SDK.
//
// @comm The Wave API Manager (WAVEAPI.DLL) sends the WODM_GETVOLUME message
// by calling the audio driver's (WAVEDEV.DLL) <f WAV_IOControl>() entry
// point via DeviceIoControl().
//
// Support for this message by drivers is optional. If
// the driver supports <m WODM_SETVOLUME>, it must support
// <m WODM_GETVOLUME>.
//
// A value of zero is silence, and a value of 0xFFFF is full volume.
//
// -----------------------------------------------------------------------------
DWORD
wdev_WODM_GETVOLUME(
UINT uDeviceId,
DWORD dwUser,
DWORD dwParam1,
DWORD dwParam2
)
{
MMRESULT mmRet = MMSYSERR_NOERROR;
FUNC_WMDD("+wdev_WODM_GETVOLUME");
mmRet = PDD_WaveProc(WAPI_OUT, WPDM_GETVOLUME, dwParam1, 0);
FUNC_WMDD("-wdev_WODM_GETVOLUME");
return(mmRet);
}
// -----------------------------------------------------------------------------
//
// @doc WDEV_EXT
//
// @msg WODM_PAUSE |
// The WODM_PAUSE message requests a waveform output driver to
// pause playback of a waveform.
//
// @parm UINT | uDeviceId |
// Device identifier (0, 1, 2, and so on) for the target device.
//
// @parm UINT | uMsg |
// WODM_PAUSE
//
// @parm DWORD | dwUser |
// Device instance identifier.
//
// @parm DWORD | dwParam1 |
// Not used.
//
// @parm DWORD | dwParam2 |
// Not used.
//
// @rdesc The driver should return MMSYSERR_NOERROR if the operation succeeds.
// Otherwise it should return one of the MMSYSERR or WAVEERR error
// codes defined in mmsystem.h. See <f waveOutPause>().
//
// @comm The Wave API Manager (WAVEAPI.DLL) sends the WODM_PAUSE message
// by calling the audio driver's (WAVEDEV.DLL) <f WAV_IOControl>() entry
// point via DeviceIoControl().
//
// The driver should stop playing the waveform and should save the
// current position. Playback should continue from this position
// when a <m WODM_RESTART> message is received. Output buffers received
// with the <m WODM_WRITE> message while playback is paused should be
// placed in the output queue.
//
// If the driver receives this message while output is already
// paused, it should return MMSYSERR_NOERROR.
//
// -----------------------------------------------------------------------------
DWORD
wdev_WODM_PAUSE(
UINT uDeviceId,
DWORD dwUser,
DWORD dwParam1,
DWORD dwParam2
)
{
MMRESULT mmRet = MMSYSERR_NOERROR;
FUNC_WMDD("+wdev_WODM_PAUSE");
LOCK_GSI(WAPI_OUT);
gsi[WAPI_OUT].bPaused = TRUE;
if(gsi[WAPI_OUT].bStarted){
mmRet = PDD_WaveProc(WAPI_OUT, WPDM_PAUSE, 0, 0);
gsi[WAPI_OUT].bStarted = FALSE;
}
UNLOCK_GSI(WAPI_OUT);
FUNC_WMDD("-wdev_WODM_PAUSE");
return(mmRet);
}
// -----------------------------------------------------------------------------
//
// @doc WDEV_EXT
//
// @msg WODM_RESET |
// The WODM_RESET message requests a waveform output driver to
// stop sending output data and return all output buffers to the client.
//
// @parm UINT | uDeviceId |
// Device identifier (0, 1, 2, and so on) for the target device.
//
// @parm UINT | uMsg |
// WODM_RESET
//
// @parm DWORD | dwUser |
// Device instance identifier.
//
// @parm DWORD | dwParam1 |
// Not used.
//
// @parm DWORD | dwParam2 |
// Not used.
//
// @rdesc The driver should return MMSYSERR_NOERROR if the operation succeeds.
// Otherwise it should return one of the MMSYSERR or WAVEERR error
// codes defined in mmsystem.h. See <f waveOutReset>().
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -