]> git.sesse.net Git - vlc/blobdiff - modules/gui/macosx/equalizer.m
macosx: Remove unneeded restart.
[vlc] / modules / gui / macosx / equalizer.m
index 367ff0b477a29eb60dec7fb927c471baf6f37b79..52a81efe56f4b902ece419e7cb79afb80806342c 100644 (file)
@@ -99,14 +99,7 @@ static void ChangeFiltersString( intf_thread_t *p_intf,
          }
     }
 
-    var_SetString( p_object, "audio-filter", psz_string );
-    if( p_aout )
-    {
-        for( i = 0; i < p_aout->i_nb_inputs; i++ )
-        {
-            p_aout->pp_inputs[i]->b_restart = true;
-        }
-    }
+    aout_EnableFilter( p_object, psz_string, false);
     
     if( (BOOL)config_GetInt( p_object, "macosx-eq-keep" ) == YES )
     {
@@ -240,23 +233,19 @@ static bool GetFiltersStatus( intf_thread_t *p_intf,
     if( p_object == NULL )
         p_object = (vlc_object_t *)pl_Hold( p_intf );
 
-    char psz_values[102];
-    memset( psz_values, 0, 102 );
-
-    /* Write the new bands values */
-    /* TODO: write a generic code instead of ten times the same thing */
-
-    sprintf( psz_values, "%s %.1f", psz_values, [o_slider_band1 floatValue] );
-    sprintf( psz_values, "%s %.1f", psz_values, [o_slider_band2 floatValue] );
-    sprintf( psz_values, "%s %.1f", psz_values, [o_slider_band3 floatValue] );
-    sprintf( psz_values, "%s %.1f", psz_values, [o_slider_band4 floatValue] );
-    sprintf( psz_values, "%s %.1f", psz_values, [o_slider_band5 floatValue] );
-    sprintf( psz_values, "%s %.1f", psz_values, [o_slider_band6 floatValue] );
-    sprintf( psz_values, "%s %.1f", psz_values, [o_slider_band7 floatValue] );
-    sprintf( psz_values, "%s %.1f", psz_values, [o_slider_band8 floatValue] );
-    sprintf( psz_values, "%s %.1f", psz_values, [o_slider_band9 floatValue] );
-    sprintf( psz_values, "%s %.1f", psz_values, [o_slider_band10 floatValue] );
-
+    const char *psz_values;
+    NSString *preset = [NSString stringWithFormat:@"%.1f", [o_slider_band1 floatValue] ];
+    preset = [preset stringByAppendingFormat:@"%.1f ", [o_slider_band2 floatValue] ];
+    preset = [preset stringByAppendingFormat:@"%.1f ", [o_slider_band3 floatValue] ];
+    preset = [preset stringByAppendingFormat:@"%.1f ", [o_slider_band4 floatValue] ];
+    preset = [preset stringByAppendingFormat:@"%.1f ", [o_slider_band5 floatValue] ];
+    preset = [preset stringByAppendingFormat:@"%.1f ", [o_slider_band6 floatValue] ];
+    preset = [preset stringByAppendingFormat:@"%.1f ", [o_slider_band7 floatValue] ];
+    preset = [preset stringByAppendingFormat:@"%.1f ", [o_slider_band8 floatValue] ];
+    preset = [preset stringByAppendingFormat:@"%.1f ", [o_slider_band9 floatValue] ];
+    preset = [preset stringByAppendingFormat:@"%.1f", [o_slider_band10 floatValue] ];
+
+    psz_values = [preset UTF8String];
     var_SetString( p_object, "equalizer-bands", psz_values );
 
     if( (BOOL)config_GetInt( p_intf, "macosx-eq-keep" ) == YES )
@@ -280,13 +269,15 @@ static bool GetFiltersStatus( intf_thread_t *p_intf,
     if( p_object == NULL )
         p_object = (vlc_object_t *)pl_Hold( p_intf );
 
-    char psz_values[102];
-    memset( psz_values, 0, 102 );
-
     var_SetString( p_object , "equalizer-preset" , preset_list[[sender indexOfSelectedItem]] );
 
+    NSString *preset = @"";
+    const char *psz_values;
     for( i = 0; i < 10; i++ )
-        sprintf( psz_values, "%s %.1f", psz_values, eqz_preset_10b[[sender indexOfSelectedItem]]->f_amp[i] );
+    {
+        preset = [preset stringByAppendingFormat:@"%.1f ", eqz_preset_10b[[sender indexOfSelectedItem]]->f_amp[i] ];
+    }
+    psz_values = [preset UTF8String];
     var_SetString( p_object, "equalizer-bands", psz_values );
     var_SetFloat( p_object, "equalizer-preamp", eqz_preset_10b[[sender indexOfSelectedItem]]->f_preamp);
 
@@ -364,14 +355,6 @@ static bool GetFiltersStatus( intf_thread_t *p_intf,
         p_object = (vlc_object_t *)pl_Hold( p_intf );
 
     var_SetBool( p_object, "equalizer-2pass", b_2p );
-    if( ( [o_ckb_enable state] ) && ( p_aout != NULL ) )
-    {
-        int i;
-        for( i = 0; i < p_aout->i_nb_inputs; i++ )
-        {
-            p_aout->pp_inputs[i]->b_restart = true;
-        }
-    }
 
     if( (BOOL)config_GetInt( p_intf, "macosx-eq-keep" ) == YES )
     {