The setup you're currently using is meant to allow players to completely disable audio. It is not meant to be a means of muting the audio.
With the above caveat in mind, you could reshow the current passage using SugarCube's built in Engine.show() method. For example, change the setting to look like the following:
var audioEnabledOnInit = function () {
if (!settings.audioEnabled) { // is false
/*
Stops all audio currently playing, via <<audio>> or <<playlist>>,
when the setting is disabled.
*/
new Wikifier(null, "<<masteraudio stop>>");
}
};
var audioEnabledOnChange = function () {
/*
We call the onInit handler here to avoid duplicating its code.
*/
audioEnabledOnInit();
if (settings.audioEnabled) { // is true
/*
Reshows the current passage, thus allowing audio to begin playing
again, when the setting is enabled.
*/
Engine.show();
}
};
Setting.addToggle("audioEnabled", {
label : "Enable audio? - Activer l'audio?",
default : true,
onInit : audioEnabledOnInit,
onChange : audioEnabledOnChange
});
That will, upon changing the setting to enable audio again, reshow the current passage, allowing any audio macro invocations within the passage to execute as normal. NOTE: Any interactive elements within the passage will be reset as a result of reshowing the passage.
Additionally. As either an alternative or a companion to the above setting, you could provide a button to toggle the mute state of the master audio. For example, you could add something like the following to the StoryMenu special passage—it could also be turned into a setting if desired:
<<link "Toggle Audio">>
<<if setup.muteAudio>>
<<masteraudio unmute>>
<<set setup.muteAudio to false>>
<<else>>
<<masteraudio mute>>
<<set setup.muteAudio to true>>
<</if>>
<</link>>
That will (un)mute the master audio.