본문 바로가기
스마트 장치 개발

C#으로 fmodex.dll을 사용하는 예제

by leo21c 2009. 6. 29.
SMALL
// DLLImport to Initialize FMOD
[DllImport("fmodex.dll", EntryPoint = "FSOUND_Init", SetLastError = true, CharSet = CharSet.Unicode, CallingConvention = CallingConvention.Winapi)]
public static extern bool FMOD_init(int mixrate, int maxsoftwarechannels, int flags);

// DLL Import to get the length of a stream
[DllImport("fmodex.dll", EntryPoint = "FSOUND_Stream_GetLength", SetLastError = true, CharSet = CharSet.Unicode, CallingConvention = CallingConvention.Winapi)]
public static extern int FMOD_getLength(IntPtr fstream);

// DLL Import to get the current position of the stream
[DllImport("fmodex.dll", EntryPoint = "FSOUND_Stream_GetPosition", SetLastError = true, CharSet = CharSet.Unicode, CallingConvention = CallingConvention.Winapi)]
public static extern UInt32 FMOD_getPosition(IntPtr fstream);

// DLL Import to open a stream
[DllImport("fmodex.dll", EntryPoint = "FSOUND_Stream_Open", SetLastError = true, CharSet = CharSet.Unicode, CallingConvention = CallingConvention.Winapi)]
public static extern IntPtr FMOD_open(IntPtr data, int mode, int offset, int length);

// DLL Import to start playing from the stream
[DllImport("fmodex.dll", EntryPoint = "FSOUND_Stream_Play", SetLastError = true, CharSet = CharSet.Unicode, CallingConvention = CallingConvention.Winapi)]
public static extern int FMOD_play(int channel, IntPtr fstream);

// DLL Import to set the position of the stream
[DllImport("fmodex.dll", EntryPoint = "FSOUND_Stream_SetPosition", SetLastError = true, CharSet = CharSet.Unicode, CallingConvention = CallingConvention.Winapi)]
public static extern bool FMOD_setPosition(IntPtr fstream, UInt32 position);

// DLL Import to stop playing the stream
[DllImport("fmodex.dll", EntryPoint = "FSOUND_Stream_Stop", SetLastError = true, CharSet = CharSet.Unicode, CallingConvention = CallingConvention.Winapi)]
public static extern bool FMOD_stop(IntPtr fstream);

// DLL Import to close FMOD and release resources
[DllImport("fmodex.dll", EntryPoint = "FSOUND_Close", SetLastError = true, CharSet = CharSet.Unicode, CallingConvention = CallingConvention.Winapi)]
public static extern void FMOD_close();


1246244818_Source_and_dll.zip
LIST