Rockbox.org home
release
dev builds
extras
themes manual
wiki
device status forums
mailing lists
IRC bugs
patches
dev guide



Rockbox mail archive

Subject: RE: Some questions about naming of some functions

RE: Some questions about naming of some functions

From: Jonas Hellesøe Nielsen <jonas_hn_at_hotmail.com>
Date: Sat, 9 Feb 2008 18:01:02 +0100

>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

>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

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
Received on 2008-02-09


Page was last modified "Jan 10 2012" The Rockbox Crew
aaa