Home Units Hierarchy Routines All identifiers

Unit unaBladeEncAPI

DescriptionUsesClasses, Interfaces, Objects and RecordsFunctions and ProceduresTypesConstantsVariables

Description

BladeEnc.DLL and LameEnc.DLL wrapper.

2.5.2008.07 Still here

2.5.2010.02 Added unaLameEncoder class

Uses

Overview

Classes, Interfaces, Objects and Records

Name Description
packed record BE_CONFIG  
packed record BE_CONFIG_FORMATLAME  
packed record BE_VERSION  
packed record tBE_CONFIG_AAC – –
packed record tBE_CONFIG_LHV1 – –
packed record tBE_CONFIG_MP3 – –
record tBladeLibrary_proc  
record tLameLibrary_proc  
Class unaLameEncoder  

Functions and Procedures

function beInitStream(const bladeProc: tBladeLibrary_proc; config: PBE_CONFIG; out nSamples: DWORD; out minOutputBufSize: DWORD; out stream: HBE_STREAM): BE_ERR;
function beEncodeChunk(const bladeProc: tBladeLibrary_proc; stream: HBE_STREAM; nSamples: DWORD; samplesBuf: pointer; outputBuf: pointer; out outputUsed: DWORD): BE_ERR;
function beDeinitStream(const bladeProc: tBladeLibrary_proc; stream: HBE_STREAM; outputBuf: pointer; out outputUsed: DWORD): BE_ERR;
function beCloseStream(const bladeProc: tBladeLibrary_proc; stream: HBE_STREAM): BE_ERR;
function beVersion(const bladeProc: tBladeLibrary_proc; out version: BE_VERSION): bool;
function blade_loadDLL(var bladeProc: tBladeLibrary_proc; const pathAndName: wString = c_bladeEncDLL): int;
function blade_unloadDLL(var bladeProc: tBladeLibrary_proc): int;
function lameInitStream(const lameProc: tLameLibrary_proc; config: PBE_CONFIG_FORMATLAME; out nSamples: DWORD; out minOutputBufSize: DWORD; out stream: HBE_STREAM): BE_ERR;
function lameEncodeChunk(const lameProc: tLameLibrary_proc; stream: HBE_STREAM; nSamples: DWORD; samplesBuf: pointer; outputBuf: pointer; out outputUsed: DWORD): BE_ERR;
function lameDeinitStream(const lameProc: tLameLibrary_proc; stream: HBE_STREAM; outputBuf: pointer; out outputUsed: DWORD): BE_ERR;
function lameCloseStream(const lameProc: tLameLibrary_proc; stream: HBE_STREAM): BE_ERR;
function lameVersion(const lameProc: tLameLibrary_proc; out version: BE_VERSION): bool;
function lameWriteVBRHeader(const lameProc: tLameLibrary_proc; const fileName: aString): BE_ERR;
function lame_loadDLL(var lameProc: tLameLibrary_proc; const pathAndName: wString = c_lameEncDLL): int;
function lame_unloadDLL(var lameProc: tLameLibrary_proc): int;

Types

PHBE_STREAM = ˆHBE_STREAM;
HBE_STREAM = DWORD;
BE_ERR = int32;
PBE_CONFIG = ˆBE_CONFIG;
PBE_VERSION = ˆBE_VERSION;
LONG = longInt;
PBE_CONFIG_FORMATLAME = ˆBE_CONFIG_FORMATLAME;
proc_beInitStream = function(pbeConfig: PBE_CONFIG; var dwSamples: DWORD; var dwBufferSize: DWORD; var phbeStream: HBE_STREAM): BE_ERR; cdecl;
proc_beEncodeChunk = function(hbeStream: HBE_STREAM; nSamples: DWORD; pSamples: pointer; pOutput: pointer; var pdwOutput: DWORD): BE_ERR; cdecl;
proc_beDeinitStream = function(hbeStream: HBE_STREAM; pOutput: pointer; var pdwOutput: DWORD): BE_ERR; cdecl;
proc_beCloseStream = function(hbeStream: HBE_STREAM): BE_ERR; cdecl;
proc_beVersion = procedure(var pbeVersion: BE_VERSION); cdecl;
pBladeLibrary_proc = ˆtBladeLibrary_proc;
proc_lameWriteVBRHeader = function(fileName: LPCSTR): BE_ERR; cdecl;
pLameLibrary_proc = ˆtLameLibrary_proc;

