diff --git a/Project.xml b/Project.xml index 1da29eb65ed..322aafad290 100644 --- a/Project.xml +++ b/Project.xml @@ -87,6 +87,12 @@ + +
+ + +
+ diff --git a/alsoft.txt b/alsoft.txt new file mode 100644 index 00000000000..9e2371dc8fd --- /dev/null +++ b/alsoft.txt @@ -0,0 +1,14 @@ +[general] +sample-type=float32 +stereo-mode=speakers +stereo-encoding=panpot +hrtf=false +cf_level=0 +resampler=fast_bsinc24 +front-stablizer=false +output-limiter=false +volume-adjust=0 +[decoder] +hq-mode=false +distance-comp=false +nfc=false diff --git a/source/Main.hx b/source/Main.hx index b60c1c42aec..79741e7dba3 100644 --- a/source/Main.hx +++ b/source/Main.hx @@ -22,6 +22,10 @@ import states.TitleState; import lime.graphics.Image; #end +#if desktop +import backend.ALSoftConfig; // Just to make sure DCE doesn't remove this, since it's not directly referenced anywhere else. +#end + //crash handler stuff #if CRASH_HANDLER import openfl.events.UncaughtErrorEvent; diff --git a/source/backend/ALSoftConfig.hx b/source/backend/ALSoftConfig.hx new file mode 100644 index 00000000000..2bbdf991596 --- /dev/null +++ b/source/backend/ALSoftConfig.hx @@ -0,0 +1,29 @@ +package backend; + +import haxe.io.Path; + +/* +A class that simply points OpenALSoft to a custom configuration file when the game starts up. + +The config overrides a few global OpenALSoft settings with the aim of improving audio quality on desktop targets. +*/ +@:keep class ALSoftConfig +{ + #if desktop + static function __init__():Void + { + var origin:String = #if hl Sys.getCwd() #else Sys.programPath() #end; + + var configPath:String = Path.directory(Path.withoutExtension(origin)); + #if windows + configPath += "/plugins/alsoft.ini"; + #elseif mac + configPath = Path.directory(configPath) + "/Resources/plugins/alsoft.conf"; + #else + configPath += "/plugins/alsoft.conf"; + #end + + Sys.putEnv("ALSOFT_CONF", configPath); + } + #end +} \ No newline at end of file