From mailserv@gaia.ucs.orst.edu Wed Apr 13 20:19:35 1994
Precedence: Bulk
Date: Wed Apr 13 16:07:59 PDT 1994
From: gus-sdk-request@gaia.ucs.orst.edu (GUS Programmer's Server)
Reply-To: gus-sdk@gaia.ucs.orst.edu (GUS Programmer's Digest)
Subject: GUS Programmer's Digest V10 #7

GUS Programmer's Digest     Wed, 13 Apr 94 16:08 PST     Volume 10: Issue   7 

Today's Topics:
                               Formats
                            GUS MIXER DOCS
                            Humongous wavs
                             Mixer stuff
                          s3m specefication

Standard Info:
	- Meta-info about the GUS can be found at the end of the Digest.
	- Before you ask a question, please READ THE FAQ.

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

Date: Wed, 13 Apr 94 11:43:30 BST
From: Flynn Peter R BSc 1 Mod Comp 93-94 <P.Flynn@teesside.ac.uk>
Subject: Formats

I have S3M, Protracker and ULT format's for the editor program I am writing.
Does anyone have the 669 format and Octamed formats ?

Peter Flynn.

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

Date: Wed, 13 Apr 1994 12:41:55 -0400
From: Ken Hornstein <kenh@wrl.epi.com>
Subject: Re: GUS MIXER DOCS

>1. Would it be possible for the technical support folk at Forte
>   to post the necessary documentation to program those GUSes 
>   that include a mixer?
>
>   a. Needed would be any and all ports, layout of ports, perhaps
>      just a bit of supporting code (not too necessary on the
>      code), and how to determine if the hardware has this feature.

I sent mail to the people at Forte a little while ago about this; they were
kind enough to give me a code fragment that initializes the mixer to a
"transparent" state.  I'm still having a weird problem that goes away when I
run ULTRINIT, so I think there's still something about the mixer that I don't
quite understand (my stuff is under Unix, not DOS, so I'd like to avoid having
to run ULTRINIT at all).  I understand that the next release of the SDK will
explain how to use the mixer.  I just talked to the folks at ICS (the people
who made the mixer chip) and they're sending me a data sheet for the chip.

>3. Is there a way to determine the hardware features on later-
>   model GUSes, as in the joy port enable bit, mixer, etc.?

Code to do some of this was included in the fragment that Forte sent me
as well.

So far, I've found that the people at Forte are pretty helpful if you ask them
directly and explain what you're trying to do.

--Ken

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

Date: Tue, 12 Apr 1994 17:39:28 -0700 (MST)
From: "Shawn T. Rutledge" <rutledge@enuxsa.eas.asu.edu>
Subject: Humongous wavs

> Situation:  We have an application that we are developing which uses .WAV
> files of anywhere from 1/2 to 2 or 3 hours in length.  Our application
> must be able to play them back at, currently, 3 different speeds.  Because
> of the GUS drivers' limitations, we have to keep _3_ copies of the .WAV
> files (1 at each speed) available to the application. Needless to say,
> HUGE DISK SPACE REQUIREMENTS.

Really!  All you should have to do though is drop samples to play back
at a higher rate.  That's probably what goldwave does.  Have you used
goldwave?  It is a general-purpose wav editor, and it has a "speed" slider
control on its control panel that lets you adjust the speed and pitch of
a wav while it is playing.  In your case, if you want to play at twice the
normal speed, just drop every other sample in the wav file, or to play
at three times the normal rate just drop two samples, play one sample,
drop two, etc.  This could be done by a "divide" function which the
data is piped through on its way into the GUS.  Then you have only to store
the slowest, highest resolution version of a file, and you can have many
more than 3 different speeds if needed.  You could also use interpolation
to get fractional division ratios.

-- 
  _______                                                             KB7PWD
 (_  | |_)                                            shawn.rutledge@asu.edu
 __) | | \__________________________________________________________________
* virtual reality * Star Trek * IEEE * fusion * freedom of information * 

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

Date: Wed, 13 Apr 94 10:21:56 EST
From: support@fortech.com (Technical Support)
Subject: Mixer stuff

There have been quite a few requests for documentation on the
mixer that is on the GUS 3.7 and above boards. We hope to put out
a new SDK with docs in a couple of weeks, but I'll post this to
see if it will be enough to hold you folks over.

First, let me review the different version of GUSes that are out
there and what features each of them has.

Version 2.2: 
   Original production version. 

Version 2.4:
   Same as 2.2 with some layout changes for manufacturing. No functional
   changes.

Version 3.4
   Added what we call the 'digital ASIC'. This removed all the PALS
   along the bottom of the board for cost reduction. There were some
   features added to the card, mainly to allow software enable/disable
   for the joystick and MIDI port.

Version 3.7
   Version 3.4 plus a mixer. Now we have input level controls for line
   mic and CD. Also have line out control outside the GF1. (Can be used
   as a master volume control.) Also added a software readable version #

UltraMax
   Version 3.4 + CS4231 + 3 CD-ROM interfaces (sony, mitsumi, and panasonic)
   The CS4231 is for 16 bit recording/playback, upto 48khz, ADPCM-ulaw-alaw
   compression. Also has a software readable version #

=============================================================================

There is probably no reason any app software would need to know whether or
not its ona 3.4 card or not, but here is how you can tell if a digital ASIC
is present or not.

/* See if the digital ASIC is present .... */
outp( config.base_port+0x0f, 0x20 );
dig_val = inp(config.base_port+0x0f);
if((dig_val != 0xff) && (dig_val & 0x02))
   digital_asic = TRUE;

To detect if you are on a 3.7 or greater card, you can look at the version
#.

val = inp(base_port+0x506);

If this value is 0xff, then is pre-3.7 (No mixer, and not a MAX)
If this value is 5 thru 9, then its a 3.7 with ICS mixer.
If its 10 or larger, its a MAX.
(See the mixer.c code below. There is a probe function included ...)

To detect an UltraMAX, read the version #. If its 10 or larger, its a 
MAX.

============================================================================

MIXER Stuff

Part #: ICS2101 digital mixer. Find an ICS data book or contact ICS
to get a data sheet on this part.

Addresses of ICS
================
ICS
2435 Boulevard of the Generals
P.O. Box 968
Valley Forge, PA 19482-0968
Phn# 215-630-5300
     215-630-5399

or

ICS
1271 Parkmoor Avenue
San Jose, CA 95126
Phn# 408-297-1201
Fax# 408-925-9460


General info:

Its an attenuate only mixer. No gain is available.
Can adjust line-in, line-out, mic-in, and cd-in.
Write only device. The only way to detect it is to look at the GUS version
   #. (see above)
Any input\output can be muted.
If device is NOT initialized, no audio will go thru. All are muted on
   powerup. That why ultrinit MUST be run for apps that are not
   aware of this mixer (SBOS, playmidi, 3rd party apps etc).
Your app MUST put the mixer back into a transparent mode when it completes
   so that other apps are not hosed up. The only possible exception may
   be something like a DOS-based mixer app that can be used to adjust
   the output of non-mixer aware apps. Currently, the only apps I know
   of that support the mixer directly are:
      - ultrinit (exe and sys)
      - uss16
      - playfile (newest rev)
      - windows drivers
      - some people are working on Unix\Linux drivers. I don't know
         what state they are at.
The mixer takes up to port locations
   (see mixer.h file below)
   control port = base_port + 0x506
   data port    = base_port + 0x106

Some 3.7 cards had a couple of the right\left outputs flipped. (revision
# 5). The ICS mixer is capable of correcting this. See the example code
below for how we did this. You will need to get the data sheets to
really understand it. If you want to use our code as is, it will take
care of it for you.

The example mixer code expects to be using the 2.10 SDK stuff. If you
don't have 2.10, please get it. Its available on lots of ftp sites.

UltraMAX (and daughter card)
=============================================================================
I'm not going to provide any preliminary code for using the cs4231 yet.
It will be in the SDK that is due out shortly. I would suggest that
anybody that wants to do any development get the data sheet from 
Crystal Semiconductor. The part # is:

CS4231 Parallel Interface, Multimedia Codec

Their address is:

Crystal Semiconductor Corporation
P.O. Box 17847
Austin, TX 78760

Phn# 512-445-7222
Pax# 512-445-7581

The SDK code will be structured much like the current SDK code. It will 
have lots of routines that get the codec to perform. There will also
be an example of how to play a file thru it (much like playfile without
the GUI).

Almost all of the code for the MAX and daughtercard is the same. The main
differences are IRQ and DMA allocation and I\O addresses. These will be
speced out in the SDK document and the library code.

===========================================================================
SDK mixer code


/***************************************************************************
*	NAME:  MIXER.C
**	COPYRIGHT:
**	"Copyright (c) 1993, by FORTE
**
**       "This software is furnished under a license and may be used,
**       copied, or disclosed only in accordance with the terms of such
**       license and with the inclusion of the above copyright notice.
**       This software or any other copies thereof may not be provided or
**       otherwise made available to any other person. No title to and
**       ownership of the software is hereby transfered."
****************************************************************************
*  CREATION DATE: 10/04/93
*--------------------------------------------------------------------------*
*     VERSION	DATE	   NAME		DESCRIPTION
*>	1.0	10/04/93		Original
***************************************************************************/
#include <stdio.h>
#include <dos.h>
#include <conio.h>

#include "forte.h"
#include "ultraerr.h"
#include "mixer.h"

ULTRA_MIXER _mixer_data;

int
UltraMixProbe(unsigned int base_port)
{
unsigned char val;

val = inp(base_port+MIX_SEL_PORT);

/* There may have to be some additional checks here if later versions */
/* of the card (post 3.6) might NOT have the ICS mixer. For now, anything */
/* later than 5 will have a mixer */

/* NOTE: Version 10 (0x0a) and up is UltraMax. No ICS mixer on MAX */
if (val >= 5 && val < 0x0a && val != 0xff)
	{
	_mixer_data.mixer_addr = base_port+MIX_SEL_PORT;
	_mixer_data.mixer_data = base_port+MIX_DATA_PORT;
	return((int)val);
	}

return(0);
}

#define FLIP_REV	5	/* Flip some mixer channels if this revision */

static unsigned char flip_left[6] = {
	0x01,		/* MIC IN */
	0x01,		/* LINE IN */
	0x01,		/* CD IN */
	0x02,		/* GF1_OUT */
	0x01,		/* UNUSED */
	0x02 };		/* MASTER OUT */

static unsigned char flip_right[6] = {
	0x02,		/* MIC IN */
	0x02,		/* LINE IN */
	0x02,		/* CD IN */
	0x01,		/* GF1_OUT */
	0x02,		/* UNUSED */
	0x01 };		/* MASTER OUT */

void
UltraMixAttn(int chan, int left, int value, int revision)
{
unsigned char ctrl_addr;
unsigned char attn_addr;
unsigned char normal;

ctrl_addr = chan << 3;		/* Shift up to the channel address bits */
attn_addr = chan << 3;		/* Shift up to the channel address bits */

if (left == MIX_LEFT)
	{
	ctrl_addr |= MIX_CTRL_LEFT;
	attn_addr |= MIX_ATTN_LEFT;
	if (revision == FLIP_REV)
		normal = flip_left[chan];
	else
		normal = 0x01;
	}
else
	{
	ctrl_addr |= MIX_CTRL_RIGHT;
	attn_addr |= MIX_ATTN_RIGHT;
	if (revision == FLIP_REV)
		normal = flip_right[chan];
	else
		normal = 0x02;
	}

ENTER_CRITICAL;

outp(_mixer_data.mixer_addr,ctrl_addr);	/* select the proper RL chan ... */
outp(_mixer_data.mixer_data,normal);	/* set to normal mode */

outp(_mixer_data.mixer_addr,attn_addr);	/* select the proper RL chan ... */
outp(_mixer_data.mixer_data,value);	/* set the value */

LEAVE_CRITICAL;
}

void
UltraMixXparent(int revision)
{
	UltraMixAttn(MIX_MIKE_IN, MIX_LEFT, 0x7f, revision);
	UltraMixAttn(MIX_MIKE_IN, MIX_RIGHT, 0x7f, revision);
	UltraMixAttn(MIX_LINE_IN, MIX_LEFT, 0x7f, revision);
	UltraMixAttn(MIX_LINE_IN, MIX_RIGHT, 0x7f, revision);
	UltraMixAttn(MIX_CD_IN, MIX_LEFT, 0x7f, revision);
	UltraMixAttn(MIX_CD_IN, MIX_RIGHT, 0x7f, revision);
	UltraMixAttn(MIX_GF1_OUT, MIX_LEFT, 0x7f, revision);
	UltraMixAttn(MIX_GF1_OUT, MIX_RIGHT, 0x7f, revision);
	UltraMixAttn(MIX_CHAN_4, MIX_LEFT, 0x00, revision);		/* Unused ... */
	UltraMixAttn(MIX_CHAN_4, MIX_RIGHT, 0x00, revision);	/* Unused ... */
	UltraMixAttn(MIX_MASTER, MIX_LEFT, 0x7f, revision);
	UltraMixAttn(MIX_MASTER, MIX_RIGHT, 0x7f, revision);
}

============================================================================

/***************************************************************************
*	NAME:  MIXER.H
**	COPYRIGHT:
**	"Copyright (c) 1993, by FORTE
**
**       "This software is furnished under a license and may be used,
**       copied, or disclosed only in accordance with the terms of such
**       license and with the inclusion of the above copyright notice.
**       This software or any other copies thereof may not be provided or
**       otherwise made available to any other person. No title to and
**       ownership of the software is hereby transfered."
****************************************************************************
*  CREATION DATE: 10/04/93
*--------------------------------------------------------------------------*
*     VERSION	DATE	   NAME		DESCRIPTION
*>	1.0	10/04/93		Original
***************************************************************************/

int UltraMixProbe(unsigned int);
void UltraMixAttn(int,int,int,int);
void UltraMixXparent(int);

#define MIX_SEL_PORT  0x506		/* Offset from base port */
#define MIX_DATA_PORT 0x106		/* Offset from base port */

#define MIX_CHAN_0	0
#define MIX_CHAN_1	1
#define MIX_CHAN_2	2
#define MIX_CHAN_3	3
#define MIX_CHAN_4	4
#define MIX_CHAN_5	5

#define MIX_LEFT 0
#define MIX_RIGHT 1

/* Mixer channels used on GUS */
/* Channel #4 is NOT used */
#define MIX_MIKE_IN	MIX_CHAN_0
#define MIX_LINE_IN MIX_CHAN_1
#define MIX_CD_IN   MIX_CHAN_2
#define MIX_GF1_OUT MIX_CHAN_3
#define MIX_MASTER  MIX_CHAN_5

#define MIX_CTRL_LEFT  0x00
#define MIX_CTRL_RIGHT 0x01
#define MIX_ATTN_LEFT  0x02
#define MIX_ATTN_RIGHT 0x03
#define MIX_PAN        0x04


typedef struct {
	unsigned int mixer_addr;
	unsigned int mixer_data;
} ULTRA_MIXER;

===========================================================================

If there are any questions, please post them to the devel acct so
we can answer them for everybody. Thanks.

Forte Tech Support

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

Date: Wed, 13 Apr 1994 08:01:55 SAT
From: "Mike" <PATRICIO@odie.ee.wits.ac.za>
Subject: s3m specefication

> >Anyway, I was wondering how you would INIT the Gravis, Play the Gravis etc as
> >that SDK stuff is all in C++ which is horrid.  I am writing the code using
> >TASM and PMODE v2.4 from Tran of Renaissance.  I really need help on 
> >accessing the Gravis from assembly.

To the original poster of this message. Sorry to use the digest, but I
accidently del'ed yesterdays digest so I don't have your E-mail 
address. What I want is the specifications for the s3m format. Where 
did u get this?? Could you post it to me?
Much thanks.
Michael.
patricio@odie.ee.wits.ac.za
#include <sig.h>

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

End of GUS Programmer's Digest V10 #7
*************************************

To post to tomorrow's digest:                    <gus-sdk@mail.orst.edu>
To (un)subscribe or get help:            <gus-sdk-request@mail.orst.edu>
To contact a human (last resort):          <gus-sdk-owner@mail.orst.edu>

FTP Sites              Archive                       Directories
---------              -------                       -----------
Main N.American Site:  archive.orst.edu              pub/packages/gravis
                       wuarchive.wustl.edu           systems/ibmpc/ultrasound
Main Asian Site:       nctuccca.edu.tw               PC/ultrasound
European Callers ONLY: theoris.rz.uni-konstanz.de    pub/sound/gus
Submissions:           archive.epas.utoronto.ca      pub/pc/ultrasound/submit
Newly Validated Files: archive.epas.utoronto.ca      pub/pc/ultrasound
Mirrors:               garbo.uwasa.fi                mirror/ultrasound
 
MailServer For Archive Access: Email to <mail-server@nike.rz.uni-konstanz.de>

Hints:
      - Get the FAQ from the FTP sites or the request server.
      - Mail to <gus-sdk-request@mail.orst.edu> for info about other GUS
	related mailing lists (general use, musician's, etc.).


