Adlib-S3M player for QuickBasic, with effects support

0. Contents

This is the documentation of fmengineqb-1.1.0.
   1. Purpose
   2. Short example
   3. Neat features
   4. Notes
      4.1. Example songs
      4.2. Hazards
      4.3. How does its timer handler work?
      4.4. If it does not play anything
      4.5. Memory usage
   5. Discussion
      5.1. Feedback
   6. Copying
   7. See also
   8. Downloading

1. Purpose

Some entirely in QuickBasic written subroutines for playing Adlib-S3M or MidiS3M files in a QuickBasic program.

2. Short example

'$INCLUDE: 'fmengine.bi'
pleiplei: IF FMtimer% THEN RETURN
IF FMinit < 0 THEN PRINT "FM sound not available.": END
FMload "mysidia.s3m"
' The main loop
WHILE INKEY$ = "": WEND
FMend
END

Could it any way be simpler than this?
 
(Note you must copy FMinit(), MPUDetect(), MPUvol(), note2period(), VibVal(), BeSilent(), FMend(), FMload(), FMnoteoff(), FMplayeffect(), FMplayrowfrom(), FMtimer(), FMtouch(), FMupdate(), FMwrite() and MPUwrite() to the program, but these do not bother your editing, do they? :) )

As an alternative, there is a shorter file "fm.inc" which can be simply concatenated to your program. it works even in QBasic (the stripped version of QuickBasic, distributed with MS-DOS 4 and 5).
An example of its use can be seen at Youtube, here.

3. Neat features

4. Notes

4.1. Example songs

The archive contains some example songs and one example effect file.
Two of the example songs are made by Future Crew, four by me, and two by Warp.

4.2. Hazards

The current version just assumes you have MPU-401 too. If you don't have, just edit the MPUwrite subroutine and add a EXIT SUB clause there to be the first command.

4.3. How does its timer handler work?

It uses ON PLAY event mechanism for the timing, and plays short silent pause commands. Therefore you can not make speaker beeps while the player is playing. This does not affect the performance of the main program.
This causes some problems with dosemu though.

4.4. If it does not play anything

In the example program, you must press a key (try a,b,c,d,e,f,i,j,g,h,v,0,1 keys).
Note that your sound card must really be Adlib compatible. Creative Sound Blaster AudioPCI 128, for example, is not.

4.5. Memory usage

The player uses following global static tables, and nothing else:
VarSize in bytesType
fmperiod24int[0..11]
order512int[0..255]
adldata2400int[1..100,0..11]
insdata1200{6 ints}[1..100]
adlchan896{14 ints}[0..31]
MIDInote64int[0..31]
MIDIchan64int[0..31]
fmfilename4+nstring
fmpattern4+nstring
fmeffect4+nstring
fmdata46{17 ints,double,long}
fmeff24{3 ints}[0..3]
Total:5242+n
(I am sorry for the big amount of names used, but QuickBasic does not allow putting arrays or dynamic strings inside typedefs.)

The engine loads and keeps only one pattern at time from the file to memory. This means that the engine accesses the media every time the pattern changes. Patterns usually are about 1kB long per average.

5. Discussion

Okay, who uses QuickBASIC today? If you find this program useful, you are strongly encouraged to tell me.
However I'm planning to make a QuickBASIC compiler for *nix systems like Linux. See the project page for details. You are encouraged to join as a developer if possible :)

5.1. Feedback

If you have problems using this program or ideas how to develop it, email me your questions or ideas.
Please do not omit the details.
My email address (sigh) is: bisqwit at iki dot fi

6. Copying

fmengineqb has been written by Joel Yliluoma, a.k.a. Bisqwit,
and is distributed under the following terms:
* No warranty. You are free to modify this source and to
* distribute the modified sources, as long as you keep the
* existing copyright messages intact and as long as you
* remember to add your own copyright markings.
* You are not allowed to distribute the program or modified versions
* of the program without including the source code (or a reference to
* the publicly available source) and this notice with it.

7. See also

8. Downloading

The official home page of fmengineqb is at http://iki.fi/bisqwit/source/fmengineqb.html.
Check there for new versions.

Generated from progdesc.php (last updated: Fri, 22 Jan 2010 11:52:14 +0200)
with docmaker.php (last updated: Fri, 22 Jan 2010 11:52:14 +0200)
at Fri, 22 Jan 2010 11:52:15 +0200