ModPlug Developer Information
Since Mod-Plugin v1.75, you can now use NPMOD32.DLL in your own
programs; the following functions are defined in the DLL:
- LPVOID WINAPI ModPlug_Create(UINT argc, LPSTR argn[], LPSTR argv[])
This function create a plugin, the same way it's done in HTML: argc
is the number of parameters on the command line, argn is a pointer to an
array of pointers to ASCIIZ strings (names of parameters), and argv is
the same thing, but the strings are the values for each parameter.
You should keep the return value to call the other functions.
- LPVOID WINAPI ModPlug_CreateEx(LPCSTR lpszArgs) (1.84+)
This function is identical to ModPlug_Create, but you can simply
use a string, instead of an array of strings. Each keyword must
be separated by a '|' character (It works also with carriage return).
For example, the command should
be sent as "loop|true|vucolor|#ff00ff|".
- BOOL WINAPI ModPlug_Destroy(LPVOID pPlugin)
This function destroys a plugin created by ModPlug_Create.
pPlugin is the return value from ModPlug_Create.
- BOOL WINAPI ModPlug_SetWindow(LPVOID pPlugin, HWND hwnd)
This function should be called immediately after ModPlug_Create.
hwnd is the handle of the window where you want the plugin to be.
You are responsible for correctly sizing this window: the parameters
SRC, WIDTH, HEIGHT, ALIGN and BORDER are ignored.
- BOOL WINAPI ModPlug_Load(LPVOID pPlugin, LPCSTR lpszFileName)
This function will read a mod file and start to play if you specified
autostart=true in the command line. lpszFileName is the file name, and
can be of any type: mod/s3m/mdz/xm...
- BOOL WINAPI ModPlug_Play(LPVOID pPlugin)
This function causes the mod to start playing.
- BOOL WINAPI ModPlug_Stop(LPVOID pPlugin)
This function causes the mod to stop playing.
NPMOD32 1.80 Additions
- BOOL WINAPI ModPlug_GetVersion()
Returns the version of npmod32.dll.
- BOOL WINAPI ModPlug_IsReady(LPVOID plugin)
Returns TRUE is a song is correctly loaded.
- BOOL WINAPI ModPlug_IsPlaying(LPVOID plugin)
Returns TRUE is the plugin is currently playing a song.
- DWORD WINAPI ModPlug_GetMaxPosition(LPVOID plugin)
Returns the maximum position of the song.
- DWORD WINAPI ModPlug_GetCurrentPosition(LPVOID plugin)
Returns the current playing position. (Between 0 and ModPlug_GetMaxPosition)
- BOOL WINAPI ModPlug_SetCurrentPosition(LPVOID plugin, DWORD nPos)
Sets the current playing position.
NPMOD32 1.91 Additions
- DWORD WINAPI ModPlug_GetVolume(LPVOID plugin)
Returns the current volume (Between 0 and 100)
- BOOL WINAPI ModPlug_SetVolume(LPVOID plugin, DWORD vol)
Sets the current volume (Between 0 and 100)
Source Code
Download C++ (Visual C++, MFC) sample source code of a mod player using
npmod32.dll (200K)
.
Download C++ (Visual C++, MFC) full source code of a basic mod/nst player (110K).
.
GModPlay: Linux player based on the Modplug Engine.
Modplug Sound System SDK
Download the ModPlug Sound System SDK for use in your C++ applications.(80K)
View the Modplug Sound System SDK C++ header file
View the Modplug Sound System SDK Delphi header file
For Visual Basic programmers, David W. Yip gave me
the following declaration for the npmod32.dll functions:
- Declare Function ModPlug_Create Lib "npmod32.dll" (ByVal argc As Integer, ByVal argn As String, ByVal argv As String) As Long
- Declare Function ModPlug_CreateEx Lib "npmod32.dll" (ByVal lpszArgs As String) As Long
- Declare Function ModPlug_Destroy Lib "npmod32.dll" (ByVal pPlugin As Long) As Long
- Declare Function ModPlug_SetWindow Lib "npmod32.dll" (ByVal pPlugin As Long, ByVal hWnd As Integer) As Long
- Declare Function ModPlug_Load Lib "npmod32.dll" (ByVal pPlugin As Long, ByVal lpszFileName As String) As Long
- Declare Function ModPlug_Play Lib "npmod32.dll" (ByVal pPlugin As Long) As Long
- Declare Function ModPlug_Stop Lib "npmod32.dll" (ByVal pPlugin As Long) As Long
- Declare Function ModPlug_SetCurrentPosition Lib "npmod32.dll" (ByVal plugin As Long, ByVal nPos As Long) As Long
- Declare Function ModPlug_GetCurrentPosition Lib "npmod32.dll" (ByVal plugin As Long) As Long
- Declare Function ModPlug_GetCurrentPosition Lib "npmod32.dll" (ByVal plugin As Long) As Long
- Declare Function ModPlug_GetMaxPosition Lib "npmod32.dll" (ByVal plugin As Long) As Long
- Declare Function ModPlug_IsPlaying Lib "npmod32.dll" (ByVal plugin As Long) As Long
- Declare Function ModPlug_GetCurrentPosition Lib "npmod32.dll" (ByVal plugin As Long)
- Declare Function ModPlug_IsReady Lib "npmod32.dll" (ByVal plugin As Long)
More detailed information for Visual Basic, by David Yip.
More detailed information for Delphi 3.x, by Anthony Chatman.
Delphi Sample Source Code, by Gabe Bauman.