📄 codec.c
字号:
acmdDriverConfigInit(pdi, lpstr); // Note: OK to pass lpstr==NULL
if (NULL != lpstr)
{
LocalFree((HLOCAL)lpstr);
}
}
#else
acmdDriverConfigInit(pdi, pdci->lpszDCIAliasName);
#endif
n = DialogBoxParam(pdi->hinst,
IDD_CONFIG,
hwnd,
acmdDlgProcConfigure,
(LPARAM)pdi);
pdi->pdci = NULL;
return ((LRESULT)n);
} // acmdDriverConfigure()
//--------------------------------------------------------------------------;
//
// LRESULT acmdDriverDetails
//
// Description:
// This function handles the ACMDM_DRIVER_DETAILS message. The ACM
// driver is responsible for filling in the ACMDRIVERDETAILS structure
// with various information.
//
// NOTE! It is *VERY* important that you fill in your ACMDRIVERDETAILS
// structure correctly. The ACM and applications must be able to
// rely on this information.
//
// WARNING! The _reserved_ bits of any fields of the ACMDRIVERDETAILS
// structure are _exactly that_: RESERVED. Do NOT use any extra
// flag bits, etc. for custom information. The proper way to add
// custom capabilities to your ACM driver is this:
//
// o define a new message in the ACMDM_USER range.
//
// o an application that wishes to use one of these extra features
// should then:
//
// o open the driver with acmDriverOpen.
//
// o check for the proper wMid and wPid using acmDriverDetails.
//
// o send the 'user defined' message with acmDriverMessage
// to retrieve additional information, etc.
//
// o close the driver with acmDriverClose.
//
// Arguments:
// PDRIVERINSTANCE pdi: Pointer to private ACM driver instance structure.
// This structure is [optionally] allocated during the DRV_OPEN message
// which is handled by the acmdDriverOpen function.
//
// LPACMDRIVERDETAILS padd: Pointer to ACMDRIVERDETAILS structure to
// fill in for the caller. This structure may be larger or smaller than
// the current definition of ACMDRIVERDETAILS--cbStruct specifies the
// valid size.
//
// Return (LRESULT):
// The return value is zero (MMSYSERR_NOERROR) for success. Non-zero
// signifies that the driver details could not be retrieved.
//
// NOTE THAT THIS FUNCTION SHOULD NEVER FAIL! There are two possible
// error conditions:
//
// o if padd is NULL or an invalid pointer.
//
// o if cbStruct is less than four; in this case, there is not enough
// room to return the number of bytes filled in.
//
// Because these two error conditions are easily defined, the ACM
// will catch these errors. The driver does NOT need to check for these
// conditions.
//
//--------------------------------------------------------------------------;
LRESULT FNLOCAL acmdDriverDetails
(
PDRIVERINSTANCE pdi,
LPACMDRIVERDETAILS padd
)
{
ACMDRIVERDETAILS add;
DWORD cbStruct;
//
// it is easiest to fill in a temporary structure with valid info
// and then copy the requested number of bytes to the destination
// buffer.
//
cbStruct = min(padd->cbStruct, sizeof(ACMDRIVERDETAILS));
add.cbStruct = cbStruct;
//
// for the current implementation of an ACM driver, the fccType and
// fccComp members *MUST* always be ACMDRIVERDETAILS_FCCTYPE_AUDIOCODEC
// ('audc') and ACMDRIVERDETAILS_FCCCOMP_UNDEFINED (0) respectively.
//
add.fccType = ACMDRIVERDETAILS_FCCTYPE_AUDIOCODEC;
add.fccComp = ACMDRIVERDETAILS_FCCCOMP_UNDEFINED;
//
// the manufacturer id (wMid) and product id (wPid) must be filled
// in with your company's _registered_ identifier's. for more
// information on these identifier's and how to get them registered
// contact Microsoft and get the Multimedia Developer Registration Kit:
//
// Microsoft Corporation
// Multimedia Technology Group
// One Microsoft Way
// Redmond, WA 98052-6399
//
// Developer Services Phone: (800) 227-4679 x11771
//
// note that during the development phase or your ACM driver, you may
// use the reserved value of '0' for both wMid and wPid. however it
// is not acceptable to ship a driver with these values.
//
add.wMid = MM_MICROSOFT;
add.wPid = MM_MSFT_ACM_GSM610;
//
// the vdwACM and vdwDriver members contain version information for
// the driver.
//
// vdwACM: must contain the version of the *ACM* that the driver was
// _designed_ for. this is the _minimum_ version number of the ACM
// that the driver will work with. this value must be >= V2.00.000.
//
// vdwDriver: the version of this ACM driver.
//
// ACM driver versions are 32 bit numbers broken into three parts as
// follows (note these parts are displayed as decimal values):
//
// bits 24 - 31: 8 bit _major_ version number
// bits 16 - 23: 8 bit _minor_ version number
// bits 0 - 15: 16 bit build number
//
add.vdwACM = VERSION_MSACM;
add.vdwDriver = VERSION_ACM_DRIVER;
//
// the following flags are used to specify the type of conversion(s)
// that the ACM driver supports. note that a driver may support one or
// more of these flags in any combination.
//
// ACMDRIVERDETAILS_SUPPORTF_CODEC: this flag is set if the driver
// supports conversions from one format tag to another format tag. for
// example, if a converter compresses or decompresses WAVE_FORMAT_PCM
// and WAVE_FORMAT_IMA_ADPCM, then this bit should be set. this is
// true even if the data is not actually changed in size--for example
// a conversion from u-Law to A-Law will still set this bit because
// the format tags differ.
//
// ACMDRIVERDETAILS_SUPPORTF_CONVERTER: this flags is set if the
// driver supports conversions on the same format tag. as an example,
// the PCM converter that is built into the ACM sets this bit (and only
// this bit) because it converts only between PCM formats (bits, sample
// rate).
//
// ACMDRIVERDETAILS_SUPPORTF_FILTER: this flag is set if the driver
// supports transformations on a single format tag but does change
// the base characteristics of the format (bit depth, sample rate, etc
// will remain the same). for example, a driver that changed the
// 'volume' of PCM data or applied a low pass filter would set this bit.
//
add.fdwSupport = ACMDRIVERDETAILS_SUPPORTF_CODEC;
//
// the number of individual format tags this ACM driver supports. for
// example, if a driver uses the WAVE_FORMAT_IMA_ADPCM and
// WAVE_FORMAT_PCM format tags, then this value would be two. if the
// driver only supports filtering on WAVE_FORMAT_PCM, then this value
// would be one. if this driver supported WAVE_FORMAT_ALAW,
// WAVE_FORMAT_MULAW and WAVE_FORMAT_PCM, then this value would be
// three. etc, etc.
//
add.cFormatTags = ACM_DRIVER_MAX_FORMAT_TAGS;
//
// the number of individual filter tags this ACM driver supports. if
// a driver supports no filters (ACMDRIVERDETAILS_SUPPORTF_FILTER is
// NOT set in the fdwSupport member), then this value must be zero.
//
add.cFilterTags = ACM_DRIVER_MAX_FILTER_TAGS;
//
// the remaining members in the ACMDRIVERDETAILS structure are sometimes
// not needed. because of this we make a quick check to see if we
// should go through the effort of filling in these members.
//
if (FIELD_OFFSET(ACMDRIVERDETAILS, hicon) < cbStruct)
{
//
// fill in the hicon member will a handle to a custom icon for
// the ACM driver. this allows the driver to be represented by
// an application graphically (usually this will be a company
// logo or something). if a driver does not wish to have a custom
// icon displayed, then simply set this member to NULL and a
// generic icon will be displayed instead.
//
// See the MSFILTER sample for a codec which contains a custom icon.
//
add.hicon = NULL;
//
// the short name and long name are used to represent the driver
// in a unique description. the short name is intended for small
// display areas (for example, in a menu or combo box). the long
// name is intended for more descriptive displays (for example,
// in an 'about box').
//
// NOTE! an ACM driver should never place formatting characters
// of any sort in these strings (for example CR/LF's, etc). it
// is up to the application to format the text.
//
LoadStringCodec(pdi->hinst, IDS_ACM_DRIVER_SHORTNAME, add.szShortName, SIZEOFACMSTR(add.szShortName));
LoadStringCodec(pdi->hinst, IDS_ACM_DRIVER_LONGNAME, add.szLongName, SIZEOFACMSTR(add.szLongName));
//
// the last three members are intended for 'about box' information.
// these members are optional and may be zero length strings if
// the driver wishes.
//
// NOTE! an ACM driver should never place formatting characters
// of any sort in these strings (for example CR/LF's, etc). it
// is up to the application to format the text.
//
if (FIELD_OFFSET(ACMDRIVERDETAILS, szCopyright) < cbStruct)
{
LoadStringCodec(pdi->hinst, IDS_ACM_DRIVER_COPYRIGHT, add.szCopyright, SIZEOFACMSTR(add.szCopyright));
LoadStringCodec(pdi->hinst, IDS_ACM_DRIVER_LICENSING, add.szLicensing, SIZEOFACMSTR(add.szLicensing));
LoadStringCodec(pdi->hinst, IDS_ACM_DRIVER_FEATURES, add.szFeatures, SIZEOFACMSTR(add.szFeatures));
}
}
//
// now copy the correct number of bytes to the caller's buffer
//
_fmemcpy(padd, &add, (UINT)add.cbStruct);
//
// success!
//
return (MMSYSERR_NOERROR);
} // acmdDriverDetails()
//--------------------------------------------------------------------------;
//
// LRESULT acmdDriverAbout
//
// Description:
// This function is called to handle the ACMDM_DRIVER_ABOUT message.
// An ACM driver has the option of displaying its own 'about box' or
// letting the ACM (or calling application) display one for it. This
// message is normally sent by the Control Panel's Sound Mapper
// option.
//
// It is recommended that an ACM driver allow a default about box
// be displayed for it--there should be no reason to bloat the size
// of a driver to simply display copyright, etc information when that
// information is contained in the ACMDRIVERDETAILS structure.
//
// Arguments:
// PDRIVERINSTANCE pdi: Pointer to private ACM driver instance structure.
// This structure is [optionally] allocated during the DRV_OPEN message
// which is handled by the acmdDriverOpen function.
//
// HWND hwnd: Handle to parent window to use when displaying the
// configuration dialog box. An ACM driver is _required_ to display a
// modal dialog box using this hwnd argument as the parent. This
// argument may be (HWND)-1 which tells the driver that it is only
// being queried for about box support.
//
// Return (LRESULT):
// The return value is MMSYSERR_NOTSUPPORTED if the ACM driver does
// not support a custom dialog box. In this case, the ACM or calling
// application will display a generic about box using the information
// contained in the ACMDRIVERDETAILS structure returned by the
// ACMDM_DRIVER_DETAILS message.
//
// If the driver chooses to display its own dialog box, then after
// the dialog is dismissed by the user, MMSYSERR_NOERROR should be
// returned.
//
// If the hwnd argument is equal to (HWND)-1, then no dialog should
// be displayed (the driver is only being queried for support). The
// driver must still return MMSYSERR_NOERROR (supported) or
// MMSYSERR_NOTSUPPORTED (no custom about box supported).
//
//--------------------------------------------------------------------------;
LRESULT FNLOCAL acmdDriverAbout
(
PDRIVERINSTANCE pdi,
HWND hwnd
)
{
//
// first check to see if we are only being queried for custom about
// box support. if hwnd == (HWND)-1 then we are being queried and
// should return MMSYSERR_NOTSUPPORTED for 'not supported' and
// MMSYSERR_NOERROR for 'supported'.
//
if ((HWND)-1 == hwnd)
{
//
// this ACM driver does NOT support a custom about box, so
// return MMSYSERR_NOTSUPPORTED...
//
return (MMSYSERR_NOTSUPPORTED);
}
//
// this driver does not support a custom dialog, so tell the ACM or
// calling application to display one for us. note that this is the
// _recommended_ method for consistency and simplicity of ACM drivers.
// why write code when you don't have to?
//
return (MMSYSERR_NOTSUPPORTED);
} // acmdDriverAbout()
//==========================================================================;
//
//
//
//
//==========================================================================;
//--------------------------------------------------------------------------;
//
// LRESULT acmdFormatSuggest
//
// Description:
// This function handles the ACMDM_FORMAT_SUGGEST message. The purpose
// of this function is to provide a way for the ACM, a wave mapper or
// an application to quickly get a destination format that this driver
// can convert the source format to. The 'suggested' format should
// be as close to a common format as possible. This message is normally
// sent in response to an acmFormatSuggest function call.
//
// Another way to think about this message is: what format would this
// driver like to convert the source format to?
//
// The caller may place restrictions on the destination format that
// should be suggested. The padfs->fdwSuggest member contains the
// restriction bits passed by the caller--see the description for
// the return value for more information.
//
// Arguments:
// PDRIVERINSTANCE pdi: Pointer to private ACM driver instance structure.
// This structure is [optionally] allocated during the DRV_OPEN message
// which is handled by the acmdDriverOpen function.
//
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -