From 90dabd0261ce580efb8bfe078eb3717673cea8ea Mon Sep 17 00:00:00 2001 From: pontscho Date: Tue, 2 Jul 2002 13:35:04 +0000 Subject: fix volume handling ( step 2 ) -- add balance support and some code cleanup and fix git-svn-id: svn://svn.mplayerhq.hu/mplayer/trunk@6620 b3059339-0415-0410-9bf9-f77b7e298cf2 --- Gui/interface.c | 35 +++++++++++++++++++++++++++++++++-- 1 file changed, 33 insertions(+), 2 deletions(-) (limited to 'Gui/interface.c') diff --git a/Gui/interface.c b/Gui/interface.c index 84f6967f38..7e473a59c9 100644 --- a/Gui/interface.c +++ b/Gui/interface.c @@ -7,6 +7,7 @@ #include "ws.h" #include "mplayer/play.h" #include "interface.h" +#include "skin/skin.h" #include "../mplayer.h" #include "mplayer/widgets.h" @@ -15,6 +16,7 @@ #include "../libvo/x11_common.h" #include "../libvo/video_out.h" #include "../input/input.h" +#include "../libao2/audio_out.h" #include #include @@ -65,12 +67,15 @@ typedef struct int disp_w,disp_h; } tmp_sh_video_t; +extern ao_functions_t * audio_out; + void guiGetEvent( int type,char * arg ) { stream_t * stream = (stream_t *) arg; #ifdef USE_DVDREAD dvd_priv_t * dvdp = (dvd_priv_t *) arg; #endif + switch ( type ) { case guiXEvent: @@ -172,12 +177,38 @@ void guiGetEvent( int type,char * arg ) if ( (unsigned int)arg & guiVCD ) guiIntfStruct.VCDTracks=0; #endif break; + case guiReDraw: +// if ( audio_out ) +// { +// float l,r; + // mixer_getvolume( &l,&r ); +// guiIntfStruct.Volume=(r>l?r:l); +// printf( "!!! guiIntfStruct.Volume: %.2f \n",guiIntfStruct.Volume ); +// } + mplEventHandling( evRedraw,0 ); + break; + case guiSetVolume: + if ( audio_out ) + { + float l,r; + mixer_getvolume( &l,&r ); + guiIntfStruct.Volume=(r>l?r:l); + if ( r != l ) guiIntfStruct.Balance=( ( r - l ) + 100 ) * 0.5f; + else guiIntfStruct.Balance=0.0f; + btnModify( evSetVolume,guiIntfStruct.Volume ); + btnModify( evSetBalance,guiIntfStruct.Balance ); + } + break; } } +extern unsigned int GetTimerMS( void ); +extern int mplTimer; + void guiEventHandling( void ) { - if ( ( use_gui && !guiIntfStruct.Playing )||( guiIntfStruct.AudioOnly ) ) wsHandleEvents(); + if ( !guiIntfStruct.Playing || guiIntfStruct.AudioOnly ) wsHandleEvents(); gtkEventHandling(); - mplTimerHandler(); // handle GUI timer events + mplTimer=GetTimerMS() / 20; +// if ( !( GetTimerMS()%2 ) ) } -- cgit v1.2.3