Dec 112017
 
Power Basic 3.0 source to use Sound Blaster card and others.
File PB-MOD.ZIP from The Programmer’s Corner in
Category BASIC Language
Power Basic 3.0 source to use Sound Blaster card and others.
File Name File Size Zip Size Zip Type
ALF.MOD 86167 55299 deflated
BASIC.DOC 19659 6690 deflated
HARDWARE.DOC 12763 4175 deflated
MODDEMO.BAS 3366 1525 deflated
MODDEMO.EXE 40759 25892 deflated
PB-MOD.OBJ 15151 8477 deflated
TPCREAD.ME 199 165 deflated

Download File PB-MOD.ZIP Here

Contents of the BASIC.DOC file


MODOBJ ********** (C) Mark J Cox
MODOBJ *** 1992
MODOBJ *****
MODOBJ **************** Version 0.05

Module playing OBJect file for Power Basic


I. QUICK START


The included program, MODDEMO was created using the
unregistered version of MOD-OBJ under PowerBasic. Look at
the demo source code to see how it works.


1. INTRODUCTION


The object file that is part of this package allows programmers
to add music and sound effects simply and easily to their programs.

Music and sound effects can be played through a large number of
sound devices, including the PC Speaker, the Soundblaster and
various Covox devices.

Music plays in the background and there are a a huge number of

ready-made music modules available on the Amiga and the PC (*).

Music modules are standard Amiga Noisetracker/ Startrekker/
Soundtracker/ Protracker modules. A music module is made up of
up to 31 sampled instruments (instruments can also be things like
speech samples or effects). Up to four of these instruments can
be played at once and are mixed to form the final sound output. The
mixing is controlled from a music track, which can playback notes
in sequence and perform numerous effects.

The MODPLAY program (currently MPLAY219B) is a stand-alone player
for these modules on a PC. It has graphical support, a real
spectrum analyser and much more. (And its freeware by Mark Cox)

The MODEDIT program (currently MODED200) is a module creator/editor
and the documentation with Modedit explains in more detail the
structure of the amiga modules. (also freeware by Norman Lin)

Please note that not all Music modules can be treated as 'Public
Domain'. Each module has a section that lists the names of all the
instruments and sometimes this includes a message from the author.
Use MODEDIT/MODPLAY to view the messages (or use a file viewer on the
MOD file). If a module has a message giving the module author, you
are advised to contact them before using their module for ANYTHING.
Beware of Modules that are taken out of commercial games and programs,
or ones that sound like popular tunes.

You can obtain modules from many Bulletin Boards, Internet sites or from
friends Amiga's. Modules usually come archived in LZH form, these can be
unpacked with the excellent LHA program.



2. SUPPORTED PROGRAMS


The OBJ file has been tested with the following software

PowerBasic

Another OBJ file is available for the following

Turbo C v2.0
Turbo Pascal v6.0



3. FEATURES


o Does not affect the clock, disk acesses or anything else

o Allows samples to be played on a special '5th track' allowing
sound effects to be put over the top of the music.
(registered version only)

