From b399eb15f7b662dbb8dfc167c74e622ae863ec56 Mon Sep 17 00:00:00 2001 From: Joe Meadows Date: Tue, 3 Nov 2020 12:45:06 -0800 Subject: [PATCH] SWS/S&M: Toggle selected FX bypass for selected tracks For each selected track, if the effects window is open then iterate through effects and toggle the enabled state. Fall back to previous behavior if the effects window for the track is not opened, i.e. toggle the current fx index for the track. Fixes #1443 --- SnM/SnM_FX.cpp | 30 ++++++++++++++++++++++++------ 1 file changed, 24 insertions(+), 6 deletions(-) diff --git a/SnM/SnM_FX.cpp b/SnM/SnM_FX.cpp index 157668a7b..3c2ef58b9 100644 --- a/SnM/SnM_FX.cpp +++ b/SnM/SnM_FX.cpp @@ -31,6 +31,7 @@ #include "SnM_FX.h" #include "SnM_Track.h" #include "SnM_Util.h" +#include "cfillion/cfillion.hpp" /////////////////////////////////////////////////////////////////////////////// @@ -101,14 +102,31 @@ bool SetOrToggleFXBypassSelTracks(const char* _undoMsg, int _mode, int _fxCmdId, } } break; - case 2: // toggle - if (fxId < fxcnt) + case 2: // toggle selected fx + { + // Get handle to FX window for this track + HWND fxChain = CF_GetTrackFXChain(tr); + if(fxChain) { - if (_undoMsg && !updated) - Undo_BeginBlock2(NULL); - TrackFX_SetEnabled(tr, fxId, !TrackFX_GetEnabled(tr, fxId)); - updated = true; + int index=-1; + // enumerate selected FX + while( (index = CF_EnumSelectedFX(fxChain, index)) >= 0) + { + if (_undoMsg && !updated) + Undo_BeginBlock2(NULL); + // toggle enabled state + TrackFX_SetEnabled(tr, index, !TrackFX_GetEnabled(tr, index)); + updated = true; + } } + else if(fxId < fxcnt) + { + if (_undoMsg && !updated) + Undo_BeginBlock2(NULL); + TrackFX_SetEnabled(tr, fxId, !TrackFX_GetEnabled(tr, fxId)); + updated = true; + } + } break; case 3: // set if (fxId < fxcnt && _val != TrackFX_GetEnabled(tr, fxId))