]> git.sesse.net Git - vlc/blobdiff - modules/gui/macosx/equalizer.m
macosx: merge Eric Dudiak's code from GSoC 2008
[vlc] / modules / gui / macosx / equalizer.m
index 78adadd89f881f6ebf56e8b2f5a47a3ab889a5f7..367ff0b477a29eb60dec7fb927c471baf6f37b79 100644 (file)
@@ -54,7 +54,7 @@ static void ChangeFiltersString( intf_thread_t *p_intf,
     aout_instance_t *p_aout = (aout_instance_t *)p_object;
     if( !p_object )
     {
-        p_object = (vlc_object_t *)pl_Yield( p_intf );
+        p_object = (vlc_object_t *)pl_Hold( p_intf );
     }
 
     psz_string = var_GetNonEmptyString( p_object, "audio-filter" );
@@ -112,9 +112,6 @@ static void ChangeFiltersString( intf_thread_t *p_intf,
     {
         /* save changed to config */
         config_PutPsz( p_object, "audio-filter", psz_string );
-
-        /* save to vlcrc */
-        config_SaveConfigFile( p_object, "main" );
     }
     
     free( psz_string );
@@ -128,7 +125,7 @@ static bool GetFiltersStatus( intf_thread_t *p_intf,
     vlc_object_t *p_object = vlc_object_find( p_intf,
                                 VLC_OBJECT_AOUT, FIND_ANYWHERE );
     if( p_object == NULL )
-        p_object = (vlc_object_t *)pl_Yield( p_intf );
+        p_object = (vlc_object_t *)pl_Hold( p_intf );
 
     if( (BOOL)config_GetInt( p_intf, "macosx-eq-keep" ) == YES )
         psz_string = config_GetPsz( p_intf, "audio-filter" );
@@ -154,6 +151,7 @@ static bool GetFiltersStatus( intf_thread_t *p_intf,
 {
     int i;
     [o_btn_equalizer setToolTip: _NS("Equalizer")];
+    [o_btn_equalizer_embedded setToolTip: _NS("Equalizer")];
     [o_ckb_2pass setTitle: _NS("2 Pass")];
     [o_ckb_2pass setToolTip: _NS("Apply the "
         "equalizer filter twice. The effect will be sharper.")];
@@ -184,7 +182,7 @@ static bool GetFiltersStatus( intf_thread_t *p_intf,
                                               VLC_OBJECT_AOUT, FIND_ANYWHERE );
 
     if( p_object == NULL )
-        p_object = (vlc_object_t *)pl_Yield( p_intf );
+        p_object = (vlc_object_t *)pl_Hold( p_intf );
 
     var_Create( p_object, "equalizer-preamp", VLC_VAR_FLOAT |
                 VLC_VAR_DOINHERIT );
@@ -218,11 +216,7 @@ static bool GetFiltersStatus( intf_thread_t *p_intf,
     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 */
@@ -244,7 +238,7 @@ static bool GetFiltersStatus( intf_thread_t *p_intf,
                                               VLC_OBJECT_AOUT, FIND_ANYWHERE );
 
     if( p_object == NULL )
-        p_object = (vlc_object_t *)pl_Yield( p_intf );
+        p_object = (vlc_object_t *)pl_Hold( p_intf );
 
     char psz_values[102];
     memset( psz_values, 0, 102 );
@@ -284,7 +278,7 @@ static bool GetFiltersStatus( intf_thread_t *p_intf,
     vlc_object_t *p_object= vlc_object_find( p_intf,
                                              VLC_OBJECT_AOUT, FIND_ANYWHERE );
     if( p_object == NULL )
-        p_object = (vlc_object_t *)pl_Yield( p_intf );
+        p_object = (vlc_object_t *)pl_Hold( p_intf );
 
     char psz_values[102];
     memset( psz_values, 0, 102 );
@@ -327,7 +321,7 @@ static bool GetFiltersStatus( intf_thread_t *p_intf,
     vlc_object_t *p_object = vlc_object_find( p_intf,
                                               VLC_OBJECT_AOUT, FIND_ANYWHERE );
     if( p_object == NULL )
-        p_object = (vlc_object_t *)pl_Yield( p_intf );
+        p_object = (vlc_object_t *)pl_Hold( p_intf );
 
     var_SetFloat( p_object, "equalizer-preamp", f_preamp );
 
@@ -349,11 +343,13 @@ static bool GetFiltersStatus( intf_thread_t *p_intf,
     {
         [o_window orderOut:sender];
         [o_btn_equalizer setState:NSOffState];
+        [o_btn_equalizer_embedded setState:NSOffState];
     }
     else
     {
         [o_window makeKeyAndOrderFront:sender];
         [o_btn_equalizer setState:NSOnState];
+        [o_btn_equalizer_embedded setState:NSOnState];
     }
 }
 
@@ -365,7 +361,7 @@ static bool GetFiltersStatus( intf_thread_t *p_intf,
                                              VLC_OBJECT_AOUT, FIND_ANYWHERE );
     aout_instance_t *p_aout = (aout_instance_t *)p_object;
     if( p_object == NULL )
-        p_object = (vlc_object_t *)pl_Yield( 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 ) )
@@ -400,7 +396,7 @@ static bool GetFiltersStatus( intf_thread_t *p_intf,
     vlc_object_t *p_object= vlc_object_find( VLCIntf,
                                              VLC_OBJECT_AOUT, FIND_ANYWHERE );
     if( p_object == NULL )
-        p_object = (vlc_object_t *)pl_Yield( VLCIntf );
+        p_object = (vlc_object_t *)pl_Hold( VLCIntf );
 
     [o_window setExcludedFromWindowsMenu: TRUE];
 
@@ -460,7 +456,7 @@ static bool GetFiltersStatus( intf_thread_t *p_intf,
 }
 
 
-- (id)getSliderByIndex:(int)index
+- (id)sliderByIndex:(int)index
 {
     switch(index)
     {
@@ -498,7 +494,7 @@ static bool GetFiltersStatus( intf_thread_t *p_intf,
 
 - (void)setValue:(float)value forSlider:(int)index
 {
-    id slider = [self getSliderByIndex:index];
+    id slider = [self sliderByIndex:index];
 
     if (slider != nil)
     {