Skip to content

Commit

Permalink
Add Mute scene option in context menu of scene Volume parameter (#7102)
Browse files Browse the repository at this point in the history
* Add Mute scene option in context menu of scene Volume parameter
  • Loading branch information
mkruselj authored Jul 19, 2023
1 parent 40bb70a commit 3c4c9fc
Show file tree
Hide file tree
Showing 5 changed files with 24 additions and 4 deletions.
1 change: 1 addition & 0 deletions src/common/Parameter.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -339,6 +339,7 @@ bool Parameter::can_deactivate() const
case ct_tape_speed:
case ct_wstype:
case ct_filtertype:
case ct_amplitude_clipper:
return true;
}
return false;
Expand Down
2 changes: 2 additions & 0 deletions src/common/SurgePatch.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -872,6 +872,7 @@ void SurgePatch::init_default_values()
}

scene[sc].volume.val.f = 0.890899f;
scene[sc].volume.deactivated = false;
scene[sc].width.val.f = 1.f; // width

scene[sc].mute_o2.val.b = true;
Expand Down Expand Up @@ -2255,6 +2256,7 @@ void SurgePatch::load_xml(const void *data, int datasize, bool is_preset)
{
scene[sc].level_ring_12.deform_type = 0;
scene[sc].level_ring_23.deform_type = 0;
scene[sc].volume.deactivated = false;
}
}

Expand Down
2 changes: 1 addition & 1 deletion src/common/SurgeStorage.h
Original file line number Diff line number Diff line change
Expand Up @@ -116,7 +116,7 @@ const int FIRoffsetI16 = FIRipolI16_N >> 1;
// 19 -> 20 (XT 1.1 release) added voice envelope mode, but super late so don't break 19
// 20 -> 21 (XT 1.2 nightlies) added absolutable mode for Combulator Offset 1/2 (to match the behavior of Center parameter)
// added oddsound_as_mts_main
// 21 -> 22 (XT 1.3 nighlies) added new ring modulator modes in the mixer, add bonsai distortion effect, changed MIDI mapping behavior
// 21 -> 22 (XT 1.3 nighlies) added new ring modulator modes in the mixer, add bonsai distortion effect, changed MIDI mapping behavior, deactivatable scenes
// clang-format on

const int ff_revision = 22;
Expand Down
9 changes: 9 additions & 0 deletions src/common/SurgeSynthesizer.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -4452,14 +4452,23 @@ void SurgeSynthesizer::process()
}

iter = voices[s].begin();

while (iter != voices[s].end())
{
SurgeVoice *v = *iter;
assert(v);
v->GetQFB(); // save filter state in voices after quad processing is done
iter++;
}

storage.modRoutingMutex.lock();

// mute scene
if (storage.getPatch().scene[s].volume.deactivated)
{
mech::clear_block<BLOCK_SIZE_OS>(sceneout[s][0]);
mech::clear_block<BLOCK_SIZE_OS>(sceneout[s][1]);
}
}

storage.modRoutingMutex.unlock();
Expand Down
14 changes: 11 additions & 3 deletions src/surge-xt/gui/SurgeGUIEditorValueCallbacks.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -947,6 +947,7 @@ int32_t SurgeGUIEditor::controlModifierClicked(Surge::GUI::IComponentTagValue *c
}

bool isGlobal = md < n_global_params;
// TODO: FIX SCENE ASSUMPTION
bool isActiveScene = parameter->scene - 1 == activeScene;

if ((isGlobal || isActiveScene || allScenes) &&
Expand Down Expand Up @@ -2591,15 +2592,22 @@ int32_t SurgeGUIEditor::controlModifierClicked(Surge::GUI::IComponentTagValue *c

bool isChecked = q->deactivated;

if (q->ctrltype == ct_envtime_linkable_delay)
switch (q->ctrltype)
{
case ct_envtime_linkable_delay:
txt = Surge::GUI::toOSCase("Link to Left Channel");
}
else
break;
case ct_amplitude_clipper:
txt = Surge::GUI::toOSCase(
fmt::format("Mute Scene {:c}", 'A' + (p->scene - 1)));
break;
default:
{
isChecked = !isChecked;
txt = Surge::GUI::toOSCase("Enabled");
}
break;
}

contextMenu.addSeparator();

Expand Down

0 comments on commit 3c4c9fc

Please sign in to comment.