www.delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp/1997/03/17/05:32:03

From: Shawn Hargreaves <Shawn AT talula DOT demon DOT co DOT uk>
Newsgroups: comp.os.msdos.djgpp
Subject: Re: Allegro sound bug?
Date: Sun, 16 Mar 1997 21:38:43 +0000
Organization: None
Distribution: world
Message-ID: <9oOMNAAjhGLzEwpY@talula.demon.co.uk>
References: <5gh3c8$nhi$1 AT news DOT sas DOT ab DOT ca>
NNTP-Posting-Host: talula.demon.co.uk
MIME-Version: 1.0
Lines: 32
To: djgpp AT delorie DOT com
DJ-Gateway: from newsgroup comp.os.msdos.djgpp

>I've found a weird problem using Allegro's play_sample() function. If I
>use it anywhere in my program other than within a while loop the sample
>sounds crappy (scratchy and half the volume). For example:
>
>       while(!keypressed())
>               if(mouse_b & 1)
>               {
>               play_sample(the_sample, 100, 128, 1000, FALSE)
>               }
>       // this works fine 
>       
>       if(move_guy > 300)
>               {
>               play_sample(the_sample, 100, 128, 1000, FALSE)
>               }
>       // this does not

I'm not convinced the presence of the while loop has anything to do with
this, because the rest of your code (the condition that decides whether
to play the sample or not) is also different. If your 
"if (move_guy > 300)" test happens inside a loop, isn't that going to
continue to be true for several cycles round your control routine? If
so, you will be triggering lots of copies of the sample in rapid
succession, which is going to sound weird (after you use up the maximum
number of voices Allegro will start chopping off the older sounds, and
the multiple copies of the sound are likely to sound weird since they
will be slightly out of phase with each other).


--
Shawn Hargreaves - shawn AT talula DOT demon DOT co DOT uk - http://www.talula.demon.co.uk/
Beauty is a French phonetic corruption of a short cloth neck ornament.

- Raw text -


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