aboutsummaryrefslogtreecommitdiff
path: root/Dll
diff options
context:
space:
mode:
Diffstat (limited to 'Dll')
-rw-r--r--Dll/BladeMP3EncDLL.c1021
-rw-r--r--Dll/BladeMP3EncDLL.def36
-rw-r--r--Dll/BladeMP3EncDLL.h280
-rw-r--r--Dll/Example.cpp288
-rw-r--r--Dll/Example_vc6.dsp90
-rw-r--r--Dll/Example_vc6.dsw74
-rw-r--r--Dll/LameDLLInterface.htm742
-rw-r--r--Dll/LameDll_vc6.dsp118
-rw-r--r--Dll/LameDll_vc8.vcproj508
-rw-r--r--Dll/MP3export.pas303
-rw-r--r--Dll/Makefile.am15
-rw-r--r--Dll/Makefile.in367
-rw-r--r--Dll/Makefile.mingw3239
-rw-r--r--Dll/README21
14 files changed, 3902 insertions, 0 deletions
diff --git a/Dll/BladeMP3EncDLL.c b/Dll/BladeMP3EncDLL.c
new file mode 100644
index 0000000..f09ca39
--- /dev/null
+++ b/Dll/BladeMP3EncDLL.c
@@ -0,0 +1,1021 @@
+/*
+* Blade DLL Interface for LAME.
+*
+* Copyright (c) 1999 - 2002 A.L. Faber
+*
+* This library is free software; you can redistribute it and/or
+* modify it under the terms of the GNU Lesser General Public
+* License as published by the Free Software Foundation; either
+* version 2 of the License, or (at your option) any later version.
+*
+* This library is distributed in the hope that it will be useful,
+* but WITHOUT ANY WARRANTY; without even the implied warranty of
+* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+* Lesser General Public License for more details.
+*
+* You should have received a copy of the GNU Lesser General Public
+* License along with this library; if not, write to the
+* Free Software Foundation, Inc., 59 Temple Place - Suite 330,
+* Boston, MA 02111-1307, USA.
+*/
+
+#include <windows.h>
+#include <Windef.h>
+#include "BladeMP3EncDLL.h"
+#include <assert.h>
+#include <stdio.h>
+
+#include <lame.h>
+
+
+#define Min(A, B) ((A) < (B) ? (A) : (B))
+#define Max(A, B) ((A) > (B) ? (A) : (B))
+
+#define _RELEASEDEBUG 0
+
+// lame_enc DLL version number
+const int MAJORVERSION = 1;
+const int MINORVERSION = 32;
+
+
+// Local variables
+static DWORD dwSampleBufferSize=0;
+static HANDLE gs_hModule=NULL;
+static BOOL gs_bLogFile=FALSE;
+static lame_global_flags* gfp_save = NULL;
+
+// Local function prototypes
+static void dump_config( lame_global_flags* gfp );
+static void DebugPrintf( const char* pzFormat, ... );
+static void DispErr( char const* strErr );
+static void PresetOptions( lame_global_flags *gfp, LONG myPreset );
+
+
+static void DebugPrintf(const char* pzFormat, ...)
+{
+ char szBuffer[1024]={'\0',};
+ char szFileName[MAX_PATH+1]={'\0',};
+ va_list ap;
+
+ // Get the full module (DLL) file name
+ GetModuleFileNameA( gs_hModule,
+ szFileName,
+ sizeof( szFileName ) );
+
+ // change file name extention
+ szFileName[ strlen(szFileName) - 3 ] = 't';
+ szFileName[ strlen(szFileName) - 2 ] = 'x';
+ szFileName[ strlen(szFileName) - 1 ] = 't';
+
+ // start at beginning of the list
+ va_start(ap, pzFormat);
+
+ // copy it to the string buffer
+ _vsnprintf(szBuffer, sizeof(szBuffer), pzFormat, ap);
+
+ // log it to the file?
+ if ( gs_bLogFile )
+ {
+ FILE* fp = NULL;
+
+ // try to open the log file
+ fp=fopen( szFileName, "a+" );
+
+ // check file open result
+ if (fp)
+ {
+ // write string to the file
+ fputs(szBuffer,fp);
+
+ // close the file
+ fclose(fp);
+ }
+ }
+
+#if defined _DEBUG || defined _RELEASEDEBUG
+ OutputDebugStringA( szBuffer );
+#endif
+
+ va_end(ap);
+}
+
+
+static void PresetOptions( lame_global_flags *gfp, LONG myPreset )
+{
+ switch (myPreset)
+ {
+ /*-1*/case LQP_NOPRESET:
+ break;
+
+ /*0*/case LQP_NORMAL_QUALITY:
+ /* lame_set_quality( gfp, 5 );*/
+ break;
+
+ /*1*/case LQP_LOW_QUALITY:
+ lame_set_quality( gfp, 9 );
+ break;
+
+ /*2*/case LQP_HIGH_QUALITY:
+ lame_set_quality( gfp, 2 );
+ break;
+
+ /*3*/case LQP_VOICE_QUALITY: // --voice flag for experimental voice mode
+ lame_set_mode( gfp, MONO );
+ lame_set_preset( gfp, 56);
+ break;
+
+ /*4*/case LQP_R3MIX: // --R3MIX
+ lame_set_preset( gfp, R3MIX);
+ break;
+
+ /*5*/case LQP_VERYHIGH_QUALITY:
+ lame_set_quality( gfp, 0 );
+ break;
+
+ /*6*/case LQP_STANDARD: // --PRESET STANDARD
+ lame_set_preset( gfp, STANDARD);
+ break;
+
+ /*7*/case LQP_FAST_STANDARD: // --PRESET FAST STANDARD
+ lame_set_preset( gfp, STANDARD_FAST);
+ break;
+
+ /*8*/case LQP_EXTREME: // --PRESET EXTREME
+ lame_set_preset( gfp, EXTREME);
+ break;
+
+ /*9*/case LQP_FAST_EXTREME: // --PRESET FAST EXTREME:
+ lame_set_preset( gfp, EXTREME_FAST);
+ break;
+
+ /*10*/case LQP_INSANE: // --PRESET INSANE
+ lame_set_preset( gfp, INSANE);
+ break;
+
+ /*11*/case LQP_ABR: // --PRESET ABR
+ // handled in beInitStream
+ break;
+
+ /*12*/case LQP_CBR: // --PRESET CBR
+ // handled in beInitStream
+ break;
+
+ /*13*/case LQP_MEDIUM: // --PRESET MEDIUM
+ lame_set_preset( gfp, MEDIUM);
+ break;
+
+ /*14*/case LQP_FAST_MEDIUM: // --PRESET FAST MEDIUM
+ lame_set_preset( gfp, MEDIUM_FAST);
+ break;
+
+ /*1000*/case LQP_PHONE:
+ lame_set_mode( gfp, MONO );
+ lame_set_preset( gfp, 16);
+ break;
+
+ /*2000*/case LQP_SW:
+ lame_set_mode( gfp, MONO );
+ lame_set_preset( gfp, 24);
+ break;
+
+ /*3000*/case LQP_AM:
+ lame_set_mode( gfp, MONO );
+ lame_set_preset( gfp, 40);
+ break;
+
+ /*4000*/case LQP_FM:
+ lame_set_preset( gfp, 112);
+ break;
+
+ /*5000*/case LQP_VOICE:
+ lame_set_mode( gfp, MONO );
+ lame_set_preset( gfp, 56);
+ break;
+
+ /*6000*/case LQP_RADIO:
+ lame_set_preset( gfp, 112);
+ break;
+
+ /*7000*/case LQP_TAPE:
+ lame_set_preset( gfp, 112);
+ break;
+
+ /*8000*/case LQP_HIFI:
+ lame_set_preset( gfp, 160);
+ break;
+
+ /*9000*/case LQP_CD:
+ lame_set_preset( gfp, 192);
+ break;
+
+ /*10000*/case LQP_STUDIO:
+ lame_set_preset( gfp, 256);
+ break;
+
+ }
+}
+
+
+__declspec(dllexport) BE_ERR beInitStream(PBE_CONFIG pbeConfig, PDWORD dwSamples, PDWORD dwBufferSize, PHBE_STREAM phbeStream)
+{
+ int actual_bitrate;
+ //2001-12-18
+ int nDllArgC = 0;
+ BE_CONFIG lameConfig = { 0, };
+ int nInitReturn = 0;
+ lame_global_flags* gfp = NULL;
+
+ // Init the global flags structure
+ gfp = lame_init();
+ *phbeStream = (HBE_STREAM)gfp;
+
+ // clear out structure
+ memset(&lameConfig,0x00,CURRENT_STRUCT_SIZE);
+
+ // Check if this is a regular BLADE_ENCODER header
+ if (pbeConfig->dwConfig!=BE_CONFIG_LAME)
+ {
+ int nCRC=pbeConfig->format.mp3.bCRC;
+ int nVBR=(nCRC>>12)&0x0F;
+
+ // Copy parameter from old Blade structure
+ lameConfig.format.LHV1.dwSampleRate =pbeConfig->format.mp3.dwSampleRate;
+ //for low bitrates, LAME will automatically downsample for better
+ //sound quality. Forcing output samplerate = input samplerate is not a good idea
+ //unless the user specifically requests it:
+ //lameConfig.format.LHV1.dwReSampleRate=pbeConfig->format.mp3.dwSampleRate;
+ lameConfig.format.LHV1.nMode =(pbeConfig->format.mp3.byMode&0x0F);
+ lameConfig.format.LHV1.dwBitrate =pbeConfig->format.mp3.wBitrate;
+ lameConfig.format.LHV1.bPrivate =pbeConfig->format.mp3.bPrivate;
+ lameConfig.format.LHV1.bOriginal =pbeConfig->format.mp3.bOriginal;
+ lameConfig.format.LHV1.bCRC =nCRC&0x01;
+ lameConfig.format.LHV1.bCopyright =pbeConfig->format.mp3.bCopyright;
+
+ // Fill out the unknowns
+ lameConfig.format.LHV1.dwStructSize=CURRENT_STRUCT_SIZE;
+ lameConfig.format.LHV1.dwStructVersion=CURRENT_STRUCT_VERSION;
+
+ // Get VBR setting from fourth nibble
+ if ( nVBR>0 )
+ {
+ lameConfig.format.LHV1.bWriteVBRHeader = TRUE;
+ lameConfig.format.LHV1.bEnableVBR = TRUE;
+ lameConfig.format.LHV1.nVBRQuality = nVBR-1;
+ }
+
+ // Get Quality from third nibble
+ lameConfig.format.LHV1.nPreset=((nCRC>>8)&0x0F);
+
+ }
+ else
+ {
+ // Copy the parameters
+ memcpy(&lameConfig,pbeConfig,pbeConfig->format.LHV1.dwStructSize);
+ }
+
+ // --------------- Set arguments to LAME encoder -------------------------
+
+ // Set input sample frequency
+ lame_set_in_samplerate( gfp, lameConfig.format.LHV1.dwSampleRate );
+
+ // disable INFO/VBR tag by default.
+ // if this tag is used, the calling program must call beWriteVBRTag()
+ // after encoding. But the original DLL documentation does not
+ // require the
+ // app to call beWriteVBRTag() unless they have specifically
+ // set LHV1.bWriteVBRHeader=TRUE. Thus the default setting should
+ // be disabled.
+ lame_set_bWriteVbrTag( gfp, 0 );
+
+ //2001-12-18 Dibrom's ABR preset stuff
+
+ if(lameConfig.format.LHV1.nPreset == LQP_ABR) // --ALT-PRESET ABR
+ {
+ actual_bitrate = lameConfig.format.LHV1.dwVbrAbr_bps / 1000;
+
+ // limit range
+ if( actual_bitrate > 320)
+ {
+ actual_bitrate = 320;
+ }
+
+ if( actual_bitrate < 8 )
+ {
+ actual_bitrate = 8;
+ }
+
+ lame_set_preset( gfp, actual_bitrate );
+ }
+
+ // end Dibrom's ABR preset 2001-12-18 ****** START OF CBR
+
+ if(lameConfig.format.LHV1.nPreset == LQP_CBR) // --ALT-PRESET CBR
+ {
+ actual_bitrate = lameConfig.format.LHV1.dwBitrate;
+ lame_set_preset(gfp, actual_bitrate);
+ lame_set_VBR(gfp, vbr_off);
+ }
+
+ // end Dibrom's CBR preset 2001-12-18
+
+ // The following settings only used when preset is not one of the LAME QUALITY Presets
+ if ( (int)lameConfig.format.LHV1.nPreset < (int) LQP_STANDARD )
+ {
+ switch ( lameConfig.format.LHV1.nMode )
+ {
+ case BE_MP3_MODE_STEREO:
+ lame_set_mode( gfp, STEREO );
+ lame_set_num_channels( gfp, 2 );
+ break;
+ case BE_MP3_MODE_JSTEREO:
+ lame_set_mode( gfp, JOINT_STEREO );
+ lame_set_num_channels( gfp, 2 );
+ break;
+ case BE_MP3_MODE_MONO:
+ lame_set_mode( gfp, MONO );
+ lame_set_num_channels( gfp, 1 );
+ break;
+ case BE_MP3_MODE_DUALCHANNEL: //warning: there is NO dual channel option working in Lame
+ lame_set_force_ms( gfp, 1 );
+ lame_set_mode( gfp, STEREO );
+ lame_set_num_channels( gfp, 2 );
+ break;
+ default:
+ {
+ DebugPrintf("Invalid lameConfig.format.LHV1.nMode, value is %d\n",lameConfig.format.LHV1.nMode);
+ return BE_ERR_INVALID_FORMAT_PARAMETERS;
+ }
+ }
+
+ if ( lameConfig.format.LHV1.bEnableVBR )
+ {
+ /* set VBR quality */
+ lame_set_VBR_q( gfp, lameConfig.format.LHV1.nVBRQuality );
+
+ /* select proper VBR method */
+ switch ( lameConfig.format.LHV1.nVbrMethod)
+ {
+ case VBR_METHOD_NONE:
+ lame_set_VBR( gfp, vbr_off );
+ break;
+
+ case VBR_METHOD_DEFAULT:
+ lame_set_VBR( gfp, vbr_default );
+ break;
+
+ case VBR_METHOD_OLD:
+ lame_set_VBR( gfp, vbr_rh );
+ break;
+
+ case VBR_METHOD_MTRH:
+ case VBR_METHOD_NEW:
+ /*
+ * the --vbr-mtrh commandline switch is obsolete.
+ * now --vbr-mtrh is known as --vbr-new
+ */
+ lame_set_VBR( gfp, vbr_mtrh );
+ break;
+
+ case VBR_METHOD_ABR:
+ lame_set_VBR( gfp, vbr_abr );
+ break;
+
+ default:
+ /* unsupported VBR method */
+ assert( FALSE );
+ }
+ }
+ else
+ {
+ /* use CBR encoding method, so turn off VBR */
+ lame_set_VBR( gfp, vbr_off );
+ }
+
+ /* Set bitrate. (CDex users always specify bitrate=Min bitrate when using VBR) */
+ lame_set_brate( gfp, lameConfig.format.LHV1.dwBitrate );
+
+ /* check if we have to use ABR, in order to backwards compatible, this
+ * condition should still be checked indepedent of the nVbrMethod method
+ */
+ if (lameConfig.format.LHV1.dwVbrAbr_bps > 0 )
+ {
+ /* set VBR method to ABR */
+ lame_set_VBR( gfp, vbr_abr );
+
+ /* calculate to kbps, round to nearest kbps */
+ lame_set_VBR_mean_bitrate_kbps( gfp, ( lameConfig.format.LHV1.dwVbrAbr_bps + 500 ) / 1000 );
+
+ /* limit range */
+ if( lame_get_VBR_mean_bitrate_kbps( gfp ) > 320)
+ {
+ lame_set_VBR_mean_bitrate_kbps( gfp, 320 );
+ }
+
+ if( lame_get_VBR_mean_bitrate_kbps( gfp ) < 8 )
+ {
+ lame_set_VBR_mean_bitrate_kbps( gfp, 8 );
+ }
+ }
+
+ }
+
+ // First set all the preset options
+ if ( LQP_NOPRESET != lameConfig.format.LHV1.nPreset )
+ {
+ PresetOptions( gfp, lameConfig.format.LHV1.nPreset );
+ }
+
+
+ // Set frequency resampling rate, if specified
+ if ( lameConfig.format.LHV1.dwReSampleRate > 0 )
+ {
+ lame_set_out_samplerate( gfp, lameConfig.format.LHV1.dwReSampleRate );
+ }
+
+
+ switch ( lameConfig.format.LHV1.nMode )
+ {
+ case BE_MP3_MODE_MONO:
+ lame_set_mode( gfp, MONO );
+ lame_set_num_channels( gfp, 1 );
+ break;
+
+ default:
+ break;
+ }
+
+
+ // Use strict ISO encoding?
+ lame_set_strict_ISO( gfp, ( lameConfig.format.LHV1.bStrictIso ) ? 1 : 0 );
+
+ // Set copyright flag?
+ if ( lameConfig.format.LHV1.bCopyright )
+ {
+ lame_set_copyright( gfp, 1 );
+ }
+
+ // Do we have to tag it as non original
+ if ( !lameConfig.format.LHV1.bOriginal )
+ {
+ lame_set_original( gfp, 0 );
+ }
+ else
+ {
+ lame_set_original( gfp, 1 );
+ }
+
+ // Add CRC?
+ if ( lameConfig.format.LHV1.bCRC )
+ {
+ lame_set_error_protection( gfp, 1 );
+ }
+ else
+ {
+ lame_set_error_protection( gfp, 0 );
+ }
+
+ // Set private bit?
+ if ( lameConfig.format.LHV1.bPrivate )
+ {
+ lame_set_extension( gfp, 1 );
+ }
+ else
+ {
+ lame_set_extension( gfp, 0 );
+ }
+
+
+ // Set VBR min bitrate, if specified
+ if ( lameConfig.format.LHV1.dwBitrate > 0 )
+ {
+ lame_set_VBR_min_bitrate_kbps( gfp, lameConfig.format.LHV1.dwBitrate );
+ }
+
+ // Set Maxbitrate, if specified
+ if ( lameConfig.format.LHV1.dwMaxBitrate > 0 )
+ {
+ lame_set_VBR_max_bitrate_kbps( gfp, lameConfig.format.LHV1.dwMaxBitrate );
+ }
+ // Set bit resovoir option
+ if ( lameConfig.format.LHV1.bNoRes )
+ {
+ lame_set_disable_reservoir( gfp,1 );
+ }
+
+ // check if the VBR tag is required
+ if ( lameConfig.format.LHV1.bWriteVBRHeader )
+ {
+ lame_set_bWriteVbrTag( gfp, 1 );
+ }
+ else
+ {
+ lame_set_bWriteVbrTag( gfp, 0 );
+ }
+
+ // Override Quality setting, use HIGHBYTE = NOT LOWBYTE to be backwards compatible
+ if ( ( lameConfig.format.LHV1.nQuality & 0xFF ) ==
+ ((~( lameConfig.format.LHV1.nQuality >> 8 )) & 0xFF) )
+ {
+ lame_set_quality( gfp, lameConfig.format.LHV1.nQuality & 0xFF );
+ }
+
+ if ( 0 != ( nInitReturn = lame_init_params( gfp ) ) )
+ {
+ return nInitReturn;
+ }
+
+ //LAME encoding call will accept any number of samples.
+ if ( 0 == lame_get_version( gfp ) )
+ {
+ // For MPEG-II, only 576 samples per frame per channel
+ *dwSamples= 576 * lame_get_num_channels( gfp );
+ }
+ else
+ {
+ // For MPEG-I, 1152 samples per frame per channel
+ *dwSamples= 1152 * lame_get_num_channels( gfp );
+ }
+
+ // Set the input sample buffer size, so we know what we can expect
+ dwSampleBufferSize = *dwSamples;
+
+ // Set MP3 buffer size, conservative estimate
+ *dwBufferSize=(DWORD)( 1.25 * ( *dwSamples / lame_get_num_channels( gfp ) ) + 7200 );
+
+ // For debugging purposes
+ dump_config( gfp );
+
+ // Everything went OK, thus return SUCCESSFUL
+ return BE_ERR_SUCCESSFUL;
+}
+
+
+
+__declspec(dllexport) BE_ERR beFlushNoGap(HBE_STREAM hbeStream, PBYTE pOutput, PDWORD pdwOutput)
+{
+ int nOutputSamples = 0;
+
+ lame_global_flags* gfp = (lame_global_flags*)hbeStream;
+
+ // Init the global flags structure
+ nOutputSamples = lame_encode_flush_nogap( gfp, pOutput, LAME_MAXMP3BUFFER );
+
+ if ( nOutputSamples < 0 )
+ {
+ *pdwOutput = 0;
+ return BE_ERR_BUFFER_TOO_SMALL;
+ }
+ else
+ {
+ *pdwOutput = nOutputSamples;
+ }
+
+ return BE_ERR_SUCCESSFUL;
+}
+
+__declspec(dllexport) BE_ERR beDeinitStream(HBE_STREAM hbeStream, PBYTE pOutput, PDWORD pdwOutput)
+{
+ int nOutputSamples = 0;
+
+ lame_global_flags* gfp = (lame_global_flags*)hbeStream;
+
+ nOutputSamples = lame_encode_flush( gfp, pOutput, 0 );
+
+ if ( nOutputSamples < 0 )
+ {
+ *pdwOutput = 0;
+ return BE_ERR_BUFFER_TOO_SMALL;
+ }
+ else
+ {
+ *pdwOutput = nOutputSamples;
+ }
+
+ return BE_ERR_SUCCESSFUL;
+}
+
+
+__declspec(dllexport) BE_ERR beCloseStream(HBE_STREAM hbeStream)
+{
+ lame_global_flags* gfp = (lame_global_flags*)hbeStream;
+
+ // lame will be close in VbrWriteTag function
+ if ( !lame_get_bWriteVbrTag( gfp ) )
+ {
+ // clean up of allocated memory
+ lame_close( gfp );
+
+ gfp_save = NULL;
+ }
+ else
+ {
+ gfp_save = (lame_global_flags*)hbeStream;
+ }
+
+ // DeInit encoder
+ return BE_ERR_SUCCESSFUL;
+}
+
+
+
+__declspec(dllexport) VOID beVersion(PBE_VERSION pbeVersion)
+{
+ // DLL Release date
+ char lpszDate[20] = { '\0', };
+ char lpszTemp[5] = { '\0', };
+ lame_version_t lv = { 0, };
+
+
+ // Set DLL interface version
+ pbeVersion->byDLLMajorVersion=MAJORVERSION;
+ pbeVersion->byDLLMinorVersion=MINORVERSION;
+
+ get_lame_version_numerical ( &lv );
+
+ // Set Engine version number (Same as Lame version)
+ pbeVersion->byMajorVersion = lv.major;
+ pbeVersion->byMinorVersion = lv.minor;
+ pbeVersion->byAlphaLevel = lv.alpha;
+ pbeVersion->byBetaLevel = lv.beta;
+
+#ifdef MMX_choose_table
+ pbeVersion->byMMXEnabled=1;
+#else
+ pbeVersion->byMMXEnabled=0;
+#endif
+
+ memset( pbeVersion->btReserved, 0, sizeof( pbeVersion->btReserved ) );
+
+ // Get compilation date
+ strcpy(lpszDate,__DATE__);
+
+ // Get the first three character, which is the month
+ strncpy(lpszTemp,lpszDate,3);
+ lpszTemp[3] = '\0';
+ pbeVersion->byMonth=1;
+
+ // Set month
+ if (strcmp(lpszTemp,"Jan")==0) pbeVersion->byMonth = 1;
+ if (strcmp(lpszTemp,"Feb")==0) pbeVersion->byMonth = 2;
+ if (strcmp(lpszTemp,"Mar")==0) pbeVersion->byMonth = 3;
+ if (strcmp(lpszTemp,"Apr")==0) pbeVersion->byMonth = 4;
+ if (strcmp(lpszTemp,"May")==0) pbeVersion->byMonth = 5;
+ if (strcmp(lpszTemp,"Jun")==0) pbeVersion->byMonth = 6;
+ if (strcmp(lpszTemp,"Jul")==0) pbeVersion->byMonth = 7;
+ if (strcmp(lpszTemp,"Aug")==0) pbeVersion->byMonth = 8;
+ if (strcmp(lpszTemp,"Sep")==0) pbeVersion->byMonth = 9;
+ if (strcmp(lpszTemp,"Oct")==0) pbeVersion->byMonth = 10;
+ if (strcmp(lpszTemp,"Nov")==0) pbeVersion->byMonth = 11;
+ if (strcmp(lpszTemp,"Dec")==0) pbeVersion->byMonth = 12;
+
+ // Get day of month string (char [4..5])
+ pbeVersion->byDay=atoi( lpszDate + 4 );
+
+ // Get year of compilation date (char [7..10])
+ pbeVersion->wYear = atoi( lpszDate + 7 );
+
+ memset( pbeVersion->zHomepage, 0x00, BE_MAX_HOMEPAGE );
+
+ strcpy( pbeVersion->zHomepage, "http://www.mp3dev.org/" );
+}
+
+__declspec(dllexport) BE_ERR beEncodeChunk(HBE_STREAM hbeStream, DWORD nSamples,
+ PSHORT pSamples, PBYTE pOutput, PDWORD pdwOutput)
+{
+ // Encode it
+ int dwSamples;
+ int nOutputSamples = 0;
+ lame_global_flags* gfp = (lame_global_flags*)hbeStream;
+
+ dwSamples = nSamples / lame_get_num_channels( gfp );
+
+ // old versions of lame_enc.dll required exactly 1152 samples
+ // and worked even if nSamples accidently set to 2304
+ // simulate this behavoir:
+ if ( 1 == lame_get_num_channels( gfp ) && nSamples == 2304)
+ {
+ dwSamples/= 2;
+ }
+
+
+ if ( 1 == lame_get_num_channels( gfp ) )
+ {
+ nOutputSamples = lame_encode_buffer(gfp,pSamples,pSamples,dwSamples,pOutput,0);
+ }
+ else
+ {
+ nOutputSamples = lame_encode_buffer_interleaved(gfp,pSamples,dwSamples,pOutput,0);
+ }
+
+
+ if ( nOutputSamples < 0 )
+ {
+ *pdwOutput=0;
+ return BE_ERR_BUFFER_TOO_SMALL;
+ }
+ else
+ {
+ *pdwOutput = (DWORD)nOutputSamples;
+ }
+
+ return BE_ERR_SUCCESSFUL;
+}
+
+
+// accept floating point audio samples, scaled to the range of a signed 16-bit
+// integer (within +/- 32768), in non-interleaved channels -- DSPguru, jd
+__declspec(dllexport) BE_ERR beEncodeChunkFloatS16NI(HBE_STREAM hbeStream, DWORD nSamples,
+ PFLOAT buffer_l, PFLOAT buffer_r, PBYTE pOutput, PDWORD pdwOutput)
+{
+ int nOutputSamples;
+ lame_global_flags* gfp = (lame_global_flags*)hbeStream;
+
+ nOutputSamples = lame_encode_buffer_float(gfp,buffer_l,buffer_r,nSamples,pOutput,0);
+
+ if ( nOutputSamples >= 0 )
+ {
+ *pdwOutput = (DWORD) nOutputSamples;
+ }
+ else
+ {
+ *pdwOutput=0;
+ return BE_ERR_BUFFER_TOO_SMALL;
+ }
+
+ return BE_ERR_SUCCESSFUL;
+}
+
+static int
+maybeSyncWord(FILE* fpStream)
+{
+ unsigned char mp3_frame_header[4];
+ size_t nbytes = fread(mp3_frame_header, 1, sizeof(mp3_frame_header), fpStream);
+ if ( nbytes != sizeof(mp3_frame_header) ) {
+ return -1;
+ }
+ if ( mp3_frame_header[0] != 0xffu ) {
+ return -1; /* doesn't look like a sync word */
+ }
+ if ( (mp3_frame_header[1] & 0xE0u) != 0xE0u ) {
+ return -1; /* doesn't look like a sync word */
+ }
+ return 0;
+}
+
+static int
+skipId3v2(FILE * fpStream, size_t lametag_frame_size)
+{
+ size_t nbytes;
+ size_t id3v2TagSize = 0;
+ unsigned char id3v2Header[10];
+
+ /* seek to the beginning of the stream */
+ if (fseek(fpStream, 0, SEEK_SET) != 0) {
+ return -2; /* not seekable, abort */
+ }
+ /* read 10 bytes in case there's an ID3 version 2 header here */
+ nbytes = fread(id3v2Header, 1, sizeof(id3v2Header), fpStream);
+ if (nbytes != sizeof(id3v2Header)) {
+ return -3; /* not readable, maybe opened Write-Only */
+ }
+ /* does the stream begin with the ID3 version 2 file identifier? */
+ if (!strncmp((char *) id3v2Header, "ID3", 3)) {
+ /* the tag size (minus the 10-byte header) is encoded into four
+ * bytes where the most significant bit is clear in each byte
+ */
+ id3v2TagSize = (((id3v2Header[6] & 0x7f) << 21)
+ | ((id3v2Header[7] & 0x7f) << 14)
+ | ((id3v2Header[8] & 0x7f) << 7)
+ | (id3v2Header[9] & 0x7f))
+ + sizeof id3v2Header;
+ }
+ /* Seek to the beginning of the audio stream */
+ if ( fseek(fpStream, id3v2TagSize, SEEK_SET) != 0 ) {
+ return -2;
+ }
+ if ( maybeSyncWord(fpStream) != 0) {
+ return -1;
+ }
+ if ( fseek(fpStream, id3v2TagSize+lametag_frame_size, SEEK_SET) != 0 ) {
+ return -2;
+ }
+ if ( maybeSyncWord(fpStream) != 0) {
+ return -1;
+ }
+ /* OK, it seems we found our LAME-Tag/Xing frame again */
+ /* Seek to the beginning of the audio stream */
+ if ( fseek(fpStream, id3v2TagSize, SEEK_SET) != 0 ) {
+ return -2;
+ }
+ return 0;
+}
+
+static BE_ERR
+updateLameTagFrame(lame_global_flags* gfp, FILE* fpStream)
+{
+ size_t n = lame_get_lametag_frame( gfp, 0, 0 ); /* ask for bufer size */
+
+ if ( n > 0 )
+ {
+ unsigned char* buffer = 0;
+ size_t m = 1;
+
+ if ( 0 != skipId3v2(fpStream, n) )
+ {
+ DispErr( "Error updating LAME-tag frame:\n\n"
+ "can't locate old frame\n" );
+ return BE_ERR_INVALID_FORMAT_PARAMETERS;
+ }
+
+ buffer = malloc( n );
+
+ if ( buffer == 0 )
+ {
+ DispErr( "Error updating LAME-tag frame:\n\n"
+ "can't allocate frame buffer\n" );
+ return BE_ERR_INVALID_FORMAT_PARAMETERS;
+ }
+
+ /* Put it all to disk again */
+ n = lame_get_lametag_frame( gfp, buffer, n );
+ if ( n > 0 )
+ {
+ m = fwrite( buffer, n, 1, fpStream );
+ }
+ free( buffer );
+
+ if ( m != 1 )
+ {
+ DispErr( "Error updating LAME-tag frame:\n\n"
+ "couldn't write frame into file\n" );
+ return BE_ERR_INVALID_FORMAT_PARAMETERS;
+ }
+ }
+ return BE_ERR_SUCCESSFUL;
+}
+
+__declspec(dllexport) BE_ERR beWriteInfoTag( HBE_STREAM hbeStream,
+ LPCSTR lpszFileName )
+{
+ FILE* fpStream = NULL;
+ BE_ERR beResult = BE_ERR_SUCCESSFUL;
+
+ lame_global_flags* gfp = (lame_global_flags*)hbeStream;
+
+ if ( NULL != gfp )
+ {
+ // Do we have to write the VBR tag?
+ if ( lame_get_bWriteVbrTag( gfp ) )
+ {
+ // Try to open the file
+ fpStream=fopen( lpszFileName, "rb+" );
+
+ // Check file open result
+ if ( NULL == fpStream )
+ {
+ beResult = BE_ERR_INVALID_FORMAT_PARAMETERS;
+ DispErr( "Error updating LAME-tag frame:\n\n"
+ "can't open file for reading and writing\n" );
+ }
+ else
+ {
+ beResult = updateLameTagFrame( gfp, fpStream );
+
+ // Close the file stream
+ fclose( fpStream );
+ }
+ }
+
+ // clean up of allocated memory
+ lame_close( gfp );
+ }
+ else
+ {
+ beResult = BE_ERR_INVALID_FORMAT_PARAMETERS;
+ }
+
+ // return result
+ return beResult;
+}
+
+// for backwards compatiblity
+__declspec(dllexport) BE_ERR beWriteVBRHeader(LPCSTR lpszFileName)
+{
+ return beWriteInfoTag( (HBE_STREAM)gfp_save, lpszFileName );
+}
+
+
+BOOL APIENTRY DllMain(HANDLE hModule,
+ DWORD ul_reason_for_call,
+ LPVOID lpReserved)
+{
+ gs_hModule=hModule;
+
+ switch( ul_reason_for_call )
+ {
+ case DLL_PROCESS_ATTACH:
+ // Enable debug/logging?
+ gs_bLogFile = GetPrivateProfileIntA("Debug","WriteLogFile",gs_bLogFile,"lame_enc.ini");
+ break;
+ case DLL_THREAD_ATTACH:
+ break;
+ case DLL_THREAD_DETACH:
+ break;
+ case DLL_PROCESS_DETACH:
+ break;
+ }
+ return TRUE;
+}
+
+
+static void dump_config( lame_global_flags* gfp )
+{
+ DebugPrintf("\n\nLame_enc configuration options:\n");
+ DebugPrintf("==========================================================\n");
+
+ DebugPrintf("version =%d\n",lame_get_version( gfp ) );
+ DebugPrintf("Layer =3\n");
+ DebugPrintf("mode =");
+ switch ( lame_get_mode( gfp ) )
+ {
+ case STEREO: DebugPrintf( "Stereo\n" ); break;
+ case JOINT_STEREO: DebugPrintf( "Joint-Stereo\n" ); break;
+ case DUAL_CHANNEL: DebugPrintf( "Forced Stereo\n" ); break;
+ case MONO: DebugPrintf( "Mono\n" ); break;
+ case NOT_SET: /* FALLTROUGH */
+ default: DebugPrintf( "Error (unknown)\n" ); break;
+ }
+
+ DebugPrintf("Input sample rate =%.1f kHz\n", lame_get_in_samplerate( gfp ) /1000.0 );
+ DebugPrintf("Output sample rate =%.1f kHz\n", lame_get_out_samplerate( gfp ) /1000.0 );
+
+ DebugPrintf("bitrate =%d kbps\n", lame_get_brate( gfp ) );
+ DebugPrintf("Quality Setting =%d\n", lame_get_quality( gfp ) );
+
+ DebugPrintf("Low pass frequency =%d\n", lame_get_lowpassfreq( gfp ) );
+ DebugPrintf("Low pass width =%d\n", lame_get_lowpasswidth( gfp ) );
+
+ DebugPrintf("High pass frequency =%d\n", lame_get_highpassfreq( gfp ) );
+ DebugPrintf("High pass width =%d\n", lame_get_highpasswidth( gfp ) );
+
+ DebugPrintf("No short blocks =%d\n", lame_get_no_short_blocks( gfp ) );
+ DebugPrintf("Force short blocks =%d\n", lame_get_force_short_blocks( gfp ) );
+
+ DebugPrintf("de-emphasis =%d\n", lame_get_emphasis( gfp ) );
+ DebugPrintf("private flag =%d\n", lame_get_extension( gfp ) );
+
+ DebugPrintf("copyright flag =%d\n", lame_get_copyright( gfp ) );
+ DebugPrintf("original flag =%d\n", lame_get_original( gfp ) );
+ DebugPrintf("CRC =%s\n", lame_get_error_protection( gfp ) ? "on" : "off" );
+ DebugPrintf("Fast mode =%s\n", ( lame_get_quality( gfp ) )? "enabled" : "disabled" );
+ DebugPrintf("Force mid/side stereo =%s\n", ( lame_get_force_ms( gfp ) )?"enabled":"disabled" );
+ DebugPrintf("Disable Reservoir =%d\n", lame_get_disable_reservoir( gfp ) );
+ DebugPrintf("Allow diff-short =%d\n", lame_get_allow_diff_short( gfp ) );
+ DebugPrintf("Interchannel masking =%f\n", lame_get_interChRatio( gfp ) );
+ DebugPrintf("Strict ISO Encoding =%s\n", ( lame_get_strict_ISO( gfp ) ) ?"Yes":"No");
+ DebugPrintf("Scale =%5.2f\n", lame_get_scale( gfp ) );
+
+ DebugPrintf("VBR =%s, VBR_q =%d, VBR method =",
+ ( lame_get_VBR( gfp ) !=vbr_off ) ? "enabled": "disabled",
+ lame_get_VBR_q( gfp ) );
+
+ switch ( lame_get_VBR( gfp ) )
+ {
+ case vbr_off: DebugPrintf( "vbr_off\n" ); break;
+ case vbr_mt : DebugPrintf( "vbr_mt \n" ); break;
+ case vbr_rh : DebugPrintf( "vbr_rh \n" ); break;
+ case vbr_mtrh: DebugPrintf( "vbr_mtrh \n" ); break;
+ case vbr_abr:
+ DebugPrintf( "vbr_abr (average bitrate %d kbps)\n", lame_get_VBR_mean_bitrate_kbps( gfp ) );
+ break;
+ default:
+ DebugPrintf("error, unknown VBR setting\n");
+ break;
+ }
+
+ DebugPrintf("Vbr Min bitrate =%d kbps\n", lame_get_VBR_min_bitrate_kbps( gfp ) );
+ DebugPrintf("Vbr Max bitrate =%d kbps\n", lame_get_VBR_max_bitrate_kbps( gfp ) );
+
+ DebugPrintf("Write VBR Header =%s\n", ( lame_get_bWriteVbrTag( gfp ) ) ?"Yes":"No");
+ DebugPrintf("VBR Hard min =%d\n", lame_get_VBR_hard_min( gfp ) );
+
+ DebugPrintf("ATH Only =%d\n", lame_get_ATHonly( gfp ) );
+ DebugPrintf("ATH short =%d\n", lame_get_ATHshort( gfp ) );
+ DebugPrintf("ATH no =%d\n", lame_get_noATH( gfp ) );
+ DebugPrintf("ATH type =%d\n", lame_get_ATHtype( gfp ) );
+ DebugPrintf("ATH lower =%f\n", lame_get_ATHlower( gfp ) );
+ DebugPrintf("ATH aa =%d\n", lame_get_athaa_type( gfp ) );
+ DebugPrintf("ATH aa loudapprox =%d\n", lame_get_athaa_loudapprox( gfp ) );
+ DebugPrintf("ATH aa sensitivity =%f\n", lame_get_athaa_sensitivity( gfp ) );
+
+ DebugPrintf("Experimental nspsytune =%d\n", lame_get_exp_nspsytune( gfp ) );
+ DebugPrintf("Experimental X =%d\n", lame_get_experimentalX( gfp ) );
+ DebugPrintf("Experimental Y =%d\n", lame_get_experimentalY( gfp ) );
+ DebugPrintf("Experimental Z =%d\n", lame_get_experimentalZ( gfp ) );
+}
+
+
+static void DispErr(char const* strErr)
+{
+ MessageBoxA(NULL,strErr,"LAME_ENC.DLL",MB_OK|MB_ICONHAND);
+}
diff --git a/Dll/BladeMP3EncDLL.def b/Dll/BladeMP3EncDLL.def
new file mode 100644
index 0000000..4a83415
--- /dev/null
+++ b/Dll/BladeMP3EncDLL.def
@@ -0,0 +1,36 @@
+LIBRARY lame_enc.DLL
+EXPORTS
+
+beInitStream @1
+beEncodeChunk @2
+beDeinitStream @3
+beCloseStream @4
+beVersion @5
+beWriteVBRHeader @6
+beEncodeChunkFloatS16NI @7
+beFlushNoGap @8
+beWriteInfoTag @9
+
+lame_init @100
+lame_close @101
+lame_init_params @102
+lame_encode_buffer_interleaved @110
+lame_encode_flush @120
+lame_mp3_tags_fid @130
+
+
+lame_set_num_samples @1000
+lame_get_num_samples @1001
+lame_set_in_samplerate @1002
+lame_get_in_samplerate @1003
+lame_set_num_channels @1004
+lame_get_num_channels @1005
+lame_set_scale @1006
+lame_get_scale @1007
+lame_set_scale_left @1008
+lame_get_scale_left @1009
+lame_set_scale_right @1010
+lame_get_scale_right @1011
+lame_set_out_samplerate @1012
+lame_get_out_samplerate @1013
+
diff --git a/Dll/BladeMP3EncDLL.h b/Dll/BladeMP3EncDLL.h
new file mode 100644
index 0000000..5e94951
--- /dev/null
+++ b/Dll/BladeMP3EncDLL.h
@@ -0,0 +1,280 @@
+/*
+ * Blade Type of DLL Interface for Lame encoder
+ *
+ * Copyright (c) 1999-2002 A.L. Faber
+ * Based on bladedll.h version 1.0 written by Jukka Poikolainen
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the
+ * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
+ * Boston, MA 02111-1307, USA.
+ */
+
+#ifndef ___BLADEDLL_H_INCLUDED___
+#define ___BLADEDLL_H_INCLUDED___
+
+#ifdef __GNUC__
+#define ATTRIBUTE_PACKED __attribute__((packed))
+#else
+#define ATTRIBUTE_PACKED
+#pragma pack(push)
+#pragma pack(1)
+#endif
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+/* encoding formats */
+
+#define BE_CONFIG_MP3 0
+#define BE_CONFIG_LAME 256
+
+/* type definitions */
+
+typedef unsigned long HBE_STREAM;
+typedef HBE_STREAM *PHBE_STREAM;
+typedef unsigned long BE_ERR;
+
+/* error codes */
+
+#define BE_ERR_SUCCESSFUL 0x00000000
+#define BE_ERR_INVALID_FORMAT 0x00000001
+#define BE_ERR_INVALID_FORMAT_PARAMETERS 0x00000002
+#define BE_ERR_NO_MORE_HANDLES 0x00000003
+#define BE_ERR_INVALID_HANDLE 0x00000004
+#define BE_ERR_BUFFER_TOO_SMALL 0x00000005
+
+/* other constants */
+
+#define BE_MAX_HOMEPAGE 128
+
+/* format specific variables */
+
+#define BE_MP3_MODE_STEREO 0
+#define BE_MP3_MODE_JSTEREO 1
+#define BE_MP3_MODE_DUALCHANNEL 2
+#define BE_MP3_MODE_MONO 3
+
+
+
+#define MPEG1 1
+#define MPEG2 0
+
+#ifdef _BLADEDLL
+#undef FLOAT
+ #include <Windows.h>
+#endif
+
+#define CURRENT_STRUCT_VERSION 1
+#define CURRENT_STRUCT_SIZE sizeof(BE_CONFIG) // is currently 331 bytes
+
+
+typedef enum
+{
+ VBR_METHOD_NONE = -1,
+ VBR_METHOD_DEFAULT = 0,
+ VBR_METHOD_OLD = 1,
+ VBR_METHOD_NEW = 2,
+ VBR_METHOD_MTRH = 3,
+ VBR_METHOD_ABR = 4
+} VBRMETHOD;
+
+typedef enum
+{
+ LQP_NOPRESET =-1,
+
+ // QUALITY PRESETS
+ LQP_NORMAL_QUALITY = 0,
+ LQP_LOW_QUALITY = 1,
+ LQP_HIGH_QUALITY = 2,
+ LQP_VOICE_QUALITY = 3,
+ LQP_R3MIX = 4,
+ LQP_VERYHIGH_QUALITY = 5,
+ LQP_STANDARD = 6,
+ LQP_FAST_STANDARD = 7,
+ LQP_EXTREME = 8,
+ LQP_FAST_EXTREME = 9,
+ LQP_INSANE = 10,
+ LQP_ABR = 11,
+ LQP_CBR = 12,
+ LQP_MEDIUM = 13,
+ LQP_FAST_MEDIUM = 14,
+
+ // NEW PRESET VALUES
+ LQP_PHONE =1000,
+ LQP_SW =2000,
+ LQP_AM =3000,
+ LQP_FM =4000,
+ LQP_VOICE =5000,
+ LQP_RADIO =6000,
+ LQP_TAPE =7000,
+ LQP_HIFI =8000,
+ LQP_CD =9000,
+ LQP_STUDIO =10000
+
+} LAME_QUALITY_PRESET;
+
+
+
+typedef struct {
+ DWORD dwConfig; // BE_CONFIG_XXXXX
+ // Currently only BE_CONFIG_MP3 is supported
+ union {
+
+ struct {
+
+ DWORD dwSampleRate; // 48000, 44100 and 32000 allowed
+ BYTE byMode; // BE_MP3_MODE_STEREO, BE_MP3_MODE_DUALCHANNEL, BE_MP3_MODE_MONO
+ WORD wBitrate; // 32, 40, 48, 56, 64, 80, 96, 112, 128, 160, 192, 224, 256 and 320 allowed
+ BOOL bPrivate;
+ BOOL bCRC;
+ BOOL bCopyright;
+ BOOL bOriginal;
+
+ } mp3; // BE_CONFIG_MP3
+
+ struct
+ {
+ // STRUCTURE INFORMATION
+ DWORD dwStructVersion;
+ DWORD dwStructSize;
+
+ // BASIC ENCODER SETTINGS
+ DWORD dwSampleRate; // SAMPLERATE OF INPUT FILE
+ DWORD dwReSampleRate; // DOWNSAMPLERATE, 0=ENCODER DECIDES
+ LONG nMode; // BE_MP3_MODE_STEREO, BE_MP3_MODE_DUALCHANNEL, BE_MP3_MODE_MONO
+ DWORD dwBitrate; // CBR bitrate, VBR min bitrate
+ DWORD dwMaxBitrate; // CBR ignored, VBR Max bitrate
+ LONG nPreset; // Quality preset, use one of the settings of the LAME_QUALITY_PRESET enum
+ DWORD dwMpegVersion; // FUTURE USE, MPEG-1 OR MPEG-2
+ DWORD dwPsyModel; // FUTURE USE, SET TO 0
+ DWORD dwEmphasis; // FUTURE USE, SET TO 0
+
+ // BIT STREAM SETTINGS
+ BOOL bPrivate; // Set Private Bit (TRUE/FALSE)
+ BOOL bCRC; // Insert CRC (TRUE/FALSE)
+ BOOL bCopyright; // Set Copyright Bit (TRUE/FALSE)
+ BOOL bOriginal; // Set Original Bit (TRUE/FALSE)
+
+ // VBR STUFF
+ BOOL bWriteVBRHeader; // WRITE XING VBR HEADER (TRUE/FALSE)
+ BOOL bEnableVBR; // USE VBR ENCODING (TRUE/FALSE)
+ INT nVBRQuality; // VBR QUALITY 0..9
+ DWORD dwVbrAbr_bps; // Use ABR in stead of nVBRQuality
+ VBRMETHOD nVbrMethod;
+ BOOL bNoRes; // Disable Bit resorvoir (TRUE/FALSE)
+
+ // MISC SETTINGS
+ BOOL bStrictIso; // Use strict ISO encoding rules (TRUE/FALSE)
+ WORD nQuality; // Quality Setting, HIGH BYTE should be NOT LOW byte, otherwhise quality=5
+
+ // FUTURE USE, SET TO 0, align strucutre to 331 bytes
+ BYTE btReserved[255-4*sizeof(DWORD) - sizeof( WORD )];
+
+ } LHV1; // LAME header version 1
+
+ struct {
+
+ DWORD dwSampleRate;
+ BYTE byMode;
+ WORD wBitrate;
+ BYTE byEncodingMethod;
+
+ } aac;
+
+ } format;
+
+} BE_CONFIG, *PBE_CONFIG ATTRIBUTE_PACKED;
+
+
+typedef struct {
+
+ // BladeEnc DLL Version number
+
+ BYTE byDLLMajorVersion;
+ BYTE byDLLMinorVersion;
+
+ // BladeEnc Engine Version Number
+
+ BYTE byMajorVersion;
+ BYTE byMinorVersion;
+
+ // DLL Release date
+
+ BYTE byDay;
+ BYTE byMonth;
+ WORD wYear;
+
+ // BladeEnc Homepage URL
+
+ CHAR zHomepage[BE_MAX_HOMEPAGE + 1];
+
+ BYTE byAlphaLevel;
+ BYTE byBetaLevel;
+ BYTE byMMXEnabled;
+
+ BYTE btReserved[125];
+
+
+} BE_VERSION, *PBE_VERSION ATTRIBUTE_PACKED;
+
+#ifndef _BLADEDLL
+
+typedef BE_ERR (*BEINITSTREAM) (PBE_CONFIG, PDWORD, PDWORD, PHBE_STREAM);
+typedef BE_ERR (*BEENCODECHUNK) (HBE_STREAM, DWORD, PSHORT, PBYTE, PDWORD);
+
+// added for floating point audio -- DSPguru, jd
+typedef BE_ERR (*BEENCODECHUNKFLOATS16NI) (HBE_STREAM, DWORD, PFLOAT, PFLOAT, PBYTE, PDWORD);
+typedef BE_ERR (*BEDEINITSTREAM) (HBE_STREAM, PBYTE, PDWORD);
+typedef BE_ERR (*BECLOSESTREAM) (HBE_STREAM);
+typedef VOID (*BEVERSION) (PBE_VERSION);
+typedef BE_ERR (*BEWRITEVBRHEADER) (LPCSTR);
+typedef BE_ERR (*BEWRITEINFOTAG) (HBE_STREAM, LPCSTR );
+
+#define TEXT_BEINITSTREAM "beInitStream"
+#define TEXT_BEENCODECHUNK "beEncodeChunk"
+#define TEXT_BEENCODECHUNKFLOATS16NI "beEncodeChunkFloatS16NI"
+#define TEXT_BEDEINITSTREAM "beDeinitStream"
+#define TEXT_BECLOSESTREAM "beCloseStream"
+#define TEXT_BEVERSION "beVersion"
+#define TEXT_BEWRITEVBRHEADER "beWriteVBRHeader"
+#define TEXT_BEFLUSHNOGAP "beFlushNoGap"
+#define TEXT_BEWRITEINFOTAG "beWriteInfoTag"
+
+
+#else
+
+__declspec(dllexport) BE_ERR beInitStream(PBE_CONFIG pbeConfig, PDWORD dwSamples, PDWORD dwBufferSize, PHBE_STREAM phbeStream);
+__declspec(dllexport) BE_ERR beEncodeChunk(HBE_STREAM hbeStream, DWORD nSamples, PSHORT pSamples, PBYTE pOutput, PDWORD pdwOutput);
+
+// added for floating point audio -- DSPguru, jd
+__declspec(dllexport) BE_ERR beEncodeChunkFloatS16NI(HBE_STREAM hbeStream, DWORD nSamples, PFLOAT buffer_l, PFLOAT buffer_r, PBYTE pOutput, PDWORD pdwOutput);
+__declspec(dllexport) BE_ERR beDeinitStream(HBE_STREAM hbeStream, PBYTE pOutput, PDWORD pdwOutput);
+__declspec(dllexport) BE_ERR beCloseStream(HBE_STREAM hbeStream);
+__declspec(dllexport) VOID beVersion(PBE_VERSION pbeVersion);
+__declspec(dllexport) BE_ERR beWriteVBRHeader(LPCSTR lpszFileName);
+__declspec(dllexport) BE_ERR beFlushNoGap(HBE_STREAM hbeStream, PBYTE pOutput, PDWORD pdwOutput);
+__declspec(dllexport) BE_ERR beWriteInfoTag( HBE_STREAM hbeStream, LPCSTR lpszFileName );
+
+#endif
+
+#ifdef __cplusplus
+}
+#endif
+
+#ifndef __GNUC__
+#pragma pack(pop)
+#endif
+
+#endif
diff --git a/Dll/Example.cpp b/Dll/Example.cpp
new file mode 100644
index 0000000..fec7565
--- /dev/null
+++ b/Dll/Example.cpp
@@ -0,0 +1,288 @@
+/*
+ * LAME DLL Sample Code.
+ *
+ * Copyright (c) 2000 A.L. Faber
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the
+ * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
+ * Boston, MA 02111-1307, USA.
+ */
+
+
+#include <windows.h>
+#include <stdio.h>
+#include <io.h>
+#include <fcntl.h>
+#include <sys/stat.h>
+#include "BladeMP3EncDLL.h"
+
+BEINITSTREAM beInitStream=NULL;
+BEENCODECHUNK beEncodeChunk=NULL;
+BEDEINITSTREAM beDeinitStream=NULL;
+BECLOSESTREAM beCloseStream=NULL;
+BEVERSION beVersion=NULL;
+BEWRITEVBRHEADER beWriteVBRHeader=NULL;
+BEWRITEINFOTAG beWriteInfoTag=NULL;
+
+
+// Main program
+int main(int argc, char *argv[])
+{
+ HINSTANCE hDLL =NULL;
+ FILE* pFileIn =NULL;
+ FILE* pFileOut =NULL;
+ BE_VERSION Version ={0,};
+ BE_CONFIG beConfig ={0,};
+
+ CHAR strFileIn[255] ={'0',};
+ CHAR strFileOut[255] ={'0',};
+
+ DWORD dwSamples =0;
+ DWORD dwMP3Buffer =0;
+ HBE_STREAM hbeStream =0;
+ BE_ERR err =0;
+
+ PBYTE pMP3Buffer =NULL;
+ PSHORT pWAVBuffer =NULL;
+
+ // check number of arguments
+ if(argc != 2)
+ {
+ fprintf(stderr,"Usage: %s <filename.wav>\n", argv[0]);
+ fprintf(stderr,"Descr: Short demo to show how to use the lame_enc.dll library file\n");
+ fprintf(stderr,"Note : WAV file is assumed to to have the following parameters\n");
+ fprintf(stderr," : 44100 Hz, stereo, 16 Bits per sample\n");
+ return -1;
+ }
+
+ // Setup the file names
+ strcpy(strFileIn ,argv[1]);
+ strcpy(strFileOut,argv[1]);
+
+ // Add mp3 extention
+ strcat(strFileOut,".mp3");
+
+ // Load lame_enc.dll library (Make sure though that you set the
+ // project/settings/debug Working Directory correctly, otherwhise the DLL can't be loaded
+
+ hDLL = LoadLibrary("lame_enc.dll");
+
+ if ( NULL == hDLL )
+ {
+ hDLL = LoadLibrary("..\\..\\output\\lame_enc.dll");
+ }
+
+ if( NULL == hDLL )
+ {
+ fprintf(stderr,"Error loading lame_enc.DLL");
+ return -1;
+ }
+
+ // Get Interface functions from the DLL
+ beInitStream = (BEINITSTREAM) GetProcAddress(hDLL, TEXT_BEINITSTREAM);
+ beEncodeChunk = (BEENCODECHUNK) GetProcAddress(hDLL, TEXT_BEENCODECHUNK);
+ beDeinitStream = (BEDEINITSTREAM) GetProcAddress(hDLL, TEXT_BEDEINITSTREAM);
+ beCloseStream = (BECLOSESTREAM) GetProcAddress(hDLL, TEXT_BECLOSESTREAM);
+ beVersion = (BEVERSION) GetProcAddress(hDLL, TEXT_BEVERSION);
+ beWriteVBRHeader= (BEWRITEVBRHEADER) GetProcAddress(hDLL,TEXT_BEWRITEVBRHEADER);
+ beWriteInfoTag = (BEWRITEINFOTAG) GetProcAddress(hDLL,TEXT_BEWRITEINFOTAG);
+
+ // Check if all interfaces are present
+ if(!beInitStream || !beEncodeChunk || !beDeinitStream || !beCloseStream || !beVersion || !beWriteVBRHeader)
+ {
+ printf("Unable to get LAME interfaces");
+ return -1;
+ }
+
+ // Get the version number
+ beVersion( &Version );
+
+ printf(
+ "lame_enc.dll version %u.%02u (%u/%u/%u)\n"
+ "lame_enc Engine %u.%02u\n"
+ "lame_enc homepage at %s\n\n",
+ Version.byDLLMajorVersion, Version.byDLLMinorVersion,
+ Version.byDay, Version.byMonth, Version.wYear,
+ Version.byMajorVersion, Version.byMinorVersion,
+ Version.zHomepage);
+
+ // Try to open the WAV file, be sure to open it as a binary file!
+ pFileIn = fopen( strFileIn, "rb" );
+
+ // Check file open result
+ if(pFileIn == NULL)
+ {
+ fprintf(stderr,"Error opening %s", argv[1]);
+ return -1;
+ }
+
+ // Open MP3 file
+ pFileOut= fopen(strFileOut,"wb+");
+
+ // Check file open result
+ if(pFileOut == NULL)
+ {
+ fprintf(stderr,"Error creating file %s", strFileOut);
+ return -1;
+ }
+
+ memset(&beConfig,0,sizeof(beConfig)); // clear all fields
+
+ // use the LAME config structure
+ beConfig.dwConfig = BE_CONFIG_LAME;
+
+ // this are the default settings for testcase.wav
+ beConfig.format.LHV1.dwStructVersion = 1;
+ beConfig.format.LHV1.dwStructSize = sizeof(beConfig);
+ beConfig.format.LHV1.dwSampleRate = 44100; // INPUT FREQUENCY
+ beConfig.format.LHV1.dwReSampleRate = 0; // DON"T RESAMPLE
+ beConfig.format.LHV1.nMode = BE_MP3_MODE_JSTEREO; // OUTPUT IN STREO
+ beConfig.format.LHV1.dwBitrate = 128; // MINIMUM BIT RATE
+ beConfig.format.LHV1.nPreset = LQP_R3MIX; // QUALITY PRESET SETTING
+ beConfig.format.LHV1.dwMpegVersion = MPEG1; // MPEG VERSION (I or II)
+ beConfig.format.LHV1.dwPsyModel = 0; // USE DEFAULT PSYCHOACOUSTIC MODEL
+ beConfig.format.LHV1.dwEmphasis = 0; // NO EMPHASIS TURNED ON
+ beConfig.format.LHV1.bOriginal = TRUE; // SET ORIGINAL FLAG
+ beConfig.format.LHV1.bWriteVBRHeader = TRUE; // Write INFO tag
+
+// beConfig.format.LHV1.dwMaxBitrate = 320; // MAXIMUM BIT RATE
+// beConfig.format.LHV1.bCRC = TRUE; // INSERT CRC
+// beConfig.format.LHV1.bCopyright = TRUE; // SET COPYRIGHT FLAG
+// beConfig.format.LHV1.bPrivate = TRUE; // SET PRIVATE FLAG
+// beConfig.format.LHV1.bWriteVBRHeader = TRUE; // YES, WRITE THE XING VBR HEADER
+// beConfig.format.LHV1.bEnableVBR = TRUE; // USE VBR
+// beConfig.format.LHV1.nVBRQuality = 5; // SET VBR QUALITY
+ beConfig.format.LHV1.bNoRes = TRUE; // No Bit resorvoir
+
+// Preset Test
+// beConfig.format.LHV1.nPreset = LQP_PHONE;
+
+ // Init the MP3 Stream
+ err = beInitStream(&beConfig, &dwSamples, &dwMP3Buffer, &hbeStream);
+
+ // Check result
+ if(err != BE_ERR_SUCCESSFUL)
+ {
+ fprintf(stderr,"Error opening encoding stream (%lu)", err);
+ return -1;
+ }
+
+
+ // Allocate MP3 buffer
+ pMP3Buffer = new BYTE[dwMP3Buffer];
+
+ // Allocate WAV buffer
+ pWAVBuffer = new SHORT[dwSamples];
+
+ // Check if Buffer are allocated properly
+ if(!pMP3Buffer || !pWAVBuffer)
+ {
+ printf("Out of memory");
+ return -1;
+ }
+
+ DWORD dwRead=0;
+ DWORD dwWrite=0;
+ DWORD dwDone=0;
+ DWORD dwFileSize=0;
+
+ // Seek to end of file
+ fseek(pFileIn,0,SEEK_END);
+
+ // Get the file size
+ dwFileSize=ftell(pFileIn);
+
+ // Seek back to start of WAV file,
+ // but skip the first 44 bytes, since that's the WAV header
+ fseek(pFileIn,44,SEEK_SET);
+
+
+ // Convert All PCM samples
+ while ( (dwRead=fread(pWAVBuffer,sizeof(SHORT),dwSamples,pFileIn)) >0 )
+ {
+ // Encode samples
+ err = beEncodeChunk(hbeStream, dwRead, pWAVBuffer, pMP3Buffer, &dwWrite);
+
+ // Check result
+ if(err != BE_ERR_SUCCESSFUL)
+ {
+ beCloseStream(hbeStream);
+ fprintf(stderr,"beEncodeChunk() failed (%lu)", err);
+ return -1;
+ }
+
+ // write dwWrite bytes that are returned in tehe pMP3Buffer to disk
+ if(fwrite(pMP3Buffer,1,dwWrite,pFileOut) != dwWrite)
+ {
+ fprintf(stderr,"Output file write error");
+ return -1;
+ }
+
+ dwDone += dwRead*sizeof(SHORT);
+
+ printf("Done: %0.2f%% \r", 100 * (float)dwDone/(float)(dwFileSize));
+ }
+
+ // Deinit the stream
+ err = beDeinitStream(hbeStream, pMP3Buffer, &dwWrite);
+
+ // Check result
+ if(err != BE_ERR_SUCCESSFUL)
+ {
+
+ beCloseStream(hbeStream);
+ fprintf(stderr,"beExitStream failed (%lu)", err);
+ return -1;
+ }
+
+ // Are there any bytes returned from the DeInit call?
+ // If so, write them to disk
+ if( dwWrite )
+ {
+ if( fwrite( pMP3Buffer, 1, dwWrite, pFileOut ) != dwWrite )
+ {
+ fprintf(stderr,"Output file write error");
+ return -1;
+ }
+ }
+
+ // close the MP3 Stream
+ beCloseStream( hbeStream );
+
+ // Delete WAV buffer
+ delete [] pWAVBuffer;
+
+ // Delete MP3 Buffer
+ delete [] pMP3Buffer;
+
+ // Close input file
+ fclose( pFileIn );
+
+ // Close output file
+ fclose( pFileOut );
+
+ if ( beWriteInfoTag )
+ {
+ // Write the INFO Tag
+ beWriteInfoTag( hbeStream, strFileOut );
+ }
+ else
+ {
+ beWriteVBRHeader( strFileOut );
+ }
+
+ // Were done, return OK result
+ return 0;
+}
+
diff --git a/Dll/Example_vc6.dsp b/Dll/Example_vc6.dsp
new file mode 100644
index 0000000..a64bdc6
--- /dev/null
+++ b/Dll/Example_vc6.dsp
@@ -0,0 +1,90 @@
+# Microsoft Developer Studio Project File - Name="Example" - Package Owner=<4>
+# Microsoft Developer Studio Generated Build File, Format Version 6.00
+# ** NICHT BEARBEITEN **
+
+# TARGTYPE "Win32 (x86) Console Application" 0x0103
+
+CFG=Example - Win32 Debug
+!MESSAGE Dies ist kein gültiges Makefile. Zum Erstellen dieses Projekts mit NMAKE
+!MESSAGE verwenden Sie den Befehl "Makefile exportieren" und führen Sie den Befehl
+!MESSAGE
+!MESSAGE NMAKE /f "Example_vc6.mak".
+!MESSAGE
+!MESSAGE Sie können beim Ausführen von NMAKE eine Konfiguration angeben
+!MESSAGE durch Definieren des Makros CFG in der Befehlszeile. Zum Beispiel:
+!MESSAGE
+!MESSAGE NMAKE /f "Example_vc6.mak" CFG="Example - Win32 Debug"
+!MESSAGE
+!MESSAGE Für die Konfiguration stehen zur Auswahl:
+!MESSAGE
+!MESSAGE "Example - Win32 Release" (basierend auf "Win32 (x86) Console Application")
+!MESSAGE "Example - Win32 Debug" (basierend auf "Win32 (x86) Console Application")
+!MESSAGE
+
+# Begin Project
+# PROP AllowPerConfigDependencies 0
+# PROP Scc_ProjName ""
+# PROP Scc_LocalPath ""
+CPP=cl.exe
+RSC=rc.exe
+
+!IF "$(CFG)" == "Example - Win32 Release"
+
+# PROP BASE Use_MFC 0
+# PROP BASE Use_Debug_Libraries 0
+# PROP BASE Output_Dir "Release"
+# PROP BASE Intermediate_Dir "Release"
+# PROP BASE Target_Dir ""
+# PROP Use_MFC 0
+# PROP Use_Debug_Libraries 0
+# PROP Output_Dir "..\output\release"
+# PROP Intermediate_Dir "..\obj\release\example"
+# PROP Ignore_Export_Lib 0
+# PROP Target_Dir ""
+# ADD BASE CPP /nologo /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_CONSOLE" /D "_MBCS" /YX /FD /c
+# ADD CPP /nologo /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_CONSOLE" /D "_MBCS" /YX /FD /c
+# ADD BASE RSC /l 0x409 /d "NDEBUG"
+# ADD RSC /l 0x409 /d "NDEBUG"
+BSC32=bscmake.exe
+# ADD BASE BSC32 /nologo
+# ADD BSC32 /nologo
+LINK32=link.exe
+# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:console /machine:I386
+# ADD LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:console /machine:I386 /libpath:"..\output\release"
+
+!ELSEIF "$(CFG)" == "Example - Win32 Debug"
+
+# PROP BASE Use_MFC 0
+# PROP BASE Use_Debug_Libraries 1
+# PROP BASE Output_Dir "Debug"
+# PROP BASE Intermediate_Dir "Debug"
+# PROP BASE Target_Dir ""
+# PROP Use_MFC 0
+# PROP Use_Debug_Libraries 1
+# PROP Output_Dir "..\output\debug"
+# PROP Intermediate_Dir "..\obj\debug\example"
+# PROP Ignore_Export_Lib 0
+# PROP Target_Dir ""
+# ADD BASE CPP /nologo /W3 /Gm /GX /Zi /Od /D "WIN32" /D "_DEBUG" /D "_CONSOLE" /D "_MBCS" /YX /FD /c
+# ADD CPP /nologo /W3 /Gm /GX /ZI /Od /D "WIN32" /D "_DEBUG" /D "_CONSOLE" /D "_MBCS" /YX /FD /c
+# ADD BASE RSC /l 0x409 /d "_DEBUG"
+# ADD RSC /l 0x409 /d "_DEBUG"
+BSC32=bscmake.exe
+# ADD BASE BSC32 /nologo
+# ADD BSC32 /nologo
+LINK32=link.exe
+# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:console /debug /machine:I386 /pdbtype:sept
+# ADD LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:console /debug /machine:I386 /pdbtype:sept /libpath:"..\output\debug"
+
+!ENDIF
+
+# Begin Target
+
+# Name "Example - Win32 Release"
+# Name "Example - Win32 Debug"
+# Begin Source File
+
+SOURCE=.\Example.cpp
+# End Source File
+# End Target
+# End Project
diff --git a/Dll/Example_vc6.dsw b/Dll/Example_vc6.dsw
new file mode 100644
index 0000000..75d8332
--- /dev/null
+++ b/Dll/Example_vc6.dsw
@@ -0,0 +1,74 @@
+Microsoft Developer Studio Workspace File, Format Version 6.00
+# WARNING: DO NOT EDIT OR DELETE THIS WORKSPACE FILE!
+
+###############################################################################
+
+Project: "Example"=.\Example_vc6.dsp - Package Owner=<4>
+
+Package=<5>
+{{{
+}}}
+
+Package=<4>
+{{{
+ Begin Project Dependency
+ Project_Dep_Name LameMp3EncDll
+ End Project Dependency
+}}}
+
+###############################################################################
+
+Project: "LameMp3EncDll"=.\LameDll_vc6.dsp - Package Owner=<4>
+
+Package=<5>
+{{{
+}}}
+
+Package=<4>
+{{{
+ Begin Project Dependency
+ Project_Dep_Name libmp3lame
+ End Project Dependency
+ Begin Project Dependency
+ Project_Dep_Name mpglib
+ End Project Dependency
+}}}
+
+###############################################################################
+
+Project: "libmp3lame"=..\libmp3lame\libmp3lame_vc6.dsp - Package Owner=<4>
+
+Package=<5>
+{{{
+}}}
+
+Package=<4>
+{{{
+}}}
+
+###############################################################################
+
+Project: "mpglib"=..\mpglib\mpglib_vc6.dsp - Package Owner=<4>
+
+Package=<5>
+{{{
+}}}
+
+Package=<4>
+{{{
+}}}
+
+###############################################################################
+
+Global:
+
+Package=<5>
+{{{
+}}}
+
+Package=<3>
+{{{
+}}}
+
+###############################################################################
+
diff --git a/Dll/LameDLLInterface.htm b/Dll/LameDLLInterface.htm
new file mode 100644
index 0000000..a9f2add
--- /dev/null
+++ b/Dll/LameDLLInterface.htm
@@ -0,0 +1,742 @@
+<html>
+
+<head>
+<meta http-equiv="Content-Type"
+content="text/html; charset=iso-8859-1">
+<meta name="GENERATOR" content="Microsoft FrontPage Express 2.0">
+<title>Lame-</title>
+</head>
+
+<body bgcolor="#FFFFFF">
+
+<p align="center">&nbsp; </p>
+
+<p align="center"><font size="7">Lame-enc DLL</font> <br>
+<font size="5">Interface version 1.32</font> (and above)<br>
+(Lame engine version: 3.93 or higher) <br>
+<font size="6">Programmers Manual</font></p>
+
+<p align="center"><i>The lame_enc.dll and this manual is
+copyright by Albert L Faber<br>
+Originally the the DLL interface is modeled after the BladeEnc
+DLL interface<br>
+which is copyrighted by Tord Jansson and Jukka Poikolainen<br>
+This document and the DLL interface may be distributed freely</i>
+<br>
+<i>as long as modifications are released under the LGPL license.</i>
+</p>
+
+<p align="center">&nbsp; </p>
+
+<p align="center"><b>Homepage</b>: <a
+href="http://www.cdex.n3.net">http://www.cdex.n3.net</a><br>
+<b>E-mail:</b> mailto: <a
+href="mailto:afaber@users.sourceforge.net">afaber@users.sourceforge.net</a>
+</p>
+
+<p><br>
+<br>
+<br>
+<br>
+</p>
+
+<p><font size="5">Distribution</font> </p>
+
+<p>People and companies&nbsp; who wants to distribute
+lame_enc.dll with their commercial products are free to do so as
+far as I'm concerned (LGPL license), but should be aware that
+lame_enc.dll might infringe certain MP3 related software patents
+held by Fraunhofer IIS in certain countries. </p>
+
+<p><br>
+&nbsp; </p>
+
+<p><font size="5">Disclaimer</font> </p>
+
+<p>lame_enc.dll and this manual is distributed 'as is' with no
+warranty of any kind. The Author is not to be held responsible
+for the result of any use or misuse of this product. <br>
+&nbsp; <br>
+&nbsp; </p>
+
+<p><font size="5">Current Bugs and Limitations</font> </p>
+
+<p>Although the interface is designed to be able to handle
+multiple parallel streams it can't be done yet due to limitations
+in the engine, only one stream is allowed. <br>
+&nbsp; </p>
+
+<p><font size="5">Future Compatibility</font> </p>
+
+<p>This interface should be compatible with all future versions
+of lame_enc.DLL without any need to recompile your programs. You
+should therefore <b>not</b> check the version number upon start
+and prevent users from running your program with a later version
+of lame_enc.DLL. <br>
+&nbsp; </p>
+
+<hr>
+
+<p><font size="5">How to use the DLL</font> </p>
+
+<p>1. Fill in a <a href="#The BE_CONFIG Structure">BE_CONFIG </a>structure
+and send it to <a href="#beInitStream()">beInitStream()</a>. Make
+sure that BE_ERR_SUCCESSFUL is returned. </p>
+
+<p>2. Reserve at least the amount of memory returned in
+dwBufferSize as your output buffer. </p>
+
+<p>3. Call <a href="#beEncodeChunk()">beEncodeChunk()</a> until
+you've encoded everything you want. </p>
+
+<p>4. Call <a href="#beDeinitStream()">beDeinitStream()</a> to
+make sure that all encoded data is flushed out before closing the
+stream. </p>
+
+<p>5. Close the stream using <a href="#beCloseStream()">beCloseStream()
+</a></p>
+
+<p>6. Finally, call the <a href="#beWriteVBRHeader()">beWriteVBRHeader()</a>
+functions, to insert the INFO tag MP3 Header. This is an
+extension of the Xing VBR tag which is also used for CBR
+encodings. This call can only be omitted if the INFO tag was
+explicilty disabled in the BE_CONFIG Structure.</p>
+
+<p>A handy feature is the available <a
+href="#Lame_enc.dll debug option">Lame_enc.dll debug option</a>,
+which will dump the important lame internal settings to a text
+file.<br>
+&nbsp; </p>
+
+<p>&nbsp;</p>
+
+<p><font size="5">Return Values</font> </p>
+
+<p>See the header-file for a complete list of function return
+values. All functions should return BE_ERR_SUCCESSFUL unless
+something went wrong. <br>
+&nbsp; </p>
+
+<hr>
+
+<h1><a name="Type definitions"><font size="5">Type definitions</font></a></h1>
+
+<p>The DLL is by default compiled with the MS Visual C/C++
+compiler, which has the following type definitions:</p>
+
+<table border="0">
+ <tr>
+ <td>Type </td>
+ <td>Description</td>
+ </tr>
+ <tr>
+ <td>CHAR</td>
+ <td>signed char (8 bits)</td>
+ </tr>
+ <tr>
+ <td>BYTE</td>
+ <td>unsigned char (8 bits)</td>
+ </tr>
+ <tr>
+ <td>SHORT</td>
+ <td>signed short (16 bits)</td>
+ </tr>
+ <tr>
+ <td>WORD</td>
+ <td>unsigned short (16 bits)</td>
+ </tr>
+ <tr>
+ <td>INT</td>
+ <td>signed long (32 bits)</td>
+ </tr>
+ <tr>
+ <td>LONG</td>
+ <td>signed long (32 bits)</td>
+ </tr>
+ <tr>
+ <td>BOOL</td>
+ <td>signed long (32 bits) (YES, 32 bits for a one bit
+ value)<br>
+ TRUE = 0<br>
+ FALSE=-1</td>
+ </tr>
+ <tr>
+ <td>DWORD</td>
+ <td>unsigned long (32 bits)</td>
+ </tr>
+ <tr>
+ <td>FLOAT</td>
+ <td>floating point (32 bits)</td>
+ </tr>
+ <tr>
+ <td>DOUBLE</td>
+ <td>float point (64 bits)</td>
+ </tr>
+ <tr>
+ <td>LPCSTR</td>
+ <td>const char* (32 bits pointer to zero terminated
+ character string)</td>
+ </tr>
+</table>
+
+<p>Within the lame_enc.dll All the structure elements are one
+byte alligned (due to backwards compatibility with BladEnc.DLL!</p>
+
+<p>&nbsp;</p>
+
+<hr>
+
+<h1><a name="The BE_CONFIG Structure"><font size="5">The
+BE_CONFIG Structure </font></a></h1>
+
+<p><font size="3">Currently there the BE_CONFIG structure has to
+varians, the old MP3 config structure that is truly compatible
+with the old BladeEnc interface, and the new defined LHV1
+structure, which can set far more options in the lame encoder</font></p>
+
+<p>&nbsp;</p>
+
+<h2><font size="5">The MP3 BE_CONFIG - structure (OBSOLETE)</font></h2>
+
+<p>This is the old structure as it was originally defined by the
+BladeEnc.DLL interface. However, I do highly recommend to use the
+new Lame specific config structure, since it gives you more
+control over the Lame encoder settings.</p>
+
+<p>These are the members of the BE_CONFIG structure you need to
+fill in before you call beInitStream(): <br>
+&nbsp; </p>
+
+<table border="0">
+ <tr>
+ <td><b>dwConfig</b></td>
+ <td>Specifies what kind of output you want. Since only
+ MP3 currently is supported you must set this to <b>BE_CONFIG_MP3</b></td>
+ </tr>
+ <tr>
+ <td><b>format.mp3.dwSampleRate</b>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</td>
+ <td>Samplerate in Hz for MP3 file. This can be set to
+ either <b>32000</b>, <b>44100</b> or <b>48000</b>.</td>
+ </tr>
+ <tr>
+ <td><b>format.mp3.byMode</b></td>
+ <td>Stereomode for MP3 file. This can be either <b>BE_MP3_MODE_STEREO</b>,
+ <b>BE_MP3_MODE_DUALCHANNEL</b> or <b>BE_MP3_MODE_MONO.</b></td>
+ </tr>
+ <tr>
+ <td><b>format.mp3.bitrate</b></td>
+ <td>Bitrate (i.e. size) of MP3 file in kBit/s. Allowed
+ bitrates are: <b>32, 40, 48, 56, 64, 80, 96, 112, 128,
+ 160, 192, 224, 256</b> and <b>320</b>.</td>
+ </tr>
+ <tr>
+ <td><b>format.mp3.bCopyright</b></td>
+ <td>If this is set to TRUE the Copyright bit in the MP3
+ stream will be set.</td>
+ </tr>
+ <tr>
+ <td><b>format.mp3.bCRC</b></td>
+ <td>Set this to TRUE in order to enable CRC-checksum in
+ the bitstream.</td>
+ </tr>
+ <tr>
+ <td><b>format.mp3.bOriginal</b></td>
+ <td>If this is set to TRUE the Original bit in the MP3
+ stream will be set.</td>
+ </tr>
+ <tr>
+ <td><b>format.mp3.bPrivate</b></td>
+ <td>If this is set to TRUE the Private bit in the MP3
+ stream will be set.</td>
+ </tr>
+</table>
+
+<p>&nbsp;</p>
+
+<h2><font size="5">The LHV1 BE_CONFIG - structure (recommended)</font></h2>
+
+<p>These are the members of the LHV1 BE_CONFIG structure, you
+need to fill in before you call beInitStream(): <br>
+</p>
+
+<table border="0">
+ <tr>
+ <td><b>dwConfig</b></td>
+ <td>Specifies what kind of output you want. Since only
+ MP3 currently is supported you must set this to <b>BE_CONFIG_LAME</b></td>
+ </tr>
+ <tr>
+ <td>&nbsp;</td>
+ <td>&nbsp;</td>
+ </tr>
+ <tr>
+ <td><b>format.LHV1.dwStructVersion</b></td>
+ <td>Indicates the version number of the structure,
+ current version number is 1</td>
+ </tr>
+ <tr>
+ <td><b>format.LHV1.dwStructSize</b></td>
+ <td>Specifies the size of the BE_CONFIG structure
+ (currently 331 bytes)</td>
+ </tr>
+ <tr>
+ <td>&nbsp;</td>
+ <td>&nbsp;</td>
+ </tr>
+ <tr>
+ <td><b>format.LHV1.dwSampleRate</b>&nbsp;</td>
+ <td>Samplerate in Hz for MP3 file. This can be set to
+ either:<br>
+ <b>32000</b>, <b>44100</b> or <b>48000</b> for MPEG-I<br>
+ <b>16000</b>, <b>22050</b> or <b>24000</b> for MPEG-I<br>
+ <b>8000</b>, <b>11025</b> or <b>12000</b> for MPEG-II.5</td>
+ </tr>
+ <tr>
+ <td><b>format.LHV1.dwReSampleRate</b></td>
+ <td>Specifies to which sample rate the input stream has
+ to be resampled, if set to 0, the encoder will decide
+ which ReSample rate to use</td>
+ </tr>
+ <tr>
+ <td><b>format.LHV1.nMode</b></td>
+ <td>Stereomode for MP3 file. This can be either <b>BE_MP3_MODE_STEREO</b>,
+ <b>BE_MP3_MODE_JSTEREO, BE_MP3_MODE_DUALCHANNEL</b> or <b>BE_MP3_MODE_MONO.</b></td>
+ </tr>
+ <tr>
+ <td><strong>format.LHV1.dwBitrate</strong></td>
+ <td>For CBR, this specifies the actual bitrate, for VBR,
+ it specifies the minimum bitrate<br>
+ Allowed bitrates are: <b>32, 40, 48, 56, 64, 80, 96, 112,
+ 128, 160, 192, 224, 256</b> and <b>320</b>.for MPEG-I<br>
+ Allowed bitrates are: <b>8, 16, 24, 32, 40, 48, 56, 64,
+ 80, 96, 112, 128, 144 </b>and<b> 160</b>.for MPEG-II<p><strong>Note:</strong>
+ dwBitrate is used as the minimum bitrate in the case of
+ using a VBR mode.</p>
+ </td>
+ </tr>
+ <tr>
+ <td><strong>format.LHV1.dwMaxBitrate</strong></td>
+ <td>When VBR mode is enabled, it specifies the maximum
+ allowed bitrate (see also dwBitrate to specify the minium
+ bitrate), for CBR mode this setting is ignored.</td>
+ </tr>
+ <tr>
+ <td><strong>format.LHV1.nPreset</strong></td>
+ <td>Keep in mind that the presets can overwrite some of
+ the other settings, since it is called right before the
+ encoder is initialized<br>
+ <table border="0">
+ <tr>
+ <td>The nPreset option can be set to one of the
+ following presets values::</td>
+ </tr>
+ </table>
+ <p>LQP_NOPRESET (don't use any presets)<br>
+ LQP_NORMAL_QUALITY (quality is set to 5)<br>
+ LQP_LOW_QUALITY (quality is set to 9)<br>
+ LQP_HIGH_QUALITY (quality is set to 2)<br>
+ LQP_VOICE_QUALITY (use for voice encoding)<br>
+ LQP_R3MIX (r3mix preset option)<br>
+ LQP_VERYHIGH_QUALITY (quality is set to 0)<br>
+ LQP_STANDARD (lame command line alt-preset standard)<br>
+ LQP_FAST_STANDARD (lame command line alt-preset fast
+ standard)<br>
+ LQP_EXTREME (lame command line alt-preset extreme)<br>
+ LQP_FAST_EXTREME (lame command line alt-preset fast
+ extreme)<br>
+ LQP_INSANE (lame command line alt-preset insane)<br>
+ LQP_ABR (lame command line alt-preset abr)<br>
+ LQP_CBR(lame command line alt-preset cbr)<br>
+ <br>
+ <strong>(old lame preset options)</strong><br>
+ LQP_PHONE <br>
+ LQP_SW<br>
+ LQP_AM<br>
+ LQP_FM<br>
+ LQP_VOICE<br>
+ LQP_RADIO<br>
+ LQP_TAPE<br>
+ LQP_HIFI<br>
+ LQP_CD<br>
+ LQP_STUDIO</p>
+ </td>
+ </tr>
+ <tr>
+ <td>&nbsp;</td>
+ </tr>
+ <tr>
+ <td><b>format.LHV1.bCopyright</b></td>
+ <td>If this is set to TRUE the Copyright bit in the MP3
+ stream will be set.</td>
+ </tr>
+ <tr>
+ <td><b>format.LHV1.bCRC</b></td>
+ <td>Set this to TRUE in order to enable CRC-checksum in
+ the bitstream.</td>
+ </tr>
+ <tr>
+ <td><b>format.LHV1.bOriginal</b></td>
+ <td>If this is set to TRUE the Original bit in the MP3
+ stream will be set.</td>
+ </tr>
+ <tr>
+ <td><b>format.LHV1.bPrivate</b></td>
+ <td>If this is set to TRUE the Private bit in the MP3
+ stream will be set.</td>
+ </tr>
+ <tr>
+ <td>&nbsp;</td>
+ <td>&nbsp;</td>
+ </tr>
+ <tr>
+ <td><strong>format.LHV1.nVbrMethod</strong></td>
+ <td>Sepecifes if the VBR method to use, currently the
+ following settings are supported:<p><font size="3">VBR_METHOD_NONE
+ (don't use VBR, use CBR encoding instead),<br>
+ VBR_METHOD_DEFAULT (default VBR method)<br>
+ VBR_METHOD_OLD (old VBR method, proven to be reliable)<br>
+ VBR_METHOD_NEW (new VBR method, faster than
+ VBR_METHOD_OLD)<br>
+ VBR_METHOD_MTRH (depreciated, same as VBR_METHOD_NEW)<br>
+ VBR_METHOD_ABR (Average Bitrate Encoding, see also </font><strong>format.LHV1.dwVbrAbr_bps</strong><font
+ size="3">)</font></p>
+ </td>
+ </tr>
+ <tr>
+ <td><strong>format.LHV1.bWriteVBRHeader</strong></td>
+ <td>Sepecifes if the a XING VBR header should be written
+ or not. When this option is enabled, you have to call the
+ <font size="3">beWriteVBRHeader function when encoding
+ has been completed. Keep in mind that the VBR info tag
+ can also be written for CBR encoded files, the TAG info
+ can be useful for additional info like encoder delay and
+ the like.</font></td>
+ </tr>
+ <tr>
+ <td><strong>format.LHV1.bEnableVBR</strong></td>
+ <td>Specifies if VBR encoding option shall be used or
+ not, possible values are TRUE/FALSE</td>
+ </tr>
+ <tr>
+ <td><strong>format.LHV1.nVBRQuality</strong></td>
+ <td>Quality option if VBR is enabled (0=highest quality,
+ 9 is lowest quality)</td>
+ </tr>
+ <tr>
+ <td><strong>format.LHV1.dwVbrAbr_bps</strong></td>
+ <td>If the Average Bit Rate is specified, the lame
+ encoder ignores the nVBRQuality settings (However, <strong>bEnableVBR</strong>
+ must be set to TRUE and the <strong>format.LHV1.nVbrMethod
+ </strong>parameter should be set to<strong> </strong><font
+ size="3"><strong>VBR_METHOD_ABR</strong>). The allowed
+ range for the </font><strong>format.LHV1.dwVbrAbr_bps </strong>parameter<strong>
+ </strong>any integer value <font size="3">between:</font><p><strong>MPEG-I:</strong>
+ 32000 .. 320000 bps<b><br>
+ </b><strong>MPEG-II:</strong> 8000 .. 160000 bps</p>
+ </td>
+ </tr>
+ <tr>
+ <td>&nbsp;</td>
+ <td>&nbsp;</td>
+ </tr>
+ <tr>
+ <td><strong>format.LHV1.bNoBitRes</strong></td>
+ <td>Disables the bit-resorvoir and disables the insertion
+ of padded frames</td>
+ </tr>
+ <tr>
+ <td><strong>format.LHV1.nQuality</strong></td>
+ <td>Quality Setting, HIGH BYTE should be NOT LOW byte,
+ otherwhise quality is set to 5. This is done to be
+ backward compatible. So to set quality to 3, you have to
+ set the nQuality parameter to 0xFC03.</td>
+ </tr>
+ <tr>
+ <td><b>format.mp3.btReserved</b></td>
+ <td>For future use, set all elements to zero</td>
+ </tr>
+</table>
+
+<p>&nbsp;</p>
+
+<p>&nbsp; </p>
+
+<hr>
+
+<h1><a name="beInitStream()"><font size="5">beInitStream()</font></a>
+</h1>
+
+<table border="0" cellspacing="16" width="100%">
+ <tr>
+ <td valign="top" width="20%"><b>Synopsis:</b></td>
+ <td valign="top" width="80%">BE_ERR beInitStream(
+ PBE_CONFIG <i>pbeConfig</i>, PDWORD <i>dwSamples</i>,
+ PDWORD <i>dwBufferSize</i>, PHBE_STREAM <i>phbeStream</i>
+ )</td>
+ </tr>
+ <tr>
+ <td valign="top" width="20%"><b>Parameters:</b></td>
+ <td valign="top" width="80%"><table border="0"
+ cellspacing="10" width="100%">
+ <tr>
+ <td valign="top" width="20%"><i>pbeConfig</i></td>
+ <td>Pointer at the struct containing encoder
+ settings.</td>
+ </tr>
+ <tr>
+ <td valign="top"><i>dwSamples</i></td>
+ <td>Pointer at double word where number of
+ samples to send to each <i>beEncodeChunk()</i> is
+ returned.</td>
+ </tr>
+ <tr>
+ <td valign="top"><i>dwBufferSize</i></td>
+ <td>Pointer at double word where minimum size in
+ bytes of output buffer is returned.</td>
+ </tr>
+ <tr>
+ <td valign="top"><i>phbeStream</i></td>
+ <td>Pointer at integer where Stream handle is
+ returned.</td>
+ </tr>
+ </table>
+ </td>
+ </tr>
+ <tr>
+ <td valign="top" width="20%"><b>Description:</b></td>
+ <td valign="top" width="80%">This function is the first
+ to call before starting an encoding stream.</td>
+ </tr>
+</table>
+
+<hr>
+
+<h1><a name="beEncodeChunk()"><font size="5">beEncodeChunk()</font>
+</a></h1>
+
+<table border="0" cellspacing="16" width="100%">
+ <tr>
+ <td valign="top" width="20%"><b>Synopsis:</b></td>
+ <td valign="top" width="80%">BE_ERR beEncodeChunk(
+ HBE_STREAM <i>hbeStream</i>, DWORD <i>nSamples</i>,
+ PSHORT <i>pSamples</i>, PBYTE <i>pOutput</i>, PDWORD <i>pdwOutput</i>
+ )</td>
+ </tr>
+ <tr>
+ <td valign="top" width="20%"><b>Parameters:</b></td>
+ <td valign="top"><table border="0" cellspacing="10"
+ width="100%">
+ <tr>
+ <td valign="top" width="20%"><i>hbeStream</i></td>
+ <td width="80%">Handle of the stream.</td>
+ </tr>
+ <tr>
+ <td valign="top" width="90"><i>nSamples</i></td>
+ <td>Number of samples to be encoded for this
+ call. This should be identical to what is
+ returned by <i>beInitStream()</i>, unless you are
+ encoding the last chunk, which might be smaller.</td>
+ </tr>
+ <tr>
+ <td valign="top" width="90"><i>pSamples</i></td>
+ <td>Pointer at the 16-bit signed samples to be
+ encoded. These should be in stereo when encoding
+ a stereo MP3 and mono when encoding a mono MP3.</td>
+ </tr>
+ <tr>
+ <td valign="top" width="90"><i>pOutput</i></td>
+ <td>Where to write the encoded data. This buffer
+ should be at least of the minimum size returned
+ by <i>beInitStream()</i>.</td>
+ </tr>
+ <tr>
+ <td valign="top" width="90"><i>pdwOutput</i></td>
+ <td>Where to return number of bytes of encoded
+ data written. The amount of data written might
+ vary from chunk to chunk.</td>
+ </tr>
+ </table>
+ </td>
+ </tr>
+ <tr>
+ <td valign="top" width="20%"><b>Description:</b></td>
+ <td valign="top">Encodes a chunk of samples. <i>Please
+ note that if you have set the output to generate mono MP3
+ files you must feed beEncodeChunk() with mono samples!</i></td>
+ </tr>
+</table>
+
+<hr>
+
+<h1><a name="beDeinitStream()"><font size="5">beDeinitStream()</font>
+</a></h1>
+
+<table border="0" cellspacing="16" width="100%">
+ <tr>
+ <td valign="top" width="20%"><b>Synopsis:</b></td>
+ <td valign="top" width="80%">BE_ERR beDeinitStream(
+ HBE_STREAM <i>hbeStream</i>, PBYTE <i>pOutput</i>, PDWORD
+ <i>pdwOutput</i> )</td>
+ </tr>
+ <tr>
+ <td valign="top" width="20%"><b>Parameters:</b></td>
+ <td valign="top"><table border="0" cellspacing="10"
+ width="100%">
+ <tr>
+ <td valign="top" width="20%"><i>hbeStream</i></td>
+ <td width="80%">Handle of the stream.</td>
+ </tr>
+ <tr>
+ <td valign="top"><i>pOutput</i></td>
+ <td>Where to write the encoded data. This buffer
+ should be at least of the minimum size returned
+ by <i>beInitStream()</i>.</td>
+ </tr>
+ <tr>
+ <td><i>pdwOutput</i></td>
+ <td>Where to return number of bytes of encoded
+ data written.</td>
+ </tr>
+ </table>
+ </td>
+ </tr>
+ <tr>
+ <td valign="top" width="20%"><b>Description:</b></td>
+ <td valign="top">This function should be called after
+ encoding the last chunk in order to flush the encoder. It
+ writes any encoded data that still might be left inside
+ the encoder to the output buffer. This function should
+ NOT be called unless you have encoded all of the chunks
+ in your stream.</td>
+ </tr>
+</table>
+
+<hr>
+
+<h1><a name="beCloseStream()"><font size="5">beCloseStream()</font></a>
+</h1>
+
+<table border="0" cellspacing="16" width="100%">
+ <tr>
+ <td valign="top" width="20%"><b>Synopsis:</b></td>
+ <td valign="top">BE_ERR beCloseStream( HBE_STREAM <i>hbeStream</i>
+ )</td>
+ </tr>
+ <tr>
+ <td valign="top" width="90"><b>Parameters:</b></td>
+ <td valign="top"><table border="0" cellspacing="10"
+ width="100%">
+ <tr>
+ <td width="20%"><i>hbeStream</i></td>
+ <td>Handle of the stream.</td>
+ </tr>
+ </table>
+ </td>
+ </tr>
+ <tr>
+ <td valign="top" width="90"><b>Description:</b></td>
+ <td valign="top">Last function to be called when finished
+ encoding a stream. Should unlike <i>beDeinitStream()</i>
+ also be called if the encoding is canceled.</td>
+ </tr>
+</table>
+
+<hr>
+
+<h1><a name="beVersion()"><font size="5">beVersion()</font> </a></h1>
+
+<table border="0" cellspacing="16" width="100%">
+ <tr>
+ <td valign="top" width="20%"><b>Synopsis:</b></td>
+ <td valign="top">VOID beVersion( PBE_VERSION <i>pbeVersion</i>
+ )</td>
+ </tr>
+ <tr>
+ <td valign="top"><b>Parameters:</b></td>
+ <td valign="top"><table border="0" cellspacing="10"
+ width="100%">
+ <tr>
+ <td valign="top" width="20%"><i>pbeVersion</i></td>
+ <td>Pointer at struct where version number,
+ release date and URL for homepage is returned.</td>
+ </tr>
+ </table>
+ </td>
+ </tr>
+ <tr>
+ <td valign="top"><b>Description:</b></td>
+ <td valign="top">Returns information like version numbers
+ (both of the DLL and encoding engine), release date and
+ URL for lame_enc's homepage. All this information should
+ be made available to the user of your product through a
+ dialog box or something similar.</td>
+ </tr>
+</table>
+
+<p>&nbsp;</p>
+
+<hr>
+
+<p>&nbsp;</p>
+
+<h1><a name="beWriteVBRHeader()"><font size="5">beWriteVBRHeader()</font>
+</a></h1>
+
+<table border="0" cellspacing="16" width="100%">
+ <tr>
+ <td valign="top" width="20%"><b>Synopsis:</b></td>
+ <td valign="top">VOID beWriteVBRHeader( LPCSTR <i>pszMP3FileName</i>
+ )</td>
+ </tr>
+ <tr>
+ <td valign="top"><b>Parameters:</b></td>
+ <td valign="top"><table border="0" cellspacing="10"
+ width="100%">
+ <tr>
+ <td valign="top" width="20%"><i>pszMP3FileName</i></td>
+ <td>Const Pointer zero terminated string, that
+ contains the MP3 file name.</td>
+ </tr>
+ </table>
+ </td>
+ </tr>
+ <tr>
+ <td valign="top"><b>Description:</b></td>
+ <td valign="top">Writes a Xing Header in front of the MP3
+ file. Make sure that the MP3 file is closed, and the the
+ beConfig.format.LHV1.bWriteVBRHeader has been set to
+ TRUE. In addition, it is always save to call
+ beWriteVBRHeader after the encoding has been finished,
+ even when the beConfig.format.LHV1.bWriteVBRHeader is not
+ set to TRUE</td>
+ </tr>
+</table>
+
+<p>&nbsp;</p>
+
+<p>&nbsp;</p>
+
+<hr>
+
+<p>&nbsp;</p>
+
+<h1><a name="Lame_enc.dll debug option">Lame_enc.dll debug option</a></h1>
+
+<p>The lame_enc.dll has a built-in debug option, that dumps all
+the important internal settings to a text file. To enable this
+feature, create a text file in the Windows directory which is
+named lame_enc.ini, and should contain the following two lines</p>
+
+<p>[debug]<br>
+WriteLogFile=1</p>
+
+<p>Save this text file, and each time you encode a file, the
+settings are added to a file name lame_enc.txt, that is located
+in the same directory as the lame_enc.dll</p>
+
+<p>&nbsp;</p>
+
+<p><br>
+&nbsp; </p>
+</body>
+</html>
diff --git a/Dll/LameDll_vc6.dsp b/Dll/LameDll_vc6.dsp
new file mode 100644
index 0000000..dd07c69
--- /dev/null
+++ b/Dll/LameDll_vc6.dsp
@@ -0,0 +1,118 @@
+# Microsoft Developer Studio Project File - Name="LameMp3EncDll" - Package Owner=<4>
+# Microsoft Developer Studio Generated Build File, Format Version 6.00
+# ** NICHT BEARBEITEN **
+
+# TARGTYPE "Win32 (x86) Dynamic-Link Library" 0x0102
+
+CFG=LameMp3EncDll - Win32 Debug
+!MESSAGE Dies ist kein gültiges Makefile. Zum Erstellen dieses Projekts mit NMAKE
+!MESSAGE verwenden Sie den Befehl "Makefile exportieren" und führen Sie den Befehl
+!MESSAGE
+!MESSAGE NMAKE /f "LameDll_vc6.mak".
+!MESSAGE
+!MESSAGE Sie können beim Ausführen von NMAKE eine Konfiguration angeben
+!MESSAGE durch Definieren des Makros CFG in der Befehlszeile. Zum Beispiel:
+!MESSAGE
+!MESSAGE NMAKE /f "LameDll_vc6.mak" CFG="LameMp3EncDll - Win32 Debug"
+!MESSAGE
+!MESSAGE Für die Konfiguration stehen zur Auswahl:
+!MESSAGE
+!MESSAGE "LameMp3EncDll - Win32 Release" (basierend auf "Win32 (x86) Dynamic-Link Library")
+!MESSAGE "LameMp3EncDll - Win32 Debug" (basierend auf "Win32 (x86) Dynamic-Link Library")
+!MESSAGE
+
+# Begin Project
+# PROP AllowPerConfigDependencies 0
+# PROP Scc_ProjName ""
+# PROP Scc_LocalPath ""
+CPP=cl.exe
+MTL=midl.exe
+RSC=rc.exe
+
+!IF "$(CFG)" == "LameMp3EncDll - Win32 Release"
+
+# PROP BASE Use_MFC 0
+# PROP BASE Use_Debug_Libraries 0
+# PROP BASE Output_Dir "Release"
+# PROP BASE Intermediate_Dir "Release"
+# PROP BASE Target_Dir ""
+# PROP Use_MFC 0
+# PROP Use_Debug_Libraries 0
+# PROP Output_Dir "..\output\Release"
+# PROP Intermediate_Dir "..\obj\Release\LameMp3EncDll"
+# PROP Ignore_Export_Lib 0
+# PROP Target_Dir ""
+# ADD BASE CPP /nologo /MT /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "LAMEMP3ENCDLL_EXPORTS" /YX /FD /c
+# ADD CPP /nologo /MD /W3 /O2 /I "../include" /I "../" /I "../libmp3lame" /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "LAMEMP3ENCDLL_EXPORTS" /YX /FD /c
+# ADD BASE MTL /nologo /D "NDEBUG" /mktyplib203 /win32
+# ADD MTL /nologo /D "NDEBUG" /mktyplib203 /win32
+# ADD BASE RSC /l 0x40c /d "NDEBUG"
+# ADD RSC /l 0x40c /d "NDEBUG"
+BSC32=bscmake.exe
+# ADD BASE BSC32 /nologo
+# ADD BSC32 /nologo
+LINK32=link.exe
+# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /dll /machine:I386
+# ADD LINK32 libmp3lame-static.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /dll /pdb:none /machine:I386 /out:"..\output\Release\lame_enc.dll" /libpath:"..\output\Release" /opt:NOWIN98
+# SUBTRACT LINK32 /nodefaultlib
+
+!ELSEIF "$(CFG)" == "LameMp3EncDll - Win32 Debug"
+
+# PROP BASE Use_MFC 0
+# PROP BASE Use_Debug_Libraries 1
+# PROP BASE Output_Dir "Debug"
+# PROP BASE Intermediate_Dir "Debug"
+# PROP BASE Target_Dir ""
+# PROP Use_MFC 0
+# PROP Use_Debug_Libraries 1
+# PROP Output_Dir "..\output\Debug"
+# PROP Intermediate_Dir "..\obj\Debug\LameMp3EncDll"
+# PROP Ignore_Export_Lib 0
+# PROP Target_Dir ""
+# ADD BASE CPP /nologo /MTd /W3 /Gm /GX /ZI /Od /D "WIN32" /D "_DEBUG" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "LAMEMP3ENCDLL_EXPORTS" /YX /FD /GZ /c
+# ADD CPP /nologo /MDd /W3 /Gm /ZI /Od /I "../include" /I "../" /I "../libmp3lame" /D "WIN32" /D "_DEBUG" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "LAMEMP3ENCDLL_EXPORTS" /YX /FD /GZ /c
+# ADD BASE MTL /nologo /D "_DEBUG" /mktyplib203 /win32
+# ADD MTL /nologo /D "_DEBUG" /mktyplib203 /win32
+# ADD BASE RSC /l 0x40c /d "_DEBUG"
+# ADD RSC /l 0x40c /d "_DEBUG"
+BSC32=bscmake.exe
+# ADD BASE BSC32 /nologo
+# ADD BSC32 /nologo
+LINK32=link.exe
+# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /dll /debug /machine:I386 /pdbtype:sept
+# ADD LINK32 libmp3lame-static.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /dll /debug /machine:I386 /out:"..\output\Debug\lame_enc.dll" /pdbtype:sept /libpath:"..\output\Debug" /opt:NOWIN98
+# SUBTRACT LINK32 /pdb:none /incremental:no
+
+!ENDIF
+
+# Begin Target
+
+# Name "LameMp3EncDll - Win32 Release"
+# Name "LameMp3EncDll - Win32 Debug"
+# Begin Group "Source Files"
+
+# PROP Default_Filter "cpp;c;cxx;rc;def;r;odl;idl;hpj;bat"
+# Begin Source File
+
+SOURCE=.\BladeMP3EncDLL.c
+# End Source File
+# Begin Source File
+
+SOURCE=.\BladeMP3EncDLL.def
+# PROP Exclude_From_Build 1
+# End Source File
+# End Group
+# Begin Group "Header Files"
+
+# PROP Default_Filter "h;hpp;hxx;hm;inl"
+# Begin Source File
+
+SOURCE=.\BladeMP3EncDLL.h
+# End Source File
+# End Group
+# Begin Group "Resource Files"
+
+# PROP Default_Filter "ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe"
+# End Group
+# End Target
+# End Project
diff --git a/Dll/LameDll_vc8.vcproj b/Dll/LameDll_vc8.vcproj
new file mode 100644
index 0000000..d1a3d25
--- /dev/null
+++ b/Dll/LameDll_vc8.vcproj
@@ -0,0 +1,508 @@
+<?xml version="1.0" encoding="Windows-1252"?>
+<VisualStudioProject
+ ProjectType="Visual C++"
+ Version="9.00"
+ Name="LameDll_vc8"
+ ProjectGUID="{F7B9D4C0-D5F2-43B7-9530-DB2DAF0E1349}"
+ RootNamespace="LameDll_vc8"
+ Keyword="Win32Proj"
+ TargetFrameworkVersion="131072"
+ >
+ <Platforms>
+ <Platform
+ Name="Win32"
+ />
+ <Platform
+ Name="x64"
+ />
+ </Platforms>
+ <ToolFiles>
+ </ToolFiles>
+ <Configurations>
+ <Configuration
+ Name="Debug|Win32"
+ OutputDirectory="$(SolutionDir)$(ConfigurationName)"
+ IntermediateDirectory="$(ConfigurationName)"
+ ConfigurationType="2"
+ CharacterSet="1"
+ >
+ <Tool
+ Name="VCPreBuildEventTool"
+ />
+ <Tool
+ Name="VCCustomBuildTool"
+ />
+ <Tool
+ Name="VCXMLDataGeneratorTool"
+ />
+ <Tool
+ Name="VCWebServiceProxyGeneratorTool"
+ />
+ <Tool
+ Name="VCMIDLTool"
+ />
+ <Tool
+ Name="VCCLCompilerTool"
+ Optimization="0"
+ AdditionalIncludeDirectories="../;../include"
+ PreprocessorDefinitions="WIN32;_DEBUG;_WINDOWS;_USRDLL;LAMEDLL_VC8_EXPORTS"
+ MinimalRebuild="true"
+ BasicRuntimeChecks="3"
+ RuntimeLibrary="1"
+ UsePrecompiledHeader="0"
+ WarningLevel="3"
+ Detect64BitPortabilityProblems="true"
+ DebugInformationFormat="4"
+ />
+ <Tool
+ Name="VCManagedResourceCompilerTool"
+ />
+ <Tool
+ Name="VCResourceCompilerTool"
+ />
+ <Tool
+ Name="VCPreLinkEventTool"
+ />
+ <Tool
+ Name="VCLinkerTool"
+ OutputFile="../output/lame_enc.dll"
+ LinkIncremental="2"
+ GenerateManifest="false"
+ ModuleDefinitionFile="BladeMP3EncDll.def"
+ GenerateDebugInformation="true"
+ SubSystem="2"
+ RandomizedBaseAddress="1"
+ DataExecutionPrevention="0"
+ TargetMachine="1"
+ />
+ <Tool
+ Name="VCALinkTool"
+ />
+ <Tool
+ Name="VCManifestTool"
+ />
+ <Tool
+ Name="VCXDCMakeTool"
+ />
+ <Tool
+ Name="VCBscMakeTool"
+ />
+ <Tool
+ Name="VCFxCopTool"
+ />
+ <Tool
+ Name="VCAppVerifierTool"
+ />
+ <Tool
+ Name="VCPostBuildEventTool"
+ />
+ </Configuration>
+ <Configuration
+ Name="Release|Win32"
+ OutputDirectory="$(SolutionDir)$(ConfigurationName)"
+ IntermediateDirectory="$(ConfigurationName)"
+ ConfigurationType="2"
+ CharacterSet="1"
+ WholeProgramOptimization="1"
+ >
+ <Tool
+ Name="VCPreBuildEventTool"
+ />
+ <Tool
+ Name="VCCustomBuildTool"
+ />
+ <Tool
+ Name="VCXMLDataGeneratorTool"
+ />
+ <Tool
+ Name="VCWebServiceProxyGeneratorTool"
+ />
+ <Tool
+ Name="VCMIDLTool"
+ />
+ <Tool
+ Name="VCCLCompilerTool"
+ AdditionalIncludeDirectories="../;../include"
+ PreprocessorDefinitions="WIN32;NDEBUG;_WINDOWS;_USRDLL;LAMEDLL_VC8_EXPORTS"
+ RuntimeLibrary="0"
+ UsePrecompiledHeader="0"
+ WarningLevel="3"
+ Detect64BitPortabilityProblems="true"
+ DebugInformationFormat="3"
+ />
+ <Tool
+ Name="VCManagedResourceCompilerTool"
+ />
+ <Tool
+ Name="VCResourceCompilerTool"
+ />
+ <Tool
+ Name="VCPreLinkEventTool"
+ />
+ <Tool
+ Name="VCLinkerTool"
+ OutputFile="../output/lame_enc.dll"
+ LinkIncremental="1"
+ GenerateManifest="false"
+ ModuleDefinitionFile="BladeMP3EncDll.def"
+ GenerateDebugInformation="true"
+ SubSystem="2"
+ OptimizeReferences="2"
+ EnableCOMDATFolding="2"
+ RandomizedBaseAddress="1"
+ DataExecutionPrevention="0"
+ TargetMachine="1"
+ />
+ <Tool
+ Name="VCALinkTool"
+ />
+ <Tool
+ Name="VCManifestTool"
+ />
+ <Tool
+ Name="VCXDCMakeTool"
+ />
+ <Tool
+ Name="VCBscMakeTool"
+ />
+ <Tool
+ Name="VCFxCopTool"
+ />
+ <Tool
+ Name="VCAppVerifierTool"
+ />
+ <Tool
+ Name="VCPostBuildEventTool"
+ />
+ </Configuration>
+ <Configuration
+ Name="Debug GTK|Win32"
+ IntermediateDirectory="$(ConfigurationName)"
+ ConfigurationType="1"
+ >
+ <Tool
+ Name="VCPreBuildEventTool"
+ />
+ <Tool
+ Name="VCCustomBuildTool"
+ />
+ <Tool
+ Name="VCXMLDataGeneratorTool"
+ />
+ <Tool
+ Name="VCWebServiceProxyGeneratorTool"
+ />
+ <Tool
+ Name="VCMIDLTool"
+ />
+ <Tool
+ Name="VCCLCompilerTool"
+ />
+ <Tool
+ Name="VCManagedResourceCompilerTool"
+ />
+ <Tool
+ Name="VCResourceCompilerTool"
+ />
+ <Tool
+ Name="VCPreLinkEventTool"
+ />
+ <Tool
+ Name="VCLinkerTool"
+ RandomizedBaseAddress="1"
+ DataExecutionPrevention="0"
+ />
+ <Tool
+ Name="VCALinkTool"
+ />
+ <Tool
+ Name="VCManifestTool"
+ />
+ <Tool
+ Name="VCXDCMakeTool"
+ />
+ <Tool
+ Name="VCBscMakeTool"
+ />
+ <Tool
+ Name="VCFxCopTool"
+ />
+ <Tool
+ Name="VCAppVerifierTool"
+ />
+ <Tool
+ Name="VCPostBuildEventTool"
+ />
+ </Configuration>
+ <Configuration
+ Name="Debug|x64"
+ OutputDirectory="$(SolutionDir)$(PlatformName)\$(ConfigurationName)"
+ IntermediateDirectory="$(PlatformName)\$(ConfigurationName)"
+ ConfigurationType="2"
+ CharacterSet="1"
+ >
+ <Tool
+ Name="VCPreBuildEventTool"
+ />
+ <Tool
+ Name="VCCustomBuildTool"
+ />
+ <Tool
+ Name="VCXMLDataGeneratorTool"
+ />
+ <Tool
+ Name="VCWebServiceProxyGeneratorTool"
+ />
+ <Tool
+ Name="VCMIDLTool"
+ TargetEnvironment="3"
+ />
+ <Tool
+ Name="VCCLCompilerTool"
+ Optimization="0"
+ AdditionalIncludeDirectories="../;../include"
+ PreprocessorDefinitions="WIN32;_DEBUG;_WINDOWS;_USRDLL;LAMEDLL_VC8_EXPORTS"
+ MinimalRebuild="true"
+ BasicRuntimeChecks="3"
+ RuntimeLibrary="1"
+ UsePrecompiledHeader="0"
+ WarningLevel="3"
+ Detect64BitPortabilityProblems="true"
+ DebugInformationFormat="3"
+ />
+ <Tool
+ Name="VCManagedResourceCompilerTool"
+ />
+ <Tool
+ Name="VCResourceCompilerTool"
+ />
+ <Tool
+ Name="VCPreLinkEventTool"
+ />
+ <Tool
+ Name="VCLinkerTool"
+ OutputFile="../output/lame_enc.dll"
+ LinkIncremental="2"
+ GenerateManifest="false"
+ ModuleDefinitionFile="BladeMP3EncDll.def"
+ GenerateDebugInformation="true"
+ SubSystem="2"
+ TargetMachine="17"
+ />
+ <Tool
+ Name="VCALinkTool"
+ />
+ <Tool
+ Name="VCManifestTool"
+ />
+ <Tool
+ Name="VCXDCMakeTool"
+ />
+ <Tool
+ Name="VCBscMakeTool"
+ />
+ <Tool
+ Name="VCFxCopTool"
+ />
+ <Tool
+ Name="VCAppVerifierTool"
+ />
+ <Tool
+ Name="VCWebDeploymentTool"
+ />
+ <Tool
+ Name="VCPostBuildEventTool"
+ />
+ </Configuration>
+ <Configuration
+ Name="Release|x64"
+ OutputDirectory="$(SolutionDir)$(PlatformName)\$(ConfigurationName)"
+ IntermediateDirectory="$(PlatformName)\$(ConfigurationName)"
+ ConfigurationType="2"
+ CharacterSet="1"
+ WholeProgramOptimization="1"
+ >
+ <Tool
+ Name="VCPreBuildEventTool"
+ />
+ <Tool
+ Name="VCCustomBuildTool"
+ />
+ <Tool
+ Name="VCXMLDataGeneratorTool"
+ />
+ <Tool
+ Name="VCWebServiceProxyGeneratorTool"
+ />
+ <Tool
+ Name="VCMIDLTool"
+ TargetEnvironment="3"
+ />
+ <Tool
+ Name="VCCLCompilerTool"
+ AdditionalIncludeDirectories="../;../include"
+ PreprocessorDefinitions="WIN32;NDEBUG;_WINDOWS;_USRDLL;LAMEDLL_VC8_EXPORTS"
+ RuntimeLibrary="0"
+ UsePrecompiledHeader="0"
+ WarningLevel="3"
+ Detect64BitPortabilityProblems="true"
+ DebugInformationFormat="3"
+ />
+ <Tool
+ Name="VCManagedResourceCompilerTool"
+ />
+ <Tool
+ Name="VCResourceCompilerTool"
+ />
+ <Tool
+ Name="VCPreLinkEventTool"
+ />
+ <Tool
+ Name="VCLinkerTool"
+ OutputFile="../output/lame_enc.dll"
+ LinkIncremental="1"
+ GenerateManifest="false"
+ ModuleDefinitionFile="BladeMP3EncDll.def"
+ GenerateDebugInformation="true"
+ SubSystem="2"
+ OptimizeReferences="2"
+ EnableCOMDATFolding="2"
+ TargetMachine="17"
+ />
+ <Tool
+ Name="VCALinkTool"
+ />
+ <Tool
+ Name="VCManifestTool"
+ />
+ <Tool
+ Name="VCXDCMakeTool"
+ />
+ <Tool
+ Name="VCBscMakeTool"
+ />
+ <Tool
+ Name="VCFxCopTool"
+ />
+ <Tool
+ Name="VCAppVerifierTool"
+ />
+ <Tool
+ Name="VCWebDeploymentTool"
+ />
+ <Tool
+ Name="VCPostBuildEventTool"
+ />
+ </Configuration>
+ <Configuration
+ Name="Debug GTK|x64"
+ OutputDirectory="$(SolutionDir)$(PlatformName)\$(ConfigurationName)"
+ IntermediateDirectory="$(PlatformName)\$(ConfigurationName)"
+ ConfigurationType="2"
+ CharacterSet="1"
+ >
+ <Tool
+ Name="VCPreBuildEventTool"
+ />
+ <Tool
+ Name="VCCustomBuildTool"
+ />
+ <Tool
+ Name="VCXMLDataGeneratorTool"
+ />
+ <Tool
+ Name="VCWebServiceProxyGeneratorTool"
+ />
+ <Tool
+ Name="VCMIDLTool"
+ TargetEnvironment="3"
+ />
+ <Tool
+ Name="VCCLCompilerTool"
+ Optimization="0"
+ AdditionalIncludeDirectories="../;../include"
+ PreprocessorDefinitions="WIN32;_DEBUG;_WINDOWS;_USRDLL;LAMEDLL_VC8_EXPORTS"
+ MinimalRebuild="true"
+ BasicRuntimeChecks="3"
+ RuntimeLibrary="1"
+ UsePrecompiledHeader="0"
+ WarningLevel="3"
+ Detect64BitPortabilityProblems="true"
+ DebugInformationFormat="3"
+ />
+ <Tool
+ Name="VCManagedResourceCompilerTool"
+ />
+ <Tool
+ Name="VCResourceCompilerTool"
+ />
+ <Tool
+ Name="VCPreLinkEventTool"
+ />
+ <Tool
+ Name="VCLinkerTool"
+ OutputFile="../output/lame_enc.dll"
+ LinkIncremental="2"
+ GenerateManifest="false"
+ ModuleDefinitionFile="BladeMP3EncDll.def"
+ GenerateDebugInformation="true"
+ SubSystem="2"
+ TargetMachine="17"
+ />
+ <Tool
+ Name="VCALinkTool"
+ />
+ <Tool
+ Name="VCManifestTool"
+ />
+ <Tool
+ Name="VCXDCMakeTool"
+ />
+ <Tool
+ Name="VCBscMakeTool"
+ />
+ <Tool
+ Name="VCFxCopTool"
+ />
+ <Tool
+ Name="VCAppVerifierTool"
+ />
+ <Tool
+ Name="VCWebDeploymentTool"
+ />
+ <Tool
+ Name="VCPostBuildEventTool"
+ />
+ </Configuration>
+ </Configurations>
+ <References>
+ </References>
+ <Files>
+ <Filter
+ Name="Source"
+ Filter="cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx"
+ UniqueIdentifier="{4FC737F1-C7A5-4376-A066-2A32D752A2FF}"
+ >
+ <File
+ RelativePath=".\BladeMP3EncDLL.c"
+ >
+ </File>
+ <File
+ RelativePath=".\BladeMP3EncDLL.def"
+ >
+ </File>
+ </Filter>
+ <Filter
+ Name="Header"
+ Filter="h;hpp;hxx;hm;inl;inc;xsd"
+ UniqueIdentifier="{93995380-89BD-4b04-88EB-625FBE52EBFB}"
+ >
+ <File
+ RelativePath=".\BladeMP3EncDLL.h"
+ >
+ </File>
+ </Filter>
+ </Files>
+ <Globals>
+ </Globals>
+</VisualStudioProject>
diff --git a/Dll/MP3export.pas b/Dll/MP3export.pas
new file mode 100644
index 0000000..ab55bba
--- /dev/null
+++ b/Dll/MP3export.pas
@@ -0,0 +1,303 @@
+unit MP3export;
+
+interface
+
+Uses SysUtils, WinTypes, WinProcs, Messages, Classes, Graphics, Controls,
+Forms, Dialogs, StdCtrls;
+
+type
+//type definitions
+//typedef unsigned long HBE_STREAM;
+//typedef HBE_STREAM *PHBE_STREAM;
+//typedef unsigned long BE_ERR;
+ THBE_STREAM = LongWord;
+ PHBE_STREAM = ^PHBE_STREAM;
+ BE_ERR = LongWord;
+
+const
+// encoding formats
+//#define BE_CONFIG_MP3 0
+//#define BE_CONFIG_LAME 256
+ BE_CONFIG_MP3 = 0;
+ BE_CONFIG_LAME = 256;
+
+
+// error codes
+//#define BE_ERR_SUCCESSFUL 0x00000000
+//#define BE_ERR_INVALID_FORMAT 0x00000001
+//#define BE_ERR_INVALID_FORMAT_PARAMETERS 0x00000002
+//#define BE_ERR_NO_MORE_HANDLES 0x00000003
+//#define BE_ERR_INVALID_HANDLE 0x00000004
+BE_ERR_SUCCESSFUL: LongWord = 0;
+BE_ERR_INVALID_FORMAT: LongWord = 1;
+BE_ERR_INVALID_FORMAT_PARAMETERS: LongWord = 2;
+BE_ERR_NO_MORE_HANDLES: LongWord = 3;
+BE_ERR_INVALID_HANDLE: LongWord = 4;
+
+// other constants
+
+BE_MAX_HOMEPAGE = 256;
+
+// format specific variables
+
+BE_MP3_MODE_STEREO = 0;
+BE_MP3_MODE_DUALCHANNEL = 2;
+BE_MP3_MODE_MONO = 3;
+
+type
+
+ TMP3 = packed record
+ dwSampleRate : LongWord;
+ byMode : Byte;
+ wBitRate : Word;
+ bPrivate : LongWord;
+ bCRC : LongWord;
+ bCopyright : LongWord;
+ bOriginal : LongWord;
+ end;
+
+ TLHV1 = packed record
+ // STRUCTURE INFORMATION
+ dwStructVersion: DWORD;
+ dwStructSize: DWORD;
+
+ // BASIC ENCODER SETTINGS
+ dwSampleRate: DWORD; // ALLOWED SAMPLERATE VALUES DEPENDS ON dwMPEGVersion
+ dwReSampleRate: DWORD; // DOWNSAMPLERATE, 0=ENCODER DECIDES
+ nMode: Integer; // BE_MP3_MODE_STEREO, BE_MP3_MODE_DUALCHANNEL, BE_MP3_MODE_MONO
+ dwBitrate: DWORD; // CBR bitrate, VBR min bitrate
+ dwMaxBitrate: DWORD; // CBR ignored, VBR Max bitrate
+ nQuality: Integer; // Quality setting (NORMAL,HIGH,LOW,VOICE)
+ dwMpegVersion: DWORD; // MPEG-1 OR MPEG-2
+ dwPsyModel: DWORD; // FUTURE USE, SET TO 0
+ dwEmphasis: DWORD; // FUTURE USE, SET TO 0
+
+ // BIT STREAM SETTINGS
+ bPrivate: LONGBOOL; // Set Private Bit (TRUE/FALSE)
+ bCRC: LONGBOOL; // Insert CRC (TRUE/FALSE)
+ bCopyright: LONGBOOL; // Set Copyright Bit (TRUE/FALSE)
+ bOriginal: LONGBOOL; // Set Original Bit (TRUE/FALSE_
+
+ // VBR STUFF
+ bWriteVBRHeader: LONGBOOL; // WRITE XING VBR HEADER (TRUE/FALSE)
+ bEnableVBR: LONGBOOL; // USE VBR ENCODING (TRUE/FALSE)
+ nVBRQuality: Integer; // VBR QUALITY 0..9
+
+ btReserved: array[0..255] of Byte; // FUTURE USE, SET TO 0
+ end;
+
+ TAAC = packed record
+ dwSampleRate : LongWord;
+ byMode : Byte;
+ wBitRate : Word;
+ byEncodingMethod : Byte;
+ end;
+
+ TFormat = packed record
+ case byte of
+ 1 : (mp3 : TMP3);
+ 2 : (lhv1 : TLHV1);
+ 3 : (aac : TAAC);
+ end;
+
+ TBE_Config = packed record
+ dwConfig : LongWord;
+ format : TFormat;
+ end;
+
+
+ PBE_Config = ^TBE_Config;
+
+//typedef struct {
+// // BladeEnc DLL Version number
+//
+// BYTE byDLLMajorVersion;
+// BYTE byDLLMinorVersion;
+//
+// // BladeEnc Engine Version Number
+//
+// BYTE byMajorVersion;
+// BYTE byMinorVersion;
+//
+// // DLL Release date
+//
+// BYTE byDay;
+// BYTE byMonth;
+// WORD wYear;
+//
+// // BladeEnc Homepage URL
+//
+// CHAR zHomepage[BE_MAX_HOMEPAGE + 1];
+//
+//} BE_VERSION, *PBE_VERSION;
+
+ TBE_Version = record
+ byDLLMajorVersion : Byte;
+ byDLLMinorVersion : Byte;
+
+ byMajorVersion : Byte;
+ byMinorVersion : Byte;
+
+ byDay : Byte;
+ byMonth : Byte;
+ wYear : Word;
+
+ zHomePage : Array[0..BE_MAX_HOMEPAGE + 1] of Char;
+ end;
+
+ PBE_Version = ^TBE_Version;
+
+//__declspec(dllexport) BE_ERR beInitStream(PBE_CONFIG pbeConfig, PDWORD dwSamples, PDWORD dwBufferSize, PHBE_STREAM phbeStream);
+//__declspec(dllexport) BE_ERR beEncodeChunk(HBE_STREAM hbeStream, DWORD nSamples, PSHORT pSamples, PBYTE pOutput, PDWORD pdwOutput);
+//__declspec(dllexport) BE_ERR beDeinitStream(HBE_STREAM hbeStream, PBYTE pOutput, PDWORD pdwOutput);
+//__declspec(dllexport) BE_ERR beCloseStream(HBE_STREAM hbeStream);
+//__declspec(dllexport) VOID beVersion(PBE_VERSION pbeVersion);
+
+{
+Function beInitStream(var pbeConfig: TBE_CONFIG; var dwSample: LongWord; var dwBufferSize: LongWord; var phbeStream: THBE_STREAM ): BE_Err; cdecl; external 'Bladeenc.dll';
+//Function beEncodeChunk(hbeStream: THBE_STREAM; nSamples: LongWord; pSample: PSmallInt;pOutput: PByte; var pdwOutput: LongWord): BE_Err; cdecl; external 'Bladeenc.dll';
+Function beEncodeChunk(hbeStream: THBE_STREAM; nSamples: LongWord; var pSample;var pOutput; var pdwOutput: LongWord): BE_Err; stdcall; cdecl 'Bladeenc.dll';
+Function beDeinitStream(hbeStream: THBE_STREAM; var pOutput; var pdwOutput: LongWord): BE_Err; cdecl; external 'Bladeenc.dll';
+Function beCloseStream(hbeStream: THBE_STREAM): BE_Err; cdecl; external 'Bladeenc.dll';
+Procedure beVersion(var pbeVersion: TBE_VERSION); cdecl; external 'Bladeenc.dll';
+}
+
+Function beInitStream(var pbeConfig: TBE_CONFIG; var dwSample: LongWord; var dwBufferSize: LongWord; var phbeStream: THBE_STREAM ): BE_Err; cdecl; external 'Lame_enc.dll';
+//Function beEncodeChunk(hbeStream: THBE_STREAM; nSamples: LongWord; pSample: PSmallInt;pOutput: PByte; var pdwOutput: LongWord): BE_Err; cdecl; external 'Lame_enc.dll';
+Function beEncodeChunk(hbeStream: THBE_STREAM; nSamples: LongWord; var pSample;var pOutput; var pdwOutput: LongWord): BE_Err; cdecl; external 'Lame_enc.dll';
+Function beDeinitStream(hbeStream: THBE_STREAM; var pOutput; var pdwOutput: LongWord): BE_Err; cdecl; external 'Lame_enc.dll';
+Function beCloseStream(hbeStream: THBE_STREAM): BE_Err; cdecl; external 'Lame_enc.dll';
+Procedure beVersion(var pbeVersion: TBE_VERSION); cdecl; external 'Lame_enc.dll';
+
+Procedure EncodeWavToMP3(fs, fd: Integer);
+implementation
+
+Uses InternetSnd, TraiteWav;
+
+{----------------------------------------}
+Procedure EncodeWavToMP3(fs, fd: Integer);
+var
+ err: Integer;
+ beConfig: TBE_Config;
+ dwSamples, dwSamplesMP3 : LongWord;
+ hbeStream : THBE_STREAM;
+ error: BE_ERR;
+ pBuffer: PSmallInt;
+ pMP3Buffer: PByte;
+ Marque:PChar;
+
+ done: LongWord;
+ dwWrite: LongWord;
+ ToRead: LongWord;
+ ToWrite: LongWord;
+ i:Integer;
+
+begin
+ beConfig.dwConfig := BE_CONFIG_LAME;
+
+{
+ beConfig.Format.mp3.dwSampleRate := WavInfo.SamplesPerSec;
+ beConfig.Format.mp3.byMode := BE_MP3_MODE_STEREO;
+ beConfig.Format.mp3.wBitrate := strToInt(MainFrm.Mp3BitRate.Text);
+ beConfig.Format.mp3.bCopyright := 0;
+ beConfig.Format.mp3.bCRC := $00000000;
+ beConfig.Format.mp3.bOriginal := 0;
+ beConfig.Format.mp3.bPrivate := 0;
+}
+//Structure information
+ beConfig.Format.lhv1.dwStructVersion := 1;
+ beConfig.Format.lhv1.dwStructSize := SizeOf(beConfig);
+//Basic encoder setting
+ beConfig.Format.lhv1.dwSampleRate := WavInfo.SamplesPerSec;
+ beConfig.Format.lhv1.dwReSampleRate := 44100;
+ beConfig.Format.lhv1.nMode := BE_MP3_MODE_STEREO;
+ beConfig.Format.lhv1.dwBitrate := strToInt(MainFrm.Mp3BitRate.Text);
+ beConfig.Format.lhv1.dwMaxBitrate := strToInt(MainFrm.Mp3BitRate.Text);
+ beConfig.Format.lhv1.nQuality := 2;
+ beConfig.Format.lhv1.dwMPegVersion := 1; //MPEG1
+ beConfig.Format.lhv1.dwPsyModel := 0;
+ beConfig.Format.lhv1.dwEmphasis := 0;
+//Bit Stream Settings
+ beConfig.Format.lhv1.bPrivate := False;
+ beConfig.Format.lhv1.bCRC := False;
+ beConfig.Format.lhv1.bCopyright := True;
+ beConfig.Format.lhv1.bOriginal := True;
+//VBR Stuff
+ beConfig.Format.lhv1.bWriteVBRHeader := false;
+ beConfig.Format.lhv1.bEnableVBR := false;
+ beConfig.Format.lhv1.nVBRQuality := 0;
+
+ i := 0;
+ error := beInitStream(beConfig, dwSamples, dwSamplesMP3, hbeStream);
+ if error = BE_ERR_SUCCESSFUL
+ then begin
+ pBuffer := AllocMem(dwSamples*2);
+ pMP3Buffer := AllocMem(dwSamplesMP3);
+ try
+ done := 0;
+
+ error := FileSeek(fs, 0, 0);
+ While (done < TotalSize) do
+ begin
+ if (done + dwSamples*2 < TotalSize)
+ then ToRead := dwSamples*2
+ else begin
+ ToRead := TotalSize-done;
+ //FillChar(buf[0],dwSamples*2,0);
+ FillChar(pbuffer^,dwSamples,0);
+ end;
+
+ //if FileRead(fs, buf[0], toread) = -1
+ if FileRead(fs, pbuffer^, toread) = -1
+ then raise Exception.Create('Erreur de lecture');
+
+ //error := beEncodeChunk(hbeStream, toRead div 2, Buf[0], TmpBuf[0], toWrite);
+ error := beEncodeChunk(hbeStream, toRead div 2, pBuffer^, pMP3Buffer^, toWrite);
+
+ if error <> BE_ERR_SUCCESSFUL
+ then begin
+ beCloseStream(hbeStream);
+ raise Exception.Create('Echec de l''encodage');
+ end;
+
+ //if FileWrite(fd, TmpBuf[0], toWrite) = -1
+ if FileWrite(fd, pMP3Buffer^, toWrite) = -1
+ then raise Exception.Create('Erreur d''écriture');
+
+ done := done + toread;
+ inc(i);
+ if i mod 64 = 0
+ then begin
+ MainFrm.ProgressBar1.Position := round(100*done/Totalsize);
+ Application.ProcessMessages;
+ end;
+ end;
+
+ error := beDeInitStream(hbeStream, pMP3Buffer^, dwWrite);
+ //error := beDeInitStream(hbeStream, TmpBuf[0], dwWrite);
+
+ if error <> BE_ERR_SUCCESSFUL
+ then begin
+ beCloseStream(hbeStream);
+ raise Exception.Create('Echec à la sortie');
+ end;
+
+ if dwWrite <> 0
+ then begin
+ //if FileWrite(fd, TmpBuf[0], dwWrite) = -1
+ if FileWrite(fd, pMP3Buffer^, dwWrite) = -1
+ then raise Exception.Create('Erreur à la dernière écriture');
+ end;
+
+ beCloseStream(hbeStream);
+ finally
+ FreeMem(pBuffer);
+ FreeMem(pMP3Buffer);
+ end;
+ end
+ else begin
+
+ end;
+end;
+
+end.
diff --git a/Dll/Makefile.am b/Dll/Makefile.am
new file mode 100644
index 0000000..78f0f6b
--- /dev/null
+++ b/Dll/Makefile.am
@@ -0,0 +1,15 @@
+## $Id: Makefile.am,v 1.9 2006/09/30 09:17:05 bouvigne Exp $
+
+include $(top_srcdir)/Makefile.am.global
+
+EXTRA_DIST = BladeMP3EncDLL.c \
+ BladeMP3EncDLL.def \
+ BladeMP3EncDLL.h \
+ Example.cpp \
+ Example_vc6.dsp \
+ Example_vc6.dsw \
+ LameDLLInterface.htm \
+ LameDll_vc6.dsp \
+ LameDll_vc8.vcproj \
+ MP3export.pas \
+ Makefile.mingw32
diff --git a/Dll/Makefile.in b/Dll/Makefile.in
new file mode 100644
index 0000000..bd14bcb
--- /dev/null
+++ b/Dll/Makefile.in
@@ -0,0 +1,367 @@
+# Makefile.in generated by automake 1.10 from Makefile.am.
+# @configure_input@
+
+# Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002,
+# 2003, 2004, 2005, 2006 Free Software Foundation, Inc.
+# This Makefile.in is free software; the Free Software Foundation
+# gives unlimited permission to copy and/or distribute it,
+# with or without modifications, as long as this notice is preserved.
+
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY, to the extent permitted by law; without
+# even the implied warranty of MERCHANTABILITY or FITNESS FOR A
+# PARTICULAR PURPOSE.
+
+@SET_MAKE@
+
+# global section for every Makefile.am
+VPATH = @srcdir@
+pkgdatadir = $(datadir)/@PACKAGE@
+pkglibdir = $(libdir)/@PACKAGE@
+pkgincludedir = $(includedir)/@PACKAGE@
+am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd
+install_sh_DATA = $(install_sh) -c -m 644
+install_sh_PROGRAM = $(install_sh) -c
+install_sh_SCRIPT = $(install_sh) -c
+INSTALL_HEADER = $(INSTALL_DATA)
+transform = $(program_transform_name)
+NORMAL_INSTALL = :
+PRE_INSTALL = :
+POST_INSTALL = :
+NORMAL_UNINSTALL = :
+PRE_UNINSTALL = :
+POST_UNINSTALL = :
+build_triplet = @build@
+host_triplet = @host@
+DIST_COMMON = README $(srcdir)/Makefile.am $(srcdir)/Makefile.in \
+ $(top_srcdir)/Makefile.am.global
+subdir = Dll
+ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
+am__aclocal_m4_deps = $(top_srcdir)/acinclude.m4 \
+ $(top_srcdir)/configure.in
+am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \
+ $(ACLOCAL_M4)
+mkinstalldirs = $(install_sh) -d
+CONFIG_HEADER = $(top_builddir)/config.h
+CONFIG_CLEAN_FILES =
+SOURCES =
+DIST_SOURCES =
+DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST)
+ACLOCAL = @ACLOCAL@
+ALLOCA = @ALLOCA@
+AMTAR = @AMTAR@
+AR = @AR@
+AUTOCONF = @AUTOCONF@
+AUTOHEADER = @AUTOHEADER@
+AUTOMAKE = @AUTOMAKE@
+AWK = @AWK@
+CC = @CC@
+CCDEPMODE = @CCDEPMODE@
+CFLAGS = @CFLAGS@
+CONFIG_DEFS = @CONFIG_DEFS@
+CONFIG_MATH_LIB = @CONFIG_MATH_LIB@
+CPP = @CPP@
+CPPFLAGS = @CPPFLAGS@
+CPUCCODE = @CPUCCODE@
+CPUTYPE = @CPUTYPE@
+CXX = @CXX@
+CXXCPP = @CXXCPP@
+CXXDEPMODE = @CXXDEPMODE@
+CXXFLAGS = @CXXFLAGS@
+CYGPATH_W = @CYGPATH_W@
+DEFS = @DEFS@
+DEPDIR = @DEPDIR@
+ECHO = @ECHO@
+ECHO_C = @ECHO_C@
+ECHO_N = @ECHO_N@
+ECHO_T = @ECHO_T@
+EGREP = @EGREP@
+EXEEXT = @EXEEXT@
+F77 = @F77@
+FFLAGS = @FFLAGS@
+FRONTEND_CFLAGS = @FRONTEND_CFLAGS@
+FRONTEND_LDADD = @FRONTEND_LDADD@
+FRONTEND_LDFLAGS = @FRONTEND_LDFLAGS@
+GREP = @GREP@
+GTK_CFLAGS = @GTK_CFLAGS@
+GTK_CONFIG = @GTK_CONFIG@
+GTK_LIBS = @GTK_LIBS@
+INCLUDES = @INCLUDES@
+INSTALL = @INSTALL@
+INSTALL_DATA = @INSTALL_DATA@
+INSTALL_PROGRAM = @INSTALL_PROGRAM@
+INSTALL_SCRIPT = @INSTALL_SCRIPT@
+INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@
+LDADD = @LDADD@
+LDFLAGS = @LDFLAGS@
+LIBOBJS = @LIBOBJS@
+LIBS = @LIBS@
+LIBTOOL = @LIBTOOL@
+LIBTOOL_DEPS = @LIBTOOL_DEPS@
+LIB_MAJOR_VERSION = @LIB_MAJOR_VERSION@
+LIB_MINOR_VERSION = @LIB_MINOR_VERSION@
+LN_S = @LN_S@
+LTLIBOBJS = @LTLIBOBJS@
+MAINT = @MAINT@
+MAKEDEP = @MAKEDEP@
+MAKEINFO = @MAKEINFO@
+MKDIR_P = @MKDIR_P@
+NASM = @NASM@
+NASM_FORMAT = @NASM_FORMAT@
+OBJEXT = @OBJEXT@
+PACKAGE = @PACKAGE@
+PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@
+PACKAGE_NAME = @PACKAGE_NAME@
+PACKAGE_STRING = @PACKAGE_STRING@
+PACKAGE_TARNAME = @PACKAGE_TARNAME@
+PACKAGE_VERSION = @PACKAGE_VERSION@
+PATH_SEPARATOR = @PATH_SEPARATOR@
+PKG_CONFIG = @PKG_CONFIG@
+RANLIB = @RANLIB@
+RM_F = @RM_F@
+SED = @SED@
+SET_MAKE = @SET_MAKE@
+SHELL = @SHELL@
+SNDFILE_CFLAGS = @SNDFILE_CFLAGS@
+SNDFILE_LIBS = @SNDFILE_LIBS@
+STRIP = @STRIP@
+U = @U@
+VERSION = @VERSION@
+WITH_FRONTEND = @WITH_FRONTEND@
+WITH_MP3RTP = @WITH_MP3RTP@
+WITH_MP3X = @WITH_MP3X@
+abs_builddir = @abs_builddir@
+abs_srcdir = @abs_srcdir@
+abs_top_builddir = @abs_top_builddir@
+abs_top_srcdir = @abs_top_srcdir@
+ac_ct_CC = @ac_ct_CC@
+ac_ct_CXX = @ac_ct_CXX@
+ac_ct_F77 = @ac_ct_F77@
+am__include = @am__include@
+am__leading_dot = @am__leading_dot@
+am__quote = @am__quote@
+am__tar = @am__tar@
+am__untar = @am__untar@
+bindir = @bindir@
+build = @build@
+build_alias = @build_alias@
+build_cpu = @build_cpu@
+build_os = @build_os@
+build_vendor = @build_vendor@
+builddir = @builddir@
+datadir = @datadir@
+datarootdir = @datarootdir@
+docdir = @docdir@
+dvidir = @dvidir@
+exec_prefix = @exec_prefix@
+host = @host@
+host_alias = @host_alias@
+host_cpu = @host_cpu@
+host_os = @host_os@
+host_vendor = @host_vendor@
+htmldir = @htmldir@
+includedir = @includedir@
+infodir = @infodir@
+install_sh = @install_sh@
+libdir = @libdir@
+libexecdir = @libexecdir@
+localedir = @localedir@
+localstatedir = @localstatedir@
+mandir = @mandir@
+mkdir_p = @mkdir_p@
+oldincludedir = @oldincludedir@
+pdfdir = @pdfdir@
+prefix = @prefix@
+program_transform_name = @program_transform_name@
+psdir = @psdir@
+sbindir = @sbindir@
+sharedstatedir = @sharedstatedir@
+srcdir = @srcdir@
+sysconfdir = @sysconfdir@
+target_alias = @target_alias@
+top_builddir = @top_builddir@
+top_srcdir = @top_srcdir@
+AUTOMAKE_OPTIONS = 1.9 foreign $(top_srcdir)/ansi2knr
+EXTRA_DIST = BladeMP3EncDLL.c \
+ BladeMP3EncDLL.def \
+ BladeMP3EncDLL.h \
+ Example.cpp \
+ Example_vc6.dsp \
+ Example_vc6.dsw \
+ LameDLLInterface.htm \
+ LameDll_vc6.dsp \
+ LameDll_vc8.vcproj \
+ MP3export.pas \
+ Makefile.mingw32
+
+all: all-am
+
+.SUFFIXES:
+$(srcdir)/Makefile.in: @MAINTAINER_MODE_TRUE@ $(srcdir)/Makefile.am $(top_srcdir)/Makefile.am.global $(am__configure_deps)
+ @for dep in $?; do \
+ case '$(am__configure_deps)' in \
+ *$$dep*) \
+ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh \
+ && exit 0; \
+ exit 1;; \
+ esac; \
+ done; \
+ echo ' cd $(top_srcdir) && $(AUTOMAKE) --foreign Dll/Makefile'; \
+ cd $(top_srcdir) && \
+ $(AUTOMAKE) --foreign Dll/Makefile
+.PRECIOUS: Makefile
+Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status
+ @case '$?' in \
+ *config.status*) \
+ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh;; \
+ *) \
+ echo ' cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe)'; \
+ cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe);; \
+ esac;
+
+$(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES)
+ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
+
+$(top_srcdir)/configure: @MAINTAINER_MODE_TRUE@ $(am__configure_deps)
+ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
+$(ACLOCAL_M4): @MAINTAINER_MODE_TRUE@ $(am__aclocal_m4_deps)
+ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
+
+mostlyclean-libtool:
+ -rm -f *.lo
+
+clean-libtool:
+ -rm -rf .libs _libs
+tags: TAGS
+TAGS:
+
+ctags: CTAGS
+CTAGS:
+
+
+distdir: $(DISTFILES)
+ @srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \
+ topsrcdirstrip=`echo "$(top_srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \
+ list='$(DISTFILES)'; \
+ dist_files=`for file in $$list; do echo $$file; done | \
+ sed -e "s|^$$srcdirstrip/||;t" \
+ -e "s|^$$topsrcdirstrip/|$(top_builddir)/|;t"`; \
+ case $$dist_files in \
+ */*) $(MKDIR_P) `echo "$$dist_files" | \
+ sed '/\//!d;s|^|$(distdir)/|;s,/[^/]*$$,,' | \
+ sort -u` ;; \
+ esac; \
+ for file in $$dist_files; do \
+ if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \
+ if test -d $$d/$$file; then \
+ dir=`echo "/$$file" | sed -e 's,/[^/]*$$,,'`; \
+ if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \
+ cp -pR $(srcdir)/$$file $(distdir)$$dir || exit 1; \
+ fi; \
+ cp -pR $$d/$$file $(distdir)$$dir || exit 1; \
+ else \
+ test -f $(distdir)/$$file \
+ || cp -p $$d/$$file $(distdir)/$$file \
+ || exit 1; \
+ fi; \
+ done
+check-am: all-am
+check: check-am
+all-am: Makefile
+installdirs:
+install: install-am
+install-exec: install-exec-am
+install-data: install-data-am
+uninstall: uninstall-am
+
+install-am: all-am
+ @$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am
+
+installcheck: installcheck-am
+install-strip:
+ $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \
+ install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \
+ `test -z '$(STRIP)' || \
+ echo "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'"` install
+mostlyclean-generic:
+
+clean-generic:
+
+distclean-generic:
+ -test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES)
+
+maintainer-clean-generic:
+ @echo "This command is intended for maintainers to use"
+ @echo "it deletes files that may require special tools to rebuild."
+clean: clean-am
+
+clean-am: clean-generic clean-libtool mostlyclean-am
+
+distclean: distclean-am
+ -rm -f Makefile
+distclean-am: clean-am distclean-generic
+
+dvi: dvi-am
+
+dvi-am:
+
+html: html-am
+
+info: info-am
+
+info-am:
+
+install-data-am:
+
+install-dvi: install-dvi-am
+
+install-exec-am:
+
+install-html: install-html-am
+
+install-info: install-info-am
+
+install-man:
+
+install-pdf: install-pdf-am
+
+install-ps: install-ps-am
+
+installcheck-am:
+
+maintainer-clean: maintainer-clean-am
+ -rm -f Makefile
+maintainer-clean-am: distclean-am maintainer-clean-generic
+
+mostlyclean: mostlyclean-am
+
+mostlyclean-am: mostlyclean-generic mostlyclean-libtool
+
+pdf: pdf-am
+
+pdf-am:
+
+ps: ps-am
+
+ps-am:
+
+uninstall-am:
+
+.MAKE: install-am install-strip
+
+.PHONY: all all-am check check-am clean clean-generic clean-libtool \
+ distclean distclean-generic distclean-libtool distdir dvi \
+ dvi-am html html-am info info-am install install-am \
+ install-data install-data-am install-dvi install-dvi-am \
+ install-exec install-exec-am install-html install-html-am \
+ install-info install-info-am install-man install-pdf \
+ install-pdf-am install-ps install-ps-am install-strip \
+ installcheck installcheck-am installdirs maintainer-clean \
+ maintainer-clean-generic mostlyclean mostlyclean-generic \
+ mostlyclean-libtool pdf pdf-am ps ps-am uninstall uninstall-am
+
+
+# end global section
+# Tell versions [3.59,3.63) of GNU make to not export all variables.
+# Otherwise a system limit (for SysV at least) may be exceeded.
+.NOEXPORT:
diff --git a/Dll/Makefile.mingw32 b/Dll/Makefile.mingw32
new file mode 100644
index 0000000..6070f29
--- /dev/null
+++ b/Dll/Makefile.mingw32
@@ -0,0 +1,39 @@
+# This makefile compiles lame_enc.dll with mingw32 (and possibly cygwin)
+# Of course, you must first build ../libmp3lame/libmp3lame.a.
+# liblame_enc.a can be used to link the lame_enc.dll to your programs.
+# Tested with EAC 0.9pb9 (my own favorite, http://www.exactaudiocopy.de/)
+# example.exe compiles and works, too.
+# Vladislav Naumov, <vnaum@inbox.ru>
+#
+# PS: to 'make clean' you need rm. MS's del is unusable.
+# PPS: quick build:
+# make -fMakefile.mingw32
+
+DLL_NAME = lame_enc
+LAME_SRC_ROOT = ..
+OFILES = BladeMP3EncDLL.o $(DLL_NAME)_exp.o
+CFLAGS = -I$(LAME_SRC_ROOT)/include -I$(LAME_SRC_ROOT)/libmp3lame
+CC = g++
+LD = g++
+LFLAGS = -L$(LAME_SRC_ROOT)/libmp3lame -o $(DLL_NAME).dll -mdll -s
+LIBS = -lmp3lame
+
+all: $(DLL_NAME).dll example.exe
+
+BladeMP3EncDLL.o: BladeMP3EncDLL.c BladeMP3EncDLL.h ../include/lame.h \
+ ../libmp3lame/lame_global_flags.h ../libmp3lame/version.h
+
+$(DLL_NAME).dll : $(OFILES)
+ $(LD) $(LFLAGS) $(OFILES) $(LIBS)
+
+$(DLL_NAME)_exp.o : BladeMP3EncDLL.o
+ dlltool --input-def BladeMP3EncDLL.def --output-lib lib$(DLL_NAME).a --output-exp $(DLL_NAME)_exp.o --dllname $(DLL_NAME) BladeMP3EncDLL.o
+
+%.o : %.c
+ $(CC) $(CFLAGS) -c $< -o $@
+
+example.exe : Example.cpp BladeMP3EncDLL.h
+ $(CC) Example.cpp -o example.exe
+
+clean :
+ rm -f $(DLL_NAME).dll $(OFILES) example.exe
diff --git a/Dll/README b/Dll/README
new file mode 100644
index 0000000..ed8467a
--- /dev/null
+++ b/Dll/README
@@ -0,0 +1,21 @@
+
+This directory contains a Windows DLL interface to the LAME
+encoding engine.
+
+This DLL is compatible with the BladeEnc.dll.
+See BladeMP3EncDLL.c for details of the calling
+sequence, and BladeMP3EncDLL.h for details of the
+data that must be passed to the DLL.
+
+As of yet, there is no other documentation.
+
+To use this DLL as a replacement for BladeEnc.dll, you
+need to populate the 'mp3' struct.
+
+To use more advanced features of LAME, you need to
+populate the LHV1 struct instead.
+
+Delphi 4 Users: Gabriel Gélin <ggelin@alapage.com> has
+contributed a .PAS file, do you can access the DLL from
+Delphi. See MP3export.pas.
+