Pete's MIDAS Audio driver for PSEmu Pro and any other freeware psx emu which can use it :)
--------------------------------------------------------------------------------------
 
Back in 1999 there were just few psx spu plugins (and most plugins
were not continued), so I choose to code my own...
Well, what's the difference between my SPU and the SEAL or Kazz 
DSound? Easy: I am trying to get the best from both :)
Let's have a look at 'Spyro the dragon':
The SEAL SPU (V 0.7) seems to use one sample buffer for playing a sample,
causing big samples to go silent after awhile... for an example check 
Spyros intro sequence...
Kazz SPU and SEAL 0.8 can handle big samples as I've noticed, but both 
cut the samples in Spyro too early. It's not their fault, as I've found 
out, the main PSEmu core tells them to stop playing... the SEAL 0.7 seems 
to ignore that commands...

My SPU streams the samples as needed, so there is no problem with big 
samples _and_ you can configure it to ignore the 'stop' commands coming 
from the main core. That's what I call: best from both worlds :)

It's not perfect and I don't think it will ever be (some PSX audio stuff 
is _really_ nasty) but it is always good to have an alternative, heh?

Well, of course lately another very fine spu plugin has 
been developed.. check out NULL2's spu plugin :)

----------------------------------------------------------------------------

Requirements:

A soundcard... yup, no PC-Speaker support ;)
I am using the free MIDAS audio library (at least it is free if the program 
using it is free, see the license on the lower part of this file), it's 
able to produce sound with or without DirectSound, so most cards should be 
playing some noise.

Just copy the file spuPeteMidas.dll into your \plugin directory, that's all.

----------------------------------------------------------------------------

Configuration:

All settings have to be changed within the SPU config window, no voice 
commands available at the moment ;)

1) MIDAS Output settings
------------------------

The section handles how the Midas library will sound and react... try it
yourself...

Default settings are:

Mixrate			44100
Output mode		16 Bit Stereo
Filtering		none
Mixmode quality		Normal
Amplification		100
DirectSound		Enabled

The last setting (DirectSound) is important for gaining speed on my cards
(Maxi Sound 64 Dynamic 3D, pushed to 6 MB Ram, and SB Live!), 
don't know which setting is the best with your soundcard... so don't ask me...
Amplification, well here's some text taken from the MIDAS help, I'm a bit lazy today :)

'Amplification can be used to boost the volume of the music, if the sounds 
played are unusually quiet, or lower it if the output seems distorted.. 
The amplification level is given as a percentage: 100 stands for no 
amplification, 200 for double volume, 400 for quadruple volue, 50 for half 
volume etc'

2.) XA Audio
------------

If a game needs to play XA for compatibility, but if it is sounding horrible,
you can turn it off... yup. It's _not_ the same option as the one in the
main emulator: you can just disable the XA audio output! If XA is enabled
in the main thingie, XA audio data will still be decoded... you just can't 
hear it anymore.
You can also set the volume of the XA audio as it suits you best...

The 'XA Smoothing' option is trying to minimize a problem that
occurs by playing mdecs and XA sound:

a) if a mdec movie is played too fast by the emu, the xa data is coming
on higher speed and the whole sound will be played out of sync,
causing cracks and noises. So, with XA smoothing, the spu will
do some FPS limitation until the mdec is played at the right speed...

b) even more complicated: the movie is played too slow. That can 
happen because such mdec streams are a hard job for the gpus 
(especially for my hw accelerated ones, the soft one can do them
much faster) and for the cpu core/cdr plugin as well. In such a case 
my 'XA Smoothing' option will lower the speed of the XA output, so
the XA output will be sooouuunnndinnng aaaa liiiittllleeee biiitt
diiiiffffeeeerreeeennnt as it should, but the cracks and noises
will also vanish :)

Mmm... final tip: XA (and mdecs) are much faster on my pc if I
ceate an ISO image from the original psx cd and use one of
the disk image cdr plugins to play it.

3.) Misc
--------

- Pitch changes while playing samples
Sometimes the psx game coders are changing the pitch of a sample
actually played to get sliding sound effects or to emulate an
engine noise. Enable this option to emulate it right :)
I've re-written that option with version 1.4 (all older versions
could produce horrible glitches with pitch changes), so I think
you can safely use it with most games.
There is still a issue with some games, causing strange sound repeats
in the Midas library when doing on-the-fly pitch changes... oh well.

4) Old SPU Interface Settings
-----------------------------

Old interface? New interface? What's that?
Well, short explanation: The PSEmu Pro 1.xx spu plugin support is
not as fine as the gpu one... the spu plugin doesn't get all needed
informations by this 'old' dll interface, so some more advanced
sound effects can't be done. The 'new' interface enables the spu plugin
to get all the needed data, but of course the main emu has to use
the new interface funcs instead of the old ones... 
So, if you are using epsxe or some other new psx emulator, try the
new interface settings...

For PSEmu 1.xx users: use the Old interface options, as there is just one:

- Always play complete sample: The 'stop' command from the main core will be 
  ignored. Could cause playing samples too long, of course... oh, and if the 
  SPU detects a sample loop, it will stop the sound correctly... else it would be
  played forever...
  That's an hack because the old interface can't do ADSR volume envelope, causing
  many samples to stop too early without this option enabled...

5) New SPU Interface Settings
-----------------------------

