Merge branch 'v0.17.x'
This commit is contained in:
2
INSTALL
2
INSTALL
@@ -103,7 +103,7 @@ libsidplay2 - http://sidplay2.sourceforge.net/
|
|||||||
For C64 SID support.
|
For C64 SID support.
|
||||||
|
|
||||||
libfluidsynth - http://fluidsynth.resonance.org/
|
libfluidsynth - http://fluidsynth.resonance.org/
|
||||||
For MIDI support (DO NOT USE - use libwildmidi instead)
|
For MIDI support.
|
||||||
|
|
||||||
libwildmidi - http://wildmidi.sourceforge.net/
|
libwildmidi - http://wildmidi.sourceforge.net/
|
||||||
For MIDI support.
|
For MIDI support.
|
||||||
|
@@ -1111,7 +1111,6 @@ test_dump_playlist_SOURCES = test/dump_playlist.c \
|
|||||||
src/audio_check.c src/pcm_buffer.c \
|
src/audio_check.c src/pcm_buffer.c \
|
||||||
src/text_input_stream.c src/fifo_buffer.c \
|
src/text_input_stream.c src/fifo_buffer.c \
|
||||||
src/cue/cue_parser.c src/cue/cue_parser.h \
|
src/cue/cue_parser.c src/cue/cue_parser.h \
|
||||||
src/timer.c src/clock.c \
|
|
||||||
src/fd_util.c
|
src/fd_util.c
|
||||||
|
|
||||||
if HAVE_FLAC
|
if HAVE_FLAC
|
||||||
@@ -1138,7 +1137,6 @@ test_run_decoder_SOURCES = test/run_decoder.c \
|
|||||||
src/fd_util.c \
|
src/fd_util.c \
|
||||||
src/audio_check.c \
|
src/audio_check.c \
|
||||||
src/audio_format.c \
|
src/audio_format.c \
|
||||||
src/timer.c src/clock.c \
|
|
||||||
$(ARCHIVE_SRC) \
|
$(ARCHIVE_SRC) \
|
||||||
$(INPUT_SRC) \
|
$(INPUT_SRC) \
|
||||||
$(TAG_SRC) \
|
$(TAG_SRC) \
|
||||||
@@ -1160,7 +1158,6 @@ test_read_tags_SOURCES = test/read_tags.c \
|
|||||||
src/uri.c \
|
src/uri.c \
|
||||||
src/fd_util.c \
|
src/fd_util.c \
|
||||||
src/audio_check.c \
|
src/audio_check.c \
|
||||||
src/timer.c src/clock.c \
|
|
||||||
$(DECODER_SRC)
|
$(DECODER_SRC)
|
||||||
|
|
||||||
if HAVE_ID3TAG
|
if HAVE_ID3TAG
|
||||||
|
5
NEWS
5
NEWS
@@ -4,6 +4,11 @@ ver 0.18 (2012/??/??)
|
|||||||
ver 0.17.2 (2012/??/??)
|
ver 0.17.2 (2012/??/??)
|
||||||
* protocol:
|
* protocol:
|
||||||
- fix crash in local file check
|
- fix crash in local file check
|
||||||
|
* decoder:
|
||||||
|
- fluidsynth: remove throttle (requires libfluidsynth 1.1)
|
||||||
|
- fluidsynth: stop playback at end of file
|
||||||
|
- fluidsynth: check MIDI file format while scanning
|
||||||
|
- fluidsynth: add sample rate setting
|
||||||
* output:
|
* output:
|
||||||
- httpd: use monotonic clock, avoid hiccups after system clock adjustment
|
- httpd: use monotonic clock, avoid hiccups after system clock adjustment
|
||||||
- httpd: fix throttling bug after resuming playback
|
- httpd: fix throttling bug after resuming playback
|
||||||
|
@@ -220,8 +220,8 @@ AC_ARG_ENABLE(flac,
|
|||||||
|
|
||||||
AC_ARG_ENABLE(fluidsynth,
|
AC_ARG_ENABLE(fluidsynth,
|
||||||
AS_HELP_STRING([--enable-fluidsynth],
|
AS_HELP_STRING([--enable-fluidsynth],
|
||||||
[enable MIDI support via fluidsynth (default: disable)]),,
|
[enable MIDI support via fluidsynth (default: auto)]),,
|
||||||
enable_fluidsynth=no)
|
enable_fluidsynth=auto)
|
||||||
|
|
||||||
AC_ARG_ENABLE(gme,
|
AC_ARG_ENABLE(gme,
|
||||||
AS_HELP_STRING([--enable-gme],
|
AS_HELP_STRING([--enable-gme],
|
||||||
@@ -857,7 +857,7 @@ enable_flac_encoder=$enable_flac
|
|||||||
|
|
||||||
dnl -------------------------------- FluidSynth -------------------------------
|
dnl -------------------------------- FluidSynth -------------------------------
|
||||||
if test x$enable_fluidsynth = xyes; then
|
if test x$enable_fluidsynth = xyes; then
|
||||||
PKG_CHECK_MODULES(FLUIDSYNTH, [fluidsynth],
|
PKG_CHECK_MODULES(FLUIDSYNTH, [fluidsynth >= 1.1],
|
||||||
AC_DEFINE(ENABLE_FLUIDSYNTH, 1, [Define for fluidsynth support]),
|
AC_DEFINE(ENABLE_FLUIDSYNTH, 1, [Define for fluidsynth support]),
|
||||||
enable_fluidsynth=no)
|
enable_fluidsynth=no)
|
||||||
fi
|
fi
|
||||||
|
71
doc/user.xml
71
doc/user.xml
@@ -937,6 +937,46 @@ systemctl start mpd.socket</programlisting>
|
|||||||
|
|
||||||
</section>
|
</section>
|
||||||
|
|
||||||
|
<section>
|
||||||
|
<title><varname>fluidsynth</varname></title>
|
||||||
|
|
||||||
|
<para>
|
||||||
|
MIDI decoder based on libfluidsynth.
|
||||||
|
</para>
|
||||||
|
|
||||||
|
<informaltable>
|
||||||
|
<tgroup cols="2">
|
||||||
|
<thead>
|
||||||
|
<row>
|
||||||
|
<entry>Setting</entry>
|
||||||
|
<entry>Description</entry>
|
||||||
|
</row>
|
||||||
|
</thead>
|
||||||
|
<tbody>
|
||||||
|
<row>
|
||||||
|
<entry>
|
||||||
|
<varname>sample_rate</varname>
|
||||||
|
</entry>
|
||||||
|
<entry>
|
||||||
|
The sample rate that shall be synthesized by the
|
||||||
|
plugin. Defaults to 48000.
|
||||||
|
</entry>
|
||||||
|
</row>
|
||||||
|
<row>
|
||||||
|
<entry>
|
||||||
|
<varname>soundfont</varname>
|
||||||
|
</entry>
|
||||||
|
<entry>
|
||||||
|
The absolute path of the soundfont file. Defaults
|
||||||
|
to
|
||||||
|
<filename>/usr/share/sounds/sf2/FluidR3_GM.sf2</filename>.
|
||||||
|
</entry>
|
||||||
|
</row>
|
||||||
|
</tbody>
|
||||||
|
</tgroup>
|
||||||
|
</informaltable>
|
||||||
|
</section>
|
||||||
|
|
||||||
<section>
|
<section>
|
||||||
<title><varname>mikmod</varname></title>
|
<title><varname>mikmod</varname></title>
|
||||||
|
|
||||||
@@ -966,6 +1006,37 @@ systemctl start mpd.socket</programlisting>
|
|||||||
</tgroup>
|
</tgroup>
|
||||||
</informaltable>
|
</informaltable>
|
||||||
</section>
|
</section>
|
||||||
|
|
||||||
|
<section>
|
||||||
|
<title><varname>wildmidi</varname></title>
|
||||||
|
|
||||||
|
<para>
|
||||||
|
MIDI decoder based on libwildmidi.
|
||||||
|
</para>
|
||||||
|
|
||||||
|
<informaltable>
|
||||||
|
<tgroup cols="2">
|
||||||
|
<thead>
|
||||||
|
<row>
|
||||||
|
<entry>Setting</entry>
|
||||||
|
<entry>Description</entry>
|
||||||
|
</row>
|
||||||
|
</thead>
|
||||||
|
<tbody>
|
||||||
|
<row>
|
||||||
|
<entry>
|
||||||
|
<varname>config_file</varname>
|
||||||
|
</entry>
|
||||||
|
<entry>
|
||||||
|
The absolute path of the timidity config file. Defaults
|
||||||
|
to
|
||||||
|
<filename>/etc/timidity/timidity.cfg</filename>.
|
||||||
|
</entry>
|
||||||
|
</row>
|
||||||
|
</tbody>
|
||||||
|
</tgroup>
|
||||||
|
</informaltable>
|
||||||
|
</section>
|
||||||
</section>
|
</section>
|
||||||
|
|
||||||
<section>
|
<section>
|
||||||
|
@@ -1,5 +1,5 @@
|
|||||||
/*
|
/*
|
||||||
* Copyright (C) 2003-2011 The Music Player Daemon Project
|
* Copyright (C) 2003-2012 The Music Player Daemon Project
|
||||||
* http://www.musicpd.org
|
* http://www.musicpd.org
|
||||||
*
|
*
|
||||||
* This program is free software; you can redistribute it and/or modify
|
* This program is free software; you can redistribute it and/or modify
|
||||||
@@ -17,18 +17,9 @@
|
|||||||
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
|
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
/*
|
|
||||||
* WARNING! This plugin suffers from major shortcomings in the
|
|
||||||
* libfluidsynth API, which render it practically unusable. For a
|
|
||||||
* discussion, see the post on the fluidsynth mailing list:
|
|
||||||
*
|
|
||||||
* http://www.mail-archive.com/fluid-dev@nongnu.org/msg01099.html
|
|
||||||
*
|
|
||||||
*/
|
|
||||||
|
|
||||||
#include "config.h"
|
#include "config.h"
|
||||||
#include "decoder_api.h"
|
#include "decoder_api.h"
|
||||||
#include "timer.h"
|
#include "audio_check.h"
|
||||||
#include "conf.h"
|
#include "conf.h"
|
||||||
|
|
||||||
#include <glib.h>
|
#include <glib.h>
|
||||||
@@ -38,6 +29,9 @@
|
|||||||
#undef G_LOG_DOMAIN
|
#undef G_LOG_DOMAIN
|
||||||
#define G_LOG_DOMAIN "fluidsynth"
|
#define G_LOG_DOMAIN "fluidsynth"
|
||||||
|
|
||||||
|
static unsigned sample_rate;
|
||||||
|
static const char *soundfont_path;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Convert a fluidsynth log level to a GLib log level.
|
* Convert a fluidsynth log level to a GLib log level.
|
||||||
*/
|
*/
|
||||||
@@ -75,8 +69,21 @@ fluidsynth_mpd_log_function(int level, char *message, G_GNUC_UNUSED void *data)
|
|||||||
}
|
}
|
||||||
|
|
||||||
static bool
|
static bool
|
||||||
fluidsynth_init(G_GNUC_UNUSED const struct config_param *param)
|
fluidsynth_init(const struct config_param *param)
|
||||||
{
|
{
|
||||||
|
GError *error = NULL;
|
||||||
|
|
||||||
|
sample_rate = config_get_block_unsigned(param, "sample_rate", 48000);
|
||||||
|
if (!audio_check_sample_rate(sample_rate, &error)) {
|
||||||
|
g_warning("%s\n", error->message);
|
||||||
|
g_error_free(error);
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
soundfont_path =
|
||||||
|
config_get_block_string(param, "soundfont",
|
||||||
|
"/usr/share/sounds/sf2/FluidR3_GM.sf2");
|
||||||
|
|
||||||
fluid_set_log_function(LAST_LOG_LEVEL,
|
fluid_set_log_function(LAST_LOG_LEVEL,
|
||||||
fluidsynth_mpd_log_function, NULL);
|
fluidsynth_mpd_log_function, NULL);
|
||||||
|
|
||||||
@@ -86,36 +93,24 @@ fluidsynth_init(G_GNUC_UNUSED const struct config_param *param)
|
|||||||
static void
|
static void
|
||||||
fluidsynth_file_decode(struct decoder *decoder, const char *path_fs)
|
fluidsynth_file_decode(struct decoder *decoder, const char *path_fs)
|
||||||
{
|
{
|
||||||
static const struct audio_format audio_format = {
|
|
||||||
.sample_rate = 48000,
|
|
||||||
.format = SAMPLE_FORMAT_S16,
|
|
||||||
.channels = 2,
|
|
||||||
};
|
|
||||||
char setting_sample_rate[] = "synth.sample-rate";
|
char setting_sample_rate[] = "synth.sample-rate";
|
||||||
/*
|
/*
|
||||||
char setting_verbose[] = "synth.verbose";
|
char setting_verbose[] = "synth.verbose";
|
||||||
char setting_yes[] = "yes";
|
char setting_yes[] = "yes";
|
||||||
*/
|
*/
|
||||||
const char *soundfont_path;
|
|
||||||
fluid_settings_t *settings;
|
fluid_settings_t *settings;
|
||||||
fluid_synth_t *synth;
|
fluid_synth_t *synth;
|
||||||
fluid_player_t *player;
|
fluid_player_t *player;
|
||||||
char *path_dup;
|
|
||||||
int ret;
|
int ret;
|
||||||
struct timer *timer;
|
|
||||||
enum decoder_command cmd;
|
enum decoder_command cmd;
|
||||||
|
|
||||||
soundfont_path =
|
|
||||||
config_get_string("soundfont",
|
|
||||||
"/usr/share/sounds/sf2/FluidR3_GM.sf2");
|
|
||||||
|
|
||||||
/* set up fluid settings */
|
/* set up fluid settings */
|
||||||
|
|
||||||
settings = new_fluid_settings();
|
settings = new_fluid_settings();
|
||||||
if (settings == NULL)
|
if (settings == NULL)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
fluid_settings_setnum(settings, setting_sample_rate, 48000);
|
fluid_settings_setnum(settings, setting_sample_rate, sample_rate);
|
||||||
|
|
||||||
/*
|
/*
|
||||||
fluid_settings_setstr(settings, setting_verbose, setting_yes);
|
fluid_settings_setstr(settings, setting_verbose, setting_yes);
|
||||||
@@ -146,11 +141,7 @@ fluidsynth_file_decode(struct decoder *decoder, const char *path_fs)
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* temporarily duplicate the path_fs string, because
|
ret = fluid_player_add(player, path_fs);
|
||||||
fluidsynth wants a writable string */
|
|
||||||
path_dup = g_strdup(path_fs);
|
|
||||||
ret = fluid_player_add(player, path_dup);
|
|
||||||
g_free(path_dup);
|
|
||||||
if (ret != 0) {
|
if (ret != 0) {
|
||||||
g_warning("fluid_player_add() failed");
|
g_warning("fluid_player_add() failed");
|
||||||
delete_fluid_player(player);
|
delete_fluid_player(player);
|
||||||
@@ -170,47 +161,34 @@ fluidsynth_file_decode(struct decoder *decoder, const char *path_fs)
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* set up a timer for synchronization; fluidsynth always
|
|
||||||
decodes in real time, which forces us to synchronize */
|
|
||||||
/* XXX is there any way to switch off real-time decoding? */
|
|
||||||
|
|
||||||
timer = timer_new(&audio_format);
|
|
||||||
timer_start(timer);
|
|
||||||
|
|
||||||
/* initialization complete - announce the audio format to the
|
/* initialization complete - announce the audio format to the
|
||||||
MPD core */
|
MPD core */
|
||||||
|
|
||||||
|
struct audio_format audio_format;
|
||||||
|
audio_format_init(&audio_format, sample_rate, SAMPLE_FORMAT_S16, 2);
|
||||||
decoder_initialized(decoder, &audio_format, false, -1);
|
decoder_initialized(decoder, &audio_format, false, -1);
|
||||||
|
|
||||||
do {
|
while (fluid_player_get_status(player) == FLUID_PLAYER_PLAYING) {
|
||||||
int16_t buffer[2048];
|
int16_t buffer[2048];
|
||||||
const unsigned max_frames = G_N_ELEMENTS(buffer) / 2;
|
const unsigned max_frames = G_N_ELEMENTS(buffer) / 2;
|
||||||
|
|
||||||
/* synchronize with the fluid player */
|
|
||||||
|
|
||||||
timer_add(timer, sizeof(buffer));
|
|
||||||
timer_sync(timer);
|
|
||||||
|
|
||||||
/* read samples from fluidsynth and send them to the
|
/* read samples from fluidsynth and send them to the
|
||||||
MPD core */
|
MPD core */
|
||||||
|
|
||||||
ret = fluid_synth_write_s16(synth, max_frames,
|
ret = fluid_synth_write_s16(synth, max_frames,
|
||||||
buffer, 0, 2,
|
buffer, 0, 2,
|
||||||
buffer, 1, 2);
|
buffer, 1, 2);
|
||||||
/* XXX how do we see whether the player is done? We
|
|
||||||
can't access the private attribute
|
|
||||||
player->status */
|
|
||||||
if (ret != 0)
|
if (ret != 0)
|
||||||
break;
|
break;
|
||||||
|
|
||||||
cmd = decoder_data(decoder, NULL, buffer, sizeof(buffer),
|
cmd = decoder_data(decoder, NULL, buffer, sizeof(buffer),
|
||||||
0);
|
0);
|
||||||
} while (cmd == DECODE_COMMAND_NONE);
|
if (cmd != DECODE_COMMAND_NONE)
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
/* clean up */
|
/* clean up */
|
||||||
|
|
||||||
timer_free(timer);
|
|
||||||
|
|
||||||
fluid_player_stop(player);
|
fluid_player_stop(player);
|
||||||
fluid_player_join(player);
|
fluid_player_join(player);
|
||||||
|
|
||||||
@@ -224,10 +202,7 @@ fluidsynth_scan_file(const char *file,
|
|||||||
G_GNUC_UNUSED const struct tag_handler *handler,
|
G_GNUC_UNUSED const struct tag_handler *handler,
|
||||||
G_GNUC_UNUSED void *handler_ctx)
|
G_GNUC_UNUSED void *handler_ctx)
|
||||||
{
|
{
|
||||||
/* to be implemented */
|
return fluid_is_midifile(file);
|
||||||
(void)file;
|
|
||||||
|
|
||||||
return true;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static const char *const fluidsynth_suffixes[] = {
|
static const char *const fluidsynth_suffixes[] = {
|
||||||
|
Reference in New Issue
Block a user