>Here we have three variations:
>* audiohw_set_master_vol
>* audiohw_set_lineout_vol
>* audiohw_set_headphone_vol
>
>which
do the same... setting volume for our headphones. The question for me
is now, if we need all these different functions, which

>have the same result in the end? Is it important for the caller of such
a function to know what technique we use to change volume (set
headphone registers,
>set master volume registers, set lineout registers)?
>I think no! As a result of this we could have one unique function name, e.g. 
>audiohw_set_volume(l, r) to change the volume.

>
>Please tell me about your opinions and maybe you can give me an understandable 
>url/document, which explains what prescale does.


Well, let's say we had a player with both some sort of master, and a headphone, 
and a separate line out. Even though we don't have it at the moment, by keeping 
three functions, each for each sort of sound output, if we one day had a player 
with these capabilities, the code would be changed in parts of the functions 
using #ifdefs. But if all three functions all have the same body, i would 
consider making audiohw_set_volume(l, r), and then do
this:

#define audiohw_set_master_vol audiohw_set_volume

#define audiohw_set_lineout_vol audiohw_set_volume

#define audiohw_set_headphone_vol audiohw_set_volume

later on, the macros could be replaces by individual functions, and we wouldn't 
need to decide which of the three functions should be used every time we would 
change volume in the code.

_________________________________________________________________
Saml dine online aktiviteter på din PC med Windows Live
www.windowslive.dk/suite

Reply via email to