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
Iterate through effects on selected tracks and toggle
the enabled state.

Fixes reaper-oss#1443
  • Loading branch information
kajamr committed Nov 3, 2020
1 parent 4ae1b75 commit b903699
Showing 1 changed file with 17 additions and 6 deletions.
23 changes: 17 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,24 @@ 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 chain 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;
}
}
}
break;
case 3: // set
if (fxId < fxcnt && _val != TrackFX_GetEnabled(tr, fxId))
Expand Down

0 comments on commit b903699

Please sign in to comment.