Skip to content
This repository has been archived by the owner on Jan 4, 2023. It is now read-only.

Commit

Permalink
Fixes for issue #290.
Browse files Browse the repository at this point in the history
  • Loading branch information
jessefreeman committed May 27, 2020
1 parent fc3b339 commit 9b2e678
Show file tree
Hide file tree
Showing 3 changed files with 28 additions and 19 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -57,14 +57,10 @@ end

if(self.lastMuteValue ~= newMuteValue) then
self.lastMuteValue = newMuteValue
-- editorUI:Enable(self.volumeKnobData, not self.lastMuteValue)
-- editorUI:ToggleButton(muteBtnData, lastMuteValue, false)
editorUI:ChangeKnob(self.volumeKnobData, Volume() / 100, false)
editorUI:ChangeKnob(self.volumeKnobData, Volume() / 100, true)
pixelVisionOS.titleBar.muteInvalid = true
end



local newCRTValue = EnableCRT()

if(self.lastCRTValue ~= newCRTValue) then
Expand Down
39 changes: 26 additions & 13 deletions SDK/Runner/GameRunner.cs
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,7 @@ public enum RunnerMode

private static bool _mute;
private static int lastVolume;
private static int muteVoldume;
private static int muteVolume;

public readonly Dictionary<InputMap, int> defaultKeys = new Dictionary<InputMap, int>
{
Expand Down Expand Up @@ -197,33 +197,46 @@ protected virtual bool RunnerActive

public virtual int Volume(int? value = null)
{
if (value.HasValue) lastVolume = value.Value;
if (value.HasValue)
lastVolume = value.Value;

SoundEffect.MasterVolume = lastVolume / 100f;

if (_mute == true && lastVolume > 0)
{
muteVolume = lastVolume;
}

return lastVolume;
}

public virtual bool Mute(bool? value = null)
{
if (value.HasValue)
if (_mute != value)
{
_mute = value.Value;
{
// if (_mute != value)
// {
_mute = value.Value;

if (_mute)
{
muteVoldume = lastVolume;
if (_mute)
{
muteVolume = lastVolume;

Volume(0);
}
else
Volume(0);
}
else
{
// Restore volume to halfway if un-muting and last value was 0
if (muteVolume < 5)
{
Volume(muteVoldume);
muteVolume = 50;
}
Volume(muteVolume);
}
// }
}

return _mute;
return SoundEffect.MasterVolume == 0 || _mute;
}


Expand Down
2 changes: 1 addition & 1 deletion UnitTests/Tests/ColorChipTest.cs
Original file line number Diff line number Diff line change
Expand Up @@ -199,7 +199,7 @@ public void BGDefaultValueTest()

if (LoadColorChip())
{
Assert.AreEqual(colorChip.backgroundColor, 1);
Assert.AreEqual(colorChip.backgroundColor, 0);
}
else
{
Expand Down

0 comments on commit 9b2e678

Please sign in to comment.