From: fgsfds Date: Wed, 4 Sep 2019 16:19:10 +0000 (+0300) Subject: Sound: OpenAL: Add module interp setting X-Git-Url: http://deadsoftware.ru/gitweb?a=commitdiff_plain;h=239ffbfb8dc7197102e6dd1ad094d00636960c4f;p=d2df-sdl.git Sound: OpenAL: Add module interp setting --- diff --git a/src/engine/e_soundfile_modplug.pas b/src/engine/e_soundfile_modplug.pas index 9f74a16..b68487d 100644 --- a/src/engine/e_soundfile_modplug.pas +++ b/src/engine/e_soundfile_modplug.pas @@ -90,7 +90,12 @@ end; function TModPlugLoaderFactory.GetLoader(): TSoundLoader; begin - ModPlug_SetSettings(@Settings); // update settings just in case + // update interpolation setting + if e_MusicLerp then + Settings.mResamplingMode := MODPLUG_RESAMPLE_LINEAR + else + Settings.mResamplingMode := MODPLUG_RESAMPLE_NEAREST; + ModPlug_SetSettings(@Settings); Result := TModPlugLoader.Create(); end; diff --git a/src/engine/e_soundfile_xmp.pas b/src/engine/e_soundfile_xmp.pas index afbadf3..d3e4da5 100644 --- a/src/engine/e_soundfile_xmp.pas +++ b/src/engine/e_soundfile_xmp.pas @@ -89,6 +89,7 @@ end; function TXMPLoader.Load(Data: Pointer; Len: LongWord; SStreaming: Boolean): Boolean; var Err: LongInt; + Interp: LongInt; begin Result := False; @@ -104,6 +105,10 @@ begin if xmp_start_player(FXMP, 48000, 0) <> 0 then raise Exception.Create('xmp_start_player failed'); + if e_MusicLerp then Interp := XMP_INTERP_LINEAR + else Interp := XMP_INTERP_NEAREST; + xmp_set_player(FXMP, XMP_PLAYER_INTERP, Interp); + FFormat.SampleRate := 48000; FFormat.SampleBits := 16; FFormat.Channels := 2; @@ -125,6 +130,7 @@ end; function TXMPLoader.Load(FName: string; SStreaming: Boolean): Boolean; var Err: LongInt; + Interp: LongInt; begin Result := False; @@ -140,6 +146,10 @@ begin if xmp_start_player(FXMP, 48000, 0) <> 0 then raise Exception.Create('xmp_start_player failed'); + if e_MusicLerp then Interp := XMP_INTERP_LINEAR + else Interp := XMP_INTERP_NEAREST; + xmp_set_player(FXMP, XMP_PLAYER_INTERP, Interp); + FFormat.SampleRate := 48000; FFormat.SampleBits := 16; FFormat.Channels := 2; diff --git a/src/game/g_sound.pas b/src/game/g_sound.pas index 20ae02e..0c18c60 100644 --- a/src/game/g_sound.pas +++ b/src/game/g_sound.pas @@ -636,9 +636,8 @@ end; {$IFDEF USE_OPENAL} initialization - {$IF DEFINED(USE_FLUIDSYNTH)} conRegVar('s_midi_soundfont', @e_SoundFont, 'soundfont to use for midi playback', 'midi soundfont'); - {$ENDIF} + conRegVar('s_mod_lerp', @e_MusicLerp, 'interpolate module playback', 'module interpolation'); {$ENDIF} end.