o Plays all Protracker 31 instrument module files. (Modules that
have 15 instruments can be converted using a program such as
MODEDIT by Norman Lin. It will also handle most Soundtracker/
Noisetracker and Startrekker (4 channel) modules, including ones
that have samples greater than 64k each in them.

o Runs completely in the background, letting your program
carry on as normal.

o Plays through a wide range of output devices, including the
PC Speaker and Soundblaster

o No royalties to pay for including it in your program (See
License agreement for details).

o Module mixing speed can be altered to account for different
speed computers


4. TECHNICAL


Technical details can be found in the technical documentation
at the end of this document


5. SHAREWARE


MODOBJ is shareware. If you intend to use it in anything other
than public domain programs you should register it. Registration
entitles you to the latest version of MOD-OBJ as well as the
ability to play sound samples over the top of the module and other
useful functions. See the sections on registering and the license
agreement.

v0.03 Original test-release version
v0.04 Modbar fixed (Reg). Partial Power Basic support
v0.05 Full Power Basic support


6. LICENCE AGREEMENT


Use of Mod-obj in a Personal or Public Domain Program


The unregistered version of MODOBJ may be used in any public domain
programs (these are programs for which no fee is charged by the
author) provided that this document is distributed with the programs
and that the author (Mark J Cox) receives credits within the program
and documentation.
You are strongly urged to register to get the extra routines
provided by the registered version however.

The registered version of MODOBJ may be used in your public domain
programs freely without the need to include this document as long
as the author (Mark J Cox) recieves credits within the program and
documentation.
(Send me a copy of the program, or a postcard if you use it).

Use of MODOBJ in Shareware Programs


The unregistered version of MODOBJ may not be used in any Shareware
(fee charged for the software) programs.

Registering your version of MODOBJ will entitle you to include
MODOBJ in your shareware programs as long as the author (Mark J Cox)
receives credits both within the program and the documentation.


Use of MODOBJ in Commercial Programs


The unregistered version of MODOBJ may not be used in any commercial
programs or be given away with any commercial product.

The registered version may be used where agreed in writing
by the author. (This will not involve royalty payments, just a
one-off fee; contact the author).


7. COPYRIGHT/LICENCE AGREEMENT


The files MOD-OBJ.DOC, TECH.DOC, MOD-OBJ.OBJ are copyrighted by
Mark J Cox. You are free to distribute the unregistered version
of the MOD-OBJ package as you wish provided no profit is made from
the distribution.

The copyright owner hereby licenses you to use this software
as stated in section 6 of this document.


NEITHER THE MODOBJ PROGRAM OR DOCUMENTATION MAY BE ALTERED
IN ANY WAY, OR REVERSE-ENGINEERED BY DISASSEMBLY OR OTHER METHOD.

There is no warranty of any kind, and the copyright owner is not liable
for damages of any kind. By using this software, you agree to
all the above terms.

Neither Mark Cox nor anyone else who has been involved in the production
or delivery of this product shall be liable for any direct, indirect,
incidental, special or consequential damages (including damages for loss
of profits, revenue, data or buisness and the like) in any way related
to this software.

The software and documentation are
Copyright (C) 1992 by Mark J Cox

Mark J Cox
29 Lundie Close
Stenson Fields
Derby DE2 3AN.



8. ELECTRONIC MAIL


You can contact me via electronic mail

[email protected](probably until 1995)

If that fails, as a last resort try

[email protected]

or look out for `xom' on Internet Relay Chat

An excellent dial-up BBS in the UK (Derby) is

Kingdom of Greyhawk, +44 332 756414 (0332 756414 UK)
its got loads of stuff on it, and in the past was voted top
UK BBS. Friendly sysop Alan Coates is waiting for your
call (300-14k4) - mention you heard about it from Mark Cox!

You can check to see if I'm still registered by calling Bradford's
Information Server; telnet to

info.bradford.ac.uk

And log in as user "info"


8. ABOUT MARK COX


In the past all the work I have done has been on FREEWARE products
(Modplay, Modres, Play, Resplay) because this way more people will
get to use and enjoy them. I'm making this shareware so that
I can get a bit of money back to aid future projects (and so I
can afford to live whilst studying for a PhD!). You don't have
to register to use MODOBJ in your program (see license section)
but I hope you will! I've receive many letters every day about other
programs - with my degree finals over I'll be able to get around to
the backlog and reply to them all. If you like MODOBJ or anything
else I've written then send me a postcard or some Email!


9. REGISTRATION


To register your version of MODOBJ, send a cheque or postal
order payable to "Mark Cox" to the address is section 6

Registration includes a diskette containing some more sample
programs, and a registered version of MODOBJ with the extra
facilities listed in this document. Please state if you want
5.25" diskette instead of usual 3.5"

By registering the Power Basic version you will also get the
registered OBJ file that can be used from C and Pascal.

Cheque/PO in UK currency (Sterling):
15 pounds

Cheque in US dollars (uncrossed if possible):
30 US dollars

Outside UK (other currency):
18 pounds * Current Exchange rate + 10% for fluctuations
If unsure, contact me first.


Coming soon:

If you have programming details for any other sound cards
let me know - Its worth a free registration to the first!



Technical Documentation for MODOBJ.
Revision 0.05pb
For POWER BASIC


To simply playback a module from a program

Call MODINIT
Call MODDEVICE and remember the device is returns
Call MODVOLUME to set the volume to maximum
Call MODSETUP to load and start playback of the module
Do your program here
Call MODSTOP to stop the module

Important note:

Whilst a module is playing you must not use the SHELL
command or the module will stop and may hang up your
computer


Initialize Memory

call modmemory( start&, end& )


Because of the way PowerBasic works, Mod-obj needs to be told what
memory it is allowed to use and where that memory is. You have to
reserve enough memory for your Mod files in advance.

Example to reserve 190k for a module, say 200000 bytes for safety

reserved& = 200000
MEMSET ENDMEM - reserved&
CALL modmemory(endmem-reserved&,reserved&)

You can see this used in the demonstration program enclosed.


Initialize Devices

call modinit


The first thing you must call before any of these other
routines. It intialises internal variables and checks for
soundblasters and the like.


Ask for a Device

call moddevice ( device% )


Asks the user to select an output device. Returns a device number
in the range 0-255. (0 is valid, the speaker and 255 is no-sound).
You need not call this routine as the numeric values it returns
will be constant for the particular version of MOD-OBJ. So you
could ask the user once, then save their preference in a file.

For this version of mod-obj(other values not used)

0PC Speaker
1D/A converter on LPT1
2D/A converter on LPT2
3D/A converter on LPT3
4D/A converters on LPT1 and LPT2 (stereo)
5D/A converters on LPT1 and LPT2 (mono)
7Soundblaster card
10Stereo-on-1 card
11Disney Sound Source on LPT1
12Disney Sound Source on LPT2
13Disney Sound Source on LPT3
255No sound

Note that there is no need for 'user defined' adaptors. If you
have two D/A converters on ports 0300 and 0301 say, then simply
patch the LPT table using debug, and use devices 4 or 5

C:\>debug
-e 40:8 00 03 01 03* Enters 0300 0301 as LPT1/2
-q


Set the playback volume

call modvolume ( v1%, v2%, v3%, v4% )


Sets the module volume for each channel to 'volume'. Must be
called before modsetup. 255 is normal, maximum volume. 0 is
minimum (off). You can call this routine to change the volume
whilst a module is playing. (4 different channels, one volume
byte for each!)


Load and Play module

call modsetup ( status%, device%, mix%, pro%, looping%, filename$ )


Pass this procedure the following data

o The device number found above
o The mixing speed in Hz (10000 is a good one, 14000 is better
for the speaker... see what works on your machine).
o A string giving the filename of the module.
o Set to 1 if your mod sounds odd when run in protracker mode
(converts volume slide commands only, might as well leave it
on 0 )
o Data on looping(Normally set this to 4)
looping = 0- Stop at end of module
looping = 1- Play the first pattern only
looping = 2 - Play normally but disallow backward jumps
looping = 4- At end of module start again

It will return

o Status = 0 with the module playing
o Status = 1 if there was an error loading/ not a mod
o Status = 2if already playing a mod
o Status = 4out of memory.


Stop the module - free memory

call modstop


Stops the module playback and free's the memory that was
allocated to it. MUST stop the mod before exiting to DOS.
Can call this routine even if there is no module playing



The REGISTERED version also has these functions:
>
>
> ins$= getinsdetails$( insnumber%, length% )
>
>
> Pass the sample number (1-31) as ins. It will return with
> a string giving the name of that instrument, and the length
> (a length of 0 means no instrument available).
>

>
> Get values for drawing bars
>
> call modbar ( b1%, b2%, b3%, b4% )
>
>
>Returns four values from 0-63 representing the 'level' of each
>of the four channels. Look at Modplay's display to see how
>this works.
>
>
>
> Find out where you are in the module
>
> call modwhereami ( finished%, speed%, songpos%, pattpos% )
>
>
>Gets the current status and postion of the module
>
>o PlayingSet to 1 when module stops
> o SpeedNot useful
> o SongposPosition within the song (0 = first pattern, 1 etc
> keeps adding 1 each time pattpos reaches 1024).
> o PattposThe current pattern (0 - 1024 in steps of 16).
> See the MODEDIT docs for details of patterns and
> songs.
>
>
> Set position within the module
>
> call modsetpos ( songpos%, pattpos% )
>
>
> Sets the current module position to be the values given
> to this call. Pattpos gets rounded to nearest 16 bytes.
>
>

>
> Outputting Samples.
>
>
> There are two ways of playing samples whilst a module is playing in
> the background. (The routine returns, and the sample continues playing).
>
> Spotsample: The first will play one of the samples that is contained
> within the module
>
> Spotsample3: The next will load a sample and play it - when the sample
> has ended the memory it took up will be free-d straight
> automatically.
>
>
> call spotsample ( sample%, frequency% )
>
>
> This command lets you play a sample over the top of the mod.
> The main module volume is halved and the sample is mixed in
> with the playback. As soon as the sample has finished playing
> the original module volume is restored.
> In stereo mode, the sample is output to both the left and
> right channels. Looping samples don't loop.
>
> Pass this procedure the sample number (1 to 31) from the module
> and the 'frequency'. Actually this number corresponds similar
> to the mod notes, so to play back at C-1 use 856. Similarly
> C2 - 428, C3 - 214 etc. Any value 1-1000 can be used.

Also in the Unregisted version are functions to let you check the
processor CPU type and EMM drivers.


Check CPU type

call checkcpu(cpu%)


Returns the CPU type installed in the computer.

0 Unknown
18086
280286
380386
480486

This function is useful to test if the processor is a 286
or better before allowing use of the Mod functions



Check EMM driver

call checkemm(emm%)


Checks to see if a EMM driver is present in the system. If
the processor is a 386 or 486 and there is a EMM driver present
then that driver will slow down the music playback. Using this
procedure you can give a warning message (see sample programs)

Returns:
0 No driver found
1EMM driver found




 December 11, 2017  Add comments

Leave a Reply