From mailserv@gaia.ucs.orst.edu Thu Apr 28 17:35:08 1994
Precedence: Bulk
Date: Thu Apr 28 15:27:45 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 #19

GUS Programmer's Digest     Thu, 28 Apr 94 15:27 PST     Volume 10: Issue  19 

Today's Topics:
                     gus sdk frequencies (2 msgs)
               no subject (file transmission) (2 msgs)
                             UNSUBSCRIBE

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, 27 Apr 94 22:11:42 EDT
From: fcass@trashbin.mv.com (Fred Cass)
Subject: gussdk frequencies

 

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

Date: Wed, 27 Apr 94 22:24:21 EDT
From: fcass@trashbin.mv.com (Fred Cass)
Subject: gus sdk frequencies

Hello all.

(I'm really sorry for the mess that this mail message is!
I actually spent about an hour trying to get my terminal
program to work with VI (yech!), and trying to figure out
how to read in a file using VI.  So sorry!)

I have been developing a great game 

I have been developing a great game 

(so my friends tell me its great anyways :)

and of course I am including native Ultrasound Support!  

Well everything (almost) works fine, I even have a nice 

SOUNDOOP object oriented sound class.  The one thing that 

doesn't seem to work right is loading the samples.  They 

load ok, but there always seems to be only half the data 

