Re: [AD] get volume

[ Thread Index | Date Index | More lists.liballeg.org/allegro-developers Archives ]


On Mon, 2006-02-27 at 11:55 +0100, Milan Mimica wrote:
> Hi,
>  
> I noticed that allegro sound routines miss getter functions for
> set_volume/set_hardware_volume that I find useful in some situations, e.g.
> setting volume sliders in game options at initial volume without altering
> current settings.
> I could add such a function to most if not all allegro sound drivers but I
> would be able to test only some of them.
> I'm not sure about the API:
> get_volume(int *digi_volume, int *midi_volume);
> get_hardware_volume(int *digi_volume, int *midi_volume);
> or
> VOLUME_STRUCT_NAME get_volume();
> VOLUME_STRUCT_NAME get_hardware_volume();
> or
> something 3rd?

I would go with the first one personally, although the 2nd one looks
cleaner (but pollutes API with another struct). All other getter
functions we have in Allegro seem to return a single value - so to be
consistent with that, we also could use 4 separate functions - but then,
we also should have 4 setter functions for that, so my vote stays #1.

<off-topic>
For 4.3, I would like to use the config system:

al_set_config_int("/allegro/mixer/hardware", 100); // set default control, like 4.2

AL_LIST *controls = al_list_config_entries("/allegro/mixer/hardware")
...
al_set_config_int("/allegro/mixer/hardware/pcm_left", 100);

This would be most flexible (e.g. could store translated names as
sub-keys to all controls for display to the user, or have the type of
controls, like slider/on-off switch, and things like that), and no extra
API needed at all.
</off-topic>

> Moreover, could it be applied to stable branch? I think it wouldn't affect much
> existing code.
> 

Yes, we already added some functions.

-- 
Elias Pschernig





Mail converted by MHonArc 2.6.19+ http://listengine.tuxfamily.org/