Both settings can't be used with PSEmu Pro 1.xx and should be turned off 
while using it (well, sounds will not be different, if you turn it on, but
you will waste some resources which will not be used anyway).

- ADSR volume envelope: Mmm... to make it short: ADSR is needed for increasing/
  decreasing/fading the volume on a per-sample base.
  Thanks to James Higgs for his infos about the ADSR timings.

- Reverb: echo/hall effects. The reverb effects with version 1.7 are 
  _not_ 100% perfect yet, but still the current implementation enhances
  some sounds and music.

6) Default settings
-------------------
Easy: if you are using PSEmu Pro 1.xx, push the "Old SPU" button, try
"New SPU" otherwise.

----------------------------------------------------------------------------

Conclusion:

Don't code a SPU if you want peace with your girlfriend ;)

For version infos read the "version.txt" file.

Have fun!

Pete Bernert

EMail: BlackDove@addcom.de
Web: http://home.t-online.de/home/PeteBernert

----------------------------------------------------------------------------

Disclaimer/Licence:

This program is freeware and cannot be sold. Also this program cannot be 
distributed without written permission. This program cannot be used for 
any commercial purposes. You may not reverse engineer, decompile, or 
disassemble the enclosed software. Authors are not responsible for any 
damages that this program may cause, and are also not responsible for 
anything this plugin will be used for.

----------------------------------------------------------------------------
----------------------------------------------------------------------------
----------------------------------------------------------------------------
 
                 MIDAS Digital Audio System LICENSE
                 ----------------------------------
    Copyright 1996,1997,1998,1999 Housemarque Inc.

0. Throughout this license, "the original MIDAS Digital Audio System archive"
or "the original archive" refers to the set of files originally distributed by
Housemarque Inc. as MIDAS Digital Audio System. This license only applies to
the freely distributable versions of MIDAS Digital Audio System, Housemarque
Inc. may make MIDAS Digital Audio System, or portions of it, available under
different licensing conditions for selected licensees.

"You" refers to the licensee, the person or other legal entity using MIDAS
Digital Audio System. "Using" MIDAS Digital Audio System includes compiling
MIDAS Digital Audio System source code, linking it to other parts of MIDAS
Digital Audio System or your own code to form an executable program, and
distributing portions of MIDAS Digital Audio System with the program. This
program is referred to as "a program using MIDAS Digital Audio System".

This license applies to all files distributed in the original MIDAS Digital
Audio System archive, including all source code, libraries, binaries and
documentation, unless otherwise stated in the file in its original, unmodified
form as distributed in the original archive. If you are unsure whether or not
a particular file is covered by this license, you must contact us to verify
this.

MIDAS DIGITAL AUDIO SYSTEM IS PROVIDED "AS IS" WITHOUT WARRANTY OF ANY KIND,
EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, WARRANTIES OF
MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. IN NO EVENT WILL ANY OF
THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY DAMAGES CAUSED BY THE USE
OR INABILITY TO USE, OF MIDAS DIGITAL AUDIO SYSTEM.

As you have not signed this license, you are not required to accept it.
However, as MIDAS Digital Audio System is copyrighted material, only this
license grants you the right to use, distribute and modify it.  Therefore, by
using, distributing or modifying MIDAS Digital Audio System, you indicate that
you understand and accept all the terms of this license.


1. MIDAS Digital Audio System may freely be copied and distributed in its
original, unmodified form as long as no fee is charged for MIDAS Digital Audio
System itself. A fee, not exceeding 10USD, may be charged for the physical act
of copying, as long as it is clearly stated that MIDAS Digital Audio System
itself is free and may always be distributed free of charge. When ever MIDAS
Digital Audio System or portions of it are distributed, this license must be
included in unmodified form, and all files must contain their original
copyright notices. If only a portion of a file is being distributed, the
appropriate copyright notice must be copied into it from the beginning of the
file, and this license must still be included in unmodified form.


2. MIDAS Digital Audio System files may freely be modified, and these modified
files distributed under the terms of Section 1 above, provided that the
following conditions are met:

        2.1. All the modified files must carry their original copyright
             notice, in addition to a list of modifications made and their
             respective authors.

        2.2. Modified versions files belonging under this license still do so,
             no matter what kind of modifications have been made.


3. MIDAS Digital Audio System may not be used in commercial programs,
including shareware. No program using MIDAS Digital Audio System may be sold
for any price, and neither may any fee be charged for the right to use the
program. Programs using MIDAS Digital Audio System may always be freely
distributed if no fee is charged for the distribution and may freely be used
by anyone. The Program and its documentation must clearly state that the
program uses MIDAS Digital Audio System and that it may freely be used and
distributed under the terms of this Section 3.


4. MIDAS Digital Audio System, or portions of it, may not be included as parts
of a commercial software package, in source code, object module or any other
form. Neither may MIDAS Digital Audio System, or portions of it, be printed in
a commercial publication, including, but not limited to, magazines and
books. Any software package or publication including portions of MIDAS Digital
Audio System may freely be used and distributed, as stated in Section 3.

MIDAS Digital Audio System may, however, be included in free software packages
as long as the whole software package can freely be distributed under the
terms of section 3 and all conditions of this license are met.  MIDAS Digital
Audio System, or portions of it, may also be printed for personal or
educational usage, provided that no attempt is made to restrict the copying
and usage of any parts of the printout or the publication in which portions of
MIDAS Digital Audio System are included.



