# HG changeset patch # User giacomo # Date 1145553902 25200 # Node ID 57c72488d475b3653b5b3240a8687ff775789946 # Parent 008bf9a501b1a4fed2acda46ac9daf50094bf33d [svn] fixed incorrect range conversion in volume functions diff -r 008bf9a501b1 -r 57c72488d475 Plugins/Input/amidi-plug/i_common.h --- a/Plugins/Input/amidi-plug/i_common.h Tue Apr 18 07:00:25 2006 -0700 +++ b/Plugins/Input/amidi-plug/i_common.h Thu Apr 20 10:25:02 2006 -0700 @@ -44,7 +44,7 @@ #endif /* DEBUG */ -#define AMIDIPLUG_VERSION "0.2" +#define AMIDIPLUG_VERSION "0.2+" #define PLAYER_NAME "Audacious" #define G_PATH_GET_BASENAME(x) g_path_get_basename(x) #define G_STRING_PRINTF(...) g_string_printf(__VA_ARGS__) diff -r 008bf9a501b1 -r 57c72488d475 Plugins/Input/amidi-plug/i_seq.c --- a/Plugins/Input/amidi-plug/i_seq.c Tue Apr 18 07:00:25 2006 -0700 +++ b/Plugins/Input/amidi-plug/i_seq.c Thu Apr 20 10:25:02 2006 -0700 @@ -429,15 +429,15 @@ if ( snd_mixer_selem_has_playback_channel( mixer_elem , SND_MIXER_SCHN_FRONT_LEFT ) ) { snd_mixer_selem_get_playback_volume( mixer_elem , SND_MIXER_SCHN_FRONT_LEFT , &lc ); - /* convert the range to 0-100 (for the unlucky case that pv_range is not 0-100 already) */ - *left_volume = (gint)(((lc - pv_min) * pv_range) / 100); + /* convert the range to 0-100 (for the case that pv_range is not 0-100 already) */ + *left_volume = (gint)(((lc - pv_min) * 100) / pv_range); DEBUGMSG( "GET VOLUME requested, get left channel (%i)\n" , *left_volume ); } if ( snd_mixer_selem_has_playback_channel( mixer_elem , SND_MIXER_SCHN_FRONT_RIGHT ) ) { snd_mixer_selem_get_playback_volume( mixer_elem , SND_MIXER_SCHN_FRONT_RIGHT , &rc ); - /* convert the range to 0-100 (for the unlucky case that pv_range is not 0-100 already) */ - *right_volume = (gint)(((rc - pv_min) * pv_range) / 100); + /* convert the range to 0-100 (for the case that pv_range is not 0-100 already) */ + *right_volume = (gint)(((rc - pv_min) * 100) / pv_range); DEBUGMSG( "GET VOLUME requested, get right channel (%i)\n" , *right_volume ); } } @@ -474,13 +474,13 @@ { DEBUGMSG( "SET VOLUME requested, setting left channel to %i%%\n" , left_volume ); snd_mixer_selem_set_playback_volume( mixer_elem , SND_MIXER_SCHN_FRONT_LEFT , - (gint)(((gdouble)pv_range * ((gdouble)left_volume*.01)) + pv_min) ); + (gint)((gdouble)(0.01 * (gdouble)(left_volume * pv_range)) + pv_min) ); } if ( snd_mixer_selem_has_playback_channel( mixer_elem , SND_MIXER_SCHN_FRONT_RIGHT ) ) { DEBUGMSG( "SET VOLUME requested, setting right channel to %i%%\n" , right_volume ); snd_mixer_selem_set_playback_volume( mixer_elem , SND_MIXER_SCHN_FRONT_RIGHT , - (gint)(((gdouble)pv_range * ((gdouble)right_volume*.01)) + pv_min) ); + (gint)((gdouble)(0.01 * (gdouble)(right_volume * pv_range)) + pv_min) ); } } }