home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
DP Tool Club 15
/
CD_ASCQ_15_070894.iso
/
vrac
/
mikmod43.zip
/
README.DOC
< prev
next >
Wrap
Text File
|
1994-04-30
|
17KB
|
654 lines
MIKMOD v0.43
============
Or how to make a modplayer using the GUS v2.10 LowLevel Toolkit and BC 3.1
Programmed by MikMak of Unicorn Design a.k.a. Jean-Paul Mikkers.
This is SOURCEWARE/PUBLIC DOMAIN so you may use my routines as long as you
mention my name :)
Contents:
Chapter 1 - Introduction
Chapter 2 - "Your interface.. I hate it, I HATE IT!"
Chapter 3 - How to compile MIKMOD
Chapter 4 - MODLOAD.C functions
Chapter 5 - MODPLAY.C functions
Chapter 6 - How to use
Chapter 7 - History
Chapter 8 - Future
Chapter 9 - Greetings
Chapter 10 - How to contact me
Chapter 11 - Legal stuff
=======================
Chapter 1: Introduction
=======================
What it does:
-------------
Pretty obvious. It loads a module (protracker,startracker,fasttracker 4-8
channels) and plays it through your GUS.
What's so good about it ?
-------------------------
Errrm.. It uses the GUS SDK toolkit.. and err.. well.. the sourcecode is
included. (In 'C' ofcourse). Anditsawholelottapublicdomain.
The program is divided into three main parts: The module loader, the module
player and the GUS interface. The module loader and player are soundcard
independent so they could be used for other soundcards than GUS. (Actually
they were until I got my GUS)
This version is sort of a in between release.. I'm still working on version
0.50 but I don't have a lot of time ( I'm graduating, you know ). So this
is _not_ a major update.. I only fixed some bugs and added a few features.
Version 0.50 will have the following features added:
- Soundblaster, covox and speaker support + full sources <sic>
- Improved gus routines
- MTM loader
If you have written a program that uses mikmod or that is based upon
mikmod, I would like to receive a copy of it (if it's not too much trou-
ble). Just send your program uuencoded to my email address (You don't have
to send me your sources if you don't want to).
See chapter 10 for my E-mail and snail-mail address.
===================================================
Chapter 2: "Your interface.. I hate it, I HATE IT!"
===================================================
"That's not my job.. my job is eating this donut.." (Ice-T, Copkiller)
This chapter is meant for anyone who uses MikMod and thinks that it has a
crappy user-interface.. well.. I agree, but I never meant to make a full-
scale, all-formats-supporting modplayer with graphical analysers, VU-bars,
shelling capabilities and lots of other neato stuff. That's something _you_
have to make. ( Or check out Extended MikMod (XMM) by Rao a.k.a. Paul
Fisher)
But to make life just a bit easier I included some nice routines for scan-
ning the commandline and wildcard filename handling. (Heh.. I'm a nice guy
:)
================================
Chapter 3: How to compile MIKMOD
================================
Using borlandc 3.1 IDE:
-----------------------
- Get the GUS SDK v2.10
- Start the borlandc IDE and open the project file MIKMOD.PRJ
- Change the library directory c:\gusdk210\libs to point to your
corresponding gusdk210 libs directory (Menu Options-Directories).
- Change the include directory c:\gusdk210\incs to point to your
corresponding gusdk210 incs directory (Menu Options-Directories).
- Then make or run it.
Using MAKE:
-----------
- Get the GUS SDK v2.10
- Edit LIBPATH and INCLUDEPATH in the file MIKMOD.MAK to point to your
corresponding directories.
- Execute MAKE -fMIKMOD.MAK
==============================
Chapter 4: MODLOAD.C functions
==============================
void ML_Load15(int yesno)
-------------------------
With this function you can enable (yesno=1) or disable (yesno=0) the
loading of 15-instrument modules. It's disabled by default, because there's
no way to accurately detect that a file is a 15-instrument module.
returns: nothing
MODFILE *ML_Open(char filename[],FILE *fp)
------------------------------------------
Opens a module and initializes a MODFILE structure that contains all infor-
mation. A module can be opened by filename or by filepointer ( If you
supply a filepointer, it's up to you to close the file when the module has
been read ). Note that when this routine returns, only the module header
has been read, the patterns and samples are not yet loaded (use ML_Load).
Take a look at MODLOAD.H for more info about the MODFILE structure.
returns: MODFILE * Pointer to an initialized MODFILE structure
or
NULL When an error occurred
int ML_Load(MODFILE *mf)
------------------------
Loads the patterns and samples of a module using the user-supplied call-
backroutines. After this function returns it's safe for you to close the
fileptr to the module, or in case you supplied a filename to ML_Open it
will be closed for you.
returns: 0 on error
or
1 everything okay
void ML_Free(MODFILE *mf)
-------------------------
Use this routine to free memory used by the module. Only use this routine
when ML_Open succeeded.
returns: nothing.
void ML_RegisterLoader(int (*Loader)(FILE *fp,SAMPLEINFO *smp))
---------------------------------------------------------------
Registers the callback routine for loading a module-sample. The callback
routine has to load smp->length bytes from the file 'fp'. It then has to
return a unique handle number that identifies the sample that was loaded.
In case of an error (for example out of memory error) it has to return -1.
The loader routine has to be registered BEFORE you try to ML_Load() a
module.
returns: nothing.
void ML_RegisterUnLoader(void (*UnLoader)(int handle,SAMPLEINFO *smp))
----------------------------------------------------------------------
Registers the callback routine for unloading a module-sample. The call-
back routine has to free the memory taken up by the sample that is identi-
fied by 'handle'.
The unloader routine has to be registered BEFORE you try to ML_Free() a
module.
returns: nothing.
const char *ML_Error(void)
--------------------------
Returns a string that explains what error occurred. Use it to explain what
went wrong.
============================
Chapter 5: MODPLAY functions
============================
void MP_NextPosition(void)
--------------------------
Skips to next song position. Note that the result may not be completely
correct if the module contains patternbreaks.
returns: nothing.
void MP_PrevPosition(void)
--------------------------
Jumps to the previous song position.
returns: nothing.
void MP_MainVol(UBYTE volume)
-----------------------------
Sets mainvolume to a value between 0-100%. Your player routine has acces to
the main volume via the global variable 'mp_mainvol'. Remember that _your_
player routine has to take care of combining this value with the voices
volumes to compute the resulting volume settings for each channel.
returns: nothing
void MP_ExtSpd(int yesno)
-------------------------
Use this function to enable (yesno=1) or disable (yesno=0) protracker
extended speed. Extended speed is enabled by default.
return: nothing
void MP_RegisterPlayer(void (*Player)(int voice,AUDTMP *aud,MODFILE *mf))
-------------------------------------------------------------------------
Registers the callback routine for playing the samples when a module is
being played. Take a look at MIKMOD.C to see how one could implement this
routine (GusPlay()).
The player routine has to be registered BEFORE you try to call MP_Handle-
Tick().
returns: nothing
void MP_Init(MODFILE *m)
------------------------
Initializes the MODPLAY routines to start playing this modfile the next
time MP_HandleTick() is called. This routine has to be called BEFORE you
try to call MP_HandleTick().
returns: nothing
void MP_HandleTick(void)
------------------------
This routine has to be called 50 (or (bpm*50)/125 ) times a second to play
a module. Every time this routine has been called, it will in turn call the
user supplied player routine to do the actual playing of the samples (See
MP_RegisterPlayer()).
returns: nothing
=========================================
Chapter 6: How to use (for ANY soundcard)
=========================================
1. Initialize soundcard hardware, dma, interrupts etc. (this is the hard
part)
2. Register your sample load and unload routines using ML_RegisterLoa-
der() and ML_RegisterUnLoader()
3. Register your sample play routine using MP_RegisterPlayer()
4. Open the modfile using ML_Open()
5. If nothing went wrong, load the patterns and samples using ML_Load()
(Between step 4 and 5 you could display the module name or sample na-
mes... display some info)
6. Call MP_Init() to tell the player to play the module the next time
you call MP_HandleTick()
7. Call MP_HandleTick() 50 times a second.. or set up an interrupt to do
this for you... and presto.. MUSIC!
8. Stop calling MP_HandleTick() and disable soundcard output.
9. Call ML_Free() to free memory
10. Goto 4 (music forever ;)
==================
Chapter 7: History
==================
Version 0.43:
-------------
- Fixed a bug that caused the first sample not to be unloaded
- Added a check to see if the loop end point exceeds the sample size
(some modfiles seem to have this problem)
- Added wildcard filename matching to the modplayer
- Added the M!K! module id.
- Removed the check for the number of bytes loaded from a sample,
because a lot of modules don't have the last sample complete, so mik-
mod would refuse to play them.
- Changed the loader so it can load 15-instrument modules
- Extended protracker speeds can be disabled
- Improved commandline parsing
- Added master volume
- Added functions to skip to the next or previous song position
Version 0.42:
-------------
- Removed more ultraclicks by adding volumeramping when stopping a
voice. Actually this idea was suggested to me by Forte Tech Support..
thanks!
- When an arpeggio effect stopped, the period would 'hang' at the last
arpeggio note, while it should return to the 'base' period.. To fix
this problem I changed the arpeggio code to not affect tmpperiod but
period itself. (This bug was kinda hard to find because it's an
outdated effect)
- Have to limit patbrk values to max. 64.
- Rearranged the GusPlay() callback routine to use a more sensible
order of setting the frequency and volume of a voice.
Version 0.41:
-------------
- When comparing to my amiga, I noticed that some effects on mikmod
were too fast. I discovered that effects like toneslide, vibrato,
volumeslide etc aren't updated the first tick of a row. FIXED.
- Have to reset wantedperiod for each note..
Version 0.4:
------------
- Totally rewritten the modload routines.. Created a type 'MODFILE'
that holds all info of a modfile, so now you can load more than one
module.
- New docs.
- Using handle-numbers instead of sample numbers to load samples..
(neccessary when loading more than one module at a time )
- Have to limit volume range for effect C
- Fixed effect '3' (toneslide) (this caused wierd slides on modules
like scramble.mod)
- Switched to a 3-byte-per-note format when converting patterns.. same
format that GUSMOD uses.
- When a patternbreak has just occurred, all patternbreak command's
have to be ignored for the next row. ( This bug made mikmod skip a
pattern in the module 'condom-corruption' )
Version 0.3: (unreleased)
------------
- Added 2 octaves to period tables.
- Removed ASM bits from MODLOAD.C
- Implemented the remaining effect commands. (Phew!)
- The sample start bug of the SDK 2.01 has been removed in the 2.10
SDK. So now this program can be compiled without modifying the SDK
itself.
- The pattern break effect data is in BCD !. This screwed up modules
like garbage_collection (by Peter Salomonson).
Version 0.2:
------------
MODLOAD.C:
- I have to check ALL song positions (128 positions ) for patterns...
This bug caused edited modules to load incorrectly. FIXED.
MODPLAY.C:
- The old version didn't allow sample loops smaller than 64 bytes. (
that was a leftover from my soundblaster player.. ) FIXED.
MIKMOD.C:
- UltraClicks removed (most of them). Ultraclicks are caused by the
fact that a GUS plays beyond the last byte of a sample. (actually, it
interpolates between the last byte of a sample and the next byte that
doesn't belong to that sample). I fixed this by allocating one more
byte when loading a sample and zeroing that extra byte.
- Added fast volume ramping when starting a sample...
- #@$%@^$!!#$@! Fixed the extended speed.. I really should be more
careful.
Version 0.1
-----------
First public release.
==================
Chapter 8: Future
==================
- Using expanded memory for storing patterns
- Some kind of collection of separate drivers that can be used for the
soundcard you need. The drivers should be dynamically loadable, but
I'm still trying to find a way how to write those in 'C'.. in assem-
bly it's much easier. These kind of drivers would allow programmers
to add soundsupport for _any_ soundcard. If anyone has got any ideas
on implementing those drivers in 'C' , please mail.
- 669, STM, P16 support ?
- Maybe a C++ implementation of these routines.
- A pascal version of mikmod.. naah.. just kidding :)
- Any function you want me to add.
=====================
Chapter 9: Greetings
=====================
Thanks to:
Bzarre, Sinox, Big Ed, Pernel (for the drams), Master of Disaster, Plim,
The Joker, Cat, Outbit, Skyhigh, MaNaR, Forte Tech Support (Mike), Jean-
Stephane Perri, Irmin Ziegelmeier, Mark Connor, Patrik Wallstr|m, Stuart
Carnie, Prime a.k.a Stefan Danes, Hyperion, everybody at Stack, Paul v.d.
Ven, JVeck, Rao, Mike Tedder, Saari Anssi, Alexander Kerkhove, Jaap van
Hengstum, Martin Flack, Dick Verweij (C00L Demo Dude!), Tomi Suominen,
Craig Peeper, Mikko Rauhala, Gavin Scarman, The Frenchman, Wildcat, Robert
Sanders, Ronny Hanssen
Thanks for your support and bugreports!
=============================
Chapter 10: How to contact me
=============================
I can be reached at:
E-mail:
*****************************
* *
* mikmak@stack.urc.tue.nl *
* *
*****************************
Snail-mail:
*****************************
* *
* Jean-Paul Mikkers *
* Godartstraat 16 *
* 5932 AX *
* Tegelen *
* The Netherlands *
* *
*****************************
Some reasons why you might want to contact me:
- You have a programming job you want me to work on.
- You found a bug.
- You want soundblaster support.
- To let me know if MikMod compiles on your compiler.. (BC 4.0, Watcom,
Microsoft-C)
- To send me your fabulous programs.
- To request a new function for the next version of MikMod.
- To give me some percentage of the multi-million dollar profit you got
out of MikMod.
- To wish me merry x-mas.
- You want to donate your complete collection of Star Trek - the next
generation or Star Trek - Deep Space 9 videos.
- You're Cindy Crawford..
- To startup another PD project for the ultrasound (Midi ? - Patches ?)
- To flame.. no wait.. just send those to /dev/nul okay?
etcetera
========================
Chapter 11: LEGAL STUFF
========================
This software is PUBLIC DOMAIN.
Disclaimer:
The author (that's me) specifically disclaims all warranties, expressed or
implied, including but not limited to implied warranties of merchantability
and fitness for a particular purpose with respect to defects in the
software and documentation.
In no event shall the author be liable for any loss of profit or damage,
including but not limited to special, incidental, or consequential damages.
The GUS Lowlevel toolkit v2.10 is copyright (C) 1992,1993 by FORTE and
advanced GRAVIS.
All product names, trademarks and registered trademarks contained in this
document are the property of their respective holders.