When I try to use the "CreateNewCompressionObject"-function, I always get this access-violation error:
Project C:\Eigene Datein\Delphi\DLL Loader\DllLoader.exe faulted with message: 'access violation at 0x00431c54: read of address 0x00000000'. Process Stopped. Use Step or Run to continue.
Here are some code-extracts (taken from several units). I get the message when I use "Start" with correct WavInfo from 'C:\test.wav'.
Code:
interface
type TWaveFormatEX = record
wFormatTag: Word; { format type }
nChannels: Word; { number of channels (i.e. mono, stereo, etc.) }
nSamplesPerSec: DWORD; { sample rate }
nAvgBytesPerSec: DWORD; { for buffer estimation }
nBlockAlign: Word; { block size of data }
wBitsPerSample: Word; { number of bits per sample of mono data }
cbSize: Word; { the count in bytes of the size of }
end;
type ENCompressionOpenResult = (COROk, CORFileError, CORMemoryError, CORCodecError);
procedure CreateNewCompressionObject(FileName:ShortString; var ReturnError: ENCompressionOpenResult; WFXOutputFormat: TWaveFormatEX); cdecl; external 'Mp3 (Lame).dll';
procedure Start(WavInfo: TWaveFormatEX);
implementation
procedure Start(WavInfo: TWaveFormatEX);
var
ReturnError: ENCompressionOpenResult;
begin
CreateNewCompressionObject('C:\test.wav',ReturnError,WavInfo);
end;