Remove support for >100% audio since it didn't actually boost the gain.

This commit is contained in:
EliteMasterEric 2024-02-20 13:37:53 -05:00
parent db428a3e36
commit d888fb860d
2 changed files with 2 additions and 17 deletions

View file

@ -23,7 +23,7 @@ import openfl.utils.AssetType;
@:nullSafety
class FunkinSound extends FlxSound implements ICloneable<FunkinSound>
{
static final MAX_VOLUME:Float = 2.0;
static final MAX_VOLUME:Float = 1.0;
static var cache(default, null):FlxTypedGroup<FunkinSound> = new FlxTypedGroup<FunkinSound>();
@ -40,7 +40,6 @@ class FunkinSound extends FlxSound implements ICloneable<FunkinSound>
override function set_volume(value:Float):Float
{
// Uncap the volume.
fixMaxVolume();
_volume = FlxMath.bound(value, 0.0, MAX_VOLUME);
updateTransform();
return _volume;
@ -126,18 +125,6 @@ class FunkinSound extends FlxSound implements ICloneable<FunkinSound>
return this;
}
function fixMaxVolume():Void
{
return;
#if lime_openal
// This code is pretty fragile, it reaches through 5 layers of private access.
@:privateAccess
var handle = this?._channel?.__source?.__backend?.handle;
if (handle == null) return;
lime.media.openal.AL.sourcef(handle, lime.media.openal.AL.MAX_GAIN, MAX_VOLUME);
#end
}
public override function play(forceRestart:Bool = false, startTime:Float = 0, ?endTime:Float):FunkinSound
{
if (!exists) return this;

View file

@ -299,16 +299,14 @@ class ChartEditorAudioHandler
*/
public static function playSound(_state:ChartEditorState, path:String, volume:Float = 1.0):Void
{
var snd:FlxSound = FlxG.sound.list.recycle(FlxSound) ?? new FlxSound();
var asset:Null<FlxSoundAsset> = FlxG.sound.cache(path);
if (asset == null)
{
trace('WARN: Failed to play sound $path, asset not found.');
return;
}
snd.loadEmbedded(asset);
var snd:FunkinSound = FunkinSound.load(asset);
snd.autoDestroy = true;
FlxG.sound.list.add(snd);
snd.play(true);
snd.volume = volume;
}