@@ -4116,7 +4116,11 @@ bool TV::ToggleHandleAction(PlayerContext *ctx,
41164116 else if (has_action (" TOGGLEAUDIOSYNC" , actions))
41174117 ChangeAudioSync (ctx, 0 ); // just display
41184118 else if (has_action (ACTION_TOGGLEVISUALISATION, actions))
4119- ToggleVisualisation (ctx);
4119+ EnableVisualisation (ctx, false , true /* toggle*/ );
4120+ else if (has_action (ACTION_ENABLEVISUALISATION, actions))
4121+ EnableVisualisation (ctx, true );
4122+ else if (has_action (ACTION_DISABLEVISUALISATION, actions))
4123+ EnableVisualisation (ctx, false );
41204124 else if (has_action (" TOGGLEPICCONTROLS" , actions))
41214125 DoTogglePictureAttribute (ctx, kAdjustingPicture_Playback );
41224126 else if (has_action (ACTION_TOGGLESTUDIOLEVELS, actions))
@@ -4162,12 +4166,15 @@ bool TV::ToggleHandleAction(PlayerContext *ctx,
41624166 return handled;
41634167}
41644168
4165- void TV::ToggleVisualisation (const PlayerContext *ctx)
4169+ void TV::EnableVisualisation (const PlayerContext *ctx, bool enable, bool toggle )
41664170{
41674171 ctx->LockDeletePlayer (__FILE__, __LINE__);
41684172 if (ctx->player && ctx->player ->CanVisualise ())
41694173 {
4170- bool on = ctx->player ->ToggleVisualisation ();
4174+ bool want = enable;
4175+ if (toggle)
4176+ want = !ctx->player ->IsVisualising ();
4177+ bool on = ctx->player ->EnableVisualisation (want);
41714178 SetOSDMessage (ctx, on ? tr (" Visualisation On" ) :
41724179 tr (" Visualisation Off" ));
41734180 }
@@ -9632,7 +9639,11 @@ void TV::OSDDialogEvent(int result, QString text, QString action)
96329639 else if (action.left (15 ) == " TOGGLEAUDIOSYNC" )
96339640 ChangeAudioSync (actx, 0 );
96349641 else if (action == ACTION_TOGGLEVISUALISATION)
9635- ToggleVisualisation (actx);
9642+ EnableVisualisation (actx, false , true /* toggle*/ );
9643+ else if (action == ACTION_ENABLEVISUALISATION)
9644+ EnableVisualisation (actx, true );
9645+ else if (action == ACTION_DISABLEVISUALISATION)
9646+ EnableVisualisation (actx, false );
96369647 else if (action.left (11 ) == ACTION_TOGGLESLEEP)
96379648 {
96389649 ToggleSleepTimer (actx, action.left (13 ));
@@ -9897,10 +9908,12 @@ void TV::FillOSDMenuAudio(const PlayerContext *ctx, OSD *osd,
98979908 uint curtrack = ~0 ;
98989909 bool avsync = true ;
98999910 bool visual = false ;
9911+ bool active = false ;
99009912 ctx->LockDeletePlayer (__FILE__, __LINE__);
99019913 if (ctx->player )
99029914 {
99039915 visual = ctx->player ->CanVisualise ();
9916+ active = ctx->player ->IsVisualising ();
99049917 tracks = ctx->player ->GetTracks (kTrackTypeAudio );
99059918 if (!tracks.empty ())
99069919 curtrack = (uint) ctx->player ->GetTrack (kTrackTypeAudio );
@@ -9928,13 +9941,18 @@ void TV::FillOSDMenuAudio(const PlayerContext *ctx, OSD *osd,
99289941 " DIALOG_MENU_AUDIOTRACKS_0" , true ,
99299942 selected == " AUDIOTRACKS" );
99309943 }
9931- if (visual)
9932- {
9933- osd->DialogAddButton (tr (" Toggle Visualisation" ),
9934- ACTION_TOGGLEVISUALISATION);
9935- }
99369944 if (avsync)
99379945 osd->DialogAddButton (tr (" Adjust Audio Sync" ), " TOGGLEAUDIOSYNC" );
9946+ if (visual && !active)
9947+ {
9948+ osd->DialogAddButton (tr (" Enable Visualisation" ),
9949+ ACTION_ENABLEVISUALISATION);
9950+ }
9951+ if (visual && active)
9952+ {
9953+ osd->DialogAddButton (tr (" Disable Visualisation" ),
9954+ ACTION_DISABLEVISUALISATION);
9955+ }
99389956 osd->DialogAddButton (tr (" Toggle Audio Upmixer" ), ACTION_TOGGLEUPMIX);
99399957 }
99409958 else if (category == " AUDIOTRACKS" )
0 commit comments