www.delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp/1998/02/11/00:15:27

From: myknees AT aol DOT com (Myknees)
Newsgroups: comp.os.msdos.djgpp
Subject: Re: Audio recording and mixing
Date: 11 Feb 1998 05:13:12 GMT
Lines: 50
Message-ID: <19980211051301.AAA21851@ladder02.news.aol.com>
NNTP-Posting-Host: ladder02.news.aol.com
References: <Z$E1rGAGIK40EwIU AT talula DOT demon DOT co DOT uk>
Organization: AOL http://www.aol.com
To: djgpp AT delorie DOT com
DJ-Gateway: from newsgroup comp.os.msdos.djgpp

Shawn Hargreaves writes:
> Guy Rauscher writes:
> >I'm using Allegro for my audio output and I want to 
> >combine recording
> >ability in a future application; Any suggestions?
> 
> Allegro doesn't support audio input, so you will have to
> write your own
> soundcode. 

That's interesting since I had just started a program that uses the Allegro
sound routines.  I read a short tutorial on digital audio mixing that basically
said that one must program the mixing routines in assembly.  Do you think that
has any truth to it?

Also, I have accidentally caused mixing to occur with this loop (based on
ex17.c):
    do {
      if (key[KEY_Q]){
	play_sample(the_sample, 255, pan, pitch, FALSE);
	rest(50);
      }
      else if(key[KEY_W]){
	play_sample(the_sample, 255, pan, pitch*2, FALSE);
	rest(50);
      }
    } while ((!key[KEY_ESC]) && (!key[KEY_SPACE]));

It makes reverb.  Where is the mixing occurring?

[snip]
> >Also, how do I mix to samples? I tried averaging the 
> >values of each two
> >bytes from the two samples by the volume I got was too 
> >low. I also
> >tried adding every two bytes but the the values were 
> >out of range. What
> >do I do?
> 
> You just have to live with some loss of quality. The
> 'correct' solution
> is to take an average, but that does lose a lot of
> volume and precision.

Are you two talking about unsigned data?  I thought that adding was the only
way to go.  Averaging only seems like it would be necessary in an unsigned-data
situation.  I'm guessing that it would be much less efficient than adding.  Of
course, I know very little about all this.

--Ed (Myknees)

- Raw text -


  webmaster     delorie software   privacy  
  Copyright © 2019   by DJ Delorie     Updated Jul 2019