Mail Archives: djgpp/1997/03/20/23:16:55
Hya there!
kalyniuk AT freenet DOT edmonton DOT ab DOT ca wrote:
> 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
Well, think about what it does. If you hold the button for a small
while, then you are sending a lot of play_sample()'s statements. Since
Allegro has a builtin limit on the number of voices that can be active
at any time (8, at least for SBPro), this means that in 8 loops of the
while{} statement (very very small time) you flood the mixer with 8
copies of the same sample. Of course it sounds glorious, try doing the
same thing on an 8 channel tracker and you'll _hear_ the difference :-)
> if(move_guy > 300)
> {
> play_sample(the_sample, 100, 128, 1000, FALSE)
> }
> // this does not
Well, this only places a copy of the sample on the mixer. Guess what
happens :-)
As a solution you may want to try this: a) increment the mixing rate and
b) duplicate the line (ie. play the sample twice) if it doesn't work.
Hope it helps 8-)
--
_*
\ |/_|\/||\ sigma AT ctv DOT es
_\|\/| ||_\ (formerly Sigmatech) Jerez / Cadiz / Spain
- Raw text -