Help with FFI - another try

John M McIntosh johnmci at smalltalkconsulting.com
Mon Jul 17 07:05:14 UTC 2006


On 16-Jul-06, at 11:27 PM, Eugene Beschastnov wrote:
>
>
> dwSamples := WordArray new: 0.
> dwMp3Buffer := WordArray new: 0.
> hbeStream := WordArray new: 0.
>
> errCode := LameEncoder apiBeInitStreamBeConfig: beConfig dwSamples:
> dwSamples dwMp3Buffer: dwMp3Buffer hbeStream: hbeStream.



I'd suspect that setting up these three variables which are going to  
be pointers to store integers into
and asking for 0 bytes of storage to be allocated for each is going  
to be an issue when the DLL attempts
to write 4 bytes into those memory locations.


I'd suggest rather you use
dwSamples := ByteArray new: 4.

and the accessors such as signedLongAt:put:
to access the data, also for the sound data is it big endian or  
little endian? Accessors exist to allow you
choose endian where the choice might not be platform dependent.

Also cross check what the DWORD/BOOL in the software really resolves  
too.

--
======================================================================== 
===
John M. McIntosh <johnmci at smalltalkconsulting.com>
Corporate Smalltalk Consulting Ltd.  http://www.smalltalkconsulting.com
======================================================================== 
===





More information about the Squeak-dev mailing list