Skip to content

Commit 6cc1cfe

Browse files
committed
changes
1 parent 29e14e5 commit 6cc1cfe

File tree

4 files changed

+5
-60
lines changed

4 files changed

+5
-60
lines changed

source/funkin/InitState.hx

Lines changed: 4 additions & 35 deletions
Original file line numberDiff line numberDiff line change
@@ -44,10 +44,6 @@ import funkin.api.discord.DiscordClient;
4444
#if FEATURE_NEWGROUNDS
4545
import funkin.api.newgrounds.NewgroundsClient;
4646
#end
47-
#if FEATURE_LOST_FOCUS_VOLUME
48-
import flixel.tweens.FlxTween;
49-
import flixel.tweens.FlxEase;
50-
#end
5147

5248
/**
5349
* A core class which performs initialization of the game.
@@ -297,45 +293,18 @@ class InitState extends FlxState
297293

298294
#if FEATURE_LOST_FOCUS_VOLUME
299295
@:noCompletion var _lastFocusVolume:Null<Float>;
300-
@:noCompletion var _lostFocusVolumeTween:Null<FlxTween>;
301296

302297
function onLostFocus()
303298
{
304-
if (FlxG.sound.muted || FlxG.sound.volume == 0 || Preferences.lostVolumeFocusMode == "Off" || FlxG.autoPause) return;
305-
_lostFocusVolumeTween?.cancel();
299+
if (FlxG.sound.muted || FlxG.sound.volume == 0 || FlxG.autoPause) return;
306300
_lastFocusVolume = FlxG.sound.volume;
307-
308-
if (Preferences.lostVolumeFocusMode == "Instant")
309-
{
310-
FlxG.sound.volume *= Constants.LOST_FOCUS_VOLUME_MULTIPLIER;
311-
}
312-
else if (Preferences.lostVolumeFocusMode == "Delayed")
313-
{
314-
_lostFocusVolumeTween = FlxTween.num(FlxG.sound.volume, FlxG.sound.volume * Constants.LOST_FOCUS_VOLUME_MULTIPLIER, Constants.LOST_FOCUS_VOLUME_DURATION,
315-
{
316-
startDelay: Constants.LOST_FOCUS_VOLUME_DELAY,
317-
ease: FlxEase.smootherStepOut
318-
}, (volume:Float) -> FlxG.sound.volume = volume);
319-
}
301+
FlxG.sound.volume *= Constants.LOST_FOCUS_VOLUME_MULTIPLIER;
320302
}
321303

322304
function onGainFocus()
323305
{
324-
if (FlxG.sound.muted || Preferences.lostVolumeFocusMode == "Off" || FlxG.autoPause) return;
325-
_lostFocusVolumeTween?.cancel();
326-
327-
if (_lastFocusVolume != null)
328-
{
329-
if (Preferences.lostVolumeFocusMode == "Instant")
330-
{
331-
FlxG.sound.volume = _lastFocusVolume;
332-
}
333-
else if (Preferences.lostVolumeFocusMode == "Delayed")
334-
{
335-
_lostFocusVolumeTween = FlxTween.num(FlxG.sound.volume, _lastFocusVolume, Math.max(0.15, FlxG.sound.volume / _lastFocusVolume * .5),
336-
{ease: FlxEase.smootherStepInOut}, (volume:Float) -> FlxG.sound.volume = volume);
337-
}
338-
}
306+
if (FlxG.sound.muted || FlxG.autoPause) return;
307+
if (_lastFocusVolume != null) FlxG.sound.volume = _lastFocusVolume;
339308
}
340309
#end
341310

source/funkin/save/Save.hx

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -127,7 +127,6 @@ class Save implements ConsoleClass
127127
hapticsMode: 'All',
128128
hapticsIntensityMultiplier: 1,
129129
autoPause: true,
130-
lostVolumeFocusMode: "Delayed",
131130
videoSubtitles: true,
132131
vsyncMode: 'Off',
133132
strumlineBackgroundOpacity: 0,
@@ -1637,12 +1636,6 @@ typedef SaveDataOptions =
16371636
*/
16381637
var autoPause:Bool;
16391638

1640-
/**
1641-
* How game should react with volume to losing application focus.
1642-
* @default `Delayed`
1643-
*/
1644-
var lostVolumeFocusMode:String;
1645-
16461639
/**
16471640
* If enabled, subtitles will be shown on video cutscenes.
16481641
* @default `true`

source/funkin/ui/options/PreferencesMenu.hx

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -160,13 +160,6 @@ class PreferencesMenu extends Page<OptionsState.OptionsMenuPageName>
160160
Preferences.debugDisplay = value;
161161
}, Preferences.debugDisplay);
162162

163-
#if FEATURE_LOST_FOCUS_VOLUME
164-
createPrefItemEnum('Focus Volume Mode', 'If enabled, game will reduce its volume when unfocused.',
165-
["Delayed" => "Delayed", "Instant" => "Instant", "Off" => "Off"], (key:String, value:String) -> {
166-
Preferences.lostVolumeFocusMode = value;
167-
}, Preferences.lostVolumeFocusMode);
168-
#end
169-
170163
createPrefItemPercentage('Debug Display BG', "Change debug display's background opacity", function(value:Int):Void {
171164
Preferences.debugDisplayBGOpacity = value;
172165
}, Preferences.debugDisplayBGOpacity);

source/funkin/util/Constants.hx

Lines changed: 1 addition & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -574,17 +574,7 @@ class Constants
574574
/**
575575
* How much volume should be reduced on Application Focus Lost.
576576
*/
577-
public static final LOST_FOCUS_VOLUME_MULTIPLIER:Float = 0.1;
578-
579-
/**
580-
* Duration, in seconds, how long should volume reduce.
581-
*/
582-
public static final LOST_FOCUS_VOLUME_DURATION:Float = 0.85;
583-
584-
/**
585-
* Delay how long should game wait before fading volume with `Delayed` volume fade option.
586-
*/
587-
public static final LOST_FOCUS_VOLUME_DELAY:Float = 0.15;
577+
public static final LOST_FOCUS_VOLUME_MULTIPLIER:Float = 0.5;
588578
#end
589579

590580
/**

0 commit comments

Comments
 (0)