[ Thread Index |
Date Index
| More lists.liballeg.org/allegro-developers Archives
]
Hi there!
The attached patch fixes alsa 9x hardware volume setting (it is broken
currently, isn't it?). The code is much clearer now and seems to fork fine.
--
Milan Mimica
--- /usr/src/allegro-4.1.18/src/unix/alsa9.c 2004-10-04 18:37:35.000000000 +0200
+++ alsa9.c 2005-03-23 00:07:02.000000000 +0100
@@ -492,13 +492,9 @@
*/
static int alsa_mixer_volume(int volume)
{
- unsigned long left_vol = 0, right_vol = 0;
-
if (alsa_mixer && alsa_mixer_elem) {
- snd_mixer_selem_get_playback_volume(alsa_mixer_elem, 0, &left_vol);
- snd_mixer_selem_get_playback_volume(alsa_mixer_elem, 1, &right_vol);
- snd_mixer_selem_set_playback_volume(alsa_mixer_elem, 0, (int)floor(left_vol + 0.5) * alsa_mixer_allegro_ratio);
- snd_mixer_selem_set_playback_volume(alsa_mixer_elem, 1, (int)floor(right_vol + 0.5) * alsa_mixer_allegro_ratio);
+ snd_mixer_selem_set_playback_volume(alsa_mixer_elem, 0, volume * alsa_mixer_allegro_ratio);
+ snd_mixer_selem_set_playback_volume(alsa_mixer_elem, 1, volume * alsa_mixer_allegro_ratio);
}
return 0;
}