Mail Archives: djgpp/1998/02/11/00:15:27
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 -