:: /* Usage :
:: lame_set_parameters(gfp, LAME_SAMP_FREQ__INT, 44100 ,
:: LAME_NR_CHANNELS__INT , 2 ,
:: LAME_LOW_PASS_VALUE__FLOAT , 16.050 ,
:: LAME_LOW_PASS_WIDTH__FLOAT , 0.75,
:: LAME_COMMENT__STRING , "This is cool" ,
:: LAME_END_MARKER);
::
:: LAME_END_MARKER informs the lame_set_parameters to stop reading values,
:: as AFAIK
:: there is not other way to determine whether all the args has been read
::
:: the __FLOAT and __INT attachments are there only to help illustrate my
:: idea,
:: but could be helpful in the actual implementation too
::
:: */
::
One function, but is this simple?
No error checking, a lot of really strange constants, mixing Hz and kHz. Do
you like bugs? Do you love bugs? Do you buy a car with only one joystick to
do all operations (including wheel- and oil-change)?
Only one joystick, that means very simple operations! Welcome on the graveyard.
typedef struct {
void* ptr;
const size_t size;
size_t len;
} bytebuffer_t;
bytebuffer_t bb;
LAME* gfp;
gfp = lame_open ();
lame_set_samplefreq ( gfp, 44100.0 );
lame_set_channels ( gfp, 2 );
lame_set_lowpass ( gfp, 16050.0 );
lame_set_lowpass_width ( gfp, 750.0 );
lame_set_lowpass_type ( gfp, lame_filter_chebychev, 8, 0.5 );
lame_set_comment ( gfp, "This is not error prone" );
lame_add_comment ( gfp, "Developers will not hate lame developers" );
lame_add_comment ( gfp, "Lame developers do not need a body guard" );
alloc_bytebuffer ( &bb, 16384 );
error = lame_encode_buffer ( gfp, &bb, 88200, channel_left, channel_right
);
if (error)
lame_perror ( "The following error occured", error );
fwrite ( fp, 1, bb.len, bb.ptr );
error = lame_encode_interleaved_buffer ( gfp, &bb, 88200, interleaved_buffer );
if (error)
lame_perror ( "The following error occured", error );
fwrite ( fp, 1, bb.len, bb.ptr );
error = lame_encode_finish ( gfp, &bb );
if (error)
lame_perror ( "The following error occured", error );
fwrite ( fp, 1, bb.len, bb.ptr );
if ( bb.size > 16384 )
printf ( "BitBuffer was increased by a subroutine, instead of crashing!\n" );
free_bytebuffer ( &bb );
error = lame_close ( gfp );
if (error)
lame_perror ( "Shit, the last operation and a error", error );
--
Mit freundlichen Grüßen
Frank Klemm
eMail | [EMAIL PROTECTED] home: [EMAIL PROTECTED]
phone | +49 (3641) 64-2721 home: +49 (3641) 390545
sMail | R.-Breitscheid-Str. 43, 07747 Jena, Germany
--
MP3 ENCODER mailing list ( http://geek.rcc.se/mp3encoder/ )