AmigaMod.irx version 1.1:
    Just changed some names that have been changed and added a simple
    Makefile wich relies on PS2SDK being set properly.
    blackdroid, 2004

AmigaMod.irx version 1.0: an IOP-side music solution.
Copyright Avinash Baliga (Vzzrzzn), 2002.


License Agreement:

Free for non-commercial use, but you must send me an email 
telling me what you're using it for: vzzrzzf@netscape.net

If you want to use this in your commercial application,
please contact me at vzzrzzf@netscape.net; I'm sure we can
come to a simple arrangement. :)


Features:

 -  Supports protracker (Amiga) format .MOD files.
 -  Software mixes on the IOP, at 24kHz 16-bit.
 -  The software mixer supports linear interpolation
    of samples.
 -  The software supports up to 16 channels, but
    I have only been able to get 8-channel playback
    to work smoothly with the 37MHz IOP.
 -  Most effects are implemented, including tempo/speed,
    portamento, arpeggio, etc.
 -  Very easy RPC interface, so it's easy to use in
    your demos.
 -  I'd like to say it has 95% compatibility with
    MODs in general.  The MOD format has been abused
    too much in the past; thus, not all MODs will
    sound perfect.  But it's quite accurate.
 -  If you have Windows 2000, you can use my horrible
    test application to see what your mod will sound
    like on the PS2 itself.  Unfortunately, other OS's
    don't like the way I called WinMM or something.
    If its working, it should start playing a MOD
    immediately; if not, it's just a blank window.
 -  modtest24kHz.exe plays back at 24kHz (as it will
    sound on the PS2), modtest48kHz.exe plays back at
    48kHz.  You can use the two versions to determine
    whether my modplayer doesn't like your MOD, or
    whether the sample rate is messing up the sound.
    One example: 24kHz mixing means that a square wave 
    (with lots of upper harmonics) can sound way out of 
    tune, since the upper harmonics alias down.  Be smart 
    with your sampling.



How to use it in your Program:

 -  Have your program load libsd.irx before amigamod.irx. In
    all PS2 consoles except SCPH-10000/15000's (original .jp
    models), you can do this with
    _sifLoadModule("rom0:LIBSD", 0, 0, 0);
 -  Make sure you have k_sceSifDmaStat() in your project. It's
    just a syscall wrapper, and is in the latest version of
    ps2lib, which can be downloaded from ps2dev.livemedia.com.au
    Here's the asm source for it:

############################################ syscall
#										 k_sceSifDmaStat ##
	.globl	k_sceSifDmaStat
	.ent	k_sceSifDmaStat
k_sceSifDmaStat:
	li $3, 118
	syscall
	jr $31
	nop
	.end	k_sceSifDmaStat


 -  Include "amigamod_rpc.c", "amigamod.h", "iopheap.c", and
    "iopheap.h" in your project.
 -  The following code will play a MOD:
 
    amigaModInit(0);
    amigaModLoad( pointer_to_mod_in_EERAM , number_of_bytes);
    amigaModPlay(0); // zero (ie. no linear interpolation) sounds
                     // cooler for Chip tunes IMO, otherwise do
                     // amigaModPlay(1);


 -  amigaModSetVolume() sets the hardware volume.  It's a value
    between 0 and 0x3fff.

 -  Never call amigaModLoad() while a MOD is playing.  Call
    amigaModPause(), wait a VSync (for safety's sake), then
    call amigaModLoad().
 -  amigaModQuit() completely shuts down the playing thread, but
    the RPC thread remains active on the IOP.  This is useful if
    you have a section in your demo where some other code (like
    SJPCM.IRX) wants to use the SPU2.  You may call amigaModInit()
    later, without reloading amigamod.irx, and everything will
    work as normal again.

 -  Read through the RPC code for more goodies ...


Credits:

 -  I referred to "MOD Player Tutorial by FireLight
    (Brett Paterson)" a great deal.  He explains how many
    .MOD effects should be programmed for the greatest
    accuracy.
 -  I looked at Ravi Iyengar's "IceModplayer" code a little,
    and stole some of his period table :)


 -  Thanks to Sjeep for testing the amigaModQuit() function.

