October 26, 2007
Downloaded from http://www.geocities.com/eiennarufuyu

This is the latest version of the new BGM driver I've been working on.
There is a Windows DLL, a Genesis binary, and the MML compiler (also for Windows).

mmdp.DLL -------- the Windows DLL version of the player(requires X68Sound.DLL)

X68Sound.dll can be aquired at http://homepage1.nifty.com/mpuusan/x68sound/x68soundbody.htm
The file you want is "X68Sound_020615.zip"

mmdplayer.exe --- an example Windows application utilizing the MMDP.DLL 
mmc2.exe -------- newer version of the MML compiler.  
                  Produces the exact same files but should be slightly faster.
                  Also included is the older compiler mmc.exe, which is obsolete, so don't bother with it.
mmlc.dll -------- made for mmc2.exe, a DLL which processes an MML string and returns a pointer to
                  a string containing the compiled data.  MMC2.EXE itself doesn't do any MML stuff 
                  at all, actually.  See mmlc.bas for Basic source code, and also compare with
                  the old mmc.bas to see how much more improved it is, w00t.

mmdp.bin -------- the original 68K based demo.  this was written in Basic just to get an idea of
                  what needed to be done for the Z80 version.  It's not very useful as a music driver
                  for fast-paced action games, but it still could be altered to work in the background.
                  Press START to move to the next song, press B to switch to meantone temperament and 
                  press C for equal temperament.   
mmdp.bex -------- BEX Source code for 68K version.  Now can be easily modified to use 
                  in new BEX projects. Just edit the subroutine at the label <reloadsong> to point
                  to the music data to play, use "gosub LoadSong" to initialize the player, 
                  then use "gosub StartSong" to start the playing.  Now make sure to call the 
                  subroutine "musicshori" constantly (just put it at the end of every loop).  Stop the
                  music with "gosub StopSong".

default.ff ------ an example instrument bank, created using VED.EXE, a program
                  that comes with the PMD music driver for the PC-9801 series computers,
                  that makes OPN/OPM-type 4-op FM voices.
*.mml ----------- example MML files
*.mmd ----------- the compiled examples
mmdpz80.zip ----- the Z80-based driver. More or less done.

 For the MML files, It's fairly standard MML, if you ever used MC.EXE from the PMD driver,
then it shouldn't be too difficult, although there are quite a few differences.
Just take a look at the example files, and you should get an idea of what you can do.
The Genesis version of the player should be completely compatible with the DLL version,
except for speed and the number of channels, so any file produced by the compiler should
correctly load in either version.

 Each MML file must begin with the title information on the first line, and the default
Timer B setting on the second line(that sets the tempo, but it ain't in Beats per Minute)

 The compiler can handle up to 10 tracks, although X68Sound.DLL has only 8 tracks.
For the Genesis version I originally planned to use tracks 7-10 for PSG.  At the moment, PSG
tone generators 1-3 are supported.  The noise generator (PSG channel 4) is not, though.





Basic commands(case-sensitive)

v0-v15	sets volume to 0 to 15 (sort of screwy, but mostly works)
o0-o7	sets the octave to 0 to 7
@0-@255	selects a voice from the instrument bank loaded into memory 
#0-#255	same as @, but it's for so-called (user-voices), it only works
	in the DLL, and mmc.exe at the moment does not support adding
	user voices to the file, so it ain't so useful I guess for now....
p1-p3	set the stereo panning for the channel. p3 is both speakers,
	p1 and p2 would be left and right
t0-t255	change the default speed
l	the l command sets the default notelength used when none is set
	l8 would mean that all notes after this point are 8th notes and so on
<	go down one octave
>	go up one octave
L	all notes from here on in this channel will be played as an infinite loop
	ex:	cd L efgab
[]	all notes in between these brackets are played the amount of times 
	specified after the closing bracket. if 0, or nothing is specified, 
	it is an infinite loop
	ex: o0l4@58[cdefgab]2	will be played 2 times... where as,
	ex: o0l4@58[cdefgab]1	will not loop at all, only play once

	Now in both DLL and Genesis versions, you can use nested loops:
	[[ce]2g>c]2	would play like : cece g>c < ceceg>c

:	use this to exit a [] loop when it is on the final repeat. It skips right to the end of the loop
	ex: [cdefg:fed]4ab>c      would play like   cdefgfed cdefgfed cdefgfed cdefg ab>c
	Does not work in BEX version

*0-1	BEX version only, experimental: sets the PCM mode for CH6.  *1 turns PCM on... must be on part F
V0-1	BEX version only, experimental: toggles the vibrato effect
!-99~99	portamento. the note directly after will bend up or down 
	the specified amount of half-steps. 
	ex:	l4gec!2c2.


Here are the mmdp.dll functions:

call this before doing anything with it
Int InitOPM(int samprate,int latency,int x68volume,*char instbankfile)
	in BCX you can call it like this: Value%=InitOPM(lib "mmdp.dll",44100,200,600,"default.ff")
	note:	The instrument bank file must be 8KB exactly(256*32 bytes).(if it goes over that's OK)

call this when your done
Void ReleaseOPM()

Void PlaySong(*char mmdfile)

Void FadeSong()

Void StopSong()