+- (void)initStrings
+{
+ int i;
+ [o_btn_equalizer setToolTip: _NS("Equalizer")];
+ [o_ckb_2pass setTitle: _NS("2 Pass")];
+ [o_ckb_2pass setToolTip: _NS("If you enable this settting, the "
+ "equalizer filter will be applied twice. The effect will be sharper.")];
+ [o_ckb_enable setTitle: _NS("Enable")];
+ [o_ckb_enable setToolTip: _NS("Enable the equalizer. You can either "
+ "manually change the bands or use a preset.")];
+ [o_fld_preamp setStringValue: _NS("Preamp")];
+
+ [o_popup_presets removeAllItems];
+ for( i = 0; i < 18 ; i++ )
+ {
+ [o_popup_presets insertItemWithTitle: _NS(preset_list_text[i]) atIndex: i];
+ }
+ [o_window setTitle: _NS("Equalizer")];
+
+ /*
+ [o_slider_band1 setFloatValue: 0];
+ [o_slider_band2 setFloatValue: 0];
+ [o_slider_band3 setFloatValue: 0];
+ [o_slider_band4 setFloatValue: 0];
+ [o_slider_band5 setFloatValue: 0];
+ [o_slider_band6 setFloatValue: 0];
+ [o_slider_band7 setFloatValue: 0];
+ [o_slider_band8 setFloatValue: 0];
+ [o_slider_band9 setFloatValue: 0];
+ [o_slider_band10 setFloatValue: 0];
+ */
+ [self initBandSliders];
+ [o_ckb_enable setState: NSOffState];
+ [o_ckb_2pass setState: NSOffState];
+}
+
+- (void)equalizerUpdated
+{
+ intf_thread_t *p_intf = VLCIntf;
+ float f_preamp, f_band[10];
+ char *psz_bands, *psz_bands_init, *p_next;
+ vlc_bool_t b_2p;
+ int i;
+ vlc_bool_t b_enabled = GetFiltersStatus( p_intf, "equalizer" );
+ vlc_object_t *p_object = vlc_object_find( p_intf,
+ VLC_OBJECT_AOUT, FIND_ANYWHERE );
+
+ if( p_object == NULL )
+ p_object = vlc_object_find( p_intf,
+ VLC_OBJECT_PLAYLIST, FIND_ANYWHERE );
+ if( p_object == NULL )
+ return;
+
+ var_Create( p_object, "equalizer-preamp", VLC_VAR_FLOAT |
+ VLC_VAR_DOINHERIT );
+ var_Create( p_object, "equalizer-bands", VLC_VAR_STRING |
+ VLC_VAR_DOINHERIT );
+
+ f_preamp = var_GetFloat( p_object, "equalizer-preamp" );
+ psz_bands = var_GetString( p_object, "equalizer-bands" );
+
+ if( !strcmp( psz_bands, "" ) )
+ psz_bands = strdup( "0 0 0 0 0 0 0 0 0 0" );
+
+ b_2p = var_GetBool( p_object, "equalizer-2pass" );
+
+ vlc_object_release( p_object );
+
+/* Set the preamp slider */
+ [o_slider_preamp setFloatValue: f_preamp];
+
+/* Set the bands slider */
+ psz_bands_init = psz_bands;
+
+ for( i = 0; i < 10; i++ )
+ {
+ /* Read dB -20/20 */
+#ifdef HAVE_STRTOF
+ f_band[i] = strtof( psz_bands, &p_next );
+#else
+ f_band[i] = (float)strtod( psz_bands, &p_next );
+#endif
+ if( !p_next || p_next == psz_bands ) break; /* strtof() failed */
+
+ if( !*psz_bands ) break; /* end of line */
+ psz_bands = p_next+1;
+ }
+ free( psz_bands_init );
+ [self setBandSlidersValues:f_band];
+
+ /*
+ [o_slider_band1 setFloatValue: f_band[0]];
+ [o_slider_band2 setFloatValue: f_band[1]];
+ [o_slider_band3 setFloatValue: f_band[2]];
+ [o_slider_band4 setFloatValue: f_band[3]];
+ [o_slider_band5 setFloatValue: f_band[4]];
+ [o_slider_band6 setFloatValue: f_band[5]];
+ [o_slider_band7 setFloatValue: f_band[6]];
+ [o_slider_band8 setFloatValue: f_band[7]];
+ [o_slider_band9 setFloatValue: f_band[8]];
+ [o_slider_band10 setFloatValue: f_band[9]];
+ */
+
+/* Set the the checkboxes */
+ if( b_enabled == VLC_TRUE )
+ [o_ckb_enable setState:NSOnState];
+ else
+ [o_ckb_enable setState:NSOffState];
+
+ [o_ckb_2pass setState:( ( b_2p == VLC_TRUE ) ? NSOnState : NSOffState )];
+}
+