[Asterisk-Users] Wildcard X100P or TDM400P?

Steven Critchfield critch at basesys.com
Tue Mar 8 14:20:56 MST 2005


On Tue, 2005-03-08 at 14:27 -0600, Rich Adamson wrote:
> > On Tue, 2005-03-08 at 13:24 -0600, Rich Adamson wrote:

> > > If that's the case, then why has bug 2023 been lurking without any such
> > > comments for many many months?
> > 
> > If it is lurking for 10 months it is because no one cares to read it. I
> > promise you I don't look at any bug unless it is mentioned on a list as
> > is pertaining to code I am running. I have so little time now, I don't
> > go looking for needles in haystacks that I don't need.
> 
> The only reason for questioning the above is that Mark (and several others)
> have contributed various comments to bug 2022 and 2023, but at no time
> have any of them ever mentioned comments relative to wav vs other file 
> formats, and effectively have left the bug unresolved.

Go look at the code for format_wav.c. I have code in there and have
actually looked at it myself.

This is at line 64 of my code base.
#define GAIN 2          /* 2^GAIN is the multiple to increase the volume by */

And this around line 480 in the wav_write function.
        if (fs->buf) {
                tmpi = f->data;
                /* Volume adjust here to accomodate */
                for (x=0;x<f->datalen/2;x++) {
                        tmpf = ((float)tmpi[x]) * ((float)(1 << GAIN));
                        if (tmpf > 32767.0)
                                tmpf = 32767.0;
                        if (tmpf < -32768.0)
                                tmpf = -32768.0;
                        tmp[x] = tmpf;
                        tmp[x] &= ~((1 << GAIN) - 1);

f is the frame to be written. f->data is the audio data to be written.
The for loop just uses pointer math to traverse each sample of the
buffer and increase the volume of the sample with clipping control.
-- 
Steven Critchfield <critch at basesys.com>




More information about the asterisk-users mailing list