μFMOD v1.17 for Win32
uFMOD is a tiny XM player library written in assembly language. It's perfect for size-critical applications (such as intros), click free, highly reliable, easy to use, open source. File, resource and direct memory playback supported. Usage examples available for most popular compilers (Visual C++, Visual Basic, PureBasic, Delphi, MASM32, FASM, NASM and TASM).
WINMM version
Files required:
import.inc - contains Win32 API defs.
ufmod.inc - contains uFMOD API defs. and function descriptions.
ufmod.obj - the library itself
Now, in your Delphi source (*.dpr or *.pas) add the following lines:
{$I ufmod.inc}
Now, let's play an XM file:
uFMOD_PlaySong('somefile.xm',0,XM_FILE);
While it plays, let's pop up a message box to avoid our app exiting and stopping playback too early:
MessageBox(0,'uFMOD ruleZ!','.:Delphi:.',0);
Now, let's stop playback:
uFMOD_StopSong
Delphi whould say it can't convert a String into a plain Pointer, so let's modify the ufmod.inc file:
function uFMOD_PlaySong(
lpXM: Pointer; { Place PChar here instead of Pointer }
param, fdwSong: Integer):
Integer; stdcall; external;
That's all.
The example included in uFMOD package plays a track in memory instead of a file. You can convert an XM file into a memory hex dump using the eff.exe tool.
uFMOD also supports resource playback. Let me know if an explanation is required.
Dealing with DirectSound is a bit more complex, but the API is almost the same, just some additional steps required. Check the included example.
最初由 Desmond 发布 WINMM version Files required: import.inc - contains Win32 API defs. ufmod.inc - contains uFMOD API defs. and function descriptions. ufmod.obj - the library itself ........