From: fgsfds Date: Mon, 2 Sep 2019 18:29:30 +0000 (+0300) Subject: Sound: OpenAL: Expose some vars; X-Git-Url: http://deadsoftware.ru/gitweb?p=d2df-sdl.git;a=commitdiff_plain;h=f9175c385c9c366ac5e3b2123b13e5c150d8cb1e Sound: OpenAL: Expose some vars; use 1 for fluid cpu-cores; disable reverb and chorus by default --- diff --git a/src/engine/e_sound_al.inc b/src/engine/e_sound_al.inc index b73b37f..38b9bb6 100644 --- a/src/engine/e_sound_al.inc +++ b/src/engine/e_sound_al.inc @@ -93,6 +93,8 @@ var e_SoundsArray: array of TSoundRec = nil; e_ZeroPosition: array [0..2] of ALfloat = (0, 0, 0); e_ALError: ALenum = 0; + e_SoundFont: string = ''; + e_MusicLerp: Boolean = True; implementation @@ -815,7 +817,7 @@ end; function TBasicSound.GetPan(): Single; var - Pos: array [0..2] of ALfloat; + Pos: array [0..2] of ALfloat = (0, 0, 0); begin Result := 0.0; if InvalidSource() then diff --git a/src/engine/e_soundfile_fluid.pas b/src/engine/e_soundfile_fluid.pas index c958c7b..ba96715 100644 --- a/src/engine/e_soundfile_fluid.pas +++ b/src/engine/e_soundfile_fluid.pas @@ -47,9 +47,6 @@ type const DEFAULT_SOUNDFONT = 'data/soundfont.sf2'; -var - e_Soundfont: string = ''; - implementation uses sysutils, utils, e_sound, e_log, ctypes{$IFDEF WINDOWS}, windirs{$ENDIF}; @@ -112,7 +109,7 @@ end; function TFluidLoaderFactory.GetLoader(): TSoundLoader; begin - if e_Soundfont = '' then e_Soundfont := FindDefaultSoundfont(); + if e_SoundFont = '' then e_SoundFont := FindDefaultSoundfont(); Result := TFluidLoader.Create(); end; @@ -128,7 +125,7 @@ begin FSynth := new_fluid_synth(FluidSettings); if FSynth = nil then raise Exception.Create('new_fluid_synth failed'); - Ret := fluid_synth_sfload(FSynth, PChar(e_Soundfont), 1); + Ret := fluid_synth_sfload(FSynth, PChar(e_SoundFont), 1); if Ret = FLUID_FAILED then raise Exception.Create('fluid_synth_sfload failed'); FPlayer := new_fluid_player(FSynth); @@ -170,7 +167,7 @@ begin FSynth := new_fluid_synth(FluidSettings); if FSynth = nil then raise Exception.Create('new_fluid_synth failed'); - Ret := fluid_synth_sfload(FSynth, PChar(e_Soundfont), 1); + Ret := fluid_synth_sfload(FSynth, PChar(e_SoundFont), 1); if Ret = FLUID_FAILED then raise Exception.Create('fluid_synth_sfload failed'); FPlayer := new_fluid_player(FSynth); @@ -239,9 +236,11 @@ initialization if FluidSettings <> nil then begin fluid_settings_setint(FluidSettings, PChar('synth.midi-channels'), 16); - fluid_settings_setint(FluidSettings, PChar('synth.cpu-cores'), 0); + fluid_settings_setint(FluidSettings, PChar('synth.cpu-cores'), 1); fluid_settings_setnum(FluidSettings, PChar('synth.sample-rate'), 44100); fluid_settings_setnum(FluidSettings, PChar('synth.gain'), 1); + fluid_settings_setint(FluidSettings, PChar('synth.reverb.active'), 0); + fluid_settings_setint(FluidSettings, PChar('synth.chorus.active'), 0); fluid_settings_setstr(FluidSettings, PChar('player.timing-source'), PChar('sample')); e_AddSoundLoader(TFluidLoaderFactory.Create()); end;