Constants

BE_CONFIG_AAC = BE_CONFIG_MP3 + 998;
BE_CONFIG_LAME = 256;
BE_CONFIG_MP3 = 0;
BE_ERR_BUFFER_TOO_SMALL = $00000005;
BE_ERR_INVALID_FORMAT = $00000001;
BE_ERR_INVALID_FORMAT_PARAMETERS = $00000002;
BE_ERR_INVALID_HANDLE = $00000004;
BE_ERR_NO_MORE_HANDLES = $00000003;
BE_ERR_SUCCESSFUL = $00000000;
BE_MAX_HOMEPAGE = 256;
BE_MP3_MODE_DUALCHANNEL = 2;
BE_MP3_MODE_JSTEREO = 1;
BE_MP3_MODE_MONO = 3;
BE_MP3_MODE_STEREO = 0;
CURRENT_STRUCT_VERSION = 1;
c_bladeEncDLL = 'BladeEnc.dll';
c_lameEncDLL = 'lame_enc.dll';
LQP_ABR = 11;
LQP_AM = 3000;
LQP_CBR = 12;
LQP_CD = 9000;
LQP_EXTREME = 8;
LQP_FAST_EXTREME = 9;
LQP_FAST_STANDARD = 7;
LQP_FM = 4000;
LQP_HIFI = 8000;
LQP_HIGH_QUALITY = 2;
LQP_INSANE = 10;
LQP_LOW_QUALITY = 1;
LQP_NOPRESET = -1;
LQP_NORMAL_QUALITY = 0;
LQP_PHONE = 1000;
LQP_R3MIX = 4;
LQP_RADIO = 6000;
LQP_STANDARD = 6;
LQP_STUDIO = 10000;
LQP_SW = 2000;
LQP_TAPE = 7000;
LQP_VERYHIGH_QUALITY = 5;
LQP_VOICE = 5000;
LQP_VOICE_QUALITY = 3;
MPEG1 = 1;
MPEG2 = 0;
UNA_ENCODER_ERR_BASE = $10000000;
UNA_ENCODER_ERR_NO_DLL = UNA_ENCODER_ERR_BASE + 1;
UNA_ENCODER_ERR_NO_PROCEDURE = UNA_ENCODER_ERR_BASE + 2;
VBR_METHOD_ABR = 4;
VBR_METHOD_DEFAULT = 0;
VBR_METHOD_MTRH = 3;
VBR_METHOD_NEW = 2;
VBR_METHOD_NONE = -1;
VBR_METHOD_OLD = 1;

Description

Functions and Procedures

function beInitStream(const bladeProc: tBladeLibrary_proc; config: PBE_CONFIG; out nSamples: DWORD; out minOutputBufSize: DWORD; out stream: HBE_STREAM): BE_ERR;

This function is the first to call before starting an encoding stream.

function beEncodeChunk(const bladeProc: tBladeLibrary_proc; stream: HBE_STREAM; nSamples: DWORD; samplesBuf: pointer; outputBuf: pointer; out outputUsed: DWORD): BE_ERR;

Encodes a chunk of samples. Please note that if you have set the output to generate mono MP3 files you must feed beEncodeChunk() with mono samples!

function beDeinitStream(const bladeProc: tBladeLibrary_proc; stream: HBE_STREAM; outputBuf: pointer; out outputUsed: DWORD): BE_ERR;

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.

function beCloseStream(const bladeProc: tBladeLibrary_proc; stream: HBE_STREAM): BE_ERR;

