[Flac-dev] Getting subframe type=verbatim on 16 bit files

Josh Coalson xflac at yahoo.com
Thu Sep 7 14:59:50 PDT 2006


--- James Smith <jsmith at landmarkdigital.com> wrote:
>     switch(bitsPerSample)
>     {
>             
>         case SIXTEEN_BITS:
>             buffer16 = (uint16_t*)inData.GetData(); // so we index
thru out data in 16 byte chunks
>             for(sample = sample32 = 0; sample32 < numFrames;
sample32++)
>             {
>                 for(channel = 0; channel < numChannels; channel++,
sample++)
>                 {
>                     flacBuffer[channel][sample32] =
(uint32_t)(uint16_t)buffer16[sample];

that last line there ^^^ looks fishy.  flac takes *signed* 32 PCM
samples.  so the cast is wrong.  also if your data really is
unsigned 16-bit then you have to subtract 32768 from each sample.

Josh


__________________________________________________
Do You Yahoo!?
Tired of spam?  Yahoo! Mail has the best spam protection around 
http://mail.yahoo.com 


More information about the Flac-dev mailing list