Mail Archives: djgpp/1999/01/08/19:04:07
On 8 Jan 99 at 20:24, Michael Burian wrote:
> 1st:
> when using the stream audio routines provided by Allegro I noticed that
> the volume is always the same no matter if you fill the buffer with
>
> p[i]=200*sin(phase);
> or
> p[i]=20000*sin(phase); // should be 20 dB louder but isn't
>
> second problem:
> sound quality is lousy, noticeable distortions, what can I do to improve
> sound
> quality?
Reread the documentation. :) Your stream is either 8 or 16
bits, so 20000 wraps if it's 16 bit and 200 wraps whichever it
is. The sample format is unsigned -- so the zero position is
at 128 or 32768, not 0 as your lines above assume.
If the stream is 8 bit, try:
p[i] = 128 + 127*sin(phase);
If 16 bit, try:
p[i] = 32768 + 32767*sin(phase);
These are the maximum volumes. You can of course use
set_volume to adjust the global sound volumes.
--
george DOT foot AT merton DOT oxford DOT ac DOT uk
- Raw text -