Last function to be called when finished encoding a stream.

Should unlike beDeinitStream() also be called if the encoding is canceled.

function beVersion(const bladeProc: tBladeLibrary_proc; out version: BE_VERSION): bool;

Returns information like version numbers (both of the DLL and encoding engine), release date and URL for BladeEnc's homepage. All this information should be made available to the user of your product through a dialog box or something similar.

function blade_loadDLL(var bladeProc: tBladeLibrary_proc; const pathAndName: wString = c_bladeEncDLL): int;

Loads Blade DLL.

Returns

0 if successuf, or Windows specific error code.

function blade_unloadDLL(var bladeProc: tBladeLibrary_proc): int;

Unloads Blade DLL.

Returns

0 if successuf, or Windows specific error code.

function lameInitStream(const lameProc: tLameLibrary_proc; config: PBE_CONFIG_FORMATLAME; out nSamples: DWORD; out minOutputBufSize: DWORD; out stream: HBE_STREAM): BE_ERR;

This function is the first to call before starting an encoding stream.

function lameEncodeChunk(const lameProc: tLameLibrary_proc; stream: HBE_STREAM; nSamples: DWORD; samplesBuf: pointer; outputBuf: pointer; out outputUsed: DWORD): BE_ERR;

Encodes a chunk of samples. Please note that if you have set the output to generate mono MP3 files you must feed beEncodeChunk() with mono samples!

function lameDeinitStream(const lameProc: tLameLibrary_proc; stream: HBE_STREAM; outputBuf: pointer; out outputUsed: DWORD): BE_ERR;

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.

function lameCloseStream(const lameProc: tLameLibrary_proc; stream: HBE_STREAM): BE_ERR;

Last function to be called when finished encoding a stream. Should unlike beDeinitStream() also be called if the encoding is canceled.

function lameVersion(const lameProc: tLameLibrary_proc; out version: BE_VERSION): bool;

Returns information like version numbers (both of the DLL and encoding engine), release date and URL for BladeEnc's homepage. All this information should be made available to the user of your product through a dialog box or something similar.

function lameWriteVBRHeader(const lameProc: tLameLibrary_proc; const fileName: aString): BE_ERR;

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 safe to call beWriteVBRHeader after the encoding has been finished, even when the beConfig.format.LHV1.bWriteVBRHeader is not set to TRUE.

function lame_loadDLL(var lameProc: tLameLibrary_proc; const pathAndName: wString = c_lameEncDLL): int;

Loads a Lame DLL. Returns 0 if successuf, or Windows specific error code.

function lame_unloadDLL(var lameProc: tLameLibrary_proc): int;

Unloads Lame DLL. Returns 0 if successuf, or Windows specific error code.

Types

PHBE_STREAM = ˆHBE_STREAM;

not supported, added by Lake type definitions */

HBE_STREAM = DWORD;
 
BE_ERR = int32;
 
PBE_CONFIG = ˆBE_CONFIG;

– –

PBE_VERSION = ˆBE_VERSION;

– –

LONG = longInt;
 
PBE_CONFIG_FORMATLAME = ˆBE_CONFIG_FORMATLAME;

FUTURE USE, SET TO 0 – –

proc_beInitStream = function(pbeConfig: PBE_CONFIG; var dwSamples: DWORD; var dwBufferSize: DWORD; var phbeStream: HBE_STREAM): BE_ERR; cdecl;

Prototype for beInitStream() routine.

proc_beEncodeChunk = function(hbeStream: HBE_STREAM; nSamples: DWORD; pSamples: pointer; pOutput: pointer; var pdwOutput: DWORD): BE_ERR; cdecl;

Prototype for beEncodeChunk() routine.

proc_beDeinitStream = function(hbeStream: HBE_STREAM; pOutput: pointer; var pdwOutput: DWORD): BE_ERR; cdecl;

Prototype for beDeinitStream() routine.

proc_beCloseStream = function(hbeStream: HBE_STREAM): BE_ERR; cdecl;

