[MPlayer-cvslog] r38628 - trunk/gui/dialog/equalizer.c
ib
subversion at mplayerhq.hu
Tue Jun 25 15:23:53 EEST 2024
Author: ib
Date: Tue Jun 25 15:23:53 2024
New Revision: 38628
Log:
Block signal handler eqHScaleChanged when calling (internal) eqSetBands().
eqSetBands() should only set the sliders to the gain values that have
already been set with MPLAYER_SET_EQUALIZER.
Only moving a slider by the user should cause a MPLAYER_SET_EQUALIZER
change, not the (subsequent) setting of the slider value.
Modified:
trunk/gui/dialog/equalizer.c
Modified: trunk/gui/dialog/equalizer.c
==============================================================================
--- trunk/gui/dialog/equalizer.c Tue Jun 25 15:22:38 2024 (r38627)
+++ trunk/gui/dialog/equalizer.c Tue Jun 25 15:23:53 2024 (r38628)
@@ -76,8 +76,49 @@ char * gtkEquChannel6 = NULL;
void ShowEquConfig( void );
+static void eqHScaleChanged (GtkRange *range, gpointer user_data)
+{
+ equalizer_t eq;
+
+ (void) range;
+
+ switch ( GPOINTER_TO_INT(user_data) )
+ {
+ case 0: eq.gain=gtk_adjustment_get_value(A3125adj); break;
+ case 1: eq.gain=gtk_adjustment_get_value(A6250adj); break;
+ case 2: eq.gain=gtk_adjustment_get_value(A125adj); break;
+ case 3: eq.gain=gtk_adjustment_get_value(A250adj); break;
+ case 4: eq.gain=gtk_adjustment_get_value(A500adj); break;
+ case 5: eq.gain=gtk_adjustment_get_value(A1000adj); break;
+ case 6: eq.gain=gtk_adjustment_get_value(A2000adj); break;
+ case 7: eq.gain=gtk_adjustment_get_value(A4000adj); break;
+ case 8: eq.gain=gtk_adjustment_get_value(A8000adj); break;
+ case 9: eq.gain=gtk_adjustment_get_value(A16000adj); break;
+ default: return;
+ }
+ eq.gain=-eq.gain;
+ eq.band=GPOINTER_TO_INT(user_data);
+ if ( Channel == -1 )
+ {
+ int i;
+ for ( i=0;i<6;i++ )
+ { eq.channel=i; mplayer( MPLAYER_SET_EQUALIZER,0,&eq ); }
+ } else { eq.channel=Channel; mplayer( MPLAYER_SET_EQUALIZER,0,&eq ); }
+}
+
static void eqSetBands( int channel )
{
+ g_signal_handlers_block_by_func(G_OBJECT(A3125), G_CALLBACK(eqHScaleChanged), GINT_TO_POINTER(0));
+ g_signal_handlers_block_by_func(G_OBJECT(A6250), G_CALLBACK(eqHScaleChanged), GINT_TO_POINTER(1));
+ g_signal_handlers_block_by_func(G_OBJECT(A125), G_CALLBACK(eqHScaleChanged), GINT_TO_POINTER(2));
+ g_signal_handlers_block_by_func(G_OBJECT(A250), G_CALLBACK(eqHScaleChanged), GINT_TO_POINTER(3));
+ g_signal_handlers_block_by_func(G_OBJECT(A500), G_CALLBACK(eqHScaleChanged), GINT_TO_POINTER(4));
+ g_signal_handlers_block_by_func(G_OBJECT(A1000), G_CALLBACK(eqHScaleChanged), GINT_TO_POINTER(5));
+ g_signal_handlers_block_by_func(G_OBJECT(A2000), G_CALLBACK(eqHScaleChanged), GINT_TO_POINTER(6));
+ g_signal_handlers_block_by_func(G_OBJECT(A4000), G_CALLBACK(eqHScaleChanged), GINT_TO_POINTER(7));
+ g_signal_handlers_block_by_func(G_OBJECT(A8000), G_CALLBACK(eqHScaleChanged), GINT_TO_POINTER(8));
+ g_signal_handlers_block_by_func(G_OBJECT(A16000), G_CALLBACK(eqHScaleChanged), GINT_TO_POINTER(9));
+
if ( channel < 0 ) channel=0;
gtk_adjustment_set_value( A3125adj,-gtkEquChannels[channel][0] );
gtk_adjustment_set_value( A6250adj,-gtkEquChannels[channel][1] );
@@ -89,6 +130,17 @@ static void eqSetBands( int channel )
gtk_adjustment_set_value( A4000adj,-gtkEquChannels[channel][7] );
gtk_adjustment_set_value( A8000adj,-gtkEquChannels[channel][8] );
gtk_adjustment_set_value( A16000adj,-gtkEquChannels[channel][9] );
+
+ g_signal_handlers_unblock_by_func(G_OBJECT(A16000), G_CALLBACK(eqHScaleChanged), GINT_TO_POINTER(9));
+ g_signal_handlers_unblock_by_func(G_OBJECT(A8000), G_CALLBACK(eqHScaleChanged), GINT_TO_POINTER(8));
+ g_signal_handlers_unblock_by_func(G_OBJECT(A4000), G_CALLBACK(eqHScaleChanged), GINT_TO_POINTER(7));
+ g_signal_handlers_unblock_by_func(G_OBJECT(A2000), G_CALLBACK(eqHScaleChanged), GINT_TO_POINTER(6));
+ g_signal_handlers_unblock_by_func(G_OBJECT(A1000), G_CALLBACK(eqHScaleChanged), GINT_TO_POINTER(5));
+ g_signal_handlers_unblock_by_func(G_OBJECT(A500), G_CALLBACK(eqHScaleChanged), GINT_TO_POINTER(4));
+ g_signal_handlers_unblock_by_func(G_OBJECT(A250), G_CALLBACK(eqHScaleChanged), GINT_TO_POINTER(3));
+ g_signal_handlers_unblock_by_func(G_OBJECT(A125), G_CALLBACK(eqHScaleChanged), GINT_TO_POINTER(2));
+ g_signal_handlers_unblock_by_func(G_OBJECT(A6250), G_CALLBACK(eqHScaleChanged), GINT_TO_POINTER(1));
+ g_signal_handlers_unblock_by_func(G_OBJECT(A3125), G_CALLBACK(eqHScaleChanged), GINT_TO_POINTER(0));
}
static void eqSetChannelNames( void )
@@ -115,36 +167,6 @@ static void eqSetChannelNames( void )
}
}
-static void eqHScaleChanged (GtkRange *range, gpointer user_data)
-{
- equalizer_t eq;
-
- (void) range;
-
- switch ( GPOINTER_TO_INT(user_data) )
- {
- case 0: eq.gain=gtk_adjustment_get_value(A3125adj); break;
- case 1: eq.gain=gtk_adjustment_get_value(A6250adj); break;
- case 2: eq.gain=gtk_adjustment_get_value(A125adj); break;
- case 3: eq.gain=gtk_adjustment_get_value(A250adj); break;
- case 4: eq.gain=gtk_adjustment_get_value(A500adj); break;
- case 5: eq.gain=gtk_adjustment_get_value(A1000adj); break;
- case 6: eq.gain=gtk_adjustment_get_value(A2000adj); break;
- case 7: eq.gain=gtk_adjustment_get_value(A4000adj); break;
- case 8: eq.gain=gtk_adjustment_get_value(A8000adj); break;
- case 9: eq.gain=gtk_adjustment_get_value(A16000adj); break;
- default: return;
- }
- eq.gain=-eq.gain;
- eq.band=GPOINTER_TO_INT(user_data);
- if ( Channel == -1 )
- {
- int i;
- for ( i=0;i<6;i++ )
- { eq.channel=i; mplayer( MPLAYER_SET_EQUALIZER,0,&eq ); }
- } else { eq.channel=Channel; mplayer( MPLAYER_SET_EQUALIZER,0,&eq ); }
-}
-
static void eqVScaleChanged (GtkRange *range, gpointer user_data)
{
(void) range;
More information about the MPlayer-cvslog
mailing list