fixing TwoLameLibEncoder.cpp for 64-bit compilation,

minor code cleanup, fixes #11
This commit is contained in:
darkeye 2007-02-19 07:55:42 +00:00
parent 3385baf170
commit 1a8f07de82
2 changed files with 5 additions and 3 deletions

View File

@ -116,7 +116,7 @@ TwoLameLibEncoder :: open ( void )
if ( !twolame_opts ) { if ( !twolame_opts ) {
throw Exception( __FILE__, __LINE__, throw Exception( __FILE__, __LINE__,
"TwoLAME lib init error", "TwoLAME lib init error",
(int) twolame_opts); (long int) twolame_opts);
} }
if ( 0 > twolame_set_num_channels( twolame_opts, getInChannel()) ) { if ( 0 > twolame_set_num_channels( twolame_opts, getInChannel()) ) {

View File

@ -274,12 +274,14 @@ VorbisLibEncoder :: write ( const void * buf,
if ( bitsPerSample == 8 ) { if ( bitsPerSample == 8 ) {
char * buf8 = (char *) buf; char * buf8 = (char *) buf;
unsigned int ix = sampleSize * i; unsigned int ix = sampleSize * i;
buf8[i] = (buf8[ix] + buf8[++ix]) / 2; unsigned int iix = ix;
buf8[i] = (buf8[ix] + buf8[++iix]) / 2;
} }
if ( bitsPerSample == 16 ) { if ( bitsPerSample == 16 ) {
short * buf16 = (short *) buf; short * buf16 = (short *) buf;
unsigned int ix = (bitsPerSample >> 3) * i; unsigned int ix = (bitsPerSample >> 3) * i;
buf16[i] = (buf16[ix] + buf16[++ix]) / 2; unsigned int iix = ix;
buf16[i] = (buf16[ix] + buf16[++iix]) / 2;
} }
} }
len >>= 1; len >>= 1;