Prototype for beCloseStream() routine.

proc_beVersion = procedure(var pbeVersion: BE_VERSION); cdecl;

Prototype for beVersion() routine.

pBladeLibrary_proc = ˆtBladeLibrary_proc;

– tBladeLibrary_proc –

proc_lameWriteVBRHeader = function(fileName: LPCSTR): BE_ERR; cdecl;

Prototype for lameWriteVBRHeader() routine.

pLameLibrary_proc = ˆtLameLibrary_proc;

– tLameLibrary_proc –

Constants

BE_CONFIG_AAC = BE_CONFIG_MP3 + 998;
 
BE_CONFIG_LAME = 256;

============= Lame ======================== LAME encoding formats */

BE_CONFIG_MP3 = 0;

============= Blade ======================== encoding formats */

BE_ERR_BUFFER_TOO_SMALL = $00000005;

LAME error codes */

BE_ERR_INVALID_FORMAT = $00000001;
 
BE_ERR_INVALID_FORMAT_PARAMETERS = $00000002;
 
BE_ERR_INVALID_HANDLE = $00000004;
 
BE_ERR_NO_MORE_HANDLES = $00000003;
 
BE_ERR_SUCCESSFUL = $00000000;

error codes */

BE_MAX_HOMEPAGE = 256;

other constants */

BE_MP3_MODE_DUALCHANNEL = 2;
 
BE_MP3_MODE_JSTEREO = 1;

supported by Lame only

BE_MP3_MODE_MONO = 3;
 
BE_MP3_MODE_STEREO = 0;

format specific variables */

CURRENT_STRUCT_VERSION = 1;
 
c_bladeEncDLL = 'BladeEnc.dll';

– DLL specific –

c_lameEncDLL = 'lame_enc.dll';

NOT SUPPORTED: 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 beFlushNoGap(HBE_STREAM hbeStream, PBYTE pOutput, PDWORD pdwOutput); – DLL specific –

LQP_ABR = 11;
 
LQP_AM = 3000;
 
LQP_CBR = 12;
 
LQP_CD = 9000;
 
LQP_EXTREME = 8;
 
LQP_FAST_EXTREME = 9;
 
LQP_FAST_STANDARD = 7;
 
LQP_FM = 4000;
 
LQP_HIFI = 8000;
 
LQP_HIGH_QUALITY = 2;
 
LQP_INSANE = 10;
 
LQP_LOW_QUALITY = 1;
 
LQP_NOPRESET = -1;

LAME_QUALTIY_PRESET:

LQP_NORMAL_QUALITY = 0;

QUALITY PRESETS

LQP_PHONE = 1000;

NEW PRESET VALUES

LQP_R3MIX = 4;
 
LQP_RADIO = 6000;
 
LQP_STANDARD = 6;
 
LQP_STUDIO = 10000;
 
LQP_SW = 2000;
 
LQP_TAPE = 7000;
 
LQP_VERYHIGH_QUALITY = 5;
 
LQP_VOICE = 5000;
 
LQP_VOICE_QUALITY = 3;
 
MPEG1 = 1;

?

MPEG2 = 0;
 
UNA_ENCODER_ERR_BASE = $10000000;

============= una specific =================

UNA_ENCODER_ERR_NO_DLL = UNA_ENCODER_ERR_BASE + 1;
 
UNA_ENCODER_ERR_NO_PROCEDURE = UNA_ENCODER_ERR_BASE + 2;
 
VBR_METHOD_ABR = 4;
 
VBR_METHOD_DEFAULT = 0;
 
VBR_METHOD_MTRH = 3;
 
VBR_METHOD_NEW = 2;
 
VBR_METHOD_NONE = -1;

#define CURRENT_STRUCT_SIZE sizeof(BE_CONFIG) // is currently 331 bytes VBRMETHOD:

VBR_METHOD_OLD = 1;
 

Author

(c) 2012 Lake of Soft


Generated by PasDoc 0.12.1 on 2012-10-09