00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024 #if !defined(_ALAMEDLL_H__INCLUDED_)
00025 #define _ALAMEDLL_H__INCLUDED_
00026
00027 #if _MSC_VER >= 1000
00028 #pragma once
00029 #endif // _MSC_VER >= 1000
00030
00031 #include <windows.h>
00032 #include <assert.h>
00033
00034 #include "BladeMP3EncDLL.h"
00035
00036 #include "ADbg/ADbg.h"
00037
00041 class ALameDLL
00042 {
00043 public:
00047 ALameDLL();
00048
00052 virtual ~ALameDLL();
00053
00060 bool Load(const char * DllLocation);
00061
00065 void Free(void);
00066
00078 inline BE_ERR ALameDLL::InitStream(PBE_CONFIG pbeConfig, PDWORD dwSamples, PDWORD dwBufferSize) const
00079 {
00080 if (beInitStream != NULL)
00081 return beInitStream(pbeConfig, dwSamples, dwBufferSize, (PHBE_STREAM) &hbeStream);
00082 else
00083 return BE_ERR_INVALID_HANDLE;
00084 }
00085
00098 inline BE_ERR ALameDLL::EncodeChunk(DWORD nSamples, PSHORT pSamples, PBYTE pOutput, PDWORD pdwOutput ) const
00099 {
00100 if (beEncodeChunk != NULL)
00101 return beEncodeChunk(hbeStream, nSamples, pSamples, pOutput, pdwOutput);
00102 else
00103 return BE_ERR_INVALID_HANDLE;
00104 }
00105
00106
00118 inline BE_ERR ALameDLL::DeinitStream(PBYTE pOutput, PDWORD pdwOutput ) const
00119 {
00120 if (beDeinitStream != NULL)
00121 return beDeinitStream( hbeStream, pOutput, pdwOutput);
00122 else
00123 return BE_ERR_INVALID_HANDLE;
00124 }
00125
00133 inline BE_ERR ALameDLL::CloseStream() const
00134 {
00135 if (beCloseStream != NULL)
00136 return beCloseStream( hbeStream );
00137 else
00138 return BE_ERR_INVALID_HANDLE;
00139 }
00140
00151 inline void ALameDLL::WriteVBRHeader(LPCSTR pszMP3FileName ) const
00152 {
00153 if (beWriteVBRHeader != NULL)
00154 beWriteVBRHeader(pszMP3FileName);
00155 }
00156
00166 inline void ALameDLL::Version(BE_VERSION * ver) const
00167 {
00168 assert(ver != NULL);
00169
00170 if (beVersion != NULL)
00171 beVersion(ver);
00172 }
00173
00177 inline bool IsLoaded() const {
00178 return ((LameDLL != NULL) && (beInitStream != NULL) && (beCloseStream != NULL) && (beEncodeChunk != NULL) && (beDeinitStream != NULL) && (beWriteVBRHeader != NULL) && (beVersion != NULL));
00179 }
00180
00189 inline DWORD ALameDLL::GetFullLocation(TCHAR * output, const int BufferSize) const {
00190 if (LameDLL != NULL)
00191 {
00192 return ::GetModuleFileName(LameDLL, output, BufferSize);
00193 }
00194 else return 0;
00195 }
00196
00197 private:
00198 HMODULE LameDLL;
00199
00200 BEINITSTREAM beInitStream;
00201 BECLOSESTREAM beCloseStream;
00202 BEENCODECHUNK beEncodeChunk;
00203 BEDEINITSTREAM beDeinitStream;
00204 BEWRITEVBRHEADER beWriteVBRHeader;
00205 BEVERSION beVersion;
00206
00207 HBE_STREAM hbeStream;
00208 };
00209
00210 #endif // !defined(_ALAMEDLL_H__INCLUDED_)