Skip to content

Commit 429ca60

Browse files
committed
Merge branch 'internal-merge' into stage-rewrite
2 parents 570d169 + d512266 commit 429ca60

2 files changed

Lines changed: 12 additions & 0 deletions

File tree

source/funkin/backend/system/Flags.hx

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -117,6 +117,7 @@ class Flags {
117117
public static var ICONS_AUTOPOSITION:Bool = true;
118118

119119
@:lazy public static var DEFAULT_SOUND_TIME_SCALED_PITCH:Null<Bool> = null;
120+
@:lazy public static var USE_SOUND_VOLUME_CURVE:Null<Bool> = null;
120121
@:lazy public static var USE_FLXTRAIL_FRAMES:Null<Bool> = null;
121122

122123
public static var SUPPORTED_CHART_RUNTIME_FORMATS:Array<String> = ["Legacy", "Psych Engine"];
@@ -341,6 +342,7 @@ class Flags {
341342
}
342343
}
343344
if (DEFAULT_SOUND_TIME_SCALED_PITCH == null) DEFAULT_SOUND_TIME_SCALED_PITCH = MOD_API_VERSION >= 2;
345+
if (USE_SOUND_VOLUME_CURVE == null) USE_SOUND_VOLUME_CURVE = MOD_API_VERSION >= 2;
344346
if (USE_FLXTRAIL_FRAMES == null) USE_FLXTRAIL_FRAMES = MOD_API_VERSION < 2;
345347

346348
flixel.sound.FlxSound.defaultTimeScaledPitch = cast DEFAULT_SOUND_TIME_SCALED_PITCH;

source/funkin/backend/system/Main.hx

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -138,6 +138,8 @@ class Main extends Sprite
138138
game.focusLostFramerate = 30;
139139
FlxG.fixedTimestep = false;
140140
FlxG.scaleMode = scaleMode = new FunkinRatioScaleMode();
141+
FlxG.sound.applySoundCurve = applySoundCurve;
142+
FlxG.sound.reverseSoundCurve = reverseSoundCurve;
141143

142144
Conductor.init();
143145
EventManager.init();
@@ -162,6 +164,14 @@ class Main extends Sprite
162164
initTransition();
163165
}
164166

167+
public static function applySoundCurve(volume:Float) {
168+
return Flags.USE_SOUND_VOLUME_CURVE ? Math.pow(volume, 1.75) : volume;
169+
}
170+
171+
public static function reverseSoundCurve(curvedVolume:Float) {
172+
return Flags.USE_SOUND_VOLUME_CURVE ? Math.pow(curvedVolume, 0.5714285714285714) : curvedVolume;
173+
}
174+
165175
static var persistShaderKeys:Map<String, Bool>;
166176

167177
public static function refreshAssets() @:privateAccess {

0 commit comments

Comments
 (0)