Mmacm.pas
上传用户:hylc_2004
上传日期:2014-01-23
资源大小:46800k
文件大小:46k
- {========================================================================}
- {= (c) 1995-98 SwiftSoft Ronald Dittrich =}
- {========================================================================}
- {= All Rights Reserved =}
- {========================================================================}
- {= D 01099 Dresden = Fax.: +49 (0)351-8037944 =}
- {= Loewenstr.7a = info@swiftsoft.de =}
- {========================================================================}
- {= Actual versions on http://www.swiftsoft.de/mmtools.html =}
- {========================================================================}
- {= This code is for reference purposes only and may not be copied or =}
- {= distributed in any format electronic or otherwise except one copy =}
- {= for backup purposes. =}
- {= =}
- {= No Delphi Component Kit or Component individually or in a collection=}
- {= subclassed or otherwise from the code in this unit, or associated =}
- {= .pas, .dfm, .dcu, .asm or .obj files may be sold or distributed =}
- {= without express permission from SwiftSoft. =}
- {= =}
- {= For more licence informations please refer to the associated =}
- {= HelpFile. =}
- {========================================================================}
- {= $Date: 06.09.98 - 12:42:51 $ =}
- {========================================================================}
- unit MMACM;
- {$I COMPILER.INC}
- interface
- uses
- {$IFDEF WIN32}
- Windows,
- {$ELSE}
- WinProcs,
- WinTypes,
- {$ENDIF}
- SysUtils,
- MMSystem,
- MMRegs;
- const
- acmDLLLoaded: Boolean = False;
- acmDLLHandle: THandle = 0;
- const
- DRV_MAPPER_PREFERRED_INPUT_GET = (DRV_USER + 0);
- DRV_MAPPER_PREFERRED_OUTPUT_GET = (DRV_USER + 2);
- DRVM_MAPPER_STATUS = ($2000);
- WIDM_MAPPER_STATUS = (DRVM_MAPPER_STATUS + 0);
- WAVEIN_MAPPER_STATUS_DEVICE = 0;
- WAVEIN_MAPPER_STATUS_MAPPED = 1;
- WAVEIN_MAPPER_STATUS_FORMAT = 2;
- WODM_MAPPER_STATUS = (DRVM_MAPPER_STATUS + 0);
- WAVEOUT_MAPPER_STATUS_DEVICE = 0;
- WAVEOUT_MAPPER_STATUS_MAPPED = 1;
- WAVEOUT_MAPPER_STATUS_FORMAT = 2;
- {========================================================================}
- { ACM General API's and Defines }
- {========================================================================}
- {------------------------------------------------------------------------}
- { there are four types of 'handles' used by the ACM. the first three }
- { are unique types that define specific objects: }
- { }
- { HACMDRIVERID: }
- { used to _identify_ an ACM driver. this identifier can be used to _open_}
- { the driver for querying details, etc about the driver. }
- { }
- { HACMDRIVER: }
- { used to manage a driver (codec, filter, etc). this handle is much like }
- { a handle to other media drivers--you use it to send messages to the }
- { converter, query for capabilities, etc. }
- { }
- { HACMSTREAM: }
- { used to manage a 'stream' (conversion channel) with the ACM. you use a }
- { stream handle to convert data from one format/type to another--much }
- { like dealing with a file handle. }
- { }
- { the fourth handle type is a generic type used on ACM functions that }
- { can accept two or more of the above handle types (for example the }
- { acmMetrics and acmDriverID functions). }
- { }
- { HACMOBJ: }
- { used to identify ACM objects. this handle is used on functions that can}
- { accept two or more ACM handle types. }
- {------------------------------------------------------------------------}
- type
- PHACMDRIVERID = ^THACMDRIVERID;
- THACMDRIVERID = THandle;
- PHACMDRIVER = ^THACMDRIVER;
- THACMDRIVER = THandle;
- PHACMSTREAM = ^THACMSTREAM;
- THACMSTREAM = THandle;
- PHACMOBJ = ^THACMOBJ;
- THACMOBJ = THandle;
- {-----------------------------------------------------------------------}
- { ACM Error Codes }
- { }
- { Note that these error codes are specific errors that apply to the ACM }
- { directly--general errors are defined as MMSYSTEM. }
- {-----------------------------------------------------------------------}
- const
- ACMERR_BASE = (512);
- ACMERR_NOTPOSSIBLE = (ACMERR_BASE + 0);
- ACMERR_BUSY = (ACMERR_BASE + 1);
- ACMERR_UNPREPARED = (ACMERR_BASE + 2);
- ACMERR_CANCELED = (ACMERR_BASE + 3);
- {-----------------------------------------------------------------------}
- { ACM Window Messages }
- { }
- { These window messages are sent by the ACM or ACM drivers to notify }
- { applications of events. }
- { }
- { Note that these window message numbers will also be defined in }
- { MMSYSTEM. }
- {-----------------------------------------------------------------------}
- const { BUGBUG: ev. 16 bit others ? }
- MM_ACM_OPEN = $03D4; { conversion callback messages }
- MM_ACM_CLOSE = $03D5;
- MM_ACM_DONE = $03D6;
- {-----------------------------------------------------------------------}
- { function acmGetVersion: Longint; }
- { }
- { the ACM version is a 32 bit number that is broken into three parts as }
- { follows: }
- { }
- { bits 24 - 31: 8 bit _major_ version number }
- { bits 16 - 23: 8 bit _minor_ version number }
- { bits 0 - 15: 16 bit build number }
- { }
- { this is then displayed as follows: }
- { }
- { bMajor = (BYTE)(dwVersion >> 24) }
- { bMinor = (BYTE)(dwVersion >> 16) & }
- { wBuild = LOWORD(dwVersion) }
- { }
- {-----------------------------------------------------------------------}
- var
- acmGetVersion: function: DWORD; {$IFDEF WIN32}stdcall;{$ENDIF}
- {-----------------------------------------------------------------------}
- { acmMetrics }
- {-----------------------------------------------------------------------}
- var
- acmMetrics: function(hao: THACMOBJ; uMetric: UINT; pMetric: Pointer): MMRESULT;
- {$IFDEF WIN32}stdcall;{$ENDIF}
- const
- ACM_METRIC_COUNT_DRIVERS = 1;
- ACM_METRIC_COUNT_CODECS = 2;
- ACM_METRIC_COUNT_CONVERTERS = 3;
- ACM_METRIC_COUNT_FILTERS = 4;
- ACM_METRIC_COUNT_DISABLED = 5;
- ACM_METRIC_COUNT_HARDWARE = 6;
- ACM_METRIC_COUNT_LOCAL_DRIVERS = 20;
- ACM_METRIC_COUNT_LOCAL_CODECS = 21;
- ACM_METRIC_COUNT_LOCAL_CONVERTERS = 22;
- ACM_METRIC_COUNT_LOCAL_FILTERS = 23;
- ACM_METRIC_COUNT_LOCAL_DISABLED = 24;
- ACM_METRIC_HARDWARE_WAVE_INPUT = 30;
- ACM_METRIC_HARDWARE_WAVE_OUTPUT = 31;
- ACM_METRIC_MAX_SIZE_FORMAT = 50;
- ACM_METRIC_MAX_SIZE_FILTER = 51;
- ACM_METRIC_DRIVER_SUPPORT = 100;
- ACM_METRIC_DRIVER_PRIORITY = 101;
- {=======================================================================}
- { ACM Drivers }
- {=======================================================================}
- {=======================================================================}
- { acmDriverEnum }
- {=======================================================================}
- type
- TACMDRIVERENUMCB = function(hadid: THACMDRIVERID;
- dwInstance, fdwSupport: DWORD): Boolean;
- {$IFDEF WIN32} stdcall; {$ENDIF}
- var
- acmDriverEnum: function(fnCallback: TACMDRIVERENUMCB;
- dwInstance, fdwEnum: DWORD): MMRESULT;
- {$IFDEF WIN32} stdcall; {$ENDIF}
- const
- ACM_DRIVERENUMF_NOLOCAL = $40000000;
- ACM_DRIVERENUMF_DISABLED = $80000000;
- {-----------------------------------------------------------------------}
- { acmDriverID }
- {-----------------------------------------------------------------------}
- var
- acmDriverID: function(hao: THACMOBJ; phadid: PHACMDRIVERID;
- fdwDriverID: DWORD): MMRESULT;
- {$IFDEF WIN32} stdcall; {$ENDIF}
- {-----------------------------------------------------------------------}
- { acmDriverAdd }
- {-----------------------------------------------------------------------}
- var
- acmDriverAdd: function(phadid: PHACMDRIVERID; hinstModule: THandle;
- lParam: LPARAM; dwPriority: DWORD; fdwAdd: DWORD): MMRESULT;
- {$IFDEF WIN32} stdcall; {$ENDIF}
- const
- ACM_DRIVERADDF_FUNCTION = $00000003; { lParam is a procedure }
- ACM_DRIVERADDF_NOTIFYHWND = $00000004; { lParam is notify hwnd }
- ACM_DRIVERADDF_TYPEMASK = $00000007; { driver type mask }
- ACM_DRIVERADDF_LOCAL = $00000000; { is local to current task }
- ACM_DRIVERADDF_GLOBAL = $00000008; { is global }
- {-----------------------------------------------------------------------}
- { prototype for ACM driver procedures that are installed as _functions_ }
- { or _notifations_ instead of as a standalone installable driver. }
- {-----------------------------------------------------------------------}
- (*type
- PACMDRIVERPROC = ^TACMDRIVERPROC;
- TACMDRIVERPROC = function(DWORD; THACMDRIVERID; UINT; LPARAM;
- LPARAM): LRESULT;
- {$IFDEF WIN32} stdcall; {$ENDIF}
- *)
- {-----------------------------------------------------------------------}
- { acmDriverRemove }
- {-----------------------------------------------------------------------}
- var
- acmDriverRemove: function(hadid: THACMDRIVERID; fdwRemove: DWORD): MMRESULT;
- {$IFDEF WIN32} stdcall; {$ENDIF}
- {-----------------------------------------------------------------------}
- { acmDriverOpen }
- {-----------------------------------------------------------------------}
- var
- acmDriverOpen: function(phad: PHACMDRIVER; hadid: THACMDRIVERID; fdwOpen: DWORD): MMRESULT;
- {$IFDEF WIN32} stdcall; {$ENDIF}
- {-----------------------------------------------------------------------}
- { acmDriverClose }
- {-----------------------------------------------------------------------}
- var
- acmDriverClose: function(had: THACMDRIVER; fdwClose: DWORD): MMRESULT;
- {$IFDEF WIN32} stdcall; {$ENDIF}
- {-----------------------------------------------------------------------}
- { acmDriverMessage }
- {-----------------------------------------------------------------------}
- var
- acmDriverMessage: function(had: THACMDRIVER; uMsg: UINT;
- lParam1, lParam2: LPARAM): LRESULT;
- {$IFDEF WIN32} stdcall; {$ENDIF}
- const
- ACMDM_USER = (DRV_USER + $0000);
- ACMDM_RESERVED_LOW = (DRV_USER + $2000);
- ACMDM_RESERVED_HIGH = (DRV_USER + $2FFF);
- ACMDM_BASE = ACMDM_RESERVED_LOW;
- ACMDM_DRIVER_ABOUT = (ACMDM_BASE + 11);
- {-----------------------------------------------------------------------}
- { acmDriverPriority }
- {-----------------------------------------------------------------------}
- var
- acmDriverPriority: function(hadid: THACMDRIVERID;
- dwPriority, fdwPriority: DWORD): MMRESULT;
- {$IFDEF WIN32} stdcall; {$ENDIF}
- const
- ACM_DRIVERPRIORITYF_ENABLE = $00000001;
- ACM_DRIVERPRIORITYF_DISABLE = $00000002;
- ACM_DRIVERPRIORITYF_ABLEMASK = $00000003;
- ACM_DRIVERPRIORITYF_BEGIN = $00010000;
- ACM_DRIVERPRIORITYF_END = $00020000;
- ACM_DRIVERPRIORITYF_DEFERMASK = $00030000;
- {-----------------------------------------------------------------------}
- { acmDriverDetails }
- {-----------------------------------------------------------------------}
- { }
- { ACMDRIVERDETAILS }
- { }
- { the ACMDRIVERDETAILS structure is used to get various capabilities }
- { from an ACM driver (codec, converter, filter). }
- {-----------------------------------------------------------------------}
- const
- ACMDRIVERDETAILS_SHORTNAME_CHARS = 32;
- ACMDRIVERDETAILS_LONGNAME_CHARS = 128;
- ACMDRIVERDETAILS_COPYRIGHT_CHARS = 80;
- ACMDRIVERDETAILS_LICENSING_CHARS = 128;
- ACMDRIVERDETAILS_FEATURES_CHARS = 512;
- type
- PACMDRIVERDETAILS = ^TACMDRIVERDETAILS;
- TACMDRIVERDETAILS = record
- cbStruct : DWORD; { number of valid bytes in structure }
- fccType : FOURCC; { compressor type 'audc' }
- fccComp : FOURCC; { sub-type (not used; reserved) }
- wMid : WORD; { manufacturer id }
- wPid : WORD; { product id }
- vdwACM : DWORD; { version of the ACM *compiled* for }
- vdwDriver : DWORD; { version of the driver }
- fdwSupport : DWORD; { misc. support flags }
- cFormatTags: DWORD; { total unique format tags supported }
- cFilterTags: DWORD; { total unique filter tags supported }
- hicon : HICON; { handle to custom icon }
- szShortName: array[0..ACMDRIVERDETAILS_SHORTNAME_CHARS-1]of Char;
- szLongName : array[0..ACMDRIVERDETAILS_LONGNAME_CHARS-1] of Char;
- szCopyright: array[0..ACMDRIVERDETAILS_COPYRIGHT_CHARS-1]of Char;
- szLicensing: array[0..ACMDRIVERDETAILS_LICENSING_CHARS-1]of Char;
- szFeatures : array[0..ACMDRIVERDETAILS_FEATURES_CHARS-1] of Char;
- end;
- {-----------------------------------------------------------------------}
- { }
- { ACMDRIVERDETAILS.fccType }
- { }
- { ACMDRIVERDETAILS_FCCTYPE_AUDIOCODEC: the FOURCC used in the fccType }
- { field of the ACMDRIVERDETAILS structure to specify that this is an }
- { ACM codec designed for audio. }
- { }
- { }
- { ACMDRIVERDETAILS.fccComp }
- { }
- { ACMDRIVERDETAILS_FCCCOMP_UNDEFINED: the FOURCC used in the fccComp }
- { field of the ACMDRIVERDETAILS structure. this is currently an unused }
- { field. }
- {-----------------------------------------------------------------------}
- const
- ACMDRIVERDETAILS_FCCTYPE_AUDIOCODEC = $63647561; {'audc'}
- ACMDRIVERDETAILS_FCCCOMP_UNDEFINED = $0;
- { the following flags are used to specify the type of conversion(s) that }
- { the converter/codec/filter supports. these are placed in the fdwSupport }
- { field of the ACMDRIVERDETAILS structure. note that a converter can }
- { 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 WAVE_FORMAT_PCM to WAVE_FORMAT_ADPCM, then this bit }
- { should be set. }
- { }
- { 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 PCM formats (bits, sample rate). }
- { }
- { ACMDRIVERDETAILS_SUPPORTF_FILTER: this flag is set if the driver supports }
- { transformations on a single format. for example, a converter that changed }
- { the 'volume' of PCM data would set this bit. 'echo' and 'reverb' are }
- { also filter types. }
- { }
- { ACMDRIVERDETAILS_SUPPORTF_HARDWARE: this flag is set if the driver supports}
- { hardware input and/or output through a waveform device. }
- { }
- { ACMDRIVERDETAILS_SUPPORTF_ASYNC: this flag is set if the driver supports }
- { async conversions. }
- { }
- { ACMDRIVERDETAILS_SUPPORTF_LOCAL: this flag is set _by the ACM_ if a }
- { driver has been installed local to the current task. this flag is also }
- { set in the fdwSupport argument to the enumeration callback function }
- { for drivers. }
- { }
- { ACMDRIVERDETAILS_SUPPORTF_DISABLED: this flag is set _by the ACM_ if a }
- { driver has been disabled. this flag is also passed set in the fdwSupport }
- { argument to the enumeration callback function for drivers. }
- { }
- {-----------------------------------------------------------------------------}
- const
- ACMDRIVERDETAILS_SUPPORTF_CODEC = $00000001;
- ACMDRIVERDETAILS_SUPPORTF_CONVERTER = $00000002;
- ACMDRIVERDETAILS_SUPPORTF_FILTER = $00000004;
- ACMDRIVERDETAILS_SUPPORTF_HARDWARE = $00000008;
- ACMDRIVERDETAILS_SUPPORTF_ASYNC = $00000010;
- ACMDRIVERDETAILS_SUPPORTF_LOCAL = $40000000;
- ACMDRIVERDETAILS_SUPPORTF_DISABLED = $80000000;
- var
- acmDriverDetails: function(hadid: THACMDRIVERID; padd: PACMDRIVERDETAILS;
- fdwDetails: DWORD): MMRESULT;
- {$IFDEF WIN32} stdcall; {$ENDIF}
- {=======================================================================}
- { ACM Format Tags }
- {=======================================================================}
- {-----------------------------------------------------------------------}
- { acmFormatTagDetails }
- {-----------------------------------------------------------------------}
- const
- ACMFORMATTAGDETAILS_FORMATTAG_CHARS = 48;
- type
- PACMFORMATTAGDETAILS = ^TACMFORMATTAGDETAILS;
- TACMFORMATTAGDETAILS = record
- cbStruct : DWORD;
- dwFormatTagIndex: DWORD;
- dwFormatTag : DWORD;
- cbFormatSize : DWORD;
- fdwSupport : DWORD;
- cStandardFormats: DWORD;
- szFormatTag: array[0..ACMFORMATTAGDETAILS_FORMATTAG_CHARS-1] of Char;
- end;
- var
- acmFormatTagDetails: function(had: THACMDRIVER; paftd: PACMFORMATTAGDETAILS;
- fdwDetails: DWORD): MMRESULT;
- {$IFDEF WIN32}stdcall; {$ENDIF}
- const
- ACM_FORMATTAGDETAILSF_INDEX = $00000000;
- ACM_FORMATTAGDETAILSF_FORMATTAG = $00000001;
- ACM_FORMATTAGDETAILSF_LARGESTSIZE = $00000002;
- ACM_FORMATTAGDETAILSF_QUERYMASK = $0000000F;
- {-----------------------------------------------------------------------}
- { acmFormatTagEnum }
- {-----------------------------------------------------------------------}
- type
- TACMFORMATTAGENUMCB = function(hadid: THACMDRIVERID;
- paftd: PACMFORMATTAGDETAILS;
- dwInstance, fdwSupport: DWORD): Boolean;
- {$IFDEF WIN32}stdcall;{$ENDIF}
- var
- acmFormatTagEnum: function(had: THACMDRIVER; paftd: PACMFORMATTAGDETAILS;
- fnCallBack: TACMFORMATTAGENUMCB;
- dwInstance, fdwEnum: DWORD): MMRESULT;
- {$IFDEF WIN32}stdcall;{$ENDIF}
- {=======================================================================}
- { ACM Formats }
- {=======================================================================}
- {-----------------------------------------------------------------------}
- { acmFormatDetails }
- {-----------------------------------------------------------------------}
- const
- ACMFORMATDETAILS_FORMAT_CHARS = 128;
- type
- PACMFORMATDETAILS = ^TACMFORMATDETAILS;
- TACMFORMATDETAILS = record
- cbStruct : DWORD;
- dwFormatIndex: DWORD;
- dwFormatTag : DWORD;
- fdwSupport : DWORD;
- pwfx : PWAVEFORMATEX;
- cbwfx : DWORD;
- szFormat: array[0..ACMFORMATDETAILS_FORMAT_CHARS-1] of Char;
- end;
- var
- acmFormatDetails: function(had: THACMDRIVER; pafd: PACMFORMATDETAILS;
- fdwDetails: DWORD): MMRESULT;
- {$IFDEF WIN32} stdcall; {$ENDIF}
- const
- ACM_FORMATDETAILSF_INDEX = $00000000;
- ACM_FORMATDETAILSF_FORMAT = $00000001;
- ACM_FORMATDETAILSF_QUERYMASK = $0000000F;
- {-----------------------------------------------------------------------}
- { acmFormatEnum }
- {-----------------------------------------------------------------------}
- type
- TACMFORMATENUMCB = function(hadid: THACMDRIVERID; pafd: PACMFORMATDETAILS;
- dwInstance, fdwSupport: DWORD): Boolean;
- {$IFDEF WIN32}stdcall;{$ENDIF}
- var
- acmFormatEnum: function(had: THACMDRIVER; pafd: PACMFORMATDETAILS;
- fnCallBack: TACMFORMATENUMCB;
- dwInstance, fdwEnum: DWORD): MMRESULT;
- {$IFDEF WIN32}stdcall;{$ENDIF}
- const
- ACM_FORMATENUMF_WFORMATTAG = $00010000;
- ACM_FORMATENUMF_NCHANNELS = $00020000;
- ACM_FORMATENUMF_NSAMPLESPERSEC = $00040000;
- ACM_FORMATENUMF_WBITSPERSAMPLE = $00080000;
- ACM_FORMATENUMF_CONVERT = $00100000;
- ACM_FORMATENUMF_SUGGEST = $00200000;
- ACM_FORMATENUMF_HARDWARE = $00400000;
- ACM_FORMATENUMF_INPUT = $00800000;
- ACM_FORMATENUMF_OUTPUT = $01000000;
- {-----------------------------------------------------------------------}
- { acmFormatSuggest }
- {-----------------------------------------------------------------------}
- var
- acmFormatSuggest: function(had: THACMDRIVER; pwfxSrc, pwfxDst: PWAVEFORMATEX;
- cbwfxDst, fdwSuggest: DWORD): MMRESULT;
- {$IFDEF WIN32}stdcall;{$ENDIF}
- const
- ACM_FORMATSUGGESTF_WFORMATTAG = $00010000;
- ACM_FORMATSUGGESTF_NCHANNELS = $00020000;
- ACM_FORMATSUGGESTF_NSAMPLESPERSEC = $00040000;
- ACM_FORMATSUGGESTF_WBITSPERSAMPLE = $00080000;
- ACM_FORMATSUGGESTF_TYPEMASK = $00FF0000;
- {-----------------------------------------------------------------------}
- { acmFormatChoose }
- {-----------------------------------------------------------------------}
- const
- ACMHELPMSGSTRING = 'acmchoose_help';
- ACMHELPMSGCONTEXTMENU = 'acmchoose_contextmenu';
- ACMHELPMSGCONTEXTHELP = 'acmchoose_contexthelp';
- { MM_ACM_FORMATCHOOSE is sent to hook callbacks by the Format Chooser }
- { Dialog... }
- MM_ACM_FORMATCHOOSE = ($8000);
- FORMATCHOOSE_MESSAGE = 0;
- FORMATCHOOSE_FORMATTAG_VERIFY = (FORMATCHOOSE_MESSAGE+0);
- FORMATCHOOSE_FORMAT_VERIFY = (FORMATCHOOSE_MESSAGE+1);
- FORMATCHOOSE_CUSTOM_VERIFY = (FORMATCHOOSE_MESSAGE+2);
- type
- TACMFORMATCHOOSEHOOKPROC = function(hwnd: HWND; uMsg: UINT;
- wParam: WPARAM; lParam: LPARAM): UINT;
- {$IFDEF WIN32}stdcall;{$ENDIF}
- PACMFORMATCHOOSE = ^TACMFORMATCHOOSE;
- TACMFORMATCHOOSE = record
- cbStruct : DWORD; { sizeof(ACMFORMATCHOOSE) }
- fdwStyle : DWORD; { chooser style flags }
- hwndOwner : HWND; { caller's window handle }
- pwfx : PWAVEFORMATEX; { ptr to wfx buf to receive choice }
- cbwfx : DWORD; { size of mem buf for pwfx }
- pszTitle : PCHAR; { dialog box title bar }
- szFormatTag : array[0..ACMFORMATTAGDETAILS_FORMATTAG_CHARS-1] of Char;
- szFormat : array[0..ACMFORMATDETAILS_FORMAT_CHARS-1] of Char;
- pszName : PCHAR; { custom name selection }
- cchName : DWORD; { size in chars of mem buf for pszName }
- fdwEnum : DWORD; { format enumeration restrictions }
- pwfxEnum : PWAVEFORMATEX; { format describing restrictions }
- hInstance : THandle; { app instance containing dlg template }
- pszTemplateName: PChar; { custom template name }
- lCustData : LPARAM; { data passed to hook fn. }
- pfnHook : TACMFORMATCHOOSEHOOKPROC;{ ptr to hook function }
- end;
- {-----------------------------------------------------------------------}
- { ACMFORMATCHOOSE.fdwStyle }
- {-----------------------------------------------------------------------}
- const
- ACMFORMATCHOOSE_STYLEF_SHOWHELP = $00000004;
- ACMFORMATCHOOSE_STYLEF_ENABLEHOOK = $00000008;
- ACMFORMATCHOOSE_STYLEF_ENABLETEMPLATE = $00000010;
- ACMFORMATCHOOSE_STYLEF_ENABLETEMPLATEHANDLE = $00000020;
- ACMFORMATCHOOSE_STYLEF_INITTOWFXSTRUCT = $00000040;
- ACMFORMATCHOOSE_STYLEF_CONTEXTHELP = $00000080;
- var
- acmFormatChoose: function(pafmtc: PACMFORMATCHOOSE): MMRESULT;
- {$IFDEF WIN32}stdcall;{$ENDIF}
- {=======================================================================}
- { ACM Filter Tags }
- {=======================================================================}
- {-----------------------------------------------------------------------}
- { acmFilterTagDetails }
- {-----------------------------------------------------------------------}
- const
- ACMFILTERTAGDETAILS_FILTERTAG_CHARS = 48;
- type
- PACMFILTERTAGDETAILS = ^TACMFILTERTAGDETAILS;
- TACMFILTERTAGDETAILS = record
- cbStruct : DWORD;
- dwFilterTagIndex: DWORD;
- dwFilterTag : DWORD;
- cbFilterSize : DWORD;
- fdwSupport : DWORD;
- cStandardFilters: DWORD;
- szFilterTag: array[0..ACMFILTERTAGDETAILS_FILTERTAG_CHARS-1] of Char;
- end;
- var
- acmFilterTagDetails: function(had: THACMDRIVER; paftd: PACMFILTERTAGDETAILS;
- fdwDetails: DWORD): MMRESULT;
- {$IFDEF WIN32}stdcall;{$ENDIF}
- const
- ACM_FILTERTAGDETAILSF_INDEX = $00000000;
- ACM_FILTERTAGDETAILSF_FILTERTAG = $00000001;
- ACM_FILTERTAGDETAILSF_LARGESTSIZE = $00000002;
- ACM_FILTERTAGDETAILSF_QUERYMASK = $0000000F;
- {-----------------------------------------------------------------------}
- { acmFilterTagEnum }
- {-----------------------------------------------------------------------}
- type
- TACMFILTERTAGENUMCB = function(hadid: THACMDRIVERID;
- paftd: PACMFILTERTAGDETAILS;
- dwInstance, fdwSupport: DWORD): Boolean;
- {$IFDEF WIN32}stdcall;{$ENDIF}
- var
- acmFilterTagEnum: function(had: THACMDRIVER;paftd: PACMFILTERTAGDETAILS;
- fnCallBack: TACMFILTERTAGENUMCB;
- dwInstance, fdwEnum: DWORD): MMRESULT;
- {$IFDEF WIN32}stdcall;{$ENDIF}
- {=======================================================================}
- { ACM Filters }
- {=======================================================================}
- {-----------------------------------------------------------------------}
- { acmFilterDetails }
- {-----------------------------------------------------------------------}
- const
- ACMFILTERDETAILS_FILTER_CHARS = 128;
- type
- PACMFILTERDETAILS = ^TACMFILTERDETAILS;
- TACMFILTERDETAILS = record
- cbStruct : DWORD;
- dwFilterIndex: DWORD;
- dwFilterTag : DWORD;
- fdwSupport : DWORD;
- pwfltr : PWAVEFILTER;
- cbwfltr : DWORD;
- szFilter: array[0..ACMFILTERDETAILS_FILTER_CHARS-1] of char;
- end;
- var
- acmFilterDetails: function(had: THACMDRIVER;
- pafd: PACMFILTERDETAILS;
- fdwDetails: DWORD): MMRESULT;
- {$IFDEF WIN32}stdcall;{$ENDIF}
- const
- ACM_FILTERDETAILSF_INDEX = $00000000;
- ACM_FILTERDETAILSF_FILTER = $00000001;
- ACM_FILTERDETAILSF_QUERYMASK = $0000000F;
- {-----------------------------------------------------------------------}
- { acmFilterEnum }
- {-----------------------------------------------------------------------}
- type
- TACMFILTERENUMCB = function(hadid: THACMDRIVERID;
- pafd: PACMFILTERDETAILS;
- dwInstance, fdwSupport: DWORD): Boolean;
- {$IFDEF WIN32}stdcall;{$ENDIF}
- var
- acmFilterEnum: function(had: THACMDRIVER; pafd: PACMFILTERDETAILS;
- fnCallBack: TACMFILTERENUMCB;
- dwInstance, fdwEnum: DWORD): MMRESULT;
- {$IFDEF WIN32}stdcall;{$ENDIF}
- const
- ACM_FILTERENUMF_DWFILTERTAG = $00010000;
- {-----------------------------------------------------------------------}
- { acmFilterChoose }
- {-----------------------------------------------------------------------}
- { MM_ACM_FILTERCHOOSE is sent to hook callbacks by the Filter Chooser }
- { Dialog... }
- const
- MM_ACM_FILTERCHOOSE = ($8000);
- FILTERCHOOSE_MESSAGE = 0;
- FILTERCHOOSE_FILTERTAG_VERIFY = (FILTERCHOOSE_MESSAGE+0);
- FILTERCHOOSE_FILTER_VERIFY = (FILTERCHOOSE_MESSAGE+1);
- FILTERCHOOSE_CUSTOM_VERIFY = (FILTERCHOOSE_MESSAGE+2);
- type
- TACMFILTERCHOOSEHOOKPROC = function(hwnd: HWND; uMsg: UINT;
- wParam: WPARAM; lParam: LPARAM): UINT;
- {$IFDEF WIN32}stdcall;{$ENDIF}
- PACMFILTERCHOOSE = ^TACMFILTERCHOOSE;
- TACMFILTERCHOOSE = record
- cbStruct : DWORD; { sizeof(ACMFILTERCHOOSE) }
- fdwStyle : DWORD; { chooser style flags }
- hwndOwner : HWND; { caller's window handle }
- pwfltr : PWAVEFILTER; { ptr to wfltr buf to receive choice }
- cbwfltr : DWORD; { size of mem buf for pwfltr }
- pszTitle : PChar;
- szFilterTag: array[0..ACMFILTERTAGDETAILS_FILTERTAG_CHARS-1] of Char;
- szFilter : array[0..ACMFILTERDETAILS_FILTER_CHARS-1] of Char;
- pszName : PChar; { custom name selection }
- cchName : DWORD; { size in chars of mem buf for pszName}
- fdwEnum : DWORD; { filter enumeration restrictions }
- pwfltrEnum : PWAVEFILTER; { filter describing restrictions }
- hInstance : THandle; { app instance containing dlg template}
- pszTemplateName: PChar; { custom template name }
- lCustData : LPARAM; { data passed to hook fn. }
- pfnHook : TACMFILTERCHOOSEHOOKPROC; { ptr to hook function }
- end;
- {-----------------------------------------------------------------------}
- { ACMFILTERCHOOSE.fdwStyle }
- {-----------------------------------------------------------------------}
- const
- ACMFILTERCHOOSE_STYLEF_SHOWHELP = $00000004;
- ACMFILTERCHOOSE_STYLEF_ENABLEHOOK = $00000008;
- ACMFILTERCHOOSE_STYLEF_ENABLETEMPLATE = $00000010;
- ACMFILTERCHOOSE_STYLEF_ENABLETEMPLATEHANDLE = $00000020;
- ACMFILTERCHOOSE_STYLEF_INITTOFILTERSTRUCT = $00000040;
- ACMFILTERCHOOSE_STYLEF_CONTEXTHELP = $00000080;
- var
- acmFilterChoose: function(pafltrc: PACMFILTERCHOOSE): MMRESULT;
- {$IFDEF WIN32}stdcall;{$ENDIF}
- {=======================================================================}
- { ACM Stream API's }
- {=======================================================================}
- {-----------------------------------------------------------------------}
- { acmStreamOpen }
- {-----------------------------------------------------------------------}
- type
- PACMSTREAMHEADER = ^TACMSTREAMHEADER;
- TACMSTREAMHEADER = record
- cbStruct : DWORD; { sizeof(ACMSTREAMHEADER) }
- fdwStatus : DWORD; { ACMSTREAMHEADER_STATUSF_* }
- dwUser : DWORD; { user instance data for hdr }
- pbSrc : PChar;
- cbSrcLength : DWORD;
- cbSrcLengthUsed: DWORD;
- dwSrcUser : DWORD; { user instance data for src }
- pbDst : PChar;
- cbDstLength : DWORD;
- cbDstLengthUsed: DWORD;
- dwDstUser : DWORD; { user instance data for dst }
- dwReservedDriver: array[0..9] of Longint;{ driver reserved work space }
- end;
- {-----------------------------------------------------------------------}
- { ACMSTREAMHEADER.fdwStatus }
- {-----------------------------------------------------------------------}
- { ACMSTREAMHEADER_STATUSF_DONE: done bit for async conversions. }
- {-----------------------------------------------------------------------}
- const
- ACMSTREAMHEADER_STATUSF_DONE = $00010000;
- ACMSTREAMHEADER_STATUSF_PREPARED = $00020000;
- ACMSTREAMHEADER_STATUSF_INQUEUE = $00100000;
- var
- acmStreamOpen: function(phas: PHACMSTREAM; { pointer to stream handle }
- had: THACMDRIVER; { optional driver handle }
- pwfxSrc: PWAVEFORMATEX;{ source format to convert }
- pwfxDst: PWAVEFORMATEX;{ required destination format }
- pwfltr: PWAVEFILTER; { optional filter }
- dwCallback: DWORD; { callback }
- dwInstance: DWORD; { callback instance data }
- fdwOpen: DWORD { ACM_STREAMOPENF_* and CALLBACK_*}
- ): MMRESULT;
- {$IFDEF WIN32}stdcall;{$ENDIF}
- const
- ACM_STREAMOPENF_QUERY = $00000001;
- ACM_STREAMOPENF_ASYNC = $00000002;
- ACM_STREAMOPENF_NONREALTIME = $00000004;
- {-----------------------------------------------------------------------}
- { acmStreamClose }
- {-----------------------------------------------------------------------}
- var
- acmStreamClose: function(has: THACMSTREAM; fdwClose: DWORD): MMRESULT;
- {$IFDEF WIN32}stdcall;{$ENDIF}
- {-----------------------------------------------------------------------}
- { acmStreamSize }
- {-----------------------------------------------------------------------}
- var
- acmStreamSize: function(has: THACMSTREAM; cbInput: DWORD;
- var dwOutputBytes: Longint; fdwSize: DWORD): MMRESULT;
- {$IFDEF WIN32}stdcall;{$ENDIF}
- const
- ACM_STREAMSIZEF_SOURCE = $00000000;
- ACM_STREAMSIZEF_DESTINATION = $00000001;
- ACM_STREAMSIZEF_QUERYMASK = $0000000F;
- {-----------------------------------------------------------------------}
- { acmStreamReset }
- {-----------------------------------------------------------------------}
- var
- acmStreamReset: function(has: THACMSTREAM; fdwReset: DWORD): MMRESULT;
- {$IFDEF WIN32}stdcall;{$ENDIF}
- {-----------------------------------------------------------------------}
- { acmStreamMessage }
- {-----------------------------------------------------------------------}
- var
- acmStreamMessage: function(has: THACMSTREAM; uMsg: UINT;
- lParam1, lParam2: LPARAM): MMRESULT;
- {$IFDEF WIN32}stdcall;{$ENDIF}
- {-----------------------------------------------------------------------}
- { acmStreamConvert }
- {-----------------------------------------------------------------------}
- var
- acmStreamConvert: function(has: THACMSTREAM; pash: PACMSTREAMHEADER;
- fdwConvert: DWORD): MMRESULT;
- {$IFDEF WIN32}stdcall;{$ENDIF}
- const
- ACM_STREAMCONVERTF_BLOCKALIGN = $00000004;
- ACM_STREAMCONVERTF_START = $00000010;
- ACM_STREAMCONVERTF_END = $00000020;
- {-----------------------------------------------------------------------}
- { acmStreamPrepareHeader }
- {-----------------------------------------------------------------------}
- var
- acmStreamPrepareHeader: function(has: THACMSTREAM; pash: PACMSTREAMHEADER;
- fdwPrepare: DWORD): MMRESULT;
- {$IFDEF WIN32}stdcall;{$ENDIF}
- {-----------------------------------------------------------------------}
- { acmStreamUnprepareHeader }
- {-----------------------------------------------------------------------}
- var
- acmStreamUnprepareHeader: function(has: THACMSTREAM; pash: PACMSTREAMHEADER;
- fdwUnprepare: DWORD): MMRESULT;
- {$IFDEF WIN32}stdcall;{$ENDIF}
- implementation
- var
- ErrorMode: Cardinal;
- procedure NewExitProc; Far;
- begin
- if ACMDLLHandle >= HINSTANCE_ERROR then FreeLibrary(ACMDLLHandle);
- end;
- Initialization
- ErrorMode := SetErrorMode(SEM_NoOpenFileErrorBox);
- {$IFDEF WIN32}
- acmDLLHandle := LoadLibrary('MSACM32.DLL');
- {$ELSE}
- acmDLLHandle := LoadLibrary('MSACM.DLL');
- {$ENDIF}
- SetErrorMode(ErrorMode);
- if abs(acmDLLHandle) >= HINSTANCE_ERROR then
- begin
- @acmGetVersion := GetProcAddress(acmDLLHandle,'acmGetVersion');
- if (@acmGetVersion = nil) then
- begin
- FreeLibrary(acmDLLHandle);
- acmDLLHandle := 0;
- exit;
- end;
- acmDLLLoaded := True;
- {$IFNDEF WIN32}
- AddExitProc(NewExitProc);
- {$ENDIF}
- { if the version of the ACM is *NOT* V2.00 or greater, then }
- { all other API's are unavailable--so don't waste time trying }
- { to link to them. }
- if HiWord(acmGetVersion) < $0200 then exit;
- { yipee! the ACM V2.00 or greater appears to be installed and }
- { happy with us--so link to the rest of the nifty cool API's. }
- @acmMetrics := GetProcAddress(acmDLLHandle,'acmMetrics');
- @acmDriverEnum := GetProcAddress(acmDLLHandle,'acmDriverEnum');
- {$IFDEF WIN32}
- @acmDriverDetails := GetProcAddress(acmDLLHandle,'acmDriverDetailsA');
- @acmDriverAdd := GetProcAddress(acmDLLHandle,'acmDriverAddA');
- {$ELSE}
- @acmDriverDetails := GetProcAddress(acmDLLHandle,'acmDriverDetails');
- @acmDriverAdd := GetProcAddress(acmDLLHandle,'acmDriverAdd');
- {$ENDIF}
- @acmDriverRemove := GetProcAddress(acmDLLHandle,'acmDriverRemove');
- @acmDriverOpen := GetProcAddress(acmDLLHandle,'acmDriverOpen');
- @acmDriverClose := GetProcAddress(acmDLLHandle,'acmDriverClose');
- @acmDriverMessage := GetProcAddress(acmDLLHandle,'acmDriverMessage');
- @acmDriverID := GetProcAddress(acmDLLHandle,'acmDriverID');
- @acmDriverPriority := GetProcAddress(acmDLLHandle,'acmDriverPriority');
- {$IFDEF WIN32}
- @acmFormatTagDetails:= GetProcAddress(acmDLLHandle,'acmFormatTagDetailsA');
- @acmFormatTagEnum := GetProcAddress(acmDLLHandle,'acmFormatTagEnumA');
- @acmFormatChoose := GetProcAddress(acmDLLHandle,'acmFormatChooseA');
- @acmFormatDetails := GetProcAddress(acmDLLHandle,'acmFormatDetailsA');
- @acmFormatEnum := GetProcAddress(acmDLLHandle,'acmFormatEnumA');
- {$ELSE}
- @acmFormatTagDetails:= GetProcAddress(acmDLLHandle,'acmFormatTagDetails');
- @acmFormatTagEnum := GetProcAddress(acmDLLHandle,'acmFormatTagEnum');
- @acmFormatChoose := GetProcAddress(acmDLLHandle,'acmFormatChoose');
- @acmFormatDetails := GetProcAddress(acmDLLHandle,'acmFormatDetails');
- @acmFormatEnum := GetProcAddress(acmDLLHandle,'acmFormatEnum');
- {$ENDIF}
- @acmFormatSuggest := GetProcAddress(acmDLLHandle,'acmFormatSuggest');
- {$IFDEF WIN32}
- @acmFilterTagDetails:= GetProcAddress(acmDLLHandle,'acmFilterTagDetailsA');
- @acmFilterTagEnum := GetProcAddress(acmDLLHandle,'acmFilterTagEnumA');
- @acmFilterChoose := GetProcAddress(acmDLLHandle,'acmFilterChooseA');
- @acmFilterDetails := GetProcAddress(acmDLLHandle,'acmFilterDetailsA');
- @acmFilterEnum := GetProcAddress(acmDLLHandle,'acmFilterEnumA');
- {$ELSE}
- @acmFilterTagDetails:= GetProcAddress(acmDLLHandle,'acmFilterTagDetails');
- @acmFilterTagEnum := GetProcAddress(acmDLLHandle,'acmFilterTagEnum');
- @acmFilterChoose := GetProcAddress(acmDLLHandle,'acmFilterChoose');
- @acmFilterDetails := GetProcAddress(acmDLLHandle,'acmFilterDetails');
- @acmFilterEnum := GetProcAddress(acmDLLHandle,'acmFilterEnum');
- {$ENDIF}
- @acmStreamOpen := GetProcAddress(acmDLLHandle,'acmStreamOpen');
- @acmStreamClose := GetProcAddress(acmDLLHandle,'acmStreamClose');
- @acmStreamSize := GetProcAddress(acmDLLHandle,'acmStreamSize');
- @acmStreamConvert := GetProcAddress(acmDLLHandle,'acmStreamConvert');
- @acmStreamReset := GetProcAddress(acmDLLHandle,'acmStreamReset');
- @acmStreamPrepareHeader := GetProcAddress(acmDLLHandle,'acmStreamPrepareHeader');
- @acmStreamUnprepareHeader:= GetProcAddress(acmDLLHandle,'acmStreamUnprepareHeader');
- end;
- {$IFDEF WIN32}
- Finalization
- NewExitProc;
- {$ENDIF}
- end.