PDA

View Full Version : The untranslated ModPlug Player SDK for Delphi?



WILL
11-05-2003, 01:19 AM
I'm just wondering if anyone would be interested in using the ModPlug Player Sound System(the player dll not the plugin dll that was translated, but limited). It took me some time to get it and it does come with a bit of a story. So if anyone is interested please let me know.

:arrow: The problem:
Now, I've used the well known plugin library that everyone knows quite well. The problem though, is that it doesn't mix all the effects properly. There has to be something for the Player NOT the plugin. It was just too old. I found this one package that was said to be some kind of SDK for the npmod32.dll plugin library. This made no sense to me. The truth that I found out later was that Oliver never translated the header for mppsdk.dll he wrote in C some time after he wrote a header for the npmod32.dll package some time before based on 'ModPlug Plugin'. You can currently download it from the modplug.com site (http://www.modplug.com/), but the documentation (http://www.modplug.com/modplug/developer.php3) for the library on the site is for the wrong library. So there is this sdk that has no documentation! :lol: I tried translating it, but with not much experience with DLLs, I couldn't do it. So why is there dll packages on the site?


:arrow: How I figured it out:
I had been searching for his mystery component set made by Dean Ellis of SilleX called SXMedia. It was for use with Hori's DelphiX components. The link on turbo.gamedev.net (http://turbo.gamedev.net/sound.asp) was dead though. :( Tried searching on google.com - notin'! So broken hearted I gave up trying. Some time later I found this site (http://www.cerebral-bicycle.co.uk/) and looked around. Wow! The SXMedia components! :D
I downloaded them and tried them. One of the SXMedia components was a TModPlayer object that played modules(MOD, S3M, IT, the works!) I played with this, found it to be better, but wait! 'mppsdk.dll'! :) It used the mppsdk.dll library with a translation of Oliver's C header that accompanied the package. Dean Ellis translated the header. And there it is dispite what everyone was reffering to it as. Good on him!


:arrow: A little bug-fix and viola:
The translation was perfect, with a small exception. It used a signed integer when it should have used an unsigned one instead. Save that and it works perfectly. So I made the fix and now I have a 100% fully working ModPlug Player Sound System library. :) Strange enough though, I have this really good, licence free(Does not require a single licence or anything to use in a freeware/shareware or commercial project!) mod playback library, but not too many people know about it. I feel like I should post it somewhere or something. The original translation of the header file was done by Dean Ellis, but he doesn't state that I cannot redistribute the wrapper it's self so... What do you guys think?

fitzbean
12-05-2003, 12:23 PM
Post it - or email it to me, and I'll post it.

fitzbean@elitefxgames.com

fitzbean
12-05-2003, 12:36 PM
exactly what variable was declared wrongly btw?

Alimonster
12-05-2003, 08:36 PM
Post it somewhere. Dean deserves some credit for it -- maybe it can be hosted at DelphiGamer or something (seems an appropriate place). Also, make sure that Sly and/or Mike Wilson update the link at Turbo (by gunpoint if necessary).

WILL
13-05-2003, 12:20 AM
I would be most glad to post it. It will take me a day or two to get the package nicely together however. I'll make sure that Dean gets credit.

It wasn't a variable per-say. Rather the parameters and return data sizes for the external funcitons of the dll.

WILL
16-05-2003, 07:46 AM
Ok, as promised I am putting together a SDK for Delphi. I am almost done. so probably by tomorrow night I can post it. Anyone interested I can email a copy to you if you would like, but I will be posting it shortly. :D

:!: I should add however that I have added some features that have been found in a newer version of the MPP SDK that were not translated before. This includes PreAmp support.

Here is a list of commands it will support:
// Reference count: the initial reference count is 1, so you shouldn't have to call AddRef()
function AddRef: Cardinal; virtual; stdcall; abstract;
function Release: Cardinal; virtual; stdcall; abstract;
// API Version: you should refuse to continue if the returned value is smaller than MPPAPI_VERSION
function GetVersion: Cardinal; virtual; stdcall; abstract;
// Basic I/O Functions
function LoadSong(const MemFile: Pointer; Length: Integer): MppError; virtual; stdcall; abstract;
// Songs are always loaded from memory. The pointer pmemfile can be destroyed
// after the call to LoadSong. You can use memory-mapped files or a pointer returned
// by LockResource(), or whatever file in memory.

// Free the memory used by the song
function FreeSong: MppError; virtual; stdcall; abstract;
// Audio Rendering Functions: example: (44100, 2, 16) for 44.1kHz, stereo, 16-bit
function SetWaveFormat(SamplesPerSecond, Channels, BitsPerSample: Integer): MppError; virtual; stdcall; abstract;
// return # of SAMPLES that have been written to the buffer, 0 if end has been reached
// Note: protect calls to Render() and SetMixerOptions() by a critical section, if they
// are used in different threads.
function Render(Buffer: Pointer; BufferSize: Cardinal): MppError;virtual; stdcall; abstract;
// Player Configuration: set of MPPMIX_XXXX
function SetMixerOptions(dwOptions: Cardinal): MppError; virtual; stdcall; abstract;
function GetMixerOptions: Cardinal; virtual; stdcall; abstract;
// Song Information
function GetSongType: Cardinal; virtual; stdcall; abstract; // Return MPPSONG_XXXX
// Buffer must be at least 32-bytes
procedure GetSongName(Buffer: PChar); virtual; stdcall; abstract;
//////////////////////////////////////////////////////////////////////////////////////
// v1.39+: Navigation functions
//
// The order is the position in the pattern sequence list: this allows you to
// jump to a specific part of a song. It can be useful in a game with a song that
// uses pattern position jump effects (or pattern loops).
// These function will not be available if GetVersion() returns a value smaller than 0x139 (MPPVERSION_HAS_NAVIGATION)
function GetNumOrders: Cardinal; virtual; stdcall; abstract;
function GetCurrentOrder: Cardinal; virtual; stdcall; abstract;
function SetCurrentOrder(NewOrder: Cardinal): MppError; virtual; stdcall; abstract;
//////////////////////////////////////////////////////////////////////////////////////
// v1.41+: Returns the song length in seconds
function GetSongLength: Cardinal; virtual; stdcall; abstract;

//////////////////////////////////////////////////////////////////////////////////////
// v1.46+: Set Pre-Amp level, in percent (25% - 400%)
procedure SetPreAmpLevel(PreAmp: Cardinal); virtual; stdcall; abstract;

//////////////////////////////////////////////////////////////////////////////////////
// v1.47+: Set repeat count (-1 = Infinite)
procedure SetRepeatCount(RepeatCount: Integer); virtual; stdcall; abstract;