[MPlayer-cvslog] r38626 - trunk/gui/dialog/equalizer.c

ib subversion at mplayerhq.hu
Tue Jun 25 15:21:11 EEST 2024


Author: ib
Date: Tue Jun 25 15:21:11 2024
New Revision: 38626

Log:
Keep old gtkEquChannels value when canceling the equalizer dialog.

Check its current value and reset it if necessary when canceling
the dialog.

Moreover, set its initial value when creating the dialog.

Modified:
   trunk/gui/dialog/equalizer.c

Modified: trunk/gui/dialog/equalizer.c
==============================================================================
--- trunk/gui/dialog/equalizer.c	Tue Jun 25 15:20:16 2024	(r38625)
+++ trunk/gui/dialog/equalizer.c	Tue Jun 25 15:21:11 2024	(r38626)
@@ -61,6 +61,8 @@ static GtkAdjustment * A3125adj, * A125a
 
 static int Channel = -1;   // the selected channel, or -1 (all channels)
 
+static float old_gtkEquChannels[6][10];
+
 // ---
 
 char * gtkEquChannel1 = NULL;
@@ -252,6 +254,23 @@ static gboolean eqDelete (GtkWidget *wid
   (void) event;
   (void) user_data;
 
+  if (memcmp(gtkEquChannels, old_gtkEquChannels, sizeof(gtkEquChannels)) != 0)
+  {
+    unsigned int i, j;
+    equalizer_t eq;
+
+    memcpy(gtkEquChannels, old_gtkEquChannels, sizeof(gtkEquChannels));
+
+    for (i = 0; i < FF_ARRAY_ELEMS(gtkEquChannels); i++)
+      for (j = 0; j < FF_ARRAY_ELEMS(*gtkEquChannels); j++)
+      {
+        eq.channel = i;
+        eq.band = j;
+        eq.gain = gtkEquChannels[i][j];
+        mplayer(MPLAYER_SET_EQUALIZER, 0, &eq);
+      }
+  }
+
   mplayer(MPLAYER_SET_CONTRAST, vo_gamma_contrast, 0);
   mplayer(MPLAYER_SET_BRIGHTNESS, vo_gamma_brightness, 0);
   mplayer(MPLAYER_SET_HUE, vo_gamma_hue, 0);
@@ -310,6 +329,8 @@ static GtkWidget * CreateEqualizer( void
   gtk_table_set_row_spacings( GTK_TABLE( table1 ),4 );
   gtk_table_set_col_spacings( GTK_TABLE( table1 ),9 );
 
+  memcpy(old_gtkEquChannels, gtkEquChannels, sizeof(gtkEquChannels));
+
   A3125adj=GTK_ADJUSTMENT( gtk_adjustment_new( 0,-eqRange,eqRange,0.5,0,0 ) );
   A3125=gtkAddVScale( A3125adj,NULL,-1 );
     gtk_table_attach( GTK_TABLE( table1 ),A3125,0,1,0,1,(GtkAttachOptions)( GTK_FILL ),(GtkAttachOptions)( GTK_EXPAND | GTK_FILL ),0,0 );
@@ -350,6 +371,9 @@ static GtkWidget * CreateEqualizer( void
   A16000=gtkAddVScale( A16000adj,NULL,-1 );
     gtk_table_attach( GTK_TABLE( table1 ),A16000,9,10,0,1,(GtkAttachOptions)( GTK_FILL ),(GtkAttachOptions)( GTK_EXPAND | GTK_FILL ),0,0 );
 
+  Channel = -1;
+  eqSetBands(0);
+
   gtk_table_attach( GTK_TABLE( table1 ),
     gtkAddLabel( _(MSGTR_GUI_Frequency0),NULL ),
     0,1,1,2,(GtkAttachOptions)( GTK_FILL ),(GtkAttachOptions)( 0 ),0,0 );
@@ -508,9 +532,6 @@ void ShowEqualizer( void )
  gtk_widget_set_sensitive(VHue, set);
  gtk_widget_set_sensitive(VSaturation, set);
 
- Channel=-1;
- eqSetBands( 0 );
-
  set = (guiInfo.Playing && gtkEnableAudioEqualizer);
 
  gtk_widget_set_sensitive(ChannelsList, set);


More information about the MPlayer-cvslog mailing list