Sigbjřrn Skjćret wrote:
> >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
>
> Yes, but this still requires the parameters to be correct,
I don't think there is a way to make it work with incorrect
parameters :-)
> and parsing gets abit more messy...
How ?
The 3 functions method , the one for int parameters :
lame_set_parameter_int(lama_global_flags *lame_struct,...)
{
va_list args;
LAME_TAG_TYPE current_tag;
va_start(args);
current_tag = va_arg(args,LAME_TAG_TYPE);
while(current_tag != LAME_TAG_END )
{
switch(current_tag) {
case LAME_SET_SAMPLING_FREQ : lame_struct.samp_freq =
va_arg(args,int); break;
case LAME_SET_NR_CHAN : lame_struct.nr_channels =
va_arg(args,int); break;
/* some other integer parameters */ ....
}
current_tag = va_arg(args,LAME_TAG_TYPE);
}
va_end(args);
}
the "unified function version :
lame_set_parameters(lama_global_flags *lame_struct,...)
{
va_list args;
LAME_TAG_TYPE current_tag;
va_start(args);
current_tag = va_arg(args,LAME_TAG_TYPE);
while(current_tag != LAME_TAG_END )
{
switch(current_tag) {
case LAME_SET_SAMPLING_FREQ : lame_struct.samp_freq =
va_arg(args,int); break;
case LAME_SET_NR_CHAN : lame_struct.nr_channels =
va_arg(args,int); break;
case LAME_FILTER_WIDTH : lame_struct.filter_width =
va_arg(args,float); break;
/* some other integer, string or float or whatever parameters */
....
}
current_tag = va_arg(args,LAME_TAG_TYPE);
}
va_end(args);
}
--
David Balazic
--------------
"Be excellent to each other." - Bill & Ted
- - - - - - - - - - - - - - - - - - - - - -
--
MP3 ENCODER mailing list ( http://geek.rcc.se/mp3encoder/ )