<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<HTML><HEAD>
<META http-equiv=Content-Type content="text/html; charset=windows-1256">
<META content="MSHTML 6.00.2900.2180" name=GENERATOR>
<STYLE></STYLE>
</HEAD>
<BODY bgColor=#ffffff>
<DIV><FONT face=Arial size=2>hello guys this is my code for the C#
wrapper.</FONT></DIV>
<DIV><FONT face=Arial size=2>=================================</FONT></DIV>
<DIV><FONT color=#0000ff size=2>
<P>using</FONT><FONT size=2> System;</P></FONT><FONT color=#0000ff size=2>
<P>using</FONT><FONT size=2> System.Runtime.InteropServices;</P></FONT><FONT
color=#0000ff size=2>
<P>using</FONT><FONT size=2> System.IO;</P></FONT><FONT color=#0000ff size=2>
<P>namespace</FONT><FONT size=2> Speex</P>
<P>{</P>
<P></FONT><FONT color=#808080 size=2>///<summary></P></FONT><FONT size=2>
<P></FONT><FONT color=#808080 size=2>///</FONT><FONT color=#008000 size=2>the
following class is the win32 SPEEX API that retrieve</P></FONT><FONT size=2>
<P></FONT><FONT color=#808080 size=2>///</FONT><FONT color=#008000
size=2>methods and structures from the libspeex file</P></FONT><FONT size=2>
<P></FONT><FONT color=#808080 size=2>///</summary></P></FONT><FONT size=2>
<P></FONT><FONT color=#0000ff size=2>public</FONT><FONT size=2> </FONT><FONT
color=#0000ff size=2>unsafe</FONT><FONT size=2> </FONT><FONT color=#0000ff
size=2>class</FONT><FONT size=2> Speex_win32</P>
<P>{</P></FONT><FONT color=#0000ff size=2>
<P>#region</FONT><FONT size=2> Speex Constants</P>
<P></FONT><FONT color=#008000 size=2>//global speex file that contains the
api(s)</P></FONT><FONT size=2>
<P></FONT><FONT color=#0000ff size=2>public</FONT><FONT size=2> </FONT><FONT
color=#0000ff size=2>const</FONT><FONT size=2> </FONT><FONT color=#0000ff
size=2>string</FONT><FONT size=2> libpath = "libspeex.dll";</P>
<P></FONT><FONT color=#0000ff size=2>public</FONT><FONT size=2> </FONT><FONT
color=#0000ff size=2>const</FONT><FONT size=2> </FONT><FONT color=#0000ff
size=2>int</FONT><FONT size=2> Frame_Size = 160;</P>
<P></FONT><FONT color=#0000ff size=2>public</FONT><FONT size=2> </FONT><FONT
color=#0000ff size=2>const</FONT><FONT size=2> </FONT><FONT color=#0000ff
size=2>int</FONT><FONT size=2> Max_Frame_Size = 2000;</P>
<P></FONT><FONT color=#0000ff size=2>public</FONT><FONT size=2> </FONT><FONT
color=#0000ff size=2>const</FONT><FONT size=2> </FONT><FONT color=#0000ff
size=2>int</FONT><FONT size=2> Speex_Get_Frame_Size = 3;</P>
<P></FONT><FONT color=#0000ff size=2>public</FONT><FONT size=2> </FONT><FONT
color=#0000ff size=2>const</FONT><FONT size=2> </FONT><FONT color=#0000ff
size=2>int</FONT><FONT size=2> Speex_Set_Quality = 4;</P>
<P></FONT><FONT color=#0000ff size=2>public</FONT><FONT size=2> </FONT><FONT
color=#0000ff size=2>const</FONT><FONT size=2> </FONT><FONT color=#0000ff
size=2>int</FONT><FONT size=2> Speex_nb_Mode = 3;</P>
<P></FONT><FONT color=#008000 size=2>//create the structure that will hold the
speexbits</P></FONT><FONT size=2>
<P></FONT><FONT color=#0000ff size=2>public</FONT><FONT size=2> </FONT><FONT
color=#0000ff size=2>struct</FONT><FONT size=2> SpeexBits</P>
<P>{</P>
<P></FONT><FONT color=#0000ff size=2>public</FONT><FONT size=2> </FONT><FONT
color=#0000ff size=2>char</FONT><FONT size=2> *chars; </FONT><FONT color=#008000
size=2>/* "raw" data */</P></FONT><FONT size=2>
<P></FONT><FONT color=#0000ff size=2>public</FONT><FONT size=2> </FONT><FONT
color=#0000ff size=2>int</FONT><FONT size=2> nbBits; </FONT><FONT color=#008000
size=2>/* Total number of bits stored in thestream*/</P></FONT><FONT size=2>
<P></FONT><FONT color=#0000ff size=2>public</FONT><FONT size=2> </FONT><FONT
color=#0000ff size=2>int</FONT><FONT size=2> charPtr; </FONT><FONT color=#008000
size=2>/* Position of the byte "cursor" */</P></FONT><FONT size=2>
<P></FONT><FONT color=#0000ff size=2>public</FONT><FONT size=2> </FONT><FONT
color=#0000ff size=2>int</FONT><FONT size=2> bitPtr; </FONT><FONT color=#008000
size=2>/* Position of the bit "cursor" within thecurrent char */</P></FONT><FONT
size=2>
<P></FONT><FONT color=#0000ff size=2>public</FONT><FONT size=2> </FONT><FONT
color=#0000ff size=2>int</FONT><FONT size=2> owner; </FONT><FONT color=#008000
size=2>/* Does the struct "own" the "raw" buffer(member "chars")
*/</P></FONT><FONT size=2>
<P></FONT><FONT color=#0000ff size=2>public</FONT><FONT size=2> </FONT><FONT
color=#0000ff size=2>int</FONT><FONT size=2> overflow; </FONT><FONT
color=#008000 size=2>/* Set to one if we try to read past thevalid data
*/</P></FONT><FONT size=2>
<P></FONT><FONT color=#0000ff size=2>public</FONT><FONT size=2> </FONT><FONT
color=#0000ff size=2>int</FONT><FONT size=2> buf_size; </FONT><FONT
color=#008000 size=2>/* Allocated size for buffer */</P></FONT><FONT size=2>
<P></FONT><FONT color=#0000ff size=2>public</FONT><FONT size=2> </FONT><FONT
color=#0000ff size=2>int</FONT><FONT size=2> reserved1; </FONT><FONT
color=#008000 size=2>/* Reserved for future use */</P></FONT><FONT size=2>
<P></FONT><FONT color=#0000ff size=2>public</FONT><FONT size=2> </FONT><FONT
color=#0000ff size=2>void</FONT><FONT size=2> *reserved2; </FONT><FONT
color=#008000 size=2>/* Reserved for future use */</P></FONT><FONT size=2>
<P>}</P>
<P>[StructLayout(LayoutKind.Sequential)]</P>
<P></FONT><FONT color=#0000ff size=2>public</FONT><FONT size=2> </FONT><FONT
color=#0000ff size=2>struct</FONT><FONT size=2> SpeexMode</P>
<P>{</P>
<P></FONT><FONT color=#0000ff size=2>public</FONT><FONT size=2> </FONT><FONT
color=#0000ff size=2>void</FONT><FONT size=2> *mode;</P>
<P></FONT><FONT color=#0000ff size=2>public</FONT><FONT size=2> IntPtr
query;</P>
<P></FONT><FONT color=#0000ff size=2>public</FONT><FONT size=2> </FONT><FONT
color=#0000ff size=2>char</FONT><FONT size=2> *modename;</P>
<P></FONT><FONT color=#0000ff size=2>public</FONT><FONT size=2> </FONT><FONT
color=#0000ff size=2>int</FONT><FONT size=2> modeid;</P>
<P></FONT><FONT color=#0000ff size=2>public</FONT><FONT size=2> </FONT><FONT
color=#0000ff size=2>int</FONT><FONT size=2> bitstream_version;</P>
<P></FONT><FONT color=#0000ff size=2>public</FONT><FONT size=2> IntPtr
enc_init;</P>
<P></FONT><FONT color=#0000ff size=2>public</FONT><FONT size=2> IntPtr
enc_destroy;</P>
<P></FONT><FONT color=#0000ff size=2>public</FONT><FONT size=2> IntPtr enc;</P>
<P></FONT><FONT color=#0000ff size=2>public</FONT><FONT size=2> IntPtr
dec_init;</P>
<P></FONT><FONT color=#0000ff size=2>public</FONT><FONT size=2> IntPtr
dec_destroy;</P>
<P></FONT><FONT color=#0000ff size=2>public</FONT><FONT size=2> IntPtr dec;</P>
<P></FONT><FONT color=#0000ff size=2>public</FONT><FONT size=2> IntPtr
enc_ctl;</P>
<P></FONT><FONT color=#0000ff size=2>public</FONT><FONT size=2> IntPtr
dec_ctl;</P>
<P>}</P></FONT><FONT color=#0000ff size=2>
<P>#endregion</P>
<P>#region</FONT><FONT size=2> Exported Methods</P>
<P>[DllImport(libpath)]</P>
<P></FONT><FONT color=#0000ff size=2>public</FONT><FONT size=2> </FONT><FONT
color=#0000ff size=2>static</FONT><FONT size=2> </FONT><FONT color=#0000ff
size=2>extern</FONT><FONT size=2> </FONT><FONT color=#0000ff
size=2>void</FONT><FONT size=2> *speex_encoder_init(</FONT><FONT color=#0000ff
size=2>ref</FONT><FONT size=2> SpeexMode modein);</P>
<P>[DllImport(libpath,EntryPoint="speex_lib_get_mode")]</P>
<P></FONT><FONT color=#0000ff size=2>public</FONT><FONT size=2> </FONT><FONT
color=#0000ff size=2>static</FONT><FONT size=2> </FONT><FONT color=#0000ff
size=2>extern</FONT><FONT size=2> IntPtr speex_lib_get_mode (</FONT><FONT
color=#0000ff size=2>int</FONT><FONT size=2> modein);</P>
<P>[DllImport(libpath)]</P>
<P></FONT><FONT color=#0000ff size=2>public</FONT><FONT size=2> </FONT><FONT
color=#0000ff size=2>static</FONT><FONT size=2> </FONT><FONT color=#0000ff
size=2>extern</FONT><FONT size=2> </FONT><FONT color=#0000ff
size=2>int</FONT><FONT size=2> speex_encoder_ctl(</FONT><FONT color=#0000ff
size=2>void</FONT><FONT size=2> *state , </FONT><FONT color=#0000ff
size=2>int</FONT><FONT size=2> request , </FONT><FONT color=#0000ff
size=2>void</FONT><FONT size=2> *ptr);</P>
<P>[DllImport(libpath)]</P>
<P></FONT><FONT color=#0000ff size=2>public</FONT><FONT size=2> </FONT><FONT
color=#0000ff size=2>static</FONT><FONT size=2> </FONT><FONT color=#0000ff
size=2>extern</FONT><FONT size=2> </FONT><FONT color=#0000ff
size=2>int</FONT><FONT size=2> speex_encoder_settings(</FONT><FONT color=#0000ff
size=2>void</FONT><FONT size=2> *state , </FONT><FONT color=#0000ff
size=2>int</FONT><FONT size=2> complexity , </FONT><FONT color=#0000ff
size=2>int</FONT><FONT size=2> samplingrate,</FONT><FONT color=#0000ff
size=2>int</FONT><FONT size=2> quality , </FONT><FONT color=#0000ff
size=2>int</FONT><FONT size=2> bitrate);</P>
<P>[DllImport(libpath)]</P>
<P></FONT><FONT color=#0000ff size=2>public</FONT><FONT size=2> </FONT><FONT
color=#0000ff size=2>static</FONT><FONT size=2> </FONT><FONT color=#0000ff
size=2>extern</FONT><FONT size=2> </FONT><FONT color=#0000ff
size=2>int</FONT><FONT size=2> speex_encoder_int(</FONT><FONT color=#0000ff
size=2>void</FONT><FONT size=2> *state , </FONT><FONT color=#0000ff
size=2>short</FONT><FONT size=2> *input , SpeexBits *bits);</P>
<P></FONT><FONT color=#008000 size=2>//exported bit operation
methods</P></FONT><FONT size=2>
<P>[DllImport(libpath)]</P>
<P></FONT><FONT color=#0000ff size=2>public</FONT><FONT size=2> </FONT><FONT
color=#0000ff size=2>static</FONT><FONT size=2> </FONT><FONT color=#0000ff
size=2>extern</FONT><FONT size=2> </FONT><FONT color=#0000ff
size=2>void</FONT><FONT size=2> speex_bits_init(SpeexBits *bits);</P>
<P>[DllImport(libpath)]</P>
<P></FONT><FONT color=#0000ff size=2>public</FONT><FONT size=2> </FONT><FONT
color=#0000ff size=2>static</FONT><FONT size=2> </FONT><FONT color=#0000ff
size=2>extern</FONT><FONT size=2> </FONT><FONT color=#0000ff
size=2>int</FONT><FONT size=2> speex_bits_write(SpeexBits *bits , IntPtr bytes ,
</FONT><FONT color=#0000ff size=2>int</FONT><FONT size=2> Max_length);</P>
<P>[DllImport(libpath)]</P>
<P></FONT><FONT color=#0000ff size=2>public</FONT><FONT size=2> </FONT><FONT
color=#0000ff size=2>static</FONT><FONT size=2> </FONT><FONT color=#0000ff
size=2>extern</FONT><FONT size=2> </FONT><FONT color=#0000ff
size=2>int</FONT><FONT size=2> speex_bits_reset(SpeexBits *bits);</P>
<P>[DllImport(libpath)]</P>
<P></FONT><FONT color=#0000ff size=2>public</FONT><FONT size=2> </FONT><FONT
color=#0000ff size=2>static</FONT><FONT size=2> </FONT><FONT color=#0000ff
size=2>extern</FONT><FONT size=2> </FONT><FONT color=#0000ff
size=2>void</FONT><FONT size=2> *speex_decoder_init(</FONT><FONT color=#0000ff
size=2>int</FONT><FONT size=2> modein);</P>
<P>[DllImport(libpath)]</P>
<P></FONT><FONT color=#0000ff size=2>public</FONT><FONT size=2> </FONT><FONT
color=#0000ff size=2>static</FONT><FONT size=2> </FONT><FONT color=#0000ff
size=2>extern</FONT><FONT size=2> </FONT><FONT color=#0000ff
size=2>int</FONT><FONT size=2> speex_decoder_ctl(</FONT><FONT color=#0000ff
size=2>void</FONT><FONT size=2> *state , </FONT><FONT color=#0000ff
size=2>int</FONT><FONT size=2> request , </FONT><FONT color=#0000ff
size=2>void</FONT><FONT size=2> *ptr);</P>
<P>[DllImport(libpath)]</P>
<P></FONT><FONT color=#0000ff size=2>public</FONT><FONT size=2> </FONT><FONT
color=#0000ff size=2>static</FONT><FONT size=2> </FONT><FONT color=#0000ff
size=2>extern</FONT><FONT size=2> </FONT><FONT color=#0000ff
size=2>int</FONT><FONT size=2> speex_decoder_int(</FONT><FONT color=#0000ff
size=2>void</FONT><FONT size=2> *state , </FONT><FONT color=#0000ff
size=2>short</FONT><FONT size=2> *input , SpeexBits *bits);</P></FONT><FONT
color=#0000ff size=2>
<P>#endregion</P></FONT><FONT size=2>
<P>}</P>
<P>}</P>
<P> </P>
<P><FONT face=Arial>when i call the speex_lib_get_mode(int modein);</FONT></P>
<P><FONT face=Arial>in my managed code i have an exception with the message
"unable to find an entrypoint for the speex_lib_get_mode in the libspeex.dll
file"</FONT></P>
<P><FONT face=Arial>please help is there anything something wrong in my wrapper
please help or correct my file please.</FONT></P></FONT></DIV></BODY></HTML>