Skip to content

Commit

Permalink
SWS/S&M: Toggle selected FX bypass for selected tracks
Browse files Browse the repository at this point in the history
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
  • Loading branch information
kajamr committed Dec 7, 2020
1 parent 4ae1b75 commit b399eb1
Showing 1 changed file with 24 additions and 6 deletions.
30 changes: 24 additions & 6 deletions SnM/SnM_FX.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@
#include "SnM_FX.h"
#include "SnM_Track.h"
#include "SnM_Util.h"
#include "cfillion/cfillion.hpp"


///////////////////////////////////////////////////////////////////////////////
Expand Down Expand Up @@ -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))
Expand Down

0 comments on commit b399eb1

Please sign in to comment.