X-Git-Url: http://deadsoftware.ru/gitweb?a=blobdiff_plain;f=src%2Fengine%2Fe_soundfile_fluid.pas;h=5235f2c0097a7040f297b350e984b45bdda46fd7;hb=987c4a835a103345b59937e8e1be8524a6228712;hp=da79055db8e9d30ffabfc3e5eb9fcfbb74be978c;hpb=01f7c9f6fb35b2b193cb967c2d881ab9fc5b6bcc;p=d2df-sdl.git diff --git a/src/engine/e_soundfile_fluid.pas b/src/engine/e_soundfile_fluid.pas index da79055..5235f2c 100644 --- a/src/engine/e_soundfile_fluid.pas +++ b/src/engine/e_soundfile_fluid.pas @@ -2,8 +2,7 @@ * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. + * the Free Software Foundation, version 3 of the License ONLY. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of @@ -47,9 +46,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 +108,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 +124,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 +166,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); @@ -224,7 +220,11 @@ end; procedure TFluidLoader.Free(); begin - if FPlayer <> nil then delete_fluid_player(FPlayer); + if FPlayer <> nil then + begin + fluid_player_stop(FPlayer); + delete_fluid_player(FPlayer); + end; if FSynth <> nil then delete_fluid_synth(FSynth); FPlayer := nil; FSynth := nil; @@ -235,9 +235,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;