Source file: /~heha/hs/puh.zip/lame_enc.h

/* 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
 */

#pragma once

#ifdef __GNUC__
#define ATTRIBUTE_PACKED	__attribute__((packed))
#else
# define ATTRIBUTE_PACKED
# pragma pack(push,1)
#endif

/* encoding formats */

#define		BE_CONFIG_MP3			0										
#define		BE_CONFIG_LAME			256		

/* type definitions */

typedef	void*		HBE_STREAM;
//typedef	HBE_STREAM	*PHBE_STREAM;
typedef	unsigned long	BE_ERR;

/* error codes */
enum{
  BE_ERR_SUCCESSFUL,
  BE_ERR_INVALID_FORMAT,
  BE_ERR_INVALID_FORMAT_PARAMETERS,
  BE_ERR_NO_MORE_HANDLES,
  BE_ERR_INVALID_HANDLE,
  BE_ERR_BUFFER_TOO_SMALL,
};

/* other constants */

#define		BE_MAX_HOMEPAGE			128

/* format specific variables */
enum{
  BE_MP3_MODE_STEREO	=0,
  BE_MP3_MODE_JSTEREO	=1,
  BE_MP3_MODE_DUALCHANNEL	=2,
  BE_MP3_MODE_MONO	=3,
  MPEG1	=1,
  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


enum VBRMETHOD{
  VBR_METHOD_NONE	= -1,
  VBR_METHOD_DEFAULT	=  0,
  VBR_METHOD_OLD	=  1,
  VBR_METHOD_NEW	=  2,
  VBR_METHOD_MTRH	=  3,
  VBR_METHOD_ABR	=  4
};

enum LAME_QUALITY_PRESET{
  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
};



struct BE_CONFIG ATTRIBUTE_PACKED{
  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;
    } unused_aac;
  } format;
};

struct BE_VERSION ATTRIBUTE_PACKED{
	// 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];
};

#ifdef _BLADEDLL
# define FUNC(r,n) _declspec(dllexport) r _cdecl n
#elif _BLADEDLL_DYNALOAD
# define FUNC(r,n) typedef r (*n)
# define	TEXT_BEINITSTREAM		"beInitStream"
# define	TEXT_BEENCODECHUNK		"beEncodeChunk"
# define	TEXT_BEDEINITSTREAM		"beDeinitStream"
# define	TEXT_BECLOSESTREAM		"beCloseStream"
# define	TEXT_BEVERSION			"beVersion"
# define	TEXT_BEWRITEVBRHEADER		"beWriteVBRHeader"
# define	TEXT_BEENCODECHUNKFLOATS16NI	"beEncodeChunkFloatS16NI"
# define	TEXT_BEFLUSHNOGAP		"beFlushNoGap"
# define	TEXT_BEWRITEINFOTAG		"beWriteInfoTag"
#else
# define FUNC(r,n) _declspec(dllimport) r _cdecl n
#endif

FUNC(BE_ERR,beInitStream)	(BE_CONFIG* pbeConfig, PDWORD dwSamples, PDWORD dwBufferSize, HBE_STREAM*phbeStream);
FUNC(BE_ERR,beEncodeChunk)	(HBE_STREAM hbeStream, DWORD nSamples, PSHORT pSamples, PBYTE pOutput, PDWORD pdwOutput);
FUNC(BE_ERR,beDeinitStream)	(HBE_STREAM hbeStream, PBYTE pOutput, PDWORD pdwOutput);
FUNC(BE_ERR,beCloseStream)	(HBE_STREAM hbeStream);
FUNC(VOID,beVersion)		(BE_VERSION*pbeVersion);
FUNC(BE_ERR,beWriteVBRHeader)	(const char*lpszFileName);
// added for floating point audio  -- DSPguru, jd
FUNC(BE_ERR,beEncodeChunkFloatS16NI)	(HBE_STREAM hbeStream, DWORD nSamples, PFLOAT buffer_l, PFLOAT buffer_r, PBYTE pOutput, PDWORD pdwOutput);
FUNC(BE_ERR,beFlushNoGap)	(HBE_STREAM hbeStream, PBYTE pOutput, PDWORD pdwOutput);
FUNC(BE_ERR,beWriteInfoTag)	(HBE_STREAM hbeStream, const char*lpszFileName );

#ifndef __GNUC__
#pragma pack(pop)
#endif
Detected encoding: ASCII (7 bit)2