(I'm guessing) in the GUS ram. I say this because I 

always have to set the frequency to half of what it should

be in order for it to sound right.  For example, I have a 

wonderful sound called PHASER.SND which was recorded at 

11025hz mono.  When I load it in, I have to set the freq. 

to 5600 or so to make it sound right.  It doesn't matter

what freq. the sound was recorded in, it always has to have

it's freq cut in half to work in my program. Has anyone else had 

this trouble?!?!?!?  I've had it for a long time.  I've 

kind of just learned to live with it. :(



Here is some of the code (the most appropriate to include 

I thought).  Most (if not all) of this was cut/pasted 

right from the EXAMPLE.C program that comes with the sdk.

The example program plays my samples ok, but my code won't.



I'm compiling using Borland's Turbo C++ 3.1 I think (version

may be different, I honestly don't remember.



If anyone can help me figure out this annoying problem,

I'd greatly appreciate it.  As a matter of fact, I'll even

send you a free registered version of the game when it's 

done if you'd like.  I'm sure it's something really simple,

but isn't it always.

/*----------------CUT HERE--------------------------------*/

int setupgus(){



  /* This routine initializes the GRAVIS ULTRASOUND hardware */

  /* Returns true if gus is found and initialized */



  unsigned char temp;

  int voices = 14;



  /* Get the ULTRASND environment string parameters */

  UltraGetCfg(&config);

  if (UltraProbe(config.base_port) == NO_ULTRA)

    return FALSE;

  /* open for x num of voices */

  if (UltraOpen(&config,voices) == NO_ULTRA) 

    return FALSE;

  dram_len = UltraSizeDram();

  temp = UltraGetOutput();

  UltraDisableOutput();

  UltraReset(voices);

  /* Re-Init some voice parms to defaults ... */

  for (temp=0;temp<=voices;temp++){

    UltraSetLinearVolume(temp,256);

    UltraSetFrequency(temp,11025L);

    UltraSetBalance(temp,7);

  }

  UltraEnableOutput();

  return TRUE;

} // setupgus





long int getsound(char wfilename[80], unsigned int wsize){

   /* read sound from file then */

   /* download a sample to DRAM */

   /* returns the start location */

   /* or a -1 if unsuccessful */



  void *data_ptr;

  int fd;

  unsigned int temp_val;

  unsigned long dram_loc;



   fd = _open(wfilename,O_RDONLY|O_BINARY);

   if (fd == -1)

     return -1;

   data_ptr = malloc(wsize);

   if (data_ptr == NULL) {

     close(fd);

     return -1;

   }

   temp_val = _read(fd,data_ptr,wsize);

   if (temp_val != wsize){

     free(data_ptr);

     close(fd);

     return -1;

   }

   dram_loc = drampos;

   control = 0;

   control |= DMA_8;

   control |= DMA_CVT_2;

   UltraDownload(data_ptr,control,dram_loc,wsize,TRUE);

   drampos += wsize;

   free(data_ptr);

   close(fd);

   return dram_loc;

} // get sound



/*--------------------------------------------*/



Thanks again for your help! 

God Bless,

	Fred Cass

	fcass@trashbin.mv.com

jjjjjjjjjjjjjkkkkkkkkjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkATZ

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

Date: Wed, 27 Apr 94 22:26:53 EDT
From: fcass@trashbin.mv.com (Fred Cass)
Subject: no subject (file transmission)

Hello all.

I have been developing a great game 
(so my friends tell me its great anyways :)
and of course I am including native Ultrasound Support!  
Well everything (almost) works fine, I even have a nice 
SOUNDOOP object oriented sound class.  The one thing that 
doesn't seem to work right is loading the samples.  They 
load ok, but there always seems to be only half the data 
(I'm guessing) in the GUS ram. I say this because I 
always have to set the frequency to half of what it should
be in order for it to sound right.  For example, I have a 
wonderful sound called PHASER.SND which was recorded at 
11025hz mono.  When I load it in, I have to set the freq. 
to 5600 or so to make it sound right.  It doesn't matter
what freq. the sound was recorded in, it always has to have
it's freq cut in half to work in my program. Has anyone else had 
this trouble?!?!?!?  I've had it for a long time.  I've 
kind of just learned to live with it. :(

Here is some of the code (the most appropriate to include 
I thought).  Most (if not all) of this was cut/pasted 
right from the EXAMPLE.C program that comes with the sdk.
The example program plays my samples ok, but my code won't.

I'm compiling using Borland's Turbo C++ 3.1 I think (version
may be different, I honestly don't remember.

If anyone can help me figure out this annoying problem,
I'd greatly appreciate it.  As a matter of fact, I'll even
send you a free registered version of the game when it's 
done if you'd like.  I'm sure it's something really simple,
but isn't it always.
/*----------------CUT HERE--------------------------------*/
int setupgus(){

  /* This routine initializes the GRAVIS ULTRASOUND hardware */
  /* Returns true if gus is found and initialized */

  unsigned char temp;
  int voices = 14;

  /* Get the ULTRASND environment string parameters */
  UltraGetCfg(&config);
  if (UltraProbe(config.base_port) == NO_ULTRA)
    return FALSE;
  /* open for x num of voices */
  if (UltraOpen(&config,voices) == NO_ULTRA) 
    return FALSE;
  dram_len = UltraSizeDram();
  temp = UltraGetOutput();
  UltraDisableOutput();
  UltraReset(voices);
  /* Re-Init some voice parms to defaults ... */
  for (temp=0;temp<=voices;temp++){
    UltraSetLinearVolume(temp,256);
    UltraSetFrequency(temp,11025L);
    UltraSetBalance(temp,7);
  }
  UltraEnableOutput();
  return TRUE;
} // setupgus


long int getsound(char wfilename[80], unsigned int wsize){
   /* read sound from file then */
   /* download a sample to DRAM */
   /* returns the start location */
   /* or a -1 if unsuccessful */

  void *data_ptr;
  int fd;
  unsigned int temp_val;
  unsigned long dram_loc;

   fd = _open(wfilename,O_RDONLY|O_BINARY);
   if (fd == -1)
     return -1;
   data_ptr = malloc(wsize);
   if (data_ptr == NULL) {
     close(fd);
     return -1;
   }
   temp_val = _read(fd,data_ptr,wsize);
   if (temp_val != wsize){
     free(data_ptr);
     close(fd);
     return -1;
   }
   dram_loc = drampos;
   control = 0;
   control |= DMA_8;
   control |= DMA_CVT_2;
   UltraDownload(data_ptr,control,dram_loc,wsize,TRUE);
   drampos += wsize;
   free(data_ptr);
   close(fd);
   return dram_loc;
} // get sound

/*--------------------------------------------*/

Thanks again for your help! 
God Bless,
	Fred Cass
	fcass@trashbin.mv.com

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

Date: Wed, 27 Apr 94 22:26:30 EDT
From: fcass@trashbin.mv.com (Fred Cass)
Subject: no subject (file transmission)

Hello all.

I have been developing a great game 
(so my friends tell me its great anyways :)
and of course I am including native Ultrasound Support!  
Well everything (almost) works fine, I even have a nice 
SOUNDOOP object oriented sound class.  The one thing that 
doesn't seem to work right is loading the samples.  They 
load ok, but there always seems to be only half the data 
(I'm guessing) in the GUS ram. I say this because I 
always have to set the frequency to half of what it should
be in order for it to sound right.  For example, I have a 
wonderful sound called PHASER.SND which was recorded at 
11025hz mono.  When I load it in, I have to set the freq. 
to 5600 or so to make it sound right.  Has anyone else had 
this trouble?!?!?!?  I've had it for a long time.  I've 
kind of just learned to live with it. :(
ojk

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

Date: Wed, 27 Apr 1994 21:43:44 CDT
From: Q-MAN <stdnt160@whscdp.whs.edu>
Subject: UNSUBSCRIBE

Unsubscribe stdnt160@whscdp.whs.edu

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

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

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.).


