Re: question about sampling rate

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Grace Baldonasa wrote:
> After computing the rate, value could be of decimal format,

In the computer, all values are binary.

> is it rounded off to either equal or greater than the whole number
> itself?

There is no whole number, it is interpreted as a number with 16 binary
fractional digits.

> subs->freqmax = subs->freqn + (subs->freqn >> 2);
> Q: why is subs->freqn shifted by 2

It's just subs->freqn plus 25 percent, and that is just some random
value that should be safe enough for any real sample clock.

> subs->phase = 0;
> /* calculate the max. size of packet */
> maxsize = ((subs->freqmax + 0xffff) * (frame_bits >> 3)) >> 16;
> 
> Q: why subs->freqmax is added with 0xffff, then frame_bits is shifted by 3
> then the whole thing shifted by 16.

It's shifted by 16 to throw away the fractional digits; we calculate
whole bytes.
"frame_bits/8" is the number of bytes per frame.
Adding 0xffff ensures that despite the truncation by the final shift,
the value is rounded up.


HTH
Clemens


-------------------------------------------------------------------------
Using Tomcat but need to do more? Need to support web services, security?
Get stuff done quickly with pre-integrated technology to make your job easier
Download IBM WebSphere Application Server v.1.0.1 based on Apache Geronimo
http://sel.as-us.falkag.net/sel?cmd=lnk&kid=120709&bid=263057&dat=121642
_______________________________________________
Alsa-devel mailing list
Alsa-devel@xxxxxxxxxxxxxxxxxxxxx
https://lists.sourceforge.net/lists/listinfo/alsa-devel

[Index of Archives]     [ALSA User]     [Linux Audio Users]     [Kernel Archive]     [Asterisk PBX]     [Photo Sharing]     [Linux Sound]     [Video 4 Linux]     [Gimp]     [Yosemite News]

  Powered by Linux