文档详情

ActiveX录音控件源码.doc

发布:2019-09-05约1.52万字共14页下载文档
文本预览下载声明
{* (C) CopyRight 2010 - by Hzj } {说明:实现录音、MP3格式压缩核心类文件 } { 创建日期:2010.06.20 } { 创建人:贺振军 } {******************************************************************************} unit EwRecord; interface uses SysUtils, Classes, Graphics, Controls,Dialogs,StdVcl, StdCtrls,ShellAPI,StrUtils,Forms,Windows,MPlayer; type TEwRec = class private public {格式转换相关函数、方法} //获取Lame.exe文件路径(在windwos/system32目录下) function GetLamePath:string; //获取生成的mp3文件名,如果传入mp3文件名则使用传入的,如果没有则使用wav文件生成相应的MP3文件名 function GetMp3FileName(_Mp3FileName:string;_WavFile: string):string; //利用ShellExecute执行压缩命令 procedure EwConvertMp3FromLame(_WavFile: string;_Mp3File: string); //procedure EwConvertMp3Procress(const DosApp : string;var OutStr : string); function EwConvertMp3Procress(const DosApp : string;var OutStr : string) : Cardinal; //利用CreatProcess执行命令,可以捕获结束标志 function WinExecAndWait32(FileName: string; Visibility: integer): Cardinal; {录音相关函数方法} //生成WAV头文件 procedure CreateWav(channels: word;{1(单声)或者2(立体声)}resolution: word;{8或者16,代表8位或16位声音}rate: longint;{声音频率,如11025,22050,44100}fn: string{对应的文件名称}); //获取生成的文件名 function GetCreateWavName:string; //根据传入的目录串检测当前目录是否存在,如果存在则返回,如果不存在则创建该目录,如果不传入则自动创建目录 function CheckDirectoryExistAndMkDir(_DirectoryPath: string) : string; end; //定义一个Wav文件头格式 TWavHeader = record rId : longint; rLen : longint; wId : longint; fId : longint; fLen : longint; wFormatTag : word; nChannels : word; nSamplesPerSec : longint; nAvgBytesPerSec : longint; nBlockAlign : word; wBitsPerSample : word; dId : longint; wSampleLength : longint; end; implementation {*(C) CopyRight 2010 - by Hzj =====================
显示全部
相似文档