Hi
(Delphi 2007, StarBurn 12.0.0.272)
I am attempting to convert Wav files to MP3 using a function that can be simplified as follows:
Code:
function ConvertWavToMp3File(const sSourceFilename : string;
const sDestFilename : string;
const sTempFolder: string;
const bVerbose: Boolean = True
): Boolean;
const
MP3_Conversion_Mode = STARBURN_STARWAVE2_MP3_MODE0 { CBR };
MP3_Bit_Rate = 128;
MP3_Conversion_Quality = STARBURN_STARWAVE2_QM_STANDARD;
var
l__ULONG__Status : DWORD;
l__CHAR__ExceptionText : Packed Array[ 1..1024 ] Of Char;
sbException: EXCEPTION_NUMBER;
l__STARBURN_STARWAVE2_INIT_PARAMS: STARBURN_STARWAVE2_INIT_PARAMS;
begin
result := True;
try
ZeroMemory(@l__CHAR__ExceptionText, sizeof( l__CHAR__ExceptionText));
ZeroMemory(@l__STARBURN_STARWAVE2_INIT_PARAMS, sizeof( l__STARBURN_STARWAVE2_INIT_PARAMS ));
l__STARBURN_STARWAVE2_INIT_PARAMS.m__STARBURN_STARWAVE2_CONVERSION_MODE := MP3_Conversion_Mode;
l__STARBURN_STARWAVE2_INIT_PARAMS.m__LONG__nominalBitrate := MP3_Bit_Rate * 1000;
l__STARBURN_STARWAVE2_INIT_PARAMS.m__STARBURN_STARWAVE2_QUALITY_MODE := MP3_Conversion_Quality;
sbException := StarBurn_StarWave2_EncodeMP3OGGFromWAV(PChar(sSourceFilename),
PChar(sDestFilename),
@l__STARBURN_STARWAVE2_INIT_PARAMS,
CompressProgressCallback,
nil,
PCHAR( @l__CHAR__ExceptionText[1] ),
sizeof( l__CHAR__ExceptionText ),
l__ULONG__Status);
if (sbException <> EN_SUCCESS) then
raise Exception.create('Audio compression error: ' + PAnsiChar(@l__CHAR__ExceptionText[1]));
except
...
end;
end;
However i consistently receive the error:
'CStarWave2_EncoderMp3::Init(): failed! Error text: 'nlame_init_params() failed', Error code = -1'
However i am able to convert using the same files and parameters with the AudioCompressor.exe demo without any problem.
Can you give me any hints as to possible causes for the error.
As the log is short I will include it in situ:
Code:
StarBurn:StarBurn_StarWave2_EncodeMP3OGGFromWAV(): ENTERed for C:\Users\ABC\AppData\Local\Temp\convert_3.wav, D:\Testing_Other\ABC\Fun_8.mp3, 0x0018E4C1, 0x006F5B44, 0x00000000, 0x0018E4DB, 1024, 0x0018E8E8
CStarWave2_EncoderGeneric::PreInit(): ENTERed.
CStarWave2_EncoderGeneric::PreInit(): EXITing with success.
StarBurn:StarBurn_StarWave2_EncodeMP3OGGFromWAV(): ->PreInit(...) returned 1
CStarWave2_EncoderMp3::Init(): ENTERed.
CStarWave2_EncoderGeneric::LoadDll(): ENTERed. Dll name: 'nlame.dll'
CStarWave2_EncoderGeneric::LoadDll(): EXITing with success.
CStarWave2_EncoderMp3::Init(): failed! Error text: 'nlame_init_params() failed', Error code = -1
CStarWave2_EncoderMP3::Init(): EXITing with failure!
StarBurn:StarBurn_StarWave2_EncodeMP3OGGFromWAV(): ->Init(...) returned 0
CStarWave2_EncoderMp3::CleanUp(): ENTERed.
CStarWave2_EncoderGeneric::UnloadDll(): ENTERed.
CStarWave2_EncoderGeneric::UnloadDll(): EXITing with success.
CStarWave2_EncoderMp3::CleanUp(): EXITing with success.
CStarWave2_EncoderGeneric::CleanUp(): ENTERed.
CStarWave2_EncoderGeneric::CleanUp(): EXITing with success.
StarBurn:StarBurn_StarWave2_EncodeMP3OGGFromWAV(): EXITing with failure!