[vlc-devel] commit: fluidsynth: use error dialogs if the sound font fails ( Rémi Denis-Courmont )
git version control
git at videolan.org
Mon Jan 25 22:13:37 CET 2010
vlc | branch: master | Rémi Denis-Courmont <remi at remlab.net> | Mon Jan 25 23:11:38 2010 +0200| [b14d2f10d62a68e15a0b5f9c524a21b5de290ee2] | committer: Rémi Denis-Courmont
fluidsynth: use error dialogs if the sound font fails
> http://git.videolan.org/gitweb.cgi/vlc.git/?a=commit;h=b14d2f10d62a68e15a0b5f9c524a21b5de290ee2
---
modules/codec/fluidsynth.c | 19 +++++++++++++++----
1 files changed, 15 insertions(+), 4 deletions(-)
diff --git a/modules/codec/fluidsynth.c b/modules/codec/fluidsynth.c
index dc79a70..c98d28f 100644
--- a/modules/codec/fluidsynth.c
+++ b/modules/codec/fluidsynth.c
@@ -28,6 +28,7 @@
#include <vlc_aout.h>
#include <vlc_codec.h>
#include <vlc_cpu.h>
+#include <vlc_dialog.h>
/* On Win32, we link statically */
#ifdef WIN32
@@ -76,10 +77,14 @@ static int Open (vlc_object_t *p_this)
if (p_dec->fmt_in.i_codec != VLC_CODEC_MIDI)
return VLC_EGENERIC;
- char *font_path = var_CreateGetNonEmptyString (p_this, "soundfont");
+ char *font_path = var_InheritString (p_this, "soundfont");
if (font_path == NULL)
{
- msg_Err (p_this, "sound fonts file required for synthesis");
+ msg_Err (p_this, "sound font file required for synthesis");
+ dialog_Fatal (p_this, _("MIDI synthesis not set up"),
+ _("A sound font file (.SF2) is required for MIDI synthesis.\n"
+ "Please install a sound font and configure it "
+ "from the VLC preferences (Codecs / Audio / FluidSynth).\n"));
return VLC_EGENERIC;
}
@@ -95,13 +100,19 @@ static int Open (vlc_object_t *p_this)
p_sys->synth = new_fluid_synth (p_sys->settings);
/* FIXME: I bet this is not thread-safe */
p_sys->soundfont = fluid_synth_sfload (p_sys->synth, font_path, 1);
- free (font_path);
if (p_sys->soundfont == -1)
{
- msg_Err (p_this, "cannot load sound fonts file");
+ msg_Err (p_this, "cannot load sound fonts file %s", font_path);
Close (p_this);
+ dialog_Fatal (p_this, _("MIDI synthesis not set up"),
+ _("The specified sound font file (%s) is incorrect.\n"
+ "Please install a valid sound font and reconfigure it "
+ "from the VLC preferences (Codecs / Audio / FluidSynth).\n"),
+ font_path);
+ free (font_path);
return VLC_EGENERIC;
}
+ free (font_path);
p_dec->fmt_out.i_cat = AUDIO_ES;
p_dec->fmt_out.audio.i_rate = 44100;
More information about the vlc-devel
mailing list