CDToMP3(WAV)原码

csz_cmy 2002-09-07 01:07:15
说明:(请搜索下载lame_coder.dll,cdrip.dll
aa.def 用来生成cdrip_dll.lib//使用implib cdrip_dll.lib aa.def
//implib lame_dll.lib lame_dll.dll 生成lame_dll.lib
//以上两个lib直接加到工程用来静态导入dll
cdrip_dll.hpp//静态导入dll的头文件
lame_dll.hpp//静态导入dll的头文件
lame.cpp lame.h//mp3压缩类
rip.cpp rip.h//cd抓取类要用到lame
mxi.cpp,mxi.h,mxi.dfm//主窗口
cdtomp3.cpp//工程cpp文件
///////////aa.def//////////////////////////////
LIBRARY LAME_ENC.DLL

EXPORTS
_beCloseStream @4 ; beCloseStream
_beDeinitStream @3 ; beDeinitStream
_beEncodeChunk @2 ; beEncodeChunk
_beInitStream @1 ; beInitStream
_beVersion @5 ; beVersion
_beWriteVBRHeader @6 ; beWriteVBRHeader
...全文
54 12 打赏 收藏 转发到动态 举报
写回复
用AI写文章
12 条回复
切换为时间正序
请发表友善的回复…
发表回复
D_Q 2002-09-08
  • 打赏
  • 举报
回复
谢谢…… 宝贵资料
==================================================
广告宣传:
闪客必备工具 - 矢量图共享(V1.07)
去除Flash 编译过的 SWF文件 的密码 使矢量共享,从EXE中分离SWF文件,SWF文件分析,支持Flash 5\Flash MX
http://www.csdn.net/cnshare/soft/13/13646.shtm 马上下载呀!
szbug 2002-09-07
  • 打赏
  • 举报
回复
麻烦也给我一份,谢谢。
szbug@szbug.com
s98231106 2002-09-07
  • 打赏
  • 举报
回复
我也要:

liangruihao@163.com
Eastunfail 2002-09-07
  • 打赏
  • 举报
回复
我也要:)
lexchow@msn.com
问一句,这是不是利用ASPI来抓取CD的?我原来也用Delphi做了一个,但是兼容性不是很好,在XP下无法抓取,就是因为ASPI的问题
cdws222 2002-09-07
  • 打赏
  • 举报
回复
好呀,大哥,你能不能将工程发到我邮箱里,我放到我的主页上去供大家下载,怎么样?
www@teatool.com
bluecetacean 2002-09-07
  • 打赏
  • 举报
回复
多谢
aawolf 2002-09-07
  • 打赏
  • 举报
回复
mark,多谢楼主了。
大大怪老张 2002-09-07
  • 打赏
  • 举报
回复
up
bluebird97073 2002-09-07
  • 打赏
  • 举报
回复
(:
收下~
csz_cmy 2002-09-07
  • 打赏
  • 举报
回复
/////////////////////lame.h/////////////////////////////////////
//---------------------------------------------------------------------------

#ifndef LameH
#define LameH
//---------------------------------------------------------------------------

#include <Windows.hpp>
#include <Messages.hpp>
#include <SysUtils.hpp>
#include <Classes.hpp>
#include <Graphics.hpp>
#include <Controls.hpp>
#include <Forms.hpp>
#include <Dialogs.hpp>
#include "Lame_dll.hpp"

typedef Exception ELameError;

class TLameVersion :public TPersistent
{
private:
TBEVersion FBeV;
public:
__fastcall TLameVersion(void);
void __fastcall Assign(TPersistent *Source);
__published:
__property byte DLLMajorVersion={read=FBeV.byDLLMajorVersion,write=FBeV.byDLLMajorVersion};
__property byte DLLMinorVersion={read=FBeV.byDLLMinorVersion,write=FBeV.byDLLMinorVersion};
__property byte MajorVersion={read=FBeV.byMajorVersion,write=FBeV.byMajorVersion};
__property byte MinorVersion={read=FBeV.byMinorVersion,write=FBeV.byMinorVersion};
};

enum TLameMode {STEREO, JSTEREO, DUALCHANNEL, MONO};

typedef void __fastcall (__closure *TProcEvent)(TObject *Sender,Word PercentComplete);
typedef void __fastcall (__closure *TProcessFileEvent)(TObject *Sender,Word Num,AnsiString FileName);

struct TWaveHeader
{
char Marker1[4];
int BytesFollowing;
char Marker2[4];
char Marker3[4];
int Fixed1;
Word FormatTag;
Word Channels;
int SampleRate;
int BytesPerSecond;
Word BytesPerSample;
Word BitsPerSample;
char Marker4[4];
int DataBytes;
};

class TLameCoder :public TComponent
{
private:
unsigned FSampleRate;
unsigned FReSampleRate;
int FMode;
unsigned FBitrate;
unsigned FMaxBitrate;
MPEG_QUALITY FQuality;
unsigned FMpegVersion;
unsigned FPsyModel;
unsigned FEmphasis;
BOOL FPrivate;
BOOL FCRC;
BOOL FCopyright;
BOOL FOriginal;
BOOL FWriteVBRHeader;
BOOL FEnableVBR;
int FVBRQuality;
TStrings *FInputFiles;
TStrings *FOutputFiles;
TLameVersion *FLameVersion;
AnsiString FDefaultExt;
AnsiString FFileName;
TBECONFIG FBeConfig;
THBESTREAM FHBeStream;
unsigned FNumSamples;
unsigned FBufSize;
void *FInputBuf;
void *FOutputBuf;
TFileStream *FMP3File;
TFileStream *FWAVFile;
TNotifyEvent FOnBeginProcess;
TProcessFileEvent FOnBeginFile;
TProcessFileEvent FOnEndFile;
TNotifyEvent FOnEndProcess;
TProcEvent FOnProgress;
bool FCancelProcess;
TWaveHeader FWave;
void __fastcall SetSampleRate(unsigned Value);
void __fastcall SetBitrate(unsigned Value);
void __fastcall SetEnableVBR(BOOL Value);
TLameVersion * __fastcall GetLameVersion(void);
void __fastcall SetInputFiles(TStrings *Value);
void __fastcall SetOutputFiles(TStrings *Value);
void __fastcall SetMode(TLameMode Value);
TLameMode __fastcall GetMode(void);
void __fastcall CleanUp(void);
public:
// Public declarations
__fastcall TLameCoder(TComponent* AOwner);
__fastcall ~TLameCoder(void);
void __fastcall Assign(TPersistent *Source);
void __fastcall ProcessFiles(void);
TBEERR __fastcall PrepareCoder(void);
TBEERR __fastcall UnPrepareCoder(void *Buf,unsigned &dwWrite);
void __fastcall CloseCoder(void);
void __fastcall CancelProcess(void);
TBEERR __fastcall EncodeBuffer(void *InBuf,void *OutBuf,unsigned &OutP);
__property unsigned NumSamples={read=FNumSamples, default=0};
__property unsigned BufSize={read=FBufSize, default=0};

__published:
// Published declarations
__property unsigned SampleRate = {read=FSampleRate, write=SetSampleRate, default=44100};
__property unsigned Bitrate = {read=FBitrate, write=SetBitrate, default=128};
__property unsigned MaxBitrate = {read=FMaxBitrate, write=FMaxBitrate, default=320};
__property MPEG_QUALITY Quality = {read=FQuality, write=FQuality, default=0};
__property BOOL Private = {read=FPrivate, write=FPrivate, default=0};
__property BOOL CRC = {read=FCRC, write=FCRC, default=-1};
__property TLameMode Mode = {read=GetMode, write=SetMode, default=0};
__property BOOL Copyright = {read=FCopyright, write=FCopyright, default=0};
__property BOOL Original = {read=FOriginal, write=FOriginal, default=0};
__property BOOL WriteVBRHeader = {read=FWriteVBRHeader, write=FWriteVBRHeader, default=0};
__property BOOL EnableVBR = {read=FEnableVBR, write=SetEnableVBR, default=0};
__property int VBRQuality = {read=FVBRQuality, write=FVBRQuality, default=4};
__property TStrings *InputFiles = {read=FInputFiles, write=SetInputFiles};
__property TStrings *OutputFiles = {read=FOutputFiles, write=SetOutputFiles};
__property TLameVersion *LameVersion = {read=GetLameVersion};
__property AnsiString DefaultExt = {read=FDefaultExt, write=FDefaultExt};
__property AnsiString Mp3FileName = {read=FFileName, write=FFileName};
__property TNotifyEvent OnBeginProcess = {read=FOnBeginProcess, write=FOnBeginProcess};
__property TProcessFileEvent OnBeginFile = {read=FOnBeginFile, write=FOnBeginFile};
__property TProcessFileEvent OnEndFile = {read=FOnEndFile, write=FOnEndFile};
__property TNotifyEvent OnEndProcess = {read=FOnEndProcess, write=FOnEndProcess};
__property TProcEvent OnProgress = {read=FOnProgress, write=FOnProgress};
};

class TLameStream :public TFileStream
{
private:
TLameCoder *FLameCoder;
void *FOutBuf;
protected:
void __fastcall SetLameCoder(TLameCoder *Value);
public:
__fastcall TLameStream(const AnsiString FileName,Word Mode);
__fastcall ~TLameStream();
__property TLameCoder *LameCoder={read=FLameCoder,write=SetLameCoder};
int __fastcall Write(const void *Buffer,int Count);
int __fastcall Read(void *Buffer,int Count);
};

//---------------------------------------------------------------------------
#endif
csz_cmy 2002-09-07
  • 打赏
  • 举报
回复

////////////////////////////lame_dll.hpp//////////////////////////
// Borland C++ Builder
// Copyright (c) 1995, 2002 by Borland Software Corporation
// All rights reserved

// (DO NOT EDIT: machine generated header) 'Lame_dll.pas' rev: 6.00

#ifndef Lame_dllHPP
#define Lame_dllHPP

#pragma delphiheader begin
#pragma option push -w-
#pragma option push -Vx
#include <Windows.hpp> // Pascal unit
#include <SysInit.hpp> // Pascal unit
#include <System.hpp> // Pascal unit

//-- user supplied -----------------------------------------------------------

namespace Lame_dll
{
//-- type declarations -------------------------------------------------------
typedef unsigned THBESTREAM;

typedef unsigned *PHBESTREAM;

typedef unsigned TBEERR;

typedef short *PSHORT;

typedef Byte *PBYTE;

#pragma option push -b-
enum MPEG_QUALITY { NORMAL_QUALITY, LOW_QUALITY, HIGH_QUALITY, VOICE_QUALITY };
#pragma option pop

struct TLHV1;
typedef TLHV1 *PLHV1;

#pragma pack(push, 1)
struct TLHV1
{
unsigned dwStructVersion;
unsigned dwStructSize;
unsigned dwSampleRate;
unsigned dwReSampleRate;
int nMode;
unsigned dwBitrate;
unsigned dwMaxBitrate;
unsigned nQuality;
unsigned dwMpegVersion;
unsigned dwPsyModel;
unsigned dwEmphasis;
BOOL bPrivate;
BOOL bCRC;
BOOL bCopyright;
BOOL bOriginal;
BOOL bWriteVBRHeader;
BOOL bEnableVBR;
int nVBRQuality;
Byte btReserved[255];
} ;
#pragma pack(pop)

struct TLameMP3;
typedef TLameMP3 *PLameMP3;

#pragma pack(push, 1)
struct TLameMP3
{
unsigned dwSampleRate;
Byte byMode;
Word wBitrate;
bool bPrivate;
bool bCRC;
bool bCopyright;
bool bOriginal;
} ;
#pragma pack(pop)

struct TAAC;
typedef TAAC *PAAC;

#pragma pack(push, 1)
struct TAAC
{
unsigned dwSampleRate;
Byte byMode;
Word wBitrate;
Byte byEncodingMethod;
} ;
#pragma pack(pop)

struct TFormat;
typedef TFormat *PFormat;

#pragma pack(push, 1)
struct TFormat
{

unsigned dwConfig;
union
{
struct
{
TLHV1 LHV1;

};
struct
{
TLameMP3 MP3;

};

};
} ;
#pragma pack(pop)

#pragma pack(push, 1)
struct TBECONFIG
{
TFormat Format;
} ;
#pragma pack(pop)

typedef TBECONFIG *PBECONFIG;

struct TBEVersion;
typedef TBEVersion *PBEVersion;

#pragma pack(push, 1)
struct TBEVersion
{
Byte byDLLMajorVersion;
Byte byDLLMinorVersion;
Byte byMajorVersion;
Byte byMinorVersion;
Byte byDay;
Byte byMonth;
Word wYear;
char zHomepage[257];
} ;
#pragma pack(pop)

//-- var, const, procedure ---------------------------------------------------
static const Shortint BE_CONFIG_MP3 = 0x0;
static const Word BE_CONFIG_LAME = 0x100;
static const Shortint BE_ERR_SUCCESSFUL = 0x0;
static const Shortint BE_ERR_INVALID_FORMAT = 0x1;
static const Shortint BE_ERR_INVALID_FORMAT_PARAMETERS = 0x2;
static const Shortint BE_ERR_NO_MORE_HANDLES = 0x3;
static const Shortint BE_ERR_INVALID_HANDLE = 0x4;
static const Shortint BE_ERR_BUFFER_TOO_SMALL = 0x5;
static const Word BE_MAX_HOMEPAGE = 0x100;
static const Shortint BE_MP3_MODE_STEREO = 0x0;
static const Shortint BE_MP3_MODE_JSTEREO = 0x1;
static const Shortint BE_MP3_MODE_DUALCHANNEL = 0x2;
static const Shortint BE_MP3_MODE_MONO = 0x3;
static const Shortint MPEG1 = 0x1;
static const Shortint MPEG2 = 0x0;
extern "C" unsigned __cdecl beInitStream(TBECONFIG &pbeConfig, unsigned &dwSamples, unsigned &dwBufferSize, unsigned &phbeStream);
extern "C" unsigned __cdecl beEncodeChunk(unsigned hbeStream, unsigned nSamples, PSHORT pSamples, PBYTE pOutput, unsigned &pdwOutput);
extern "C" unsigned __cdecl beDeinitStream(unsigned hbeStream, PBYTE pOutput, unsigned &pdwOutput);
extern "C" unsigned __cdecl beCloseStream(unsigned hbeStream);
extern "C" void __cdecl beVersion(TBEVersion &pbeVersion);
} /* namespace Lame_dll */
using namespace Lame_dll;
#pragma option pop // -w-
#pragma option pop // -Vx

#pragma delphiheader end.
//-- end unit ----------------------------------------------------------------
#endif // Lame_dll
csz_cmy 2002-09-07
  • 打赏
  • 举报
回复
///////////////cdrip_dll.hpp//////////////////////////////////
// Borland C++ Builder
// Copyright (c) 1995, 2002 by Borland Software Corporation
// All rights reserved

// (DO NOT EDIT: machine generated header) 'CdRip_dll.pas' rev: 6.00

#ifndef CdRip_dllHPP
#define CdRip_dllHPP

#pragma delphiheader begin
#pragma option push -w-
#pragma option push -Vx
#include <Windows.hpp> // Pascal unit
#include <SysInit.hpp> // Pascal unit
#include <System.hpp> // Pascal unit

//-- user supplied -----------------------------------------------------------

namespace Cdrip_dll
{
//-- type declarations -------------------------------------------------------
#pragma pack(push, 4)
struct TCDAFile
{
char Marker1[4];
int BytesFollowing;
char Marker2[4];
char Marker3[4];
int Fixed1;
Word CDAVersion;
Word TrackNum;
unsigned CDSerial;
unsigned HSGBeg;
unsigned HSGLen;
unsigned RedBeg;
unsigned RedLen;
} ;
#pragma pack(pop)

typedef short *PShort;

typedef int CDEX_ERR;

struct TSenseKey;
typedef TSenseKey *PSenseKey;

#pragma pack(push, 1)
struct TSenseKey
{
Byte SK;
Byte ASC;
Byte ASCQ;
} ;
#pragma pack(pop)

#pragma option push -b-
enum TDriveType { GENERIC, TOSHIBA, TOSHIBANEW, IBM, NEC, DEC, IMS, KODAK, RICOH, HP, PHILIPS, PLASMON, GRUNDIGCDR100IPW, MITSUMICDR, PLEXTOR, SONY, YAMAHA, NRC, IMSCDD5, CUSTOMDRIVE };
#pragma option pop

#pragma option push -b-
enum TReadMethod { READMMC, READ10, READNEC, READSONY, READMMC2, READMMC3, READC1, READC2, READC3 };
#pragma option pop

#pragma option push -b-
enum TSetSpeed { SPEEDNONE, SPEEDMMC, SPEEDSONY, SPEEDYAMAHA, SPEEDTOSHIBA, SPEEDPHILIPS, SPEEDNEC };
#pragma option pop

#pragma option push -b-
enum TEndian { BIGENDIAN, LITTLEENDIAN };
#pragma option pop

#pragma option push -b-
enum TEnableMode { ENABLENONE, ENABLESTD };
#pragma option pop

struct TDriveTable;
typedef TDriveTable *PDriveTable;

#pragma pack(push, 1)
struct TDriveTable
{
TDriveType DriveType;
TReadMethod ReadMethod;
TSetSpeed SetSpeed;
TEndian Endian;
TEnableMode EnableMode;
int nDensity;
BOOL bAtapi;
} ;
#pragma pack(pop)

#pragma option push -b-
enum TOutputFormat { STEREO44100, MONO44100, STEREO22050, MONO22050, STEREO11025, MONO11025 };
#pragma option pop

struct TCDROMParams;
typedef TCDROMParams *PCDROMParams;

#pragma pack(push, 1)
struct TCDROMParams
{
char lpszCDROMID[256];
int nNumReadSectors;
int nNumOverlapSectors;
int nNumCompareSectors;
int nOffsetStart;
int nOffsetEnd;
int nSpeed;
int nSpinUpTime;
BOOL bJitterCorrection;
BOOL bSwapLefRightChannel;
TDriveTable DriveTable;
Byte btTargetID;
Byte btAdapterID;
Byte btLunID;
BOOL bAspiPosting;
TOutputFormat nOutputFormat;
int nAspiRetries;
int nAspiTimeOut;
} ;
#pragma pack(pop)

struct TTOCEntry;
typedef TTOCEntry *PTOCEntry;

#pragma pack(push, 1)
struct TTOCEntry
{
int dwStartSector;
Byte btFlag;
Byte btTrackNumber;
} ;
#pragma pack(pop)

//-- var, const, procedure ---------------------------------------------------
static const Shortint CDEX_OK = 0x0;
static const Shortint CDEX_ERROR = 0x1;
static const Shortint CDEX_FILEOPEN_ERROR = 0x2;
static const Shortint CDEX_JITTER_ERROR = 0x3;
static const Shortint CDEX_RIPPING_DONE = 0x4;
static const Shortint CDEX_RIPPING_INPROGRESS = 0x5;
static const Shortint CDROMDATAFLAG = 0x4;
static const Shortint AUDIOTRKFLAG = 0x10;
extern "C" int __stdcall CR_Init(void);
extern "C" int __stdcall CR_GetCDRipVersion(void);
extern "C" int __stdcall CR_GetNumCDROM(void);
extern "C" int __stdcall CR_GetActiveCDROM(void);
extern "C" int __stdcall CR_SetActiveCDROM(int nActiveDrive);
extern "C" int __stdcall CR_SelectCDROMType(TDriveType cdType);
extern "C" TDriveType __stdcall CR_GetCDROMType(void);
extern "C" int __stdcall CR_GetCDROMParameters(TCDROMParams &pParam);
extern "C" int __stdcall CR_SetCDROMParameters(PCDROMParams pParam);
extern "C" int __stdcall CR_OpenRipper(PLongint plBufferSize, int dwStartSector, int dwEndSector);
extern "C" int __stdcall CR_CloseRipper(void);
extern "C" int __stdcall CR_GetPercentCompleted(void);
extern "C" int __stdcall CR_GetPeakValue(void);
extern "C" int __stdcall CR_GetNumberOfJitterErrors(void);
extern "C" int __stdcall CR_GetJitterPosition(void);
extern "C" int __stdcall CR_RipChunk(void * pbtStream, unsigned &pNumBytes);
extern "C" int __stdcall CR_LoadSettings(char * strIniFname);
extern "C" int __stdcall CR_SaveSettings(char * strIniFname);
extern "C" void __stdcall CR_NormalizeChunk(PShort pbsStream, int nNumSamples, double dScaleFactor);
extern "C" int __stdcall CR_ReadToc(void);
extern "C" int __stdcall CR_GetNumTocEntries(void);
extern "C" __int64 __stdcall CR_GetTocEntry(int nTocEntry);
extern "C" BOOL __stdcall CR_IsUnitReady(void);
extern "C" BOOL __stdcall CR_EjectCD(BOOL bEject);
extern "C" BOOL __stdcall CR_IsAudioPlaying(void);
extern "C" int __stdcall CR_PlayTrack(int nTrack);
extern "C" int __stdcall CR_StopPlayTrack(void);
extern "C" int __stdcall CR_PauseCD(BOOL bPause);
extern "C" TSenseKey __stdcall CR_GetSenseKey(void);
extern "C" int __stdcall CR_GetPlayPosition(unsigned &dwRelPos, unsigned &dwAbsPos);
extern "C" int __stdcall CR_SetPlayPosition(unsigned dwAbsPos);
extern "C" int __stdcall CR_PlaySection(int lStartSector, int lEndSector);
extern "C" void __stdcall CR_GetLastJitterErrorPosition(unsigned &dwStartSector, unsigned &dwEndSector);

} /* namespace Cdrip_dll */
using namespace Cdrip_dll;
#pragma option pop // -w-
#pragma option pop // -Vx

#pragma delphiheader end.
//-- end unit ----------------------------------------------------------------
#endif // CdRip_dll





13,825

社区成员

发帖
与我相关
我的任务
社区描述
C++ Builder相关内容讨论区
社区管理员
  • 基础类社区
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