* Copyright © 2007 Rémi Denis-Courmont
* $Id$
*
- * 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 2 of the License, or
+ * This program is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as published by
+ * the Free Software Foundation; either version 2.1 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License for more details.
*
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301, USA.
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with this program; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301, USA.
*****************************************************************************/
#ifdef HAVE_CONFIG_H
#include <vlc_plugin.h>
#include <vlc_codec.h>
#include <vlc_dialog.h>
-#include <vlc_charset.h>
-#ifdef HAVE_UNISTD_H
-# include <unistd.h>
-#endif
+#include <unistd.h>
#ifdef _POSIX_VERSION
# include <glob.h>
#endif
/* On Win32, we link statically */
-#ifdef WIN32
+#ifdef _WIN32
# define FLUIDSYNTH_NOT_A_DLL
#endif
add_loadfile ("soundfont", "",
SOUNDFONT_TEXT, SOUNDFONT_LONGTEXT, false)
add_bool ("synth-chorus", true, CHORUS_TEXT, CHORUS_TEXT, false)
- add_float ("synth-gain", 0.8, GAIN_TEXT, GAIN_LONGTEXT, false)
+ add_float ("synth-gain", .5, GAIN_TEXT, GAIN_LONGTEXT, false)
change_float_range (0., 10.)
add_integer ("synth-polyphony", 256,
POLYPHONY_TEXT, POLYPHONY_LONGTEXT, false)
};
-static aout_buffer_t *DecodeBlock (decoder_t *p_dec, block_t **pp_block);
+static block_t *DecodeBlock (decoder_t *p_dec, block_t **pp_block);
static int Open (vlc_object_t *p_this)
char *font_path = var_InheritString (p_this, "soundfont");
if (font_path != NULL)
{
- const char *lpath = ToLocale (font_path);
-
msg_Dbg (p_this, "loading sound fonts file %s", font_path);
p_sys->soundfont = fluid_synth_sfload (p_sys->synth, font_path, 1);
- LocaleFree (lpath);
if (p_sys->soundfont == -1)
msg_Err (p_this, "cannot load sound fonts file %s", font_path);
free (font_path);
}
-static aout_buffer_t *DecodeBlock (decoder_t *p_dec, block_t **pp_block)
+static block_t *DecodeBlock (decoder_t *p_dec, block_t **pp_block)
{
block_t *p_block;
decoder_sys_t *p_sys = p_dec->p_sys;
- aout_buffer_t *p_out = NULL;
+ block_t *p_out = NULL;
if (pp_block == NULL)
return NULL;
return NULL;
*pp_block = NULL;
+ if (p_block->i_flags & (BLOCK_FLAG_DISCONTINUITY|BLOCK_FLAG_CORRUPTED))
+ {
+ date_Set (&p_sys->end_date, 0);
+ //fluid_synth_system_reset (p_sys->synth);
+ fluid_synth_program_reset (p_sys->synth);
+ for (unsigned channel = 0; channel < 16; channel++)
+ for (unsigned note = 0; note < 128; note++)
+ fluid_synth_noteoff (p_sys->synth, channel, note);
+ }
+
if (p_block->i_pts > VLC_TS_INVALID && !date_Get (&p_sys->end_date))
date_Set (&p_sys->end_date, p_block->i_